From 74d563ad38d6681d9c62078de9e35beef6463a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Wed, 26 Nov 2025 21:56:20 +0800 Subject: [PATCH] WebUI 5a11901efb3835ed1b221bf502430625454b4681 --- webui/dist/assets/icons-Bom2zaMH.js | 1 + webui/dist/assets/icons-NigUckDX.js | 1 - .../{index-ZouZGJSS.js => index-Bh0H0ZnO.js} | 168 ++++++++++-------- webui/dist/assets/index-BwXMDuHV.css | 1 + webui/dist/assets/index-C7HtKTTn.css | 1 - webui/dist/index.html | 12 +- 6 files changed, 100 insertions(+), 84 deletions(-) create mode 100644 webui/dist/assets/icons-Bom2zaMH.js delete mode 100644 webui/dist/assets/icons-NigUckDX.js rename webui/dist/assets/{index-ZouZGJSS.js => index-Bh0H0ZnO.js} (50%) create mode 100644 webui/dist/assets/index-BwXMDuHV.css delete mode 100644 webui/dist/assets/index-C7HtKTTn.css diff --git a/webui/dist/assets/icons-Bom2zaMH.js b/webui/dist/assets/icons-Bom2zaMH.js new file mode 100644 index 00000000..4de62b5c --- /dev/null +++ b/webui/dist/assets/icons-Bom2zaMH.js @@ -0,0 +1 @@ +import{r as s}from"./router-SinpzM5S.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={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"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:k,...h},p)=>s.createElement("svg",{ref:p,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...k.map(([i,l])=>s.createElement(i,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const u=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],Y1=e("activity",u);const g=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],e2=e("arrow-left",g);const f=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],a2=e("arrow-right",f);const $=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],t2=e("ban",$);const N=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],c2=e("book-open",N);const w=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],o2=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],n2=e("boxes",z);const b=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],s2=e("bug",b);const q=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],y2=e("calendar",q);const C=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],h2=e("chart-column",C);const j=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],d2=e("check",j);const V=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],r2=e("chevron-down",V);const A=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],k2=e("chevron-left",A);const H=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],p2=e("chevron-right",H);const L=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],i2=e("chevron-up",L);const S=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],l2=e("chevrons-left",S);const P=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],_2=e("chevrons-right",P);const U=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],M2=e("chevrons-up-down",U);const T=[["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"}]],m2=e("circle-alert",T);const Z=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],v2=e("circle-check",Z);const R=[["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"}]],x2=e("circle-question-mark",R);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],u2=e("circle-user",B);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],g2=e("circle-x",E);const D=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],f2=e("circle",D);const F=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],$2=e("clock",F);const O=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],N2=e("code-xml",O);const I=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],w2=e("container",I);const K=[["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"}]],z2=e("copy",K);const W=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],b2=e("database",W);const X=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],q2=e("dollar-sign",X);const G=[["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"}]],C2=e("download",G);const Q=[["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"}]],j2=e("external-link",Q);const J=[["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"}]],V2=e("eye-off",J);const Y=[["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"}]],A2=e("eye",Y);const e1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],H2=e("file-search",e1);const a1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],L2=e("file-text",a1);const t1=[["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"}]],S2=e("folder-open",t1);const c1=[["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"}]],P2=e("funnel",c1);const o1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],U2=e("grip-vertical",o1);const n1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],T2=e("hash",n1);const s1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],Z2=e("house",s1);const y1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],R2=e("info",y1);const h1=[["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"}]],B2=e("key",h1);const d1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],E2=e("loader-circle",d1);const r1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],D2=e("lock",r1);const k1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],F2=e("log-out",k1);const p1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],O2=e("menu",p1);const i1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],I2=e("message-square",i1);const l1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],K2=e("moon",l1);const _1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],W2=e("network",_1);const M1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],X2=e("package",M1);const m1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],G2=e("palette",m1);const v1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],Q2=e("panels-top-left",v1);const x1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],J2=e("pause",x1);const u1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Y2=e("pencil",u1);const g1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],e0=e("play",g1);const f1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],a0=e("plus",f1);const $1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],t0=e("power",$1);const N1=[["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"}]],c0=e("refresh-cw",N1);const w1=[["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"}]],o0=e("rotate-ccw",w1);const z1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],n0=e("rotate-cw",z1);const b1=[["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"}]],s0=e("save",b1);const q1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],y0=e("search",q1);const C1=[["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"}]],h0=e("server",C1);const j1=[["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"}]],d0=e("settings-2",j1);const V1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],r0=e("settings",V1);const A1=[["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"}]],k0=e("shield",A1);const H1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],p0=e("skip-forward",H1);const L1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],i0=e("sliders-vertical",L1);const S1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],l0=e("smile",S1);const P1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],_0=e("sparkles",P1);const U1=[["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"}]],M0=e("square-pen",U1);const T1=[["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"}]],m0=e("star",T1);const Z1=[["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"}]],v0=e("sun",Z1);const R1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],x0=e("terminal",R1);const B1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],u0=e("thumbs-up",B1);const E1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],g0=e("thumbs-down",E1);const D1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],f0=e("trash-2",D1);const F1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],$0=e("trending-up",F1);const O1=[["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"}]],N0=e("triangle-alert",O1);const I1=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],w0=e("type",I1);const K1=[["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"}]],z0=e("upload",K1);const W1=[["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"}]],b0=e("user",W1);const X1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],q0=e("users",X1);const G1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],C0=e("x",G1);const Q1=[["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"}]],j0=e("zap",Q1);export{_2 as $,Y1 as A,o2 as B,$2 as C,q2 as D,V2 as E,L2 as F,s0 as G,Z2 as H,R2 as I,t0 as J,B2 as K,D2 as L,I2 as M,a0 as N,f0 as O,G2 as P,H2 as Q,c0 as R,k0 as S,$0 as T,b0 as U,Y2 as V,l2 as W,C0 as X,k2 as Y,j0 as Z,p2 as _,b2 as a,M2 as a0,U2 as a1,w2 as a2,X2 as a3,z0 as a4,S2 as a5,C2 as a6,P2 as a7,M0 as a8,t2 as a9,T2 as aa,q0 as ab,W2 as ac,y2 as ad,J2 as ae,e0 as af,w0 as ag,m0 as ah,u0 as ai,g0 as aj,d0 as ak,h0 as al,n2 as am,u2 as an,h2 as ao,f2 as ap,i0 as aq,O2 as ar,c2 as as,F2 as at,n0 as au,s2 as av,r0 as b,N0 as c,d2 as d,z2 as e,A2 as f,v2 as g,g2 as h,o0 as i,v0 as j,K2 as k,m2 as l,x2 as m,x0 as n,j2 as o,E2 as p,_0 as q,l0 as r,p0 as s,a2 as t,y0 as u,e2 as v,r2 as w,i2 as x,Q2 as y,N2 as z}; diff --git a/webui/dist/assets/icons-NigUckDX.js b/webui/dist/assets/icons-NigUckDX.js deleted file mode 100644 index 54ecdd0f..00000000 --- a/webui/dist/assets/icons-NigUckDX.js +++ /dev/null @@ -1 +0,0 @@ -import{r as s}from"./router-SinpzM5S.js";const _=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),M=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,c,o)=>o?o.toUpperCase():c.toLowerCase()),d=t=>{const a=M(t);return a.charAt(0).toUpperCase()+a.slice(1)},r=(...t)=>t.filter((a,c,o)=>!!a&&a.trim()!==""&&o.indexOf(a)===c).join(" ").trim(),m=t=>{for(const a in t)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};var v={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"};const x=s.forwardRef(({color:t="currentColor",size:a=24,strokeWidth:c=2,absoluteStrokeWidth:o,className:y="",children:n,iconNode:k,...h},i)=>s.createElement("svg",{ref:i,...v,width:a,height:a,stroke:t,strokeWidth:o?Number(c)*24/Number(a):c,className:r("lucide",y),...!n&&!m(h)&&{"aria-hidden":"true"},...h},[...k.map(([p,l])=>s.createElement(p,l)),...Array.isArray(n)?n:[n]]));const e=(t,a)=>{const c=s.forwardRef(({className:o,...y},n)=>s.createElement(x,{ref:n,iconNode:a,className:r(`lucide-${_(d(t))}`,`lucide-${t}`,o),...y}));return c.displayName=d(t),c};const u=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],J1=e("activity",u);const g=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Y1=e("arrow-left",g);const $=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],e2=e("arrow-right",$);const N=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],a2=e("ban",N);const f=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],t2=e("book-open",f);const w=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],c2=e("bot",w);const z=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],o2=e("boxes",z);const q=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],n2=e("calendar",q);const b=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],s2=e("chart-column",b);const C=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],y2=e("check",C);const j=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],h2=e("chevron-down",j);const V=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],d2=e("chevron-left",V);const A=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],r2=e("chevron-right",A);const H=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],k2=e("chevron-up",H);const L=[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]],i2=e("chevrons-left",L);const S=[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]],p2=e("chevrons-right",S);const P=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],l2=e("chevrons-up-down",P);const U=[["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"}]],_2=e("circle-alert",U);const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],M2=e("circle-check",T);const Z=[["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"}]],m2=e("circle-question-mark",Z);const R=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]],v2=e("circle-user",R);const E=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],x2=e("circle-x",E);const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],u2=e("circle",B);const D=[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],g2=e("clock",D);const F=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],$2=e("code-xml",F);const O=[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]],N2=e("container",O);const I=[["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"}]],f2=e("copy",I);const K=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],w2=e("database",K);const W=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],z2=e("dollar-sign",W);const X=[["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"}]],q2=e("download",X);const G=[["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"}]],b2=e("external-link",G);const Q=[["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"}]],C2=e("eye-off",Q);const J=[["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"}]],j2=e("eye",J);const Y=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]],V2=e("file-search",Y);const e1=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],A2=e("file-text",e1);const a1=[["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"}]],H2=e("folder-open",a1);const t1=[["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"}]],L2=e("funnel",t1);const c1=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],S2=e("grip-vertical",c1);const o1=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],P2=e("hash",o1);const n1=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],U2=e("house",n1);const s1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],T2=e("info",s1);const y1=[["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"}]],Z2=e("key",y1);const h1=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],R2=e("loader-circle",h1);const d1=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],E2=e("lock",d1);const r1=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],B2=e("log-out",r1);const k1=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],D2=e("menu",k1);const i1=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],F2=e("message-square",i1);const p1=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],O2=e("moon",p1);const l1=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],I2=e("network",l1);const _1=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],K2=e("package",_1);const M1=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],W2=e("palette",M1);const m1=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],X2=e("panels-top-left",m1);const v1=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],G2=e("pause",v1);const x1=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Q2=e("pencil",x1);const u1=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],J2=e("play",u1);const g1=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Y2=e("plus",g1);const $1=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],e0=e("power",$1);const N1=[["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"}]],a0=e("refresh-cw",N1);const f1=[["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"}]],t0=e("rotate-ccw",f1);const w1=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],c0=e("rotate-cw",w1);const z1=[["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"}]],o0=e("save",z1);const q1=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],n0=e("search",q1);const b1=[["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"}]],s0=e("server",b1);const C1=[["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"}]],y0=e("settings-2",C1);const j1=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],h0=e("settings",j1);const V1=[["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"}]],d0=e("shield",V1);const A1=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],r0=e("skip-forward",A1);const H1=[["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M12 21v-9",key:"17s77i"}],["path",{d:"M12 8V3",key:"13r4qs"}],["path",{d:"M17 16h4",key:"h1uq16"}],["path",{d:"M19 12V3",key:"o1uvq1"}],["path",{d:"M19 21v-5",key:"qua636"}],["path",{d:"M3 14h4",key:"bcjad9"}],["path",{d:"M5 10V3",key:"cb8scm"}],["path",{d:"M5 21v-7",key:"1w1uti"}]],k0=e("sliders-vertical",H1);const L1=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]],i0=e("smile",L1);const S1=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],p0=e("sparkles",S1);const P1=[["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"}]],l0=e("square-pen",P1);const U1=[["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"}]],_0=e("star",U1);const T1=[["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"}]],M0=e("sun",T1);const Z1=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],m0=e("terminal",Z1);const R1=[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]],v0=e("thumbs-up",R1);const E1=[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]],x0=e("thumbs-down",E1);const B1=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],u0=e("trash-2",B1);const D1=[["path",{d:"M16 7h6v6",key:"box55l"}],["path",{d:"m22 7-8.5 8.5-5-5L2 17",key:"1t1m79"}]],g0=e("trending-up",D1);const F1=[["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"}]],$0=e("triangle-alert",F1);const O1=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],N0=e("type",O1);const I1=[["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"}]],f0=e("upload",I1);const K1=[["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"}]],w0=e("user",K1);const W1=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],z0=e("users",W1);const X1=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],q0=e("x",X1);const G1=[["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"}]],b0=e("zap",G1);export{p2 as $,J1 as A,c2 as B,g2 as C,z2 as D,C2 as E,A2 as F,o0 as G,U2 as H,T2 as I,e0 as J,Z2 as K,E2 as L,F2 as M,Y2 as N,u0 as O,W2 as P,V2 as Q,a0 as R,d0 as S,g0 as T,w0 as U,Q2 as V,i2 as W,q0 as X,d2 as Y,b0 as Z,r2 as _,w2 as a,l2 as a0,S2 as a1,N2 as a2,K2 as a3,f0 as a4,H2 as a5,q2 as a6,L2 as a7,l0 as a8,a2 as a9,P2 as aa,z0 as ab,I2 as ac,n2 as ad,G2 as ae,J2 as af,N0 as ag,_0 as ah,v0 as ai,x0 as aj,y0 as ak,s0 as al,o2 as am,v2 as an,s2 as ao,u2 as ap,k0 as aq,D2 as ar,t2 as as,B2 as at,c0 as au,h0 as b,$0 as c,y2 as d,f2 as e,j2 as f,M2 as g,x2 as h,t0 as i,M0 as j,O2 as k,_2 as l,m2 as m,m0 as n,b2 as o,R2 as p,p0 as q,i0 as r,r0 as s,e2 as t,n0 as u,Y1 as v,h2 as w,k2 as x,X2 as y,$2 as z}; diff --git a/webui/dist/assets/index-ZouZGJSS.js b/webui/dist/assets/index-Bh0H0ZnO.js similarity index 50% rename from webui/dist/assets/index-ZouZGJSS.js rename to webui/dist/assets/index-Bh0H0ZnO.js index c586a439..d35b20b3 100644 --- a/webui/dist/assets/index-ZouZGJSS.js +++ b/webui/dist/assets/index-Bh0H0ZnO.js @@ -1,103 +1,103 @@ -import{r as b,j as o,u as Ca,R as he,b as du,d as HX,e as VX,L as UX,f as WX,g as ns,h as GX,k as XX,O as dD,l as YX}from"./router-SinpzM5S.js";import{a as KX,b as ZX,g as Mk}from"./react-vendor-Dtc2IqVY.js";import{c as hD,R as JX,T as eY,L as tY,a as nY,C as Bg,X as qg,Y as Vf,b as rY,B as H2,d as Fg,P as sY,e as iY,f as aY,_ as oY,g as lY,i as cY,h as CC,j as uY,k as TC,l as dY,m as hY,n as fY,r as fD,o as mY,p as Ak,q as mD,s as Lu,t as Rk,u as pY,v as gY,w as pD,x as gD,y as xD,z as Dk,A as zk,D as Pk,E as xY,F as vY,G as yY,H as bY,I as wY,J as SY,K as kY,M as Lk,N as bv,O as OY,Q as jY,S as Ik,U as NY,V as CY,W as vD,Z as yD,$ as bD,a0 as wD,a1 as wv,a2 as SD,a3 as kD,a4 as TY,a5 as EY,a6 as _Y,a7 as MY,a8 as AY,a9 as RY,aa as DY,ab as zY,ac as OD,ad as jD,ae as PY,af as LY,ag as IY,ah as BY,ai as qY,aj as FY,ak as $Y,al as QY,am as HY,an as VY,ao as UY,ap as WY,aq as GY,ar as XY,as as YY,at as KY}from"./charts-BH1Uno6i.js";import{c as Ta,a as Sv,u as ea,P as xn,b as Ze,d as qn,e as T0,f as Cc,g as ys,h as ai,i as ND,j as Bk,k as qk,S as ZY,l as CD,m as TD,R as ED,O as kv,n as Fk,C as Ov,o as $k,T as Qk,D as Hk,p as Vk,q as _D,r as MD,W as JY,s as AD,I as eK,t as RD,v as DD,w as tK,x as zD,V as nK,L as PD,y as LD,z as rK,A as sK,B as ID,E as iK,F as aK,G as mc,H as jv,J as Ah,K as BD,M as qD,N as FD,Q as $D,U as Uk,X as Wk,Y as Nv,Z as Cv,_ as Gk,$ as QD,a0 as oK,a1 as HD,a2 as lK,a3 as cK,a4 as VD,a5 as uK}from"./ui-vendor-BLBhIcJ8.js";import{R as Ti,A as dK,D as hK,a as b3,Z as w3,C as Gd,M as E0,T as fK,X as _0,P as UD,S as mK,b as vu,I as wa,c as Xd,d as dc,e as S3,E as b1,f as sa,g as pc,h as pK,i as gK,j as k3,k as O3,L as EC,K as WD,l as Ou,m as xK,n as vK,F as tl,o as Yd,p as dh,q as yK,B as bK,U as GD,r as Xk,s as wK,t as SK,u as ii,H as w1,v as XD,w as Im,x as j3,y as kK,z as OK,G as Tv,J as Yk,N as ms,O as sn,Q as S1,V as hh,W as M0,Y as Iu,_ as Bu,$ as A0,a0 as YD,a1 as jK,a2 as NK,a3 as fh,a4 as _C,a5 as CK,a6 as yu,a7 as N3,a8 as Bm,a9 as TK,aa as C3,ab as EK,ac as KD,ad as MC,ae as _K,af as MK,ag as AK,ah as tc,ai as V2,aj as AC,ak as RK,al as ZD,am as JD,an as ez,ao as DK,ap as zK,aq as RC,ar as PK,as as LK,at as DC,au as IK}from"./icons-NigUckDX.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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 r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var U2={exports:{}},Uf={},W2={exports:{}},G2={};var zC;function BK(){return zC||(zC=1,(function(t){function e(P,W){var J=P.length;P.push(W);e:for(;0>>1,R=P[X];if(0>>1;Xs(F,J))Us(te,F)?(P[X]=te,P[U]=J,X=U):(P[X]=F,P[G]=J,X=G);else if(Us(te,J))P[X]=te,P[U]=J,X=U;else break e}}return W}function s(P,W){var J=P.sortIndex-W.sortIndex;return J!==0?J:P.id-W.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,l=a.now();t.unstable_now=function(){return a.now()-l}}var c=[],h=[],f=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(P){for(var W=n(h);W!==null;){if(W.callback===null)r(h);else if(W.startTime<=P)r(h),W.sortIndex=W.expirationTime,e(c,W);else break;W=n(h)}}function _(P){if(w=!1,T(P),!y)if(n(c)!==null)y=!0,E||(E=!0,V());else{var W=n(h);W!==null&&H(_,W.startTime-P)}}var E=!1,M=-1,q=5,L=-1;function I(){return S?!0:!(t.unstable_now()-LP&&I());){var X=m.callback;if(typeof X=="function"){m.callback=null,g=m.priorityLevel;var R=X(m.expirationTime<=P);if(P=t.unstable_now(),typeof R=="function"){m.callback=R,T(P),W=!0;break t}m===n(c)&&r(c),T(P)}else r(c);m=n(c)}if(m!==null)W=!0;else{var se=n(h);se!==null&&H(_,se.startTime-P),W=!1}}break e}finally{m=null,g=J,x=!1}W=void 0}}finally{W?V():E=!1}}}var V;if(typeof C=="function")V=function(){C($)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,z=ee.port2;ee.port1.onmessage=$,V=function(){z.postMessage(null)}}else V=function(){k($,0)};function H(P,W){M=k(function(){P(t.unstable_now())},W)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125X?(P.sortIndex=J,e(h,P),n(c)===null&&P===n(h)&&(w?(N(M),M=-1):w=!0,H(_,J-X))):(P.sortIndex=R,e(c,P),y||x||(y=!0,E||(E=!0,V()))),P},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(P){var W=g;return function(){var J=g;g=W;try{return P.apply(this,arguments)}finally{g=J}}}})(G2)),G2}var PC;function qK(){return PC||(PC=1,W2.exports=BK()),W2.exports}var LC;function FK(){if(LC)return Uf;LC=1;var t=qK(),e=KX(),n=ZX();function r(u){var d="https://react.dev/errors/"+u;if(1R||(u.current=X[R],X[R]=null,R--)}function F(u,d){R++,X[R]=u.current,u.current=d}var U=se(null),te=se(null),ne=se(null),Y=se(null);function ae(u,d){switch(F(ne,d),F(te,u),F(U,null),d.nodeType){case 9:case 11:u=(u=d.documentElement)&&(u=u.namespaceURI)?Y8(u):0;break;default:if(u=d.tagName,d=d.namespaceURI)d=Y8(d),u=K8(d,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(U),F(U,u)}function re(){G(U),G(te),G(ne)}function oe(u){u.memoizedState!==null&&F(Y,u);var d=U.current,p=K8(d,u.type);d!==p&&(F(te,u),F(U,p))}function _e(u){te.current===u&&(G(U),G(te)),Y.current===u&&(G(Y),Ff._currentValue=J)}var Ge,tt;function Xe(u){if(Ge===void 0)try{throw Error()}catch(p){var d=p.stack.trim().match(/\n( *(at )?)/);Ge=d&&d[1]||"",tt=-1{for(const i of s)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(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 r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Z2={exports:{}},Gf={},J2={exports:{}},ew={};var $C;function eZ(){return $C||($C=1,(function(t){function e(P,W){var J=P.length;P.push(W);e:for(;0>>1,R=P[X];if(0>>1;Xs(F,J))Us(te,F)?(P[X]=te,P[U]=J,X=U):(P[X]=F,P[G]=J,X=G);else if(Us(te,J))P[X]=te,P[U]=J,X=U;else break e}}return W}function s(P,W){var J=P.sortIndex-W.sortIndex;return J!==0?J:P.id-W.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var a=Date,o=a.now();t.unstable_now=function(){return a.now()-o}}var c=[],h=[],f=1,m=null,g=3,x=!1,y=!1,w=!1,S=!1,k=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function T(P){for(var W=n(h);W!==null;){if(W.callback===null)r(h);else if(W.startTime<=P)r(h),W.sortIndex=W.expirationTime,e(c,W);else break;W=n(h)}}function _(P){if(w=!1,T(P),!y)if(n(c)!==null)y=!0,E||(E=!0,V());else{var W=n(h);W!==null&&H(_,W.startTime-P)}}var E=!1,M=-1,q=5,L=-1;function I(){return S?!0:!(t.unstable_now()-LP&&I());){var X=m.callback;if(typeof X=="function"){m.callback=null,g=m.priorityLevel;var R=X(m.expirationTime<=P);if(P=t.unstable_now(),typeof R=="function"){m.callback=R,T(P),W=!0;break t}m===n(c)&&r(c),T(P)}else r(c);m=n(c)}if(m!==null)W=!0;else{var se=n(h);se!==null&&H(_,se.startTime-P),W=!1}}break e}finally{m=null,g=J,x=!1}W=void 0}}finally{W?V():E=!1}}}var V;if(typeof C=="function")V=function(){C($)};else if(typeof MessageChannel<"u"){var ee=new MessageChannel,z=ee.port2;ee.port1.onmessage=$,V=function(){z.postMessage(null)}}else V=function(){k($,0)};function H(P,W){M=k(function(){P(t.unstable_now())},W)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_forceFrameRate=function(P){0>P||125X?(P.sortIndex=J,e(h,P),n(c)===null&&P===n(h)&&(w?(N(M),M=-1):w=!0,H(_,J-X))):(P.sortIndex=R,e(c,P),y||x||(y=!0,E||(E=!0,V()))),P},t.unstable_shouldYield=I,t.unstable_wrapCallback=function(P){var W=g;return function(){var J=g;g=W;try{return P.apply(this,arguments)}finally{g=J}}}})(ew)),ew}var QC;function tZ(){return QC||(QC=1,J2.exports=eZ()),J2.exports}var HC;function nZ(){if(HC)return Gf;HC=1;var t=tZ(),e=hY(),n=fY();function r(u){var d="https://react.dev/errors/"+u;if(1R||(u.current=X[R],X[R]=null,R--)}function F(u,d){R++,X[R]=u.current,u.current=d}var U=se(null),te=se(null),ne=se(null),Y=se(null);function ae(u,d){switch(F(ne,d),F(te,u),F(U,null),d.nodeType){case 9:case 11:u=(u=d.documentElement)&&(u=u.namespaceURI)?rC(u):0;break;default:if(u=d.tagName,d=d.namespaceURI)d=rC(d),u=sC(d,u);else switch(u){case"svg":u=1;break;case"math":u=2;break;default:u=0}}G(U),F(U,u)}function re(){G(U),G(te),G(ne)}function le(u){u.memoizedState!==null&&F(Y,u);var d=U.current,p=sC(d,u.type);d!==p&&(F(te,u),F(U,p))}function _e(u){te.current===u&&(G(U),G(te)),Y.current===u&&(G(Y),Qf._currentValue=J)}var Ge,tt;function Xe(u){if(Ge===void 0)try{throw Error()}catch(p){var d=p.stack.trim().match(/\n( *(at )?)/);Ge=d&&d[1]||"",tt=-1)":-1O||ue[v]!==Se[O]){var Ee=` `+ue[v].replace(" at new "," at ");return u.displayName&&Ee.includes("")&&(Ee=Ee.replace("",u.displayName)),Ee}while(1<=v&&0<=O);break}}}finally{je=!1,Error.prepareStackTrace=p}return(p=u?u.displayName||u.name:"")?Xe(p):""}function He(u,d){switch(u.tag){case 26:case 27:case 5:return Xe(u.type);case 16:return Xe("Lazy");case 13:return u.child!==d&&d!==null?Xe("Suspense Fallback"):Xe("Suspense");case 19:return Xe("SuspenseList");case 0:case 15:return Qe(u.type,!1);case 11:return Qe(u.type.render,!1);case 1:return Qe(u.type,!0);case 31:return Xe("Activity");default:return""}}function $e(u){try{var d="",p=null;do d+=He(u,p),p=u,u=u.return;while(u);return d}catch(v){return` Error generating stack: `+v.message+` -`+v.stack}}var bt=Object.prototype.hasOwnProperty,ot=t.unstable_scheduleCallback,on=t.unstable_cancelCallback,Tn=t.unstable_shouldYield,Nn=t.unstable_requestPaint,Rt=t.unstable_now,xt=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,rt=t.unstable_LowPriority,wt=t.unstable_IdlePriority,jt=t.log,Ne=t.unstable_setDisableYieldValue,ie=null,xe=null;function Je(u){if(typeof jt=="function"&&Ne(u),xe&&typeof xe.setStrictMode=="function")try{xe.setStrictMode(ie,u)}catch{}}var dt=Math.clz32?Math.clz32:vn,er=Math.log,pt=Math.LN2;function vn(u){return u>>>=0,u===0?32:31-(er(u)/pt|0)|0}var vt=256,Wt=262144,Ht=4194304;function lt(u){var d=u&42;if(d!==0)return d;switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function ur(u,d,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,j=u.suspendedLanes,B=u.pingedLanes;u=u.warmLanes;var K=v&134217727;return K!==0?(v=K&~j,v!==0?O=lt(v):(B&=K,B!==0?O=lt(B):p||(p=K&~u,p!==0&&(O=lt(p))))):(K=v&~j,K!==0?O=lt(K):B!==0?O=lt(B):p||(p=v&~u,p!==0&&(O=lt(p)))),O===0?0:d!==0&&d!==O&&(d&j)===0&&(j=O&-O,p=d&-d,j>=p||j===32&&(p&4194048)!==0)?d:O}function Xr(u,d){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&d)===0}function Yr(u,d){switch(u){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function dr(){var u=Ht;return Ht<<=1,(Ht&62914560)===0&&(Ht=4194304),u}function Nr(u){for(var d=[],p=0;31>p;p++)d.push(u);return d}function Is(u,d){u.pendingLanes|=d,d!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function xr(u,d,p,v,O,j){var B=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var K=u.entanglements,ue=u.expirationTimes,Se=u.hiddenUpdates;for(p=B&~p;0"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var IW=/[\n"\\]/g;function zi(u){return u.replace(IW,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Iy(u,d,p,v,O,j,B,K){u.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?u.type=B:u.removeAttribute("type"),d!=null?B==="number"?(d===0&&u.value===""||u.value!=d)&&(u.value=""+Di(d)):u.value!==""+Di(d)&&(u.value=""+Di(d)):B!=="submit"&&B!=="reset"||u.removeAttribute("value"),d!=null?By(u,B,Di(d)):p!=null?By(u,B,Di(p)):v!=null&&u.removeAttribute("value"),O==null&&j!=null&&(u.defaultChecked=!!j),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?u.name=""+Di(K):u.removeAttribute("name")}function Hj(u,d,p,v,O,j,B,K){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(u.type=j),d!=null||p!=null){if(!(j!=="submit"&&j!=="reset"||d!=null)){Ly(u);return}p=p!=null?""+Di(p):"",d=d!=null?""+Di(d):p,K||d===u.value||(u.value=d),u.defaultValue=d}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=K?u.checked:!!v,u.defaultChecked=!!v,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(u.name=B),Ly(u)}function By(u,d,p){d==="number"&&Ep(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Vu(u,d,p,v){if(u=u.options,d){d={};for(var O=0;O"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Hy=!1;if(ko)try{var sf={};Object.defineProperty(sf,"passive",{get:function(){Hy=!0}}),window.addEventListener("test",sf,sf),window.removeEventListener("test",sf,sf)}catch{Hy=!1}var Nl=null,Vy=null,Mp=null;function Kj(){if(Mp)return Mp;var u,d=Vy,p=d.length,v,O="value"in Nl?Nl.value:Nl.textContent,j=O.length;for(u=0;u=lf),r7=" ",s7=!1;function i7(u,d){switch(u){case"keyup":return hG.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function a7(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Xu=!1;function mG(u,d){switch(u){case"compositionend":return a7(d);case"keypress":return d.which!==32?null:(s7=!0,r7);case"textInput":return u=d.data,u===r7&&s7?null:u;default:return null}}function pG(u,d){if(Xu)return u==="compositionend"||!Yy&&i7(u,d)?(u=Kj(),Mp=Vy=Nl=null,Xu=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=m7(p)}}function g7(u,d){return u&&d?u===d?!0:u&&u.nodeType===3?!1:d&&d.nodeType===3?g7(u,d.parentNode):"contains"in u?u.contains(d):u.compareDocumentPosition?!!(u.compareDocumentPosition(d)&16):!1:!1}function x7(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var d=Ep(u.document);d instanceof u.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)u=d.contentWindow;else break;d=Ep(u.document)}return d}function Jy(u){var d=u&&u.nodeName&&u.nodeName.toLowerCase();return d&&(d==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||d==="textarea"||u.contentEditable==="true")}var kG=ko&&"documentMode"in document&&11>=document.documentMode,Yu=null,eb=null,hf=null,tb=!1;function v7(u,d,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;tb||Yu==null||Yu!==Ep(v)||(v=Yu,"selectionStart"in v&&Jy(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),hf&&df(hf,v)||(hf=v,v=Og(eb,"onSelect"),0>=B,O-=B,Da=1<<32-dt(d)+O|p<Bt?(Zt=ct,ct=null):Zt=ct.sibling;var bn=ke(ge,ct,be[Bt],Me);if(bn===null){ct===null&&(ct=Zt);break}u&&ct&&bn.alternate===null&&d(ge,ct),fe=j(bn,fe,Bt),yn===null?yt=bn:yn.sibling=bn,yn=bn,ct=Zt}if(Bt===be.length)return p(ge,ct),tn&&jo(ge,Bt),yt;if(ct===null){for(;BtBt?(Zt=ct,ct=null):Zt=ct.sibling;var Gl=ke(ge,ct,bn.value,Me);if(Gl===null){ct===null&&(ct=Zt);break}u&&ct&&Gl.alternate===null&&d(ge,ct),fe=j(Gl,fe,Bt),yn===null?yt=Gl:yn.sibling=Gl,yn=Gl,ct=Zt}if(bn.done)return p(ge,ct),tn&&jo(ge,Bt),yt;if(ct===null){for(;!bn.done;Bt++,bn=be.next())bn=De(ge,bn.value,Me),bn!==null&&(fe=j(bn,fe,Bt),yn===null?yt=bn:yn.sibling=bn,yn=bn);return tn&&jo(ge,Bt),yt}for(ct=v(ct);!bn.done;Bt++,bn=be.next())bn=Ce(ct,ge,Bt,bn.value,Me),bn!==null&&(u&&bn.alternate!==null&&ct.delete(bn.key===null?Bt:bn.key),fe=j(bn,fe,Bt),yn===null?yt=bn:yn.sibling=bn,yn=bn);return u&&ct.forEach(function(QX){return d(ge,QX)}),tn&&jo(ge,Bt),yt}function zn(ge,fe,be,Me){if(typeof be=="object"&&be!==null&&be.type===w&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case x:e:{for(var yt=be.key;fe!==null;){if(fe.key===yt){if(yt=be.type,yt===w){if(fe.tag===7){p(ge,fe.sibling),Me=O(fe,be.props.children),Me.return=ge,ge=Me;break e}}else if(fe.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&Gc(yt)===fe.type){p(ge,fe.sibling),Me=O(fe,be.props),vf(Me,be),Me.return=ge,ge=Me;break e}p(ge,fe);break}else d(ge,fe);fe=fe.sibling}be.type===w?(Me=Qc(be.props.children,ge.mode,Me,be.key),Me.return=ge,ge=Me):(Me=Fp(be.type,be.key,be.props,null,ge.mode,Me),vf(Me,be),Me.return=ge,ge=Me)}return B(ge);case y:e:{for(yt=be.key;fe!==null;){if(fe.key===yt)if(fe.tag===4&&fe.stateNode.containerInfo===be.containerInfo&&fe.stateNode.implementation===be.implementation){p(ge,fe.sibling),Me=O(fe,be.children||[]),Me.return=ge,ge=Me;break e}else{p(ge,fe);break}else d(ge,fe);fe=fe.sibling}Me=lb(be,ge.mode,Me),Me.return=ge,ge=Me}return B(ge);case q:return be=Gc(be),zn(ge,fe,be,Me)}if(H(be))return st(ge,fe,be,Me);if(V(be)){if(yt=V(be),typeof yt!="function")throw Error(r(150));return be=yt.call(be),Ot(ge,fe,be,Me)}if(typeof be.then=="function")return zn(ge,fe,Gp(be),Me);if(be.$$typeof===C)return zn(ge,fe,Hp(ge,be),Me);Xp(ge,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,fe!==null&&fe.tag===6?(p(ge,fe.sibling),Me=O(fe,be),Me.return=ge,ge=Me):(p(ge,fe),Me=ob(be,ge.mode,Me),Me.return=ge,ge=Me),B(ge)):p(ge,fe)}return function(ge,fe,be,Me){try{xf=0;var yt=zn(ge,fe,be,Me);return od=null,yt}catch(ct){if(ct===ad||ct===Up)throw ct;var yn=mi(29,ct,null,ge.mode);return yn.lanes=Me,yn.return=ge,yn}finally{}}}var Yc=F7(!0),$7=F7(!1),Ml=!1;function bb(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wb(u,d){u=u.updateQueue,d.updateQueue===u&&(d.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function Al(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Rl(u,d,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Cn&2)!==0){var O=v.pending;return O===null?d.next=d:(d.next=O.next,O.next=d),v.pending=d,d=qp(u),j7(u,null,p),d}return Bp(u,v,d,p),qp(u)}function yf(u,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194048)!==0)){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Ns(u,p)}}function Sb(u,d){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,j=null;if(p=p.firstBaseUpdate,p!==null){do{var B={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};j===null?O=j=B:j=j.next=B,p=p.next}while(p!==null);j===null?O=j=d:j=j.next=d}else O=j=d;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:j,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=d:u.next=d,p.lastBaseUpdate=d}var kb=!1;function bf(){if(kb){var u=id;if(u!==null)throw u}}function wf(u,d,p,v){kb=!1;var O=u.updateQueue;Ml=!1;var j=O.firstBaseUpdate,B=O.lastBaseUpdate,K=O.shared.pending;if(K!==null){O.shared.pending=null;var ue=K,Se=ue.next;ue.next=null,B===null?j=Se:B.next=Se,B=ue;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==B&&(K===null?Ee.firstBaseUpdate=Se:K.next=Se,Ee.lastBaseUpdate=ue))}if(j!==null){var De=O.baseState;B=0,Ee=Se=ue=null,K=j;do{var ke=K.lane&-536870913,Ce=ke!==K.lane;if(Ce?(Kt&ke)===ke:(v&ke)===ke){ke!==0&&ke===sd&&(kb=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var st=u,Ot=K;ke=d;var zn=p;switch(Ot.tag){case 1:if(st=Ot.payload,typeof st=="function"){De=st.call(zn,De,ke);break e}De=st;break e;case 3:st.flags=st.flags&-65537|128;case 0:if(st=Ot.payload,ke=typeof st=="function"?st.call(zn,De,ke):st,ke==null)break e;De=m({},De,ke);break e;case 2:Ml=!0}}ke=K.callback,ke!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[ke]:Ce.push(ke))}else Ce={lane:ke,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(Se=Ee=Ce,ue=De):Ee=Ee.next=Ce,B|=ke;if(K=K.next,K===null){if(K=O.shared.pending,K===null)break;Ce=K,K=Ce.next,Ce.next=null,O.lastBaseUpdate=Ce,O.shared.pending=null}}while(!0);Ee===null&&(ue=De),O.baseState=ue,O.firstBaseUpdate=Se,O.lastBaseUpdate=Ee,j===null&&(O.shared.lanes=0),Il|=B,u.lanes=B,u.memoizedState=De}}function Q7(u,d){if(typeof u!="function")throw Error(r(191,u));u.call(d)}function H7(u,d){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;uj?j:8;var B=P.T,K={};P.T=K,$b(u,!1,d,p);try{var ue=O(),Se=P.S;if(Se!==null&&Se(K,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ee=AG(ue,v);Of(u,d,Ee,yi(u))}else Of(u,d,v,yi(u))}catch(De){Of(u,d,{then:function(){},status:"rejected",reason:De},yi())}finally{W.p=j,B!==null&&K.types!==null&&(B.types=K.types),P.T=B}}function IG(){}function qb(u,d,p,v){if(u.tag!==5)throw Error(r(476));var O=SN(u).queue;wN(u,O,d,J,p===null?IG:function(){return kN(u),p(v)})}function SN(u){var d=u.memoizedState;if(d!==null)return d;d={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:J},next:null};var p={};return d.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Eo,lastRenderedState:p},next:null},u.memoizedState=d,u=u.alternate,u!==null&&(u.memoizedState=d),d}function kN(u){var d=SN(u);d.next===null&&(d=u.alternate.memoizedState),Of(u,d.next.queue,{},yi())}function Fb(){return as(Ff)}function ON(){return yr().memoizedState}function jN(){return yr().memoizedState}function BG(u){for(var d=u.return;d!==null;){switch(d.tag){case 24:case 3:var p=yi();u=Al(p);var v=Rl(d,u,p);v!==null&&(Us(v,d,p),yf(v,d,p)),d={cache:gb()},u.payload=d;return}d=d.return}}function qG(u,d,p){var v=yi();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},ig(u)?CN(d,p):(p=ib(u,d,p,v),p!==null&&(Us(p,u,v),TN(p,d,v)))}function NN(u,d,p){var v=yi();Of(u,d,p,v)}function Of(u,d,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(ig(u))CN(d,O);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var B=d.lastRenderedState,K=j(B,p);if(O.hasEagerState=!0,O.eagerState=K,fi(K,B))return Bp(u,d,O,0),Fn===null&&Ip(),!1}catch{}finally{}if(p=ib(u,d,O,v),p!==null)return Us(p,u,v),TN(p,d,v),!0}return!1}function $b(u,d,p,v){if(v={lane:2,revertLane:b2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},ig(u)){if(d)throw Error(r(479))}else d=ib(u,p,v,2),d!==null&&Us(d,u,2)}function ig(u){var d=u.alternate;return u===Pt||d!==null&&d===Pt}function CN(u,d){cd=Zp=!0;var p=u.pending;p===null?d.next=d:(d.next=p.next,p.next=d),u.pending=d}function TN(u,d,p){if((p&4194048)!==0){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Ns(u,p)}}var jf={readContext:as,use:tg,useCallback:hr,useContext:hr,useEffect:hr,useImperativeHandle:hr,useLayoutEffect:hr,useInsertionEffect:hr,useMemo:hr,useReducer:hr,useRef:hr,useState:hr,useDebugValue:hr,useDeferredValue:hr,useTransition:hr,useSyncExternalStore:hr,useId:hr,useHostTransitionStatus:hr,useFormState:hr,useActionState:hr,useOptimistic:hr,useMemoCache:hr,useCacheRefresh:hr};jf.useEffectEvent=hr;var EN={readContext:as,use:tg,useCallback:function(u,d){return Cs().memoizedState=[u,d===void 0?null:d],u},useContext:as,useEffect:hN,useImperativeHandle:function(u,d,p){p=p!=null?p.concat([u]):null,rg(4194308,4,gN.bind(null,d,u),p)},useLayoutEffect:function(u,d){return rg(4194308,4,u,d)},useInsertionEffect:function(u,d){rg(4,2,u,d)},useMemo:function(u,d){var p=Cs();d=d===void 0?null:d;var v=u();if(Kc){Je(!0);try{u()}finally{Je(!1)}}return p.memoizedState=[v,d],v},useReducer:function(u,d,p){var v=Cs();if(p!==void 0){var O=p(d);if(Kc){Je(!0);try{p(d)}finally{Je(!1)}}}else O=d;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=qG.bind(null,Pt,u),[v.memoizedState,u]},useRef:function(u){var d=Cs();return u={current:u},d.memoizedState=u},useState:function(u){u=zb(u);var d=u.queue,p=NN.bind(null,Pt,d);return d.dispatch=p,[u.memoizedState,p]},useDebugValue:Ib,useDeferredValue:function(u,d){var p=Cs();return Bb(p,u,d)},useTransition:function(){var u=zb(!1);return u=wN.bind(null,Pt,u.queue,!0,!1),Cs().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,d,p){var v=Pt,O=Cs();if(tn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=d(),Fn===null)throw Error(r(349));(Kt&127)!==0||Y7(v,d,p)}O.memoizedState=p;var j={value:p,getSnapshot:d};return O.queue=j,hN(Z7.bind(null,v,j,u),[u]),v.flags|=2048,dd(9,{destroy:void 0},K7.bind(null,v,j,p,d),null),p},useId:function(){var u=Cs(),d=Fn.identifierPrefix;if(tn){var p=za,v=Da;p=(v&~(1<<32-dt(v)-1)).toString(32)+p,d="_"+d+"R_"+p,p=Jp++,0<\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof v.is=="string"?B.createElement("select",{is:v.is}):B.createElement("select"),v.multiple?j.multiple=!0:v.size&&(j.size=v.size);break;default:j=typeof v.is=="string"?B.createElement(O,{is:v.is}):B.createElement(O)}}j[Ir]=d,j[ss]=v;e:for(B=d.child;B!==null;){if(B.tag===5||B.tag===6)j.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===d)break e;for(;B.sibling===null;){if(B.return===null||B.return===d)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}d.stateNode=j;e:switch(ls(j,O,v),O){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Mo(d)}}return Kn(d),n2(d,d.type,u===null?null:u.memoizedProps,d.pendingProps,p),null;case 6:if(u&&d.stateNode!=null)u.memoizedProps!==v&&Mo(d);else{if(typeof v!="string"&&d.stateNode===null)throw Error(r(166));if(u=ne.current,nd(d)){if(u=d.stateNode,p=d.memoizedProps,v=null,O=is,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Ir]=d,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||G8(u.nodeValue,p)),u||El(d,!0)}else u=jg(u).createTextNode(v),u[Ir]=d,d.stateNode=u}return Kn(d),null;case 31:if(p=d.memoizedState,u===null||u.memoizedState!==null){if(v=nd(d),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=d.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Ir]=d}else Hc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),u=!1}else p=hb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return d.flags&256?(gi(d),d):(gi(d),null);if((d.flags&128)!==0)throw Error(r(558))}return Kn(d),null;case 13:if(v=d.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=nd(d),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=d.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Ir]=d}else Hc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),O=!1}else O=hb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return d.flags&256?(gi(d),d):(gi(d),null)}return gi(d),(d.flags&128)!==0?(d.lanes=p,d):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=d.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),j=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(j=v.memoizedState.cachePool.pool),j!==O&&(v.flags|=2048)),p!==u&&p&&(d.child.flags|=8192),ug(d,d.updateQueue),Kn(d),null);case 4:return re(),u===null&&O2(d.stateNode.containerInfo),Kn(d),null;case 10:return Co(d.type),Kn(d),null;case 19:if(G(vr),v=d.memoizedState,v===null)return Kn(d),null;if(O=(d.flags&128)!==0,j=v.rendering,j===null)if(O)Cf(v,!1);else{if(fr!==0||u!==null&&(u.flags&128)!==0)for(u=d.child;u!==null;){if(j=Kp(u),j!==null){for(d.flags|=128,Cf(v,!1),u=j.updateQueue,d.updateQueue=u,ug(d,u),d.subtreeFlags=0,u=p,p=d.child;p!==null;)N7(p,u),p=p.sibling;return F(vr,vr.current&1|2),tn&&jo(d,v.treeForkCount),d.child}u=u.sibling}v.tail!==null&&Rt()>pg&&(d.flags|=128,O=!0,Cf(v,!1),d.lanes=4194304)}else{if(!O)if(u=Kp(j),u!==null){if(d.flags|=128,O=!0,u=u.updateQueue,d.updateQueue=u,ug(d,u),Cf(v,!0),v.tail===null&&v.tailMode==="hidden"&&!j.alternate&&!tn)return Kn(d),null}else 2*Rt()-v.renderingStartTime>pg&&p!==536870912&&(d.flags|=128,O=!0,Cf(v,!1),d.lanes=4194304);v.isBackwards?(j.sibling=d.child,d.child=j):(u=v.last,u!==null?u.sibling=j:d.child=j,v.last=j)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=Rt(),u.sibling=null,p=vr.current,F(vr,O?p&1|2:p&1),tn&&jo(d,v.treeForkCount),u):(Kn(d),null);case 22:case 23:return gi(d),jb(),v=d.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(d.flags|=8192):v&&(d.flags|=8192),v?(p&536870912)!==0&&(d.flags&128)===0&&(Kn(d),d.subtreeFlags&6&&(d.flags|=8192)):Kn(d),p=d.updateQueue,p!==null&&ug(d,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048),u!==null&&G(Wc),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),d.memoizedState.cache!==p&&(d.flags|=2048),Co(Tr),Kn(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function VG(u,d){switch(ub(d),d.tag){case 1:return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 3:return Co(Tr),re(),u=d.flags,(u&65536)!==0&&(u&128)===0?(d.flags=u&-65537|128,d):null;case 26:case 27:case 5:return _e(d),null;case 31:if(d.memoizedState!==null){if(gi(d),d.alternate===null)throw Error(r(340));Hc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 13:if(gi(d),u=d.memoizedState,u!==null&&u.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Hc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 19:return G(vr),null;case 4:return re(),null;case 10:return Co(d.type),null;case 22:case 23:return gi(d),jb(),u!==null&&G(Wc),u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 24:return Co(Tr),null;case 25:return null;default:return null}}function JN(u,d){switch(ub(d),d.tag){case 3:Co(Tr),re();break;case 26:case 27:case 5:_e(d);break;case 4:re();break;case 31:d.memoizedState!==null&&gi(d);break;case 13:gi(d);break;case 19:G(vr);break;case 10:Co(d.type);break;case 22:case 23:gi(d),jb(),u!==null&&G(Wc);break;case 24:Co(Tr)}}function Tf(u,d){try{var p=d.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var O=v.next;p=O;do{if((p.tag&u)===u){v=void 0;var j=p.create,B=p.inst;v=j(),B.destroy=v}p=p.next}while(p!==O)}}catch(K){_n(d,d.return,K)}}function Pl(u,d,p){try{var v=d.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var j=O.next;v=j;do{if((v.tag&u)===u){var B=v.inst,K=B.destroy;if(K!==void 0){B.destroy=void 0,O=d;var ue=p,Se=K;try{Se()}catch(Ee){_n(O,ue,Ee)}}}v=v.next}while(v!==j)}}catch(Ee){_n(d,d.return,Ee)}}function e8(u){var d=u.updateQueue;if(d!==null){var p=u.stateNode;try{H7(d,p)}catch(v){_n(u,u.return,v)}}}function t8(u,d,p){p.props=Zc(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){_n(u,d,v)}}function Ef(u,d){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(O){_n(u,d,O)}}function Pa(u,d){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){_n(u,d,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){_n(u,d,O)}else p.current=null}function n8(u){var d=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(O){_n(u,u.return,O)}}function r2(u,d,p){try{var v=u.stateNode;fX(v,u.type,p,d),v[ss]=d}catch(O){_n(u,u.return,O)}}function r8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Ql(u.type)||u.tag===4}function s2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||r8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Ql(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function i2(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,d):(d=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,d.appendChild(u),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=So));else if(v!==4&&(v===27&&Ql(u.type)&&(p=u.stateNode,d=null),u=u.child,u!==null))for(i2(u,d,p),u=u.sibling;u!==null;)i2(u,d,p),u=u.sibling}function dg(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?p.insertBefore(u,d):p.appendChild(u);else if(v!==4&&(v===27&&Ql(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(dg(u,d,p),u=u.sibling;u!==null;)dg(u,d,p),u=u.sibling}function s8(u){var d=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=d.attributes;O.length;)d.removeAttributeNode(O[0]);ls(d,v,p),d[Ir]=u,d[ss]=p}catch(j){_n(u,u.return,j)}}var Ao=!1,Mr=!1,a2=!1,i8=typeof WeakSet=="function"?WeakSet:Set,Kr=null;function UG(u,d){if(u=u.containerInfo,C2=Ag,u=x7(u),Jy(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var O=v.anchorOffset,j=v.focusNode;v=v.focusOffset;try{p.nodeType,j.nodeType}catch{p=null;break e}var B=0,K=-1,ue=-1,Se=0,Ee=0,De=u,ke=null;t:for(;;){for(var Ce;De!==p||O!==0&&De.nodeType!==3||(K=B+O),De!==j||v!==0&&De.nodeType!==3||(ue=B+v),De.nodeType===3&&(B+=De.nodeValue.length),(Ce=De.firstChild)!==null;)ke=De,De=Ce;for(;;){if(De===u)break t;if(ke===p&&++Se===O&&(K=B),ke===j&&++Ee===v&&(ue=B),(Ce=De.nextSibling)!==null)break;De=ke,ke=De.parentNode}De=Ce}p=K===-1||ue===-1?null:{start:K,end:ue}}else p=null}p=p||{start:0,end:0}}else p=null;for(T2={focusedElem:u,selectionRange:p},Ag=!1,Kr=d;Kr!==null;)if(d=Kr,u=d.child,(d.subtreeFlags&1028)!==0&&u!==null)u.return=d,Kr=u;else for(;Kr!==null;){switch(d=Kr,j=d.alternate,u=d.flags,d.tag){case 0:if((u&4)!==0&&(u=d.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p title"))),ls(j,v,p),j[Ir]=u,Cr(j),v=j;break e;case"link":var B=dC("link","href",O).get(v+(p.href||""));if(B){for(var K=0;Kzn&&(B=zn,zn=Ot,Ot=B);var ge=p7(K,Ot),fe=p7(K,zn);if(ge&&fe&&(Ce.rangeCount!==1||Ce.anchorNode!==ge.node||Ce.anchorOffset!==ge.offset||Ce.focusNode!==fe.node||Ce.focusOffset!==fe.offset)){var be=De.createRange();be.setStart(ge.node,ge.offset),Ce.removeAllRanges(),Ot>zn?(Ce.addRange(be),Ce.extend(fe.node,fe.offset)):(be.setEnd(fe.node,fe.offset),Ce.addRange(be))}}}}for(De=[],Ce=K;Ce=Ce.parentNode;)Ce.nodeType===1&&De.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;Kp?32:p,P.T=null,p=f2,f2=null;var j=ql,B=Lo;if(Br=0,gd=ql=null,Lo=0,(Cn&6)!==0)throw Error(r(331));var K=Cn;if(Cn|=4,g8(j.current),f8(j,j.current,B,p),Cn=K,zf(0,!1),xe&&typeof xe.onPostCommitFiberRoot=="function")try{xe.onPostCommitFiberRoot(ie,j)}catch{}return!0}finally{W.p=O,P.T=v,D8(u,d)}}function P8(u,d,p){d=Li(p,d),d=Ub(u.stateNode,d,2),u=Rl(u,d,2),u!==null&&(Is(u,2),La(u))}function _n(u,d,p){if(u.tag===3)P8(u,u,p);else for(;d!==null;){if(d.tag===3){P8(d,u,p);break}else if(d.tag===1){var v=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&(Bl===null||!Bl.has(v))){u=Li(p,u),p=LN(2),v=Rl(d,p,2),v!==null&&(IN(p,v,d,u),Is(v,2),La(v));break}}d=d.return}}function x2(u,d,p){var v=u.pingCache;if(v===null){v=u.pingCache=new XG;var O=new Set;v.set(d,O)}else O=v.get(d),O===void 0&&(O=new Set,v.set(d,O));O.has(p)||(c2=!0,O.add(p),u=eX.bind(null,u,d,p),d.then(u,u))}function eX(u,d,p){var v=u.pingCache;v!==null&&v.delete(d),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,Fn===u&&(Kt&p)===p&&(fr===4||fr===3&&(Kt&62914560)===Kt&&300>Rt()-mg?(Cn&2)===0&&xd(u,0):u2|=p,pd===Kt&&(pd=0)),La(u)}function L8(u,d){d===0&&(d=dr()),u=$c(u,d),u!==null&&(Is(u,d),La(u))}function tX(u){var d=u.memoizedState,p=0;d!==null&&(p=d.retryLane),L8(u,p)}function nX(u,d){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,O=u.memoizedState;O!==null&&(p=O.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(d),L8(u,p)}function rX(u,d){return ot(u,d)}var wg=null,yd=null,v2=!1,Sg=!1,y2=!1,$l=0;function La(u){u!==yd&&u.next===null&&(yd===null?wg=yd=u:yd=yd.next=u),Sg=!0,v2||(v2=!0,iX())}function zf(u,d){if(!y2&&Sg){y2=!0;do for(var p=!1,v=wg;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var j=0;else{var B=v.suspendedLanes,K=v.pingedLanes;j=(1<<31-dt(42|u)+1)-1,j&=O&~(B&~K),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(p=!0,F8(v,j))}else j=Kt,j=ur(v,v===Fn?j:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(j&3)===0||Xr(v,j)||(p=!0,F8(v,j));v=v.next}while(p);y2=!1}}function sX(){I8()}function I8(){Sg=v2=!1;var u=0;$l!==0&&pX()&&(u=$l);for(var d=Rt(),p=null,v=wg;v!==null;){var O=v.next,j=B8(v,d);j===0?(v.next=null,p===null?wg=O:p.next=O,O===null&&(yd=p)):(p=v,(u!==0||(j&3)!==0)&&(Sg=!0)),v=O}Br!==0&&Br!==5||zf(u),$l!==0&&($l=0)}function B8(u,d){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,j=u.pendingLanes&-62914561;0K)break;var Ee=ue.transferSize,De=ue.initiatorType;Ee&&X8(De)&&(ue=ue.responseEnd,B+=Ee*(ue"u"?null:document;function oC(u,d,p){var v=bd;if(v&&typeof d=="string"&&d){var O=zi(d);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),aC.has(O)||(aC.add(O),u={rel:u,crossOrigin:p,href:d},v.querySelector(O)===null&&(d=v.createElement("link"),ls(d,"link",u),Cr(d),v.head.appendChild(d)))}}function OX(u){Io.D(u),oC("dns-prefetch",u,null)}function jX(u,d){Io.C(u,d),oC("preconnect",u,d)}function NX(u,d,p){Io.L(u,d,p);var v=bd;if(v&&u&&d){var O='link[rel="preload"][as="'+zi(d)+'"]';d==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+zi(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+zi(p.imageSizes)+'"]')):O+='[href="'+zi(u)+'"]';var j=O;switch(d){case"style":j=wd(u);break;case"script":j=Sd(u)}Qi.has(j)||(u=m({rel:"preload",href:d==="image"&&p&&p.imageSrcSet?void 0:u,as:d},p),Qi.set(j,u),v.querySelector(O)!==null||d==="style"&&v.querySelector(Bf(j))||d==="script"&&v.querySelector(qf(j))||(d=v.createElement("link"),ls(d,"link",u),Cr(d),v.head.appendChild(d)))}}function CX(u,d){Io.m(u,d);var p=bd;if(p&&u){var v=d&&typeof d.as=="string"?d.as:"script",O='link[rel="modulepreload"][as="'+zi(v)+'"][href="'+zi(u)+'"]',j=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Sd(u)}if(!Qi.has(j)&&(u=m({rel:"modulepreload",href:u},d),Qi.set(j,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector(qf(j)))return}v=p.createElement("link"),ls(v,"link",u),Cr(v),p.head.appendChild(v)}}}function TX(u,d,p){Io.S(u,d,p);var v=bd;if(v&&u){var O=jl(v).hoistableStyles,j=wd(u);d=d||"default";var B=O.get(j);if(!B){var K={loading:0,preload:null};if(B=v.querySelector(Bf(j)))K.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":d},p),(p=Qi.get(j))&&z2(u,p);var ue=B=v.createElement("link");Cr(ue),ls(ue,"link",u),ue._p=new Promise(function(Se,Ee){ue.onload=Se,ue.onerror=Ee}),ue.addEventListener("load",function(){K.loading|=1}),ue.addEventListener("error",function(){K.loading|=2}),K.loading|=4,Cg(B,d,v)}B={type:"stylesheet",instance:B,count:1,state:K},O.set(j,B)}}}function EX(u,d){Io.X(u,d);var p=bd;if(p&&u){var v=jl(p).hoistableScripts,O=Sd(u),j=v.get(O);j||(j=p.querySelector(qf(O)),j||(u=m({src:u,async:!0},d),(d=Qi.get(O))&&P2(u,d),j=p.createElement("script"),Cr(j),ls(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function _X(u,d){Io.M(u,d);var p=bd;if(p&&u){var v=jl(p).hoistableScripts,O=Sd(u),j=v.get(O);j||(j=p.querySelector(qf(O)),j||(u=m({src:u,async:!0,type:"module"},d),(d=Qi.get(O))&&P2(u,d),j=p.createElement("script"),Cr(j),ls(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function lC(u,d,p,v){var O=(O=ne.current)?Ng(O):null;if(!O)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(d=wd(p.href),p=jl(O).hoistableStyles,v=p.get(d),v||(v={type:"style",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=wd(p.href);var j=jl(O).hoistableStyles,B=j.get(u);if(B||(O=O.ownerDocument||O,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(u,B),(j=O.querySelector(Bf(u)))&&!j._p&&(B.instance=j,B.state.loading=5),Qi.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Qi.set(u,p),j||MX(O,u,p,B.state))),d&&v===null)throw Error(r(528,""));return B}if(d&&v!==null)throw Error(r(529,""));return null;case"script":return d=p.async,p=p.src,typeof p=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Sd(p),p=jl(O).hoistableScripts,v=p.get(d),v||(v={type:"script",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function wd(u){return'href="'+zi(u)+'"'}function Bf(u){return'link[rel="stylesheet"]['+u+"]"}function cC(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function MX(u,d,p,v){u.querySelector('link[rel="preload"][as="style"]['+d+"]")?v.loading=1:(d=u.createElement("link"),v.preload=d,d.addEventListener("load",function(){return v.loading|=1}),d.addEventListener("error",function(){return v.loading|=2}),ls(d,"link",p),Cr(d),u.head.appendChild(d))}function Sd(u){return'[src="'+zi(u)+'"]'}function qf(u){return"script[async]"+u}function uC(u,d,p){if(d.count++,d.instance===null)switch(d.type){case"style":var v=u.querySelector('style[data-href~="'+zi(p.href)+'"]');if(v)return d.instance=v,Cr(v),v;var O=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Cr(v),ls(v,"style",O),Cg(v,p.precedence,u),d.instance=v;case"stylesheet":O=wd(p.href);var j=u.querySelector(Bf(O));if(j)return d.state.loading|=4,d.instance=j,Cr(j),j;v=cC(p),(O=Qi.get(O))&&z2(v,O),j=(u.ownerDocument||u).createElement("link"),Cr(j);var B=j;return B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),ls(j,"link",v),d.state.loading|=4,Cg(j,p.precedence,u),d.instance=j;case"script":return j=Sd(p.src),(O=u.querySelector(qf(j)))?(d.instance=O,Cr(O),O):(v=p,(O=Qi.get(j))&&(v=m({},p),P2(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Cr(O),ls(O,"link",v),u.head.appendChild(O),d.instance=O);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(v=d.instance,d.state.loading|=4,Cg(v,p.precedence,u));return d.instance}function Cg(u,d,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,j=O,B=0;B title"):null)}function AX(u,d,p){if(p===1||d.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return u=d.disabled,typeof d.precedence=="string"&&u==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function fC(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function RX(u,d,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var O=wd(v.href),j=d.querySelector(Bf(O));if(j){d=j._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(u.count++,u=Eg.bind(u),d.then(u,u)),p.state.loading|=4,p.instance=j,Cr(j);return}j=d.ownerDocument||d,v=cC(v),(O=Qi.get(O))&&z2(v,O),j=j.createElement("link"),Cr(j);var B=j;B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),ls(j,"link",v),p.instance=j}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=Eg.bind(u),d.addEventListener("load",p),d.addEventListener("error",p))}}var L2=0;function DX(u,d){return u.stylesheets&&u.count===0&&Mg(u,u.stylesheets),0L2?50:800)+d);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function Eg(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Mg(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var _g=null;function Mg(u,d){u.stylesheets=null,u.unsuspend!==null&&(u.count++,_g=new Map,d.forEach(zX,u),_g=null,Eg.call(u))}function zX(u,d){if(!(d.state.loading&4)){var p=_g.get(u);if(p)var v=p.get(null);else{p=new Map,_g.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),U2.exports=FK(),U2.exports}var QK=$K();function tz(t,e){return function(){return t.apply(e,arguments)}}const{toString:HK}=Object.prototype,{getPrototypeOf:Kk}=Object,{iterator:Ev,toStringTag:nz}=Symbol,_v=(t=>e=>{const n=HK.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Ea=t=>(t=t.toLowerCase(),e=>_v(e)===t),Mv=t=>e=>typeof e===t,{isArray:Rh}=Array,mh=Mv("undefined");function R0(t){return t!==null&&!mh(t)&&t.constructor!==null&&!mh(t.constructor)&&ei(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const rz=Ea("ArrayBuffer");function VK(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&rz(t.buffer),e}const UK=Mv("string"),ei=Mv("function"),sz=Mv("number"),D0=t=>t!==null&&typeof t=="object",WK=t=>t===!0||t===!1,Ux=t=>{if(_v(t)!=="object")return!1;const e=Kk(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(nz in t)&&!(Ev in t)},GK=t=>{if(!D0(t)||R0(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},XK=Ea("Date"),YK=Ea("File"),KK=Ea("Blob"),ZK=Ea("FileList"),JK=t=>D0(t)&&ei(t.pipe),eZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ei(t.append)&&((e=_v(t))==="formdata"||e==="object"&&ei(t.toString)&&t.toString()==="[object FormData]"))},tZ=Ea("URLSearchParams"),[nZ,rZ,sZ,iZ]=["ReadableStream","Request","Response","Headers"].map(Ea),aZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function z0(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Rh(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const hu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,az=t=>!mh(t)&&t!==hu;function T3(){const{caseless:t,skipUndefined:e}=az(this)&&this||{},n={},r=(s,i)=>{const a=t&&iz(n,i)||i;Ux(n[a])&&Ux(s)?n[a]=T3(n[a],s):Ux(s)?n[a]=T3({},s):Rh(s)?n[a]=s.slice():(!e||!mh(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(z0(e,(s,i)=>{n&&ei(s)?t[i]=tz(s,n):t[i]=s},{allOwnKeys:r}),t),lZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),cZ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},uZ=(t,e,n,r)=>{let s,i,a;const l={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!l[a]&&(e[a]=t[a],l[a]=!0);t=n!==!1&&Kk(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},dZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},hZ=t=>{if(!t)return null;if(Rh(t))return t;let e=t.length;if(!sz(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},fZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&Kk(Uint8Array)),mZ=(t,e)=>{const r=(t&&t[Ev]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},pZ=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},gZ=Ea("HTMLFormElement"),xZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),BC=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),vZ=Ea("RegExp"),oz=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};z0(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},yZ=t=>{oz(t,(e,n)=>{if(ei(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ei(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},bZ=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Rh(t)?r(t):r(String(t).split(e)),n},wZ=()=>{},SZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function kZ(t){return!!(t&&ei(t.append)&&t[nz]==="FormData"&&t[Ev])}const OZ=t=>{const e=new Array(10),n=(r,s)=>{if(D0(r)){if(e.indexOf(r)>=0)return;if(R0(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Rh(r)?[]:{};return z0(r,(a,l)=>{const c=n(a,s+1);!mh(c)&&(i[l]=c)}),e[s]=void 0,i}}return r};return n(t,0)},jZ=Ea("AsyncFunction"),NZ=t=>t&&(D0(t)||ei(t))&&ei(t.then)&&ei(t.catch),lz=((t,e)=>t?setImmediate:e?((n,r)=>(hu.addEventListener("message",({source:s,data:i})=>{s===hu&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),hu.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ei(hu.postMessage)),CZ=typeof queueMicrotask<"u"?queueMicrotask.bind(hu):typeof process<"u"&&process.nextTick||lz,TZ=t=>t!=null&&ei(t[Ev]),Oe={isArray:Rh,isArrayBuffer:rz,isBuffer:R0,isFormData:eZ,isArrayBufferView:VK,isString:UK,isNumber:sz,isBoolean:WK,isObject:D0,isPlainObject:Ux,isEmptyObject:GK,isReadableStream:nZ,isRequest:rZ,isResponse:sZ,isHeaders:iZ,isUndefined:mh,isDate:XK,isFile:YK,isBlob:KK,isRegExp:vZ,isFunction:ei,isStream:JK,isURLSearchParams:tZ,isTypedArray:fZ,isFileList:ZK,forEach:z0,merge:T3,extend:oZ,trim:aZ,stripBOM:lZ,inherits:cZ,toFlatObject:uZ,kindOf:_v,kindOfTest:Ea,endsWith:dZ,toArray:hZ,forEachEntry:mZ,matchAll:pZ,isHTMLForm:gZ,hasOwnProperty:BC,hasOwnProp:BC,reduceDescriptors:oz,freezeMethods:yZ,toObjectSet:bZ,toCamelCase:xZ,noop:wZ,toFiniteNumber:SZ,findKey:iz,global:hu,isContextDefined:az,isSpecCompliantForm:kZ,toJSONObject:OZ,isAsyncFn:jZ,isThenable:NZ,setImmediate:lz,asap:CZ,isIterable:TZ};function It(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}Oe.inherits(It,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const cz=It.prototype,uz={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{uz[t]={value:t}});Object.defineProperties(It,uz);Object.defineProperty(cz,"isAxiosError",{value:!0});It.from=(t,e,n,r,s,i)=>{const a=Object.create(cz);Oe.toFlatObject(t,a,function(f){return f!==Error.prototype},h=>h!=="isAxiosError");const l=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return It.call(a,l,c,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const EZ=null;function E3(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function dz(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function qC(t,e,n){return t?t.concat(e).map(function(s,i){return s=dz(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function _Z(t){return Oe.isArray(t)&&!t.some(E3)}const MZ=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function Av(t,e,n){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!Oe.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(s))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(Oe.isDate(y))return y.toISOString();if(Oe.isBoolean(y))return y.toString();if(!c&&Oe.isBlob(y))throw new It("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(y)||Oe.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(Oe.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(Oe.isArray(y)&&_Z(y)||(Oe.isFileList(y)||Oe.endsWith(w,"[]"))&&(k=Oe.toArray(y)))return w=dz(w),k.forEach(function(C,T){!(Oe.isUndefined(C)||C===null)&&e.append(a===!0?qC([w],T,i):a===null?w:w+"[]",h(C))}),!1}return E3(y)?!0:(e.append(qC(S,w,i),h(y)),!1)}const m=[],g=Object.assign(MZ,{defaultVisitor:f,convertValue:h,isVisitable:E3});function x(y,w){if(!Oe.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),Oe.forEach(y,function(k,N){(!(Oe.isUndefined(k)||k===null)&&s.call(e,k,Oe.isString(N)?N.trim():N,w,g))===!0&&x(k,w?w.concat(N):[N])}),m.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return x(t),e}function FC(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function Zk(t,e){this._pairs=[],t&&Av(t,this,e)}const hz=Zk.prototype;hz.append=function(e,n){this._pairs.push([e,n])};hz.toString=function(e){const n=e?function(r){return e.call(this,r,FC)}:FC;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function AZ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function fz(t,e,n){if(!e)return t;const r=n&&n.encode||AZ;Oe.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=Oe.isURLSearchParams(e)?e.toString():new Zk(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class $C{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const mz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},RZ=typeof URLSearchParams<"u"?URLSearchParams:Zk,DZ=typeof FormData<"u"?FormData:null,zZ=typeof Blob<"u"?Blob:null,PZ={isBrowser:!0,classes:{URLSearchParams:RZ,FormData:DZ,Blob:zZ},protocols:["http","https","file","blob","url","data"]},Jk=typeof window<"u"&&typeof document<"u",_3=typeof navigator=="object"&&navigator||void 0,LZ=Jk&&(!_3||["ReactNative","NativeScript","NS"].indexOf(_3.product)<0),IZ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",BZ=Jk&&window.location.href||"http://localhost",qZ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Jk,hasStandardBrowserEnv:LZ,hasStandardBrowserWebWorkerEnv:IZ,navigator:_3,origin:BZ},Symbol.toStringTag,{value:"Module"})),bs={...qZ,...PZ};function FZ(t,e){return Av(t,new bs.classes.URLSearchParams,{visitor:function(n,r,s,i){return bs.isNode&&Oe.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function $Z(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function QZ(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&Oe.isArray(s)?s.length:a,c?(Oe.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!l):((!s[a]||!Oe.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&Oe.isArray(s[a])&&(s[a]=QZ(s[a])),!l)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const n={};return Oe.forEachEntry(t,(r,s)=>{e($Z(r),s,n,0)}),n}return null}function HZ(t,e,n){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const P0={transitional:mz,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=Oe.isObject(e);if(i&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return s?JSON.stringify(pz(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let l;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return FZ(e,this.formSerializer).toString();if((l=Oe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Av(l?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),HZ(e)):e}],transformResponse:[function(e){const n=this.transitional||P0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(l){if(a)throw l.name==="SyntaxError"?It.from(l,It.ERR_BAD_RESPONSE,this,null,this.response):l}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bs.classes.FormData,Blob:bs.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{P0.headers[t]={}});const VZ=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),UZ=t=>{const e={};let n,r,s;return t&&t.split(` -`).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&VZ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},QC=Symbol("internals");function Wf(t){return t&&String(t).trim().toLowerCase()}function Wx(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(Wx):String(t)}function WZ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const GZ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function X2(t,e,n,r,s){if(Oe.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!Oe.isString(e)){if(Oe.isString(r))return e.indexOf(r)!==-1;if(Oe.isRegExp(r))return r.test(e)}}function XZ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function YZ(t,e){const n=Oe.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let ti=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(l,c,h){const f=Wf(c);if(!f)throw new Error("header name must be a non-empty string");const m=Oe.findKey(s,f);(!m||s[m]===void 0||h===!0||h===void 0&&s[m]!==!1)&&(s[m||c]=Wx(l))}const a=(l,c)=>Oe.forEach(l,(h,f)=>i(h,f,c));if(Oe.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(Oe.isString(e)&&(e=e.trim())&&!GZ(e))a(UZ(e),n);else if(Oe.isObject(e)&&Oe.isIterable(e)){let l={},c,h;for(const f of e){if(!Oe.isArray(f))throw TypeError("Object iterator must return a key-value pair");l[h=f[0]]=(c=l[h])?Oe.isArray(c)?[...c,f[1]]:[c,f[1]]:f[1]}a(l,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Wf(e),e){const r=Oe.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return WZ(s);if(Oe.isFunction(n))return n.call(this,s,r);if(Oe.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Wf(e),e){const r=Oe.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||X2(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Wf(a),a){const l=Oe.findKey(r,a);l&&(!n||X2(r,r[l],l,n))&&(delete r[l],s=!0)}}return Oe.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||X2(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return Oe.forEach(this,(s,i)=>{const a=Oe.findKey(r,i);if(a){n[a]=Wx(s),delete n[i];return}const l=e?XZ(i):String(i).trim();l!==i&&delete n[i],n[l]=Wx(s),r[l]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Oe.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&Oe.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` -`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[QC]=this[QC]={accessors:{}}).accessors,s=this.prototype;function i(a){const l=Wf(a);r[l]||(YZ(s,a),r[l]=!0)}return Oe.isArray(e)?e.forEach(i):i(e),this}};ti.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Oe.reduceDescriptors(ti.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});Oe.freezeMethods(ti);function Y2(t,e){const n=this||P0,r=e||n,s=ti.from(r.headers);let i=r.data;return Oe.forEach(t,function(l){i=l.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function gz(t){return!!(t&&t.__CANCEL__)}function Dh(t,e,n){It.call(this,t??"canceled",It.ERR_CANCELED,e,n),this.name="CanceledError"}Oe.inherits(Dh,It,{__CANCEL__:!0});function xz(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new It("Request failed with status code "+n.status,[It.ERR_BAD_REQUEST,It.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function KZ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function ZZ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const h=Date.now(),f=r[i];a||(a=h),n[s]=c,r[s]=h;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-a{n=f,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const f=Date.now(),m=f-n;m>=r?a(h,f):(s=h,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const k1=(t,e,n=3)=>{let r=0;const s=ZZ(50,250);return JZ(i=>{const a=i.loaded,l=i.lengthComputable?i.total:void 0,c=a-r,h=s(c),f=a<=l;r=a;const m={loaded:a,total:l,progress:l?a/l:void 0,bytes:c,rate:h||void 0,estimated:h&&l&&f?(l-a)/h:void 0,event:i,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(m)},n)},HC=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},VC=t=>(...e)=>Oe.asap(()=>t(...e)),eJ=bs.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,bs.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(bs.origin),bs.navigator&&/(msie|trident)/i.test(bs.navigator.userAgent)):()=>!0,tJ=bs.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const l=[`${t}=${encodeURIComponent(e)}`];Oe.isNumber(n)&&l.push(`expires=${new Date(n).toUTCString()}`),Oe.isString(r)&&l.push(`path=${r}`),Oe.isString(s)&&l.push(`domain=${s}`),i===!0&&l.push("secure"),Oe.isString(a)&&l.push(`SameSite=${a}`),document.cookie=l.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function nJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function rJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function vz(t,e,n){let r=!nJ(e);return t&&(r||n==!1)?rJ(t,e):e}const UC=t=>t instanceof ti?{...t}:t;function ju(t,e){e=e||{};const n={};function r(h,f,m,g){return Oe.isPlainObject(h)&&Oe.isPlainObject(f)?Oe.merge.call({caseless:g},h,f):Oe.isPlainObject(f)?Oe.merge({},f):Oe.isArray(f)?f.slice():f}function s(h,f,m,g){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h,m,g)}else return r(h,f,m,g)}function i(h,f){if(!Oe.isUndefined(f))return r(void 0,f)}function a(h,f){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h)}else return r(void 0,f)}function l(h,f,m){if(m in e)return r(h,f);if(m in t)return r(void 0,h)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(h,f,m)=>s(UC(h),UC(f),m,!0)};return Oe.forEach(Object.keys({...t,...e}),function(f){const m=c[f]||s,g=m(t[f],e[f],f);Oe.isUndefined(g)&&m!==l||(n[f]=g)}),n}const yz=t=>{const e=ju({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:l}=e;if(e.headers=a=ti.from(a),e.url=fz(vz(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):""))),Oe.isFormData(n)){if(bs.hasStandardBrowserEnv||bs.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Oe.isFunction(n.getHeaders)){const c=n.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([f,m])=>{h.includes(f.toLowerCase())&&a.set(f,m)})}}if(bs.hasStandardBrowserEnv&&(r&&Oe.isFunction(r)&&(r=r(e)),r||r!==!1&&eJ(e.url))){const c=s&&i&&tJ.read(i);c&&a.set(s,c)}return e},sJ=typeof XMLHttpRequest<"u",iJ=sJ&&function(t){return new Promise(function(n,r){const s=yz(t);let i=s.data;const a=ti.from(s.headers).normalize();let{responseType:l,onUploadProgress:c,onDownloadProgress:h}=s,f,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const C=ti.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),_={data:!l||l==="text"||l==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:C,config:t,request:S};xz(function(M){n(M),w()},function(M){r(M),w()},_),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new It("Request aborted",It.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const _=T&&T.message?T.message:"Network Error",E=new It(_,It.ERR_NETWORK,t,S);E.event=T||null,r(E),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||mz;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new It(T,_.clarifyTimeoutError?It.ETIMEDOUT:It.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&Oe.forEach(a.toJSON(),function(T,_){S.setRequestHeader(_,T)}),Oe.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),l&&l!=="json"&&(S.responseType=s.responseType),h&&([g,y]=k1(h,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=k1(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(f=C=>{S&&(r(!C||C.type?new Dh(null,t,S):C),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=KZ(s.url);if(N&&bs.protocols.indexOf(N)===-1){r(new It("Unsupported protocol "+N+":",It.ERR_BAD_REQUEST,t));return}S.send(i||null)})},aJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,l();const f=h instanceof Error?h:this.reason;r.abort(f instanceof It?f:new Dh(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new It(`timeout ${e} of ms exceeded`,It.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>Oe.asap(l),c}},oJ=function*(t,e){let n=t.byteLength;if(n{const s=lJ(t,e);let i=0,a,l=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:h,value:f}=await s.next();if(h){l(),c.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(f))}catch(h){throw l(h),h}},cancel(c){return l(c),s.return()}},{highWaterMark:2})},GC=64*1024,{isFunction:$g}=Oe,uJ=(({Request:t,Response:e})=>({Request:t,Response:e}))(Oe.global),{ReadableStream:XC,TextEncoder:YC}=Oe.global,KC=(t,...e)=>{try{return!!t(...e)}catch{return!1}},dJ=t=>{t=Oe.merge.call({skipUndefined:!0},uJ,t);const{fetch:e,Request:n,Response:r}=t,s=e?$g(e):typeof fetch=="function",i=$g(n),a=$g(r);if(!s)return!1;const l=s&&$g(XC),c=s&&(typeof YC=="function"?(y=>w=>y.encode(w))(new YC):async y=>new Uint8Array(await new n(y).arrayBuffer())),h=i&&l&&KC(()=>{let y=!1;const w=new n(bs.origin,{body:new XC,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),f=a&&l&&KC(()=>Oe.isReadableStream(new r("").body)),m={stream:f&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new It(`Response type '${y}' is not supported`,It.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(Oe.isBlob(y))return y.size;if(Oe.isSpecCompliantForm(y))return(await new n(bs.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(y)||Oe.isArrayBuffer(y))return y.byteLength;if(Oe.isURLSearchParams(y)&&(y=y+""),Oe.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=Oe.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:N,cancelToken:C,timeout:T,onDownloadProgress:_,onUploadProgress:E,responseType:M,headers:q,withCredentials:L="same-origin",fetchOptions:I}=yz(y),$=e||fetch;M=M?(M+"").toLowerCase():"text";let V=aJ([N,C&&C.toAbortSignal()],T),ee=null;const z=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let H;try{if(E&&h&&S!=="get"&&S!=="head"&&(H=await x(q,k))!==0){let se=new n(w,{method:"POST",body:k,duplex:"half"}),G;if(Oe.isFormData(k)&&(G=se.headers.get("content-type"))&&q.setContentType(G),se.body){const[F,U]=HC(H,k1(VC(E)));k=WC(se.body,GC,F,U)}}Oe.isString(L)||(L=L?"include":"omit");const P=i&&"credentials"in n.prototype,W={...I,signal:V,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:k,duplex:"half",credentials:P?L:void 0};ee=i&&new n(w,W);let J=await(i?$(ee,I):$(w,W));const X=f&&(M==="stream"||M==="response");if(f&&(_||X&&z)){const se={};["status","statusText","headers"].forEach(te=>{se[te]=J[te]});const G=Oe.toFiniteNumber(J.headers.get("content-length")),[F,U]=_&&HC(G,k1(VC(_),!0))||[];J=new r(WC(J.body,GC,F,()=>{U&&U(),z&&z()}),se)}M=M||"text";let R=await m[Oe.findKey(m,M)||"text"](J,y);return!X&&z&&z(),await new Promise((se,G)=>{xz(se,G,{data:R,headers:ti.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:ee})})}catch(P){throw z&&z(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new It("Network Error",It.ERR_NETWORK,y,ee),{cause:P.cause||P}):It.from(P,P&&P.code,y,ee)}}},hJ=new Map,bz=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,l=a,c,h,f=hJ;for(;l--;)c=i[l],h=f.get(c),h===void 0&&f.set(c,h=l?new Map:dJ(e)),f=h;return h};bz();const e6={http:EZ,xhr:iJ,fetch:{get:bz}};Oe.forEach(e6,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ZC=t=>`- ${t}`,fJ=t=>Oe.isFunction(t)||t===null||t===!1;function mJ(t,e){t=Oe.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build"));let l=n?a.length>1?`since : -`+a.map(ZC).join(` -`):" "+ZC(a[0]):"as no adapter specified";throw new It("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return s}const wz={getAdapter:mJ,adapters:e6};function K2(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Dh(null,t)}function JC(t){return K2(t),t.headers=ti.from(t.headers),t.data=Y2.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),wz.getAdapter(t.adapter||P0.adapter,t)(t).then(function(r){return K2(t),r.data=Y2.call(t,t.transformResponse,r),r.headers=ti.from(r.headers),r},function(r){return gz(r)||(K2(t),r&&r.response&&(r.response.data=Y2.call(t,t.transformResponse,r.response),r.response.headers=ti.from(r.response.headers))),Promise.reject(r)})}const Sz="1.13.2",Rv={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Rv[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const e9={};Rv.transitional=function(e,n,r){function s(i,a){return"[Axios v"+Sz+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,l)=>{if(e===!1)throw new It(s(a," has been removed"+(n?" in "+n:"")),It.ERR_DEPRECATED);return n&&!e9[a]&&(e9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,l):!0}};Rv.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function pJ(t,e,n){if(typeof t!="object")throw new It("options must be an object",It.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const l=t[i],c=l===void 0||a(l,i,t);if(c!==!0)throw new It("option "+i+" must be "+c,It.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new It("Unknown option "+i,It.ERR_BAD_OPTION)}}const Gx={assertOptions:pJ,validators:Rv},Ia=Gx.validators;let bu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new $C,response:new $C}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` -`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=ju(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Gx.assertOptions(r,{silentJSONParsing:Ia.transitional(Ia.boolean),forcedJSONParsing:Ia.transitional(Ia.boolean),clarifyTimeoutError:Ia.transitional(Ia.boolean)},!1),s!=null&&(Oe.isFunction(s)?n.paramsSerializer={serialize:s}:Gx.assertOptions(s,{encode:Ia.function,serialize:Ia.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Gx.assertOptions(n,{baseUrl:Ia.spelling("baseURL"),withXsrfToken:Ia.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&Oe.merge(i.common,i[n.method]);i&&Oe.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=ti.concat(a,i);const l=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,l.unshift(w.fulfilled,w.rejected))});const h=[];this.interceptors.response.forEach(function(w){h.push(w.fulfilled,w.rejected)});let f,m=0,g;if(!c){const y=[JC.bind(this),void 0];for(y.unshift(...l),y.push(...h),g=y.length,f=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(l=>{r.subscribe(l),i=l}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,l){r.reason||(r.reason=new Dh(i,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new kz(function(s){e=s}),cancel:e}}};function xJ(t){return function(n){return t.apply(null,n)}}function vJ(t){return Oe.isObject(t)&&t.isAxiosError===!0}const M3={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(M3).forEach(([t,e])=>{M3[e]=t});function Oz(t){const e=new bu(t),n=tz(bu.prototype.request,e);return Oe.extend(n,bu.prototype,e,{allOwnKeys:!0}),Oe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Oz(ju(t,s))},n}const gr=Oz(P0);gr.Axios=bu;gr.CanceledError=Dh;gr.CancelToken=gJ;gr.isCancel=gz;gr.VERSION=Sz;gr.toFormData=Av;gr.AxiosError=It;gr.Cancel=gr.CanceledError;gr.all=function(e){return Promise.all(e)};gr.spread=xJ;gr.isAxiosError=vJ;gr.mergeConfig=ju;gr.AxiosHeaders=ti;gr.formToJSON=t=>pz(Oe.isHTMLForm(t)?new FormData(t):t);gr.getAdapter=wz.getAdapter;gr.HttpStatusCode=M3;gr.default=gr;const{Axios:STe,AxiosError:kTe,CanceledError:OTe,isCancel:jTe,CancelToken:NTe,VERSION:CTe,all:TTe,Cancel:ETe,isAxiosError:_Te,spread:MTe,toFormData:ATe,AxiosHeaders:RTe,HttpStatusCode:DTe,formToJSON:zTe,getAdapter:PTe,mergeConfig:LTe}=gr,yJ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),jz=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),O1="-",t9=[],wJ="arbitrary..",SJ=t=>{const e=OJ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return kJ(a);const l=a.split(O1),c=l[0]===""&&l.length>1?1:0;return Nz(l,c,e)},getConflictingClassGroupIds:(a,l)=>{if(l){const c=r[a],h=n[a];return c?h?yJ(h,c):c:h||t9}return n[a]||t9}}},Nz=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=Nz(t,e+1,i);if(h)return h}const a=n.validators;if(a===null)return;const l=e===0?t.join(O1):t.slice(e).join(O1),c=a.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?wJ+r:void 0})(),OJ=t=>{const{theme:e,classGroups:n}=t;return jJ(n,e)},jJ=(t,e)=>{const n=jz();for(const r in t){const s=t[r];t6(s,n,r,e)}return n},t6=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){CJ(t,e,n);return}if(typeof t=="function"){TJ(t,e,n,r);return}EJ(t,e,n,r)},CJ=(t,e,n)=>{const r=t===""?e:Cz(e,t);r.classGroupId=n},TJ=(t,e,n,r)=>{if(_J(t)){t6(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(bJ(n,t))},EJ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split(O1),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,MJ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},A3="!",n9=":",AJ=[],r9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),RJ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,l=0,c=0,h;const f=s.length;for(let w=0;wc?h-c:void 0;return r9(i,x,g,y)};if(e){const s=e+n9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):r9(AJ,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},DJ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},zJ=t=>({cache:MJ(t.cacheSize),parseClassName:RJ(t),sortModifiers:DJ(t),...SJ(t)}),PJ=/\s+/,LJ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],l=t.trim().split(PJ);let c="";for(let h=l.length-1;h>=0;h-=1){const f=l[h],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=f+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=f+(c.length>0?" "+c:c);continue}S=!1}const N=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?N+A3:N,T=C+k;if(a.indexOf(T)>-1)continue;a.push(T);const _=s(k,S);for(let E=0;E<_.length;++E){const M=_[E];a.push(C+M)}c=f+(c.length>0?" "+c:c)}return c},IJ=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=c=>{const h=e.reduce((f,m)=>m(f),t());return n=zJ(h),r=n.cache.get,s=n.cache.set,i=l,l(c)},l=c=>{const h=r(c);if(h)return h;const f=LJ(c,n);return s(c,f),f};return i=a,(...c)=>i(IJ(...c))},qJ=[],qr=t=>{const e=n=>n[t]||qJ;return e.isThemeGetter=!0,e},Ez=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_z=/^\((?:(\w[\w-]*):)?(.+)\)$/i,FJ=/^\d+\/\d+$/,$J=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QJ=/\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$/,HJ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,VJ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,UJ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Od=t=>FJ.test(t),$t=t=>!!t&&!Number.isNaN(Number(t)),Xl=t=>!!t&&Number.isInteger(Number(t)),Z2=t=>t.endsWith("%")&&$t(t.slice(0,-1)),Bo=t=>$J.test(t),WJ=()=>!0,GJ=t=>QJ.test(t)&&!HJ.test(t),Mz=()=>!1,XJ=t=>VJ.test(t),YJ=t=>UJ.test(t),KJ=t=>!it(t)&&!at(t),ZJ=t=>zh(t,Dz,Mz),it=t=>Ez.test(t),tu=t=>zh(t,zz,GJ),J2=t=>zh(t,ree,$t),s9=t=>zh(t,Az,Mz),JJ=t=>zh(t,Rz,YJ),Qg=t=>zh(t,Pz,XJ),at=t=>_z.test(t),Gf=t=>Ph(t,zz),eee=t=>Ph(t,see),i9=t=>Ph(t,Az),tee=t=>Ph(t,Dz),nee=t=>Ph(t,Rz),Hg=t=>Ph(t,Pz,!0),zh=(t,e,n)=>{const r=Ez.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Ph=(t,e,n=!1)=>{const r=_z.exec(t);return r?r[1]?e(r[1]):n:!1},Az=t=>t==="position"||t==="percentage",Rz=t=>t==="image"||t==="url",Dz=t=>t==="length"||t==="size"||t==="bg-size",zz=t=>t==="length",ree=t=>t==="number",see=t=>t==="family-name",Pz=t=>t==="shadow",iee=()=>{const t=qr("color"),e=qr("font"),n=qr("text"),r=qr("font-weight"),s=qr("tracking"),i=qr("leading"),a=qr("breakpoint"),l=qr("container"),c=qr("spacing"),h=qr("radius"),f=qr("shadow"),m=qr("inset-shadow"),g=qr("text-shadow"),x=qr("drop-shadow"),y=qr("blur"),w=qr("perspective"),S=qr("aspect"),k=qr("ease"),N=qr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),at,it],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],q=()=>[at,it,c],L=()=>[Od,"full","auto",...q()],I=()=>[Xl,"none","subgrid",at,it],$=()=>["auto",{span:["full",Xl,at,it]},Xl,at,it],V=()=>[Xl,"auto",at,it],ee=()=>["auto","min","max","fr",at,it],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...q()],W=()=>[Od,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],J=()=>[t,at,it],X=()=>[...T(),i9,s9,{position:[at,it]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",tee,ZJ,{size:[at,it]}],G=()=>[Z2,Gf,tu],F=()=>["","none","full",h,at,it],U=()=>["",$t,Gf,tu],te=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[$t,Z2,i9,s9],ae=()=>["","none",y,at,it],re=()=>["none",$t,at,it],oe=()=>["none",$t,at,it],_e=()=>[$t,at,it],Ge=()=>[Od,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Bo],breakpoint:[Bo],color:[WJ],container:[Bo],"drop-shadow":[Bo],ease:["in","out","in-out"],font:[KJ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Bo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Bo],shadow:[Bo],spacing:["px",$t],text:[Bo],"text-shadow":[Bo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Od,it,at,S]}],container:["container"],columns:[{columns:[$t,it,at,l]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Xl,"auto",at,it]}],basis:[{basis:[Od,"full","auto",l,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[$t,Od,"auto","initial","none",it]}],grow:[{grow:["",$t,at,it]}],shrink:[{shrink:["",$t,at,it]}],order:[{order:[Xl,"first","last","none",at,it]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[l,"screen",...W()]}],"min-w":[{"min-w":[l,"screen","none",...W()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[a]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Gf,tu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,at,J2]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Z2,it]}],"font-family":[{font:[eee,it,e]}],"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,at,it]}],"line-clamp":[{"line-clamp":[$t,"none",at,J2]}],leading:[{leading:[i,...q()]}],"list-image":[{"list-image":["none",at,it]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",at,it]}],"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:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[$t,"from-font","auto",at,tu]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[$t,"auto",at,it]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",at,it]}],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",at,it]}],"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:R()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Xl,at,it],radial:["",at,it],conic:[Xl,at,it]},nee,JJ]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"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:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[$t,at,it]}],"outline-w":[{outline:["",$t,Gf,tu]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",f,Hg,Qg]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Hg,Qg]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[$t,tu]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Hg,Qg]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[$t,at,it]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[$t]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"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":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"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":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"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":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"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":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"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":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"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":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[at,it]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[$t]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"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:R()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",at,it]}],filter:[{filter:["","none",at,it]}],blur:[{blur:ae()}],brightness:[{brightness:[$t,at,it]}],contrast:[{contrast:[$t,at,it]}],"drop-shadow":[{"drop-shadow":["","none",x,Hg,Qg]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",$t,at,it]}],"hue-rotate":[{"hue-rotate":[$t,at,it]}],invert:[{invert:["",$t,at,it]}],saturate:[{saturate:[$t,at,it]}],sepia:[{sepia:["",$t,at,it]}],"backdrop-filter":[{"backdrop-filter":["","none",at,it]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[$t,at,it]}],"backdrop-contrast":[{"backdrop-contrast":[$t,at,it]}],"backdrop-grayscale":[{"backdrop-grayscale":["",$t,at,it]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[$t,at,it]}],"backdrop-invert":[{"backdrop-invert":["",$t,at,it]}],"backdrop-opacity":[{"backdrop-opacity":[$t,at,it]}],"backdrop-saturate":[{"backdrop-saturate":[$t,at,it]}],"backdrop-sepia":[{"backdrop-sepia":["",$t,at,it]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",at,it]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[$t,"initial",at,it]}],ease:[{ease:["linear","initial",k,at,it]}],delay:[{delay:[$t,at,it]}],animate:[{animate:["none",N,at,it]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,at,it]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:oe()}],"scale-x":[{"scale-x":oe()}],"scale-y":[{"scale-y":oe()}],"scale-z":[{"scale-z":oe()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[at,it,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ge()}],"translate-x":[{"translate-x":Ge()}],"translate-y":[{"translate-y":Ge()}],"translate-z":[{"translate-z":Ge()}],"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",at,it]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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",at,it]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[$t,Gf,tu,J2]}],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"]}},aee=BJ(iee);function ye(...t){return aee(hD(t))}const _t=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));_t.displayName="Card";const wn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));wn.displayName="CardHeader";const Sn=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));Sn.displayName="CardTitle";const Fr=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Fr.displayName="CardDescription";const An=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));An.displayName="CardContent";const Lz=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));Lz.displayName="CardFooter";var ew="rovingFocusGroup.onEntryFocus",oee={bubbles:!1,cancelable:!0},L0="RovingFocusGroup",[R3,Iz,lee]=Sv(L0),[cee,Dv]=Ta(L0,[lee]),[uee,dee]=cee(L0),Bz=b.forwardRef((t,e)=>o.jsx(R3.Provider,{scope:t.__scopeRovingFocusGroup,children:o.jsx(R3.Slot,{scope:t.__scopeRovingFocusGroup,children:o.jsx(hee,{...t,ref:e})})}));Bz.displayName=L0;var hee=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),x=qn(e,g),y=T0(i),[w,S]=Cc({prop:a,defaultProp:l??null,onChange:c,caller:L0}),[k,N]=b.useState(!1),C=ys(h),T=Iz(n),_=b.useRef(!1),[E,M]=b.useState(0);return b.useEffect(()=>{const q=g.current;if(q)return q.addEventListener(ew,C),()=>q.removeEventListener(ew,C)},[C]),o.jsx(uee,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(q=>S(q),[S]),onItemShiftTab:b.useCallback(()=>N(!0),[]),onFocusableItemAdd:b.useCallback(()=>M(q=>q+1),[]),onFocusableItemRemove:b.useCallback(()=>M(q=>q-1),[]),children:o.jsx(xn.div,{tabIndex:k||E===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:Ze(t.onMouseDown,()=>{_.current=!0}),onFocus:Ze(t.onFocus,q=>{const L=!_.current;if(q.target===q.currentTarget&&L&&!k){const I=new CustomEvent(ew,oee);if(q.currentTarget.dispatchEvent(I),!I.defaultPrevented){const $=T().filter(P=>P.focusable),V=$.find(P=>P.active),ee=$.find(P=>P.id===w),H=[V,ee,...$].filter(Boolean).map(P=>P.ref.current);$z(H,f)}}_.current=!1}),onBlur:Ze(t.onBlur,()=>N(!1))})})}),qz="RovingFocusGroupItem",Fz=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...l}=t,c=ea(),h=i||c,f=dee(qz,n),m=f.currentTabStopId===h,g=Iz(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),o.jsx(R3.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:o.jsx(xn.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...l,ref:e,onMouseDown:Ze(t.onMouseDown,S=>{r?f.onItemFocus(h):S.preventDefault()}),onFocus:Ze(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Ze(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=pee(S,f.orientation,f.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(S.currentTarget);C=f.loop?gee(C,T+1):C.slice(T+1)}setTimeout(()=>$z(C))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});Fz.displayName=qz;var fee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mee(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function pee(t,e,n){const r=mee(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return fee[r]}function $z(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function gee(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Qz=Bz,Hz=Fz,zv="Tabs",[xee]=Ta(zv,[Dv]),Vz=Dv(),[vee,n6]=xee(zv),Uz=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:l,activationMode:c="automatic",...h}=t,f=T0(l),[m,g]=Cc({prop:r,onChange:s,defaultProp:i??"",caller:zv});return o.jsx(vee,{scope:n,baseId:ea(),value:m,onValueChange:g,orientation:a,dir:f,activationMode:c,children:o.jsx(xn.div,{dir:f,"data-orientation":a,...h,ref:e})})});Uz.displayName=zv;var Wz="TabsList",Gz=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=n6(Wz,n),a=Vz(n);return o.jsx(Qz,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:o.jsx(xn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});Gz.displayName=Wz;var Xz="TabsTrigger",Yz=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=n6(Xz,n),l=Vz(n),c=Jz(a.baseId,r),h=eP(a.baseId,r),f=r===a.value;return o.jsx(Hz,{asChild:!0,...l,focusable:!s,active:f,children:o.jsx(xn.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:Ze(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:Ze(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:Ze(t.onFocus,()=>{const m=a.activationMode!=="manual";!f&&!s&&m&&a.onValueChange(r)})})})});Yz.displayName=Xz;var Kz="TabsContent",Zz=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,l=n6(Kz,n),c=Jz(l.baseId,r),h=eP(l.baseId,r),f=r===l.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),o.jsx(ai,{present:s||f,children:({present:g})=>o.jsx(xn.div,{"data-state":f?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:h,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});Zz.displayName=Kz;function Jz(t,e){return`${t}-trigger-${e}`}function eP(t,e){return`${t}-content-${e}`}var yee=Uz,tP=Gz,nP=Yz,rP=Zz;const ll=yee,ro=b.forwardRef(({className:t,...e},n)=>o.jsx(tP,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ro.displayName=tP.displayName;const Jt=b.forwardRef(({className:t,...e},n)=>o.jsx(nP,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Jt.displayName=nP.displayName;const Pn=b.forwardRef(({className:t,...e},n)=>o.jsx(rP,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));Pn.displayName=rP.displayName;function bee(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var r6="ScrollArea",[sP]=Ta(r6),[wee,la]=sP(r6),iP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[l,c]=b.useState(null),[h,f]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,N]=b.useState(0),[C,T]=b.useState(0),[_,E]=b.useState(!1),[M,q]=b.useState(!1),L=qn(e,$=>c($)),I=T0(s);return o.jsx(wee,{scope:n,type:r,dir:I,scrollHideDelay:i,scrollArea:l,viewport:h,onViewportChange:f,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:_,onScrollbarXEnabledChange:E,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:M,onScrollbarYEnabledChange:q,onCornerWidthChange:N,onCornerHeightChange:T,children:o.jsx(xn.div,{dir:I,...a,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});iP.displayName=r6;var aP="ScrollAreaViewport",oP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=la(aP,n),l=b.useRef(null),c=qn(e,l,a.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),o.jsx(xn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:o.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});oP.displayName=aP;var oo="ScrollAreaScrollbar",s6=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=la(oo,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,l=t.orientation==="horizontal";return b.useEffect(()=>(l?i(!0):a(!0),()=>{l?i(!1):a(!1)}),[l,i,a]),s.type==="hover"?o.jsx(See,{...r,ref:e,forceMount:n}):s.type==="scroll"?o.jsx(kee,{...r,ref:e,forceMount:n}):s.type==="auto"?o.jsx(lP,{...r,ref:e,forceMount:n}):s.type==="always"?o.jsx(i6,{...r,ref:e}):null});s6.displayName=oo;var See=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=la(oo,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const h=()=>{window.clearTimeout(c),a(!0)},f=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",h),l.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",h),l.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),o.jsx(ai,{present:n||i,children:o.jsx(lP,{"data-state":i?"visible":"hidden",...r,ref:e})})}),kee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=la(oo,t.__scopeScrollArea),i=t.orientation==="horizontal",a=Lv(()=>c("SCROLL_END"),100),[l,c]=bee("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(l==="idle"){const h=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[l,s.scrollHideDelay,c]),b.useEffect(()=>{const h=s.viewport,f=i?"scrollLeft":"scrollTop";if(h){let m=h[f];const g=()=>{const x=h[f];m!==x&&(c("SCROLL"),a()),m=x};return h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),o.jsx(ai,{present:n||l!=="hidden",children:o.jsx(i6,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ze(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ze(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),lP=b.forwardRef((t,e)=>{const n=la(oo,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),l=t.orientation==="horizontal",c=Lv(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=la(oo,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[l,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=fP(l.viewport,l.content),f={...r,sizes:l,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return Eee(g,a.current,l,x)}return n==="horizontal"?o.jsx(Oee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=a9(g,l,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?o.jsx(jee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=a9(g,l);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),Oee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=la(oo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),h=qn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(uP,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Pv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+f.deltaX;t.onWheelScroll(g),pP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:N1(a.paddingLeft),paddingEnd:N1(a.paddingRight)}})}})}),jee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=la(oo,t.__scopeScrollArea),[a,l]=b.useState(),c=b.useRef(null),h=qn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(uP,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Pv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollTop+f.deltaY;t.onWheelScroll(g),pP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:N1(a.paddingTop),paddingEnd:N1(a.paddingBottom)}})}})}),[Nee,cP]=sP(oo),uP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:f,onResize:m,...g}=t,x=la(oo,n),[y,w]=b.useState(null),S=qn(e,L=>w(L)),k=b.useRef(null),N=b.useRef(""),C=x.viewport,T=r.content-r.viewport,_=ys(f),E=ys(c),M=Lv(m,10);function q(L){if(k.current){const I=L.clientX-k.current.left,$=L.clientY-k.current.top;h({x:I,y:$})}}return b.useEffect(()=>{const L=I=>{const $=I.target;y?.contains($)&&_(I,T)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[C,y,T,_]),b.useEffect(E,[r,E]),ph(y,M),ph(x.content,M),o.jsx(Nee,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:ys(i),onThumbPointerUp:ys(a),onThumbPositionChange:E,onThumbPointerDown:ys(l),children:o.jsx(xn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:Ze(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),k.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),q(L))}),onPointerMove:Ze(t.onPointerMove,q),onPointerUp:Ze(t.onPointerUp,L=>{const I=L.target;I.hasPointerCapture(L.pointerId)&&I.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),j1="ScrollAreaThumb",dP=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=cP(j1,t.__scopeScrollArea);return o.jsx(ai,{present:n||s.hasThumb,children:o.jsx(Cee,{ref:e,...r})})}),Cee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=la(j1,n),a=cP(j1,n),{onThumbPositionChange:l}=a,c=qn(e,m=>a.onThumbChange(m)),h=b.useRef(void 0),f=Lv(()=>{h.current&&(h.current(),h.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(f(),!h.current){const x=_ee(m,l);h.current=x,l()}};return l(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,f,l]),o.jsx(xn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ze(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:Ze(t.onPointerUp,a.onThumbPointerUp)})});dP.displayName=j1;var a6="ScrollAreaCorner",hP=b.forwardRef((t,e)=>{const n=la(a6,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?o.jsx(Tee,{...t,ref:e}):null});hP.displayName=a6;var Tee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=la(a6,n),[i,a]=b.useState(0),[l,c]=b.useState(0),h=!!(i&&l);return ph(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),c(f)}),ph(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),a(f)}),h?o.jsx(xn.div,{...r,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function N1(t){return t?parseInt(t,10):0}function fP(t,e){const n=t/e;return isNaN(n)?0:n}function Pv(t){const e=fP(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Eee(t,e,n,r="ltr"){const s=Pv(n),i=s/2,a=e||i,l=s-a,c=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-l,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return mP([c,h],m)(t)}function a9(t,e,n="ltr"){const r=Pv(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,l=i-r,c=n==="ltr"?[0,a]:[a*-1,0],h=Bk(t,c);return mP([0,a],[0,l])(h)}function mP(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function pP(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,l=n.top!==i.top;(a||l)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function Lv(t,e){const n=ys(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function ph(t,e){const n=ys(e);ND(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var gP=iP,Mee=oP,Aee=hP;const kn=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>o.jsxs(gP,{ref:s,className:ye("relative overflow-hidden",t),...r,children:[o.jsx(Mee,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),o.jsx(D3,{}),o.jsx(D3,{orientation:"horizontal"}),o.jsx(Aee,{})]}));kn.displayName=gP.displayName;const D3=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>o.jsx(s6,{ref:r,orientation:e,className:ye("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:o.jsx(dP,{className:"relative flex-1 rounded-full bg-border"})}));D3.displayName=s6.displayName;function o9({className:t,...e}){return o.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function Ree(t,e=[]){let n=[];function r(i,a){const l=b.createContext(a);l.displayName=i+"Context";const c=n.length;n=[...n,a];const h=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||l,S=b.useMemo(()=>y,Object.values(y));return o.jsx(w.Provider,{value:S,children:x})};h.displayName=i+"Provider";function f(m,g){const x=g?.[t]?.[c]||l,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(l){const c=l?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,Dee(s,...e)]}function Dee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((l,{useScope:c,scopeName:h})=>{const m=c(i)[`__scope${h}`];return{...l,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var zee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],xP=zee.reduce((t,e)=>{const n=qk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),o6="Progress",l6=100,[Pee]=Ree(o6),[Lee,Iee]=Pee(o6),vP=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=Bee,...a}=t;(s||s===0)&&!l9(s)&&console.error(qee(`${s}`,"Progress"));const l=l9(s)?s:l6;r!==null&&!c9(r,l)&&console.error(Fee(`${r}`,"Progress"));const c=c9(r,l)?r:null,h=C1(c)?i(c,l):void 0;return o.jsx(Lee,{scope:n,value:c,max:l,children:o.jsx(xP.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":C1(c)?c:void 0,"aria-valuetext":h,role:"progressbar","data-state":wP(c,l),"data-value":c??void 0,"data-max":l,...a,ref:e})})});vP.displayName=o6;var yP="ProgressIndicator",bP=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=Iee(yP,n);return o.jsx(xP.div,{"data-state":wP(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});bP.displayName=yP;function Bee(t,e){return`${Math.round(t/e*100)}%`}function wP(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function C1(t){return typeof t=="number"}function l9(t){return C1(t)&&!isNaN(t)&&t>0}function c9(t,e){return C1(t)&&!isNaN(t)&&t<=e&&t>=0}function qee(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${l6}\`.`}function Fee(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: +`+v.stack}}var bt=Object.prototype.hasOwnProperty,lt=t.unstable_scheduleCallback,xn=t.unstable_cancelCallback,_n=t.unstable_shouldYield,Cn=t.unstable_requestPaint,Dt=t.unstable_now,xt=t.unstable_getCurrentPriorityLevel,Te=t.unstable_ImmediatePriority,Re=t.unstable_UserBlockingPriority,qe=t.unstable_NormalPriority,rt=t.unstable_LowPriority,wt=t.unstable_IdlePriority,jt=t.log,Ne=t.unstable_setDisableYieldValue,ie=null,xe=null;function Je(u){if(typeof jt=="function"&&Ne(u),xe&&typeof xe.setStrictMode=="function")try{xe.setStrictMode(ie,u)}catch{}}var dt=Math.clz32?Math.clz32:kn,er=Math.log,pt=Math.LN2;function kn(u){return u>>>=0,u===0?32:31-(er(u)/pt|0)|0}var vt=256,Gt=262144,Vt=4194304;function ot(u){var d=u&42;if(d!==0)return d;switch(u&-u){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return u&261888;case 262144:case 524288:case 1048576:case 2097152:return u&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function mr(u,d,p){var v=u.pendingLanes;if(v===0)return 0;var O=0,j=u.suspendedLanes,B=u.pingedLanes;u=u.warmLanes;var K=v&134217727;return K!==0?(v=K&~j,v!==0?O=ot(v):(B&=K,B!==0?O=ot(B):p||(p=K&~u,p!==0&&(O=ot(p))))):(K=v&~j,K!==0?O=ot(K):B!==0?O=ot(B):p||(p=v&~u,p!==0&&(O=ot(p)))),O===0?0:d!==0&&d!==O&&(d&j)===0&&(j=O&-O,p=d&-d,j>=p||j===32&&(p&4194048)!==0)?d:O}function Yr(u,d){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&d)===0}function Kr(u,d){switch(u){case 1:case 2:case 4:case 8:case 64:return d+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return d+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pr(){var u=Vt;return Vt<<=1,(Vt&62914560)===0&&(Vt=4194304),u}function Cr(u){for(var d=[],p=0;31>p;p++)d.push(u);return d}function Bs(u,d){u.pendingLanes|=d,d!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function wr(u,d,p,v,O,j){var B=u.pendingLanes;u.pendingLanes=p,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=p,u.entangledLanes&=p,u.errorRecoveryDisabledLanes&=p,u.shellSuspendCounter=0;var K=u.entanglements,ue=u.expirationTimes,Se=u.hiddenUpdates;for(p=B&~p;0"u")return null;try{return u.activeElement||u.body}catch{return u.body}}var JW=/[\n"\\]/g;function Li(u){return u.replace(JW,function(d){return"\\"+d.charCodeAt(0).toString(16)+" "})}function Hy(u,d,p,v,O,j,B,K){u.name="",B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?u.type=B:u.removeAttribute("type"),d!=null?B==="number"?(d===0&&u.value===""||u.value!=d)&&(u.value=""+Pi(d)):u.value!==""+Pi(d)&&(u.value=""+Pi(d)):B!=="submit"&&B!=="reset"||u.removeAttribute("value"),d!=null?Vy(u,B,Pi(d)):p!=null?Vy(u,B,Pi(p)):v!=null&&u.removeAttribute("value"),O==null&&j!=null&&(u.defaultChecked=!!j),O!=null&&(u.checked=O&&typeof O!="function"&&typeof O!="symbol"),K!=null&&typeof K!="function"&&typeof K!="symbol"&&typeof K!="boolean"?u.name=""+Pi(K):u.removeAttribute("name")}function Kj(u,d,p,v,O,j,B,K){if(j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"&&(u.type=j),d!=null||p!=null){if(!(j!=="submit"&&j!=="reset"||d!=null)){Qy(u);return}p=p!=null?""+Pi(p):"",d=d!=null?""+Pi(d):p,K||d===u.value||(u.value=d),u.defaultValue=d}v=v??O,v=typeof v!="function"&&typeof v!="symbol"&&!!v,u.checked=K?u.checked:!!v,u.defaultChecked=!!v,B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"&&(u.name=B),Qy(u)}function Vy(u,d,p){d==="number"&&Ap(u.ownerDocument)===u||u.defaultValue===""+p||(u.defaultValue=""+p)}function Wu(u,d,p,v){if(u=u.options,d){d={};for(var O=0;O"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Yy=!1;if(Nl)try{var lf={};Object.defineProperty(lf,"passive",{get:function(){Yy=!0}}),window.addEventListener("test",lf,lf),window.removeEventListener("test",lf,lf)}catch{Yy=!1}var Eo=null,Ky=null,Dp=null;function sN(){if(Dp)return Dp;var u,d=Ky,p=d.length,v,O="value"in Eo?Eo.value:Eo.textContent,j=O.length;for(u=0;u=uf),uN=" ",dN=!1;function hN(u,d){switch(u){case"keyup":return CG.indexOf(d.keyCode)!==-1;case"keydown":return d.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function fN(u){return u=u.detail,typeof u=="object"&&"data"in u?u.data:null}var Ku=!1;function EG(u,d){switch(u){case"compositionend":return fN(d);case"keypress":return d.which!==32?null:(dN=!0,uN);case"textInput":return u=d.data,u===uN&&dN?null:u;default:return null}}function _G(u,d){if(Ku)return u==="compositionend"||!nb&&hN(u,d)?(u=sN(),Dp=Ky=Eo=null,Ku=!1,u):null;switch(u){case"paste":return null;case"keypress":if(!(d.ctrlKey||d.altKey||d.metaKey)||d.ctrlKey&&d.altKey){if(d.char&&1=d)return{node:p,offset:d-u};u=v}e:{for(;p;){if(p.nextSibling){p=p.nextSibling;break e}p=p.parentNode}p=void 0}p=wN(p)}}function kN(u,d){return u&&d?u===d?!0:u&&u.nodeType===3?!1:d&&d.nodeType===3?kN(u,d.parentNode):"contains"in u?u.contains(d):u.compareDocumentPosition?!!(u.compareDocumentPosition(d)&16):!1:!1}function ON(u){u=u!=null&&u.ownerDocument!=null&&u.ownerDocument.defaultView!=null?u.ownerDocument.defaultView:window;for(var d=Ap(u.document);d instanceof u.HTMLIFrameElement;){try{var p=typeof d.contentWindow.location.href=="string"}catch{p=!1}if(p)u=d.contentWindow;else break;d=Ap(u.document)}return d}function ib(u){var d=u&&u.nodeName&&u.nodeName.toLowerCase();return d&&(d==="input"&&(u.type==="text"||u.type==="search"||u.type==="tel"||u.type==="url"||u.type==="password")||d==="textarea"||u.contentEditable==="true")}var IG=Nl&&"documentMode"in document&&11>=document.documentMode,Zu=null,ab=null,mf=null,lb=!1;function jN(u,d,p){var v=p.window===p?p.document:p.nodeType===9?p:p.ownerDocument;lb||Zu==null||Zu!==Ap(v)||(v=Zu,"selectionStart"in v&&ib(v)?v={start:v.selectionStart,end:v.selectionEnd}:(v=(v.ownerDocument&&v.ownerDocument.defaultView||window).getSelection(),v={anchorNode:v.anchorNode,anchorOffset:v.anchorOffset,focusNode:v.focusNode,focusOffset:v.focusOffset}),mf&&ff(mf,v)||(mf=v,v=Cg(ab,"onSelect"),0>=B,O-=B,La=1<<32-dt(d)+O|p<qt?(en=ct,ct=null):en=ct.sibling;var jn=ke(ge,ct,be[qt],Me);if(jn===null){ct===null&&(ct=en);break}u&&ct&&jn.alternate===null&&d(ge,ct),me=j(jn,me,qt),On===null?yt=jn:On.sibling=jn,On=jn,ct=en}if(qt===be.length)return p(ge,ct),rn&&Tl(ge,qt),yt;if(ct===null){for(;qtqt?(en=ct,ct=null):en=ct.sibling;var Ko=ke(ge,ct,jn.value,Me);if(Ko===null){ct===null&&(ct=en);break}u&&ct&&Ko.alternate===null&&d(ge,ct),me=j(Ko,me,qt),On===null?yt=Ko:On.sibling=Ko,On=Ko,ct=en}if(jn.done)return p(ge,ct),rn&&Tl(ge,qt),yt;if(ct===null){for(;!jn.done;qt++,jn=be.next())jn=De(ge,jn.value,Me),jn!==null&&(me=j(jn,me,qt),On===null?yt=jn:On.sibling=jn,On=jn);return rn&&Tl(ge,qt),yt}for(ct=v(ct);!jn.done;qt++,jn=be.next())jn=Ce(ct,ge,qt,jn.value,Me),jn!==null&&(u&&jn.alternate!==null&&ct.delete(jn.key===null?qt:jn.key),me=j(jn,me,qt),On===null?yt=jn:On.sibling=jn,On=jn);return u&&ct.forEach(function(sY){return d(ge,sY)}),rn&&Tl(ge,qt),yt}function Ln(ge,me,be,Me){if(typeof be=="object"&&be!==null&&be.type===w&&be.key===null&&(be=be.props.children),typeof be=="object"&&be!==null){switch(be.$$typeof){case x:e:{for(var yt=be.key;me!==null;){if(me.key===yt){if(yt=be.type,yt===w){if(me.tag===7){p(ge,me.sibling),Me=O(me,be.props.children),Me.return=ge,ge=Me;break e}}else if(me.elementType===yt||typeof yt=="object"&&yt!==null&&yt.$$typeof===q&&Xc(yt)===me.type){p(ge,me.sibling),Me=O(me,be.props),bf(Me,be),Me.return=ge,ge=Me;break e}p(ge,me);break}else d(ge,me);me=me.sibling}be.type===w?(Me=Hc(be.props.children,ge.mode,Me,be.key),Me.return=ge,ge=Me):(Me=Hp(be.type,be.key,be.props,null,ge.mode,Me),bf(Me,be),Me.return=ge,ge=Me)}return B(ge);case y:e:{for(yt=be.key;me!==null;){if(me.key===yt)if(me.tag===4&&me.stateNode.containerInfo===be.containerInfo&&me.stateNode.implementation===be.implementation){p(ge,me.sibling),Me=O(me,be.children||[]),Me.return=ge,ge=Me;break e}else{p(ge,me);break}else d(ge,me);me=me.sibling}Me=mb(be,ge.mode,Me),Me.return=ge,ge=Me}return B(ge);case q:return be=Xc(be),Ln(ge,me,be,Me)}if(H(be))return st(ge,me,be,Me);if(V(be)){if(yt=V(be),typeof yt!="function")throw Error(r(150));return be=yt.call(be),Ot(ge,me,be,Me)}if(typeof be.then=="function")return Ln(ge,me,Kp(be),Me);if(be.$$typeof===C)return Ln(ge,me,Wp(ge,be),Me);Zp(ge,be)}return typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint"?(be=""+be,me!==null&&me.tag===6?(p(ge,me.sibling),Me=O(me,be),Me.return=ge,ge=Me):(p(ge,me),Me=fb(be,ge.mode,Me),Me.return=ge,ge=Me),B(ge)):p(ge,me)}return function(ge,me,be,Me){try{yf=0;var yt=Ln(ge,me,be,Me);return cd=null,yt}catch(ct){if(ct===od||ct===Xp)throw ct;var On=pi(29,ct,null,ge.mode);return On.lanes=Me,On.return=ge,On}finally{}}}var Kc=GN(!0),XN=GN(!1),Do=!1;function Nb(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Cb(u,d){u=u.updateQueue,d.updateQueue===u&&(d.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function zo(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function Po(u,d,p){var v=u.updateQueue;if(v===null)return null;if(v=v.shared,(Tn&2)!==0){var O=v.pending;return O===null?d.next=d:(d.next=O.next,O.next=d),v.pending=d,d=Qp(u),AN(u,null,p),d}return $p(u,v,d,p),Qp(u)}function wf(u,d,p){if(d=d.updateQueue,d!==null&&(d=d.shared,(p&4194048)!==0)){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Cs(u,p)}}function Tb(u,d){var p=u.updateQueue,v=u.alternate;if(v!==null&&(v=v.updateQueue,p===v)){var O=null,j=null;if(p=p.firstBaseUpdate,p!==null){do{var B={lane:p.lane,tag:p.tag,payload:p.payload,callback:null,next:null};j===null?O=j=B:j=j.next=B,p=p.next}while(p!==null);j===null?O=j=d:j=j.next=d}else O=j=d;p={baseState:v.baseState,firstBaseUpdate:O,lastBaseUpdate:j,shared:v.shared,callbacks:v.callbacks},u.updateQueue=p;return}u=p.lastBaseUpdate,u===null?p.firstBaseUpdate=d:u.next=d,p.lastBaseUpdate=d}var Eb=!1;function Sf(){if(Eb){var u=ld;if(u!==null)throw u}}function kf(u,d,p,v){Eb=!1;var O=u.updateQueue;Do=!1;var j=O.firstBaseUpdate,B=O.lastBaseUpdate,K=O.shared.pending;if(K!==null){O.shared.pending=null;var ue=K,Se=ue.next;ue.next=null,B===null?j=Se:B.next=Se,B=ue;var Ee=u.alternate;Ee!==null&&(Ee=Ee.updateQueue,K=Ee.lastBaseUpdate,K!==B&&(K===null?Ee.firstBaseUpdate=Se:K.next=Se,Ee.lastBaseUpdate=ue))}if(j!==null){var De=O.baseState;B=0,Ee=Se=ue=null,K=j;do{var ke=K.lane&-536870913,Ce=ke!==K.lane;if(Ce?(Jt&ke)===ke:(v&ke)===ke){ke!==0&&ke===ad&&(Eb=!0),Ee!==null&&(Ee=Ee.next={lane:0,tag:K.tag,payload:K.payload,callback:null,next:null});e:{var st=u,Ot=K;ke=d;var Ln=p;switch(Ot.tag){case 1:if(st=Ot.payload,typeof st=="function"){De=st.call(Ln,De,ke);break e}De=st;break e;case 3:st.flags=st.flags&-65537|128;case 0:if(st=Ot.payload,ke=typeof st=="function"?st.call(Ln,De,ke):st,ke==null)break e;De=m({},De,ke);break e;case 2:Do=!0}}ke=K.callback,ke!==null&&(u.flags|=64,Ce&&(u.flags|=8192),Ce=O.callbacks,Ce===null?O.callbacks=[ke]:Ce.push(ke))}else Ce={lane:ke,tag:K.tag,payload:K.payload,callback:K.callback,next:null},Ee===null?(Se=Ee=Ce,ue=De):Ee=Ee.next=Ce,B|=ke;if(K=K.next,K===null){if(K=O.shared.pending,K===null)break;Ce=K,K=Ce.next,Ce.next=null,O.lastBaseUpdate=Ce,O.shared.pending=null}}while(!0);Ee===null&&(ue=De),O.baseState=ue,O.firstBaseUpdate=Se,O.lastBaseUpdate=Ee,j===null&&(O.shared.lanes=0),Fo|=B,u.lanes=B,u.memoizedState=De}}function YN(u,d){if(typeof u!="function")throw Error(r(191,u));u.call(d)}function KN(u,d){var p=u.callbacks;if(p!==null)for(u.callbacks=null,u=0;uj?j:8;var B=P.T,K={};P.T=K,Gb(u,!1,d,p);try{var ue=O(),Se=P.S;if(Se!==null&&Se(K,ue),ue!==null&&typeof ue=="object"&&typeof ue.then=="function"){var Ee=WG(ue,v);Nf(u,d,Ee,bi(u))}else Nf(u,d,v,bi(u))}catch(De){Nf(u,d,{then:function(){},status:"rejected",reason:De},bi())}finally{W.p=j,B!==null&&K.types!==null&&(B.types=K.types),P.T=B}}function JG(){}function Ub(u,d,p,v){if(u.tag!==5)throw Error(r(476));var O=E7(u).queue;T7(u,O,d,J,p===null?JG:function(){return _7(u),p(v)})}function E7(u){var d=u.memoizedState;if(d!==null)return d;d={memoizedState:J,baseState:J,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:J},next:null};var p={};return d.next={memoizedState:p,baseState:p,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Al,lastRenderedState:p},next:null},u.memoizedState=d,u=u.alternate,u!==null&&(u.memoizedState=d),d}function _7(u){var d=E7(u);d.next===null&&(d=u.alternate.memoizedState),Nf(u,d.next.queue,{},bi())}function Wb(){return os(Qf)}function M7(){return kr().memoizedState}function A7(){return kr().memoizedState}function eX(u){for(var d=u.return;d!==null;){switch(d.tag){case 24:case 3:var p=bi();u=zo(p);var v=Po(d,u,p);v!==null&&(Ws(v,d,p),wf(v,d,p)),d={cache:Sb()},u.payload=d;return}d=d.return}}function tX(u,d,p){var v=bi();p={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},og(u)?D7(d,p):(p=db(u,d,p,v),p!==null&&(Ws(p,u,v),z7(p,d,v)))}function R7(u,d,p){var v=bi();Nf(u,d,p,v)}function Nf(u,d,p,v){var O={lane:v,revertLane:0,gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null};if(og(u))D7(d,O);else{var j=u.alternate;if(u.lanes===0&&(j===null||j.lanes===0)&&(j=d.lastRenderedReducer,j!==null))try{var B=d.lastRenderedState,K=j(B,p);if(O.hasEagerState=!0,O.eagerState=K,mi(K,B))return $p(u,d,O,0),Fn===null&&Fp(),!1}catch{}finally{}if(p=db(u,d,O,v),p!==null)return Ws(p,u,v),z7(p,d,v),!0}return!1}function Gb(u,d,p,v){if(v={lane:2,revertLane:N2(),gesture:null,action:v,hasEagerState:!1,eagerState:null,next:null},og(u)){if(d)throw Error(r(479))}else d=db(u,p,v,2),d!==null&&Ws(d,u,2)}function og(u){var d=u.alternate;return u===Lt||d!==null&&d===Lt}function D7(u,d){dd=tg=!0;var p=u.pending;p===null?d.next=d:(d.next=p.next,p.next=d),u.pending=d}function z7(u,d,p){if((p&4194048)!==0){var v=d.lanes;v&=u.pendingLanes,p|=v,d.lanes=p,Cs(u,p)}}var Cf={readContext:os,use:sg,useCallback:gr,useContext:gr,useEffect:gr,useImperativeHandle:gr,useLayoutEffect:gr,useInsertionEffect:gr,useMemo:gr,useReducer:gr,useRef:gr,useState:gr,useDebugValue:gr,useDeferredValue:gr,useTransition:gr,useSyncExternalStore:gr,useId:gr,useHostTransitionStatus:gr,useFormState:gr,useActionState:gr,useOptimistic:gr,useMemoCache:gr,useCacheRefresh:gr};Cf.useEffectEvent=gr;var P7={readContext:os,use:sg,useCallback:function(u,d){return Ts().memoizedState=[u,d===void 0?null:d],u},useContext:os,useEffect:y7,useImperativeHandle:function(u,d,p){p=p!=null?p.concat([u]):null,ag(4194308,4,k7.bind(null,d,u),p)},useLayoutEffect:function(u,d){return ag(4194308,4,u,d)},useInsertionEffect:function(u,d){ag(4,2,u,d)},useMemo:function(u,d){var p=Ts();d=d===void 0?null:d;var v=u();if(Zc){Je(!0);try{u()}finally{Je(!1)}}return p.memoizedState=[v,d],v},useReducer:function(u,d,p){var v=Ts();if(p!==void 0){var O=p(d);if(Zc){Je(!0);try{p(d)}finally{Je(!1)}}}else O=d;return v.memoizedState=v.baseState=O,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:O},v.queue=u,u=u.dispatch=tX.bind(null,Lt,u),[v.memoizedState,u]},useRef:function(u){var d=Ts();return u={current:u},d.memoizedState=u},useState:function(u){u=Fb(u);var d=u.queue,p=R7.bind(null,Lt,d);return d.dispatch=p,[u.memoizedState,p]},useDebugValue:Hb,useDeferredValue:function(u,d){var p=Ts();return Vb(p,u,d)},useTransition:function(){var u=Fb(!1);return u=T7.bind(null,Lt,u.queue,!0,!1),Ts().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,d,p){var v=Lt,O=Ts();if(rn){if(p===void 0)throw Error(r(407));p=p()}else{if(p=d(),Fn===null)throw Error(r(349));(Jt&127)!==0||r7(v,d,p)}O.memoizedState=p;var j={value:p,getSnapshot:d};return O.queue=j,y7(i7.bind(null,v,j,u),[u]),v.flags|=2048,fd(9,{destroy:void 0},s7.bind(null,v,j,p,d),null),p},useId:function(){var u=Ts(),d=Fn.identifierPrefix;if(rn){var p=Ia,v=La;p=(v&~(1<<32-dt(v)-1)).toString(32)+p,d="_"+d+"R_"+p,p=ng++,0<\/script>",j=j.removeChild(j.firstChild);break;case"select":j=typeof v.is=="string"?B.createElement("select",{is:v.is}):B.createElement("select"),v.multiple?j.multiple=!0:v.size&&(j.size=v.size);break;default:j=typeof v.is=="string"?B.createElement(O,{is:v.is}):B.createElement(O)}}j[Fr]=d,j[as]=v;e:for(B=d.child;B!==null;){if(B.tag===5||B.tag===6)j.appendChild(B.stateNode);else if(B.tag!==4&&B.tag!==27&&B.child!==null){B.child.return=B,B=B.child;continue}if(B===d)break e;for(;B.sibling===null;){if(B.return===null||B.return===d)break e;B=B.return}B.sibling.return=B.return,B=B.sibling}d.stateNode=j;e:switch(us(j,O,v),O){case"button":case"input":case"select":case"textarea":v=!!v.autoFocus;break e;case"img":v=!0;break e;default:v=!1}v&&Dl(d)}}return Kn(d),o2(d,d.type,u===null?null:u.memoizedProps,d.pendingProps,p),null;case 6:if(u&&d.stateNode!=null)u.memoizedProps!==v&&Dl(d);else{if(typeof v!="string"&&d.stateNode===null)throw Error(r(166));if(u=ne.current,sd(d)){if(u=d.stateNode,p=d.memoizedProps,v=null,O=ls,O!==null)switch(O.tag){case 27:case 5:v=O.memoizedProps}u[Fr]=d,u=!!(u.nodeValue===p||v!==null&&v.suppressHydrationWarning===!0||tC(u.nodeValue,p)),u||Ao(d,!0)}else u=Tg(u).createTextNode(v),u[Fr]=d,d.stateNode=u}return Kn(d),null;case 31:if(p=d.memoizedState,u===null||u.memoizedState!==null){if(v=sd(d),p!==null){if(u===null){if(!v)throw Error(r(318));if(u=d.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(r(557));u[Fr]=d}else Vc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),u=!1}else p=vb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=p),u=!0;if(!u)return d.flags&256?(xi(d),d):(xi(d),null);if((d.flags&128)!==0)throw Error(r(558))}return Kn(d),null;case 13:if(v=d.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(O=sd(d),v!==null&&v.dehydrated!==null){if(u===null){if(!O)throw Error(r(318));if(O=d.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(r(317));O[Fr]=d}else Vc(),(d.flags&128)===0&&(d.memoizedState=null),d.flags|=4;Kn(d),O=!1}else O=vb(),u!==null&&u.memoizedState!==null&&(u.memoizedState.hydrationErrors=O),O=!0;if(!O)return d.flags&256?(xi(d),d):(xi(d),null)}return xi(d),(d.flags&128)!==0?(d.lanes=p,d):(p=v!==null,u=u!==null&&u.memoizedState!==null,p&&(v=d.child,O=null,v.alternate!==null&&v.alternate.memoizedState!==null&&v.alternate.memoizedState.cachePool!==null&&(O=v.alternate.memoizedState.cachePool.pool),j=null,v.memoizedState!==null&&v.memoizedState.cachePool!==null&&(j=v.memoizedState.cachePool.pool),j!==O&&(v.flags|=2048)),p!==u&&p&&(d.child.flags|=8192),fg(d,d.updateQueue),Kn(d),null);case 4:return re(),u===null&&_2(d.stateNode.containerInfo),Kn(d),null;case 10:return _l(d.type),Kn(d),null;case 19:if(G(Sr),v=d.memoizedState,v===null)return Kn(d),null;if(O=(d.flags&128)!==0,j=v.rendering,j===null)if(O)Ef(v,!1);else{if(xr!==0||u!==null&&(u.flags&128)!==0)for(u=d.child;u!==null;){if(j=eg(u),j!==null){for(d.flags|=128,Ef(v,!1),u=j.updateQueue,d.updateQueue=u,fg(d,u),d.subtreeFlags=0,u=p,p=d.child;p!==null;)RN(p,u),p=p.sibling;return F(Sr,Sr.current&1|2),rn&&Tl(d,v.treeForkCount),d.child}u=u.sibling}v.tail!==null&&Dt()>vg&&(d.flags|=128,O=!0,Ef(v,!1),d.lanes=4194304)}else{if(!O)if(u=eg(j),u!==null){if(d.flags|=128,O=!0,u=u.updateQueue,d.updateQueue=u,fg(d,u),Ef(v,!0),v.tail===null&&v.tailMode==="hidden"&&!j.alternate&&!rn)return Kn(d),null}else 2*Dt()-v.renderingStartTime>vg&&p!==536870912&&(d.flags|=128,O=!0,Ef(v,!1),d.lanes=4194304);v.isBackwards?(j.sibling=d.child,d.child=j):(u=v.last,u!==null?u.sibling=j:d.child=j,v.last=j)}return v.tail!==null?(u=v.tail,v.rendering=u,v.tail=u.sibling,v.renderingStartTime=Dt(),u.sibling=null,p=Sr.current,F(Sr,O?p&1|2:p&1),rn&&Tl(d,v.treeForkCount),u):(Kn(d),null);case 22:case 23:return xi(d),Mb(),v=d.memoizedState!==null,u!==null?u.memoizedState!==null!==v&&(d.flags|=8192):v&&(d.flags|=8192),v?(p&536870912)!==0&&(d.flags&128)===0&&(Kn(d),d.subtreeFlags&6&&(d.flags|=8192)):Kn(d),p=d.updateQueue,p!==null&&fg(d,p.retryQueue),p=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(p=u.memoizedState.cachePool.pool),v=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(v=d.memoizedState.cachePool.pool),v!==p&&(d.flags|=2048),u!==null&&G(Gc),null;case 24:return p=null,u!==null&&(p=u.memoizedState.cache),d.memoizedState.cache!==p&&(d.flags|=2048),_l(Er),Kn(d),null;case 25:return null;case 30:return null}throw Error(r(156,d.tag))}function aX(u,d){switch(gb(d),d.tag){case 1:return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 3:return _l(Er),re(),u=d.flags,(u&65536)!==0&&(u&128)===0?(d.flags=u&-65537|128,d):null;case 26:case 27:case 5:return _e(d),null;case 31:if(d.memoizedState!==null){if(xi(d),d.alternate===null)throw Error(r(340));Vc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 13:if(xi(d),u=d.memoizedState,u!==null&&u.dehydrated!==null){if(d.alternate===null)throw Error(r(340));Vc()}return u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 19:return G(Sr),null;case 4:return re(),null;case 10:return _l(d.type),null;case 22:case 23:return xi(d),Mb(),u!==null&&G(Gc),u=d.flags,u&65536?(d.flags=u&-65537|128,d):null;case 24:return _l(Er),null;case 25:return null;default:return null}}function a8(u,d){switch(gb(d),d.tag){case 3:_l(Er),re();break;case 26:case 27:case 5:_e(d);break;case 4:re();break;case 31:d.memoizedState!==null&&xi(d);break;case 13:xi(d);break;case 19:G(Sr);break;case 10:_l(d.type);break;case 22:case 23:xi(d),Mb(),u!==null&&G(Gc);break;case 24:_l(Er)}}function _f(u,d){try{var p=d.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var O=v.next;p=O;do{if((p.tag&u)===u){v=void 0;var j=p.create,B=p.inst;v=j(),B.destroy=v}p=p.next}while(p!==O)}}catch(K){An(d,d.return,K)}}function Bo(u,d,p){try{var v=d.updateQueue,O=v!==null?v.lastEffect:null;if(O!==null){var j=O.next;v=j;do{if((v.tag&u)===u){var B=v.inst,K=B.destroy;if(K!==void 0){B.destroy=void 0,O=d;var ue=p,Se=K;try{Se()}catch(Ee){An(O,ue,Ee)}}}v=v.next}while(v!==j)}}catch(Ee){An(d,d.return,Ee)}}function l8(u){var d=u.updateQueue;if(d!==null){var p=u.stateNode;try{KN(d,p)}catch(v){An(u,u.return,v)}}}function o8(u,d,p){p.props=Jc(u.type,u.memoizedProps),p.state=u.memoizedState;try{p.componentWillUnmount()}catch(v){An(u,d,v)}}function Mf(u,d){try{var p=u.ref;if(p!==null){switch(u.tag){case 26:case 27:case 5:var v=u.stateNode;break;case 30:v=u.stateNode;break;default:v=u.stateNode}typeof p=="function"?u.refCleanup=p(v):p.current=v}}catch(O){An(u,d,O)}}function Ba(u,d){var p=u.ref,v=u.refCleanup;if(p!==null)if(typeof v=="function")try{v()}catch(O){An(u,d,O)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof p=="function")try{p(null)}catch(O){An(u,d,O)}else p.current=null}function c8(u){var d=u.type,p=u.memoizedProps,v=u.stateNode;try{e:switch(d){case"button":case"input":case"select":case"textarea":p.autoFocus&&v.focus();break e;case"img":p.src?v.src=p.src:p.srcSet&&(v.srcset=p.srcSet)}}catch(O){An(u,u.return,O)}}function c2(u,d,p){try{var v=u.stateNode;TX(v,u.type,p,d),v[as]=d}catch(O){An(u,u.return,O)}}function u8(u){return u.tag===5||u.tag===3||u.tag===26||u.tag===27&&Uo(u.type)||u.tag===4}function u2(u){e:for(;;){for(;u.sibling===null;){if(u.return===null||u8(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&u.tag!==18;){if(u.tag===27&&Uo(u.type)||u.flags&2||u.child===null||u.tag===4)continue e;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function d2(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?(p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p).insertBefore(u,d):(d=p.nodeType===9?p.body:p.nodeName==="HTML"?p.ownerDocument.body:p,d.appendChild(u),p=p._reactRootContainer,p!=null||d.onclick!==null||(d.onclick=jl));else if(v!==4&&(v===27&&Uo(u.type)&&(p=u.stateNode,d=null),u=u.child,u!==null))for(d2(u,d,p),u=u.sibling;u!==null;)d2(u,d,p),u=u.sibling}function mg(u,d,p){var v=u.tag;if(v===5||v===6)u=u.stateNode,d?p.insertBefore(u,d):p.appendChild(u);else if(v!==4&&(v===27&&Uo(u.type)&&(p=u.stateNode),u=u.child,u!==null))for(mg(u,d,p),u=u.sibling;u!==null;)mg(u,d,p),u=u.sibling}function d8(u){var d=u.stateNode,p=u.memoizedProps;try{for(var v=u.type,O=d.attributes;O.length;)d.removeAttributeNode(O[0]);us(d,v,p),d[Fr]=u,d[as]=p}catch(j){An(u,u.return,j)}}var zl=!1,Ar=!1,h2=!1,h8=typeof WeakSet=="function"?WeakSet:Set,Zr=null;function lX(u,d){if(u=u.containerInfo,R2=zg,u=ON(u),ib(u)){if("selectionStart"in u)var p={start:u.selectionStart,end:u.selectionEnd};else e:{p=(p=u.ownerDocument)&&p.defaultView||window;var v=p.getSelection&&p.getSelection();if(v&&v.rangeCount!==0){p=v.anchorNode;var O=v.anchorOffset,j=v.focusNode;v=v.focusOffset;try{p.nodeType,j.nodeType}catch{p=null;break e}var B=0,K=-1,ue=-1,Se=0,Ee=0,De=u,ke=null;t:for(;;){for(var Ce;De!==p||O!==0&&De.nodeType!==3||(K=B+O),De!==j||v!==0&&De.nodeType!==3||(ue=B+v),De.nodeType===3&&(B+=De.nodeValue.length),(Ce=De.firstChild)!==null;)ke=De,De=Ce;for(;;){if(De===u)break t;if(ke===p&&++Se===O&&(K=B),ke===j&&++Ee===v&&(ue=B),(Ce=De.nextSibling)!==null)break;De=ke,ke=De.parentNode}De=Ce}p=K===-1||ue===-1?null:{start:K,end:ue}}else p=null}p=p||{start:0,end:0}}else p=null;for(D2={focusedElem:u,selectionRange:p},zg=!1,Zr=d;Zr!==null;)if(d=Zr,u=d.child,(d.subtreeFlags&1028)!==0&&u!==null)u.return=d,Zr=u;else for(;Zr!==null;){switch(d=Zr,j=d.alternate,u=d.flags,d.tag){case 0:if((u&4)!==0&&(u=d.updateQueue,u=u!==null?u.events:null,u!==null))for(p=0;p title"))),us(j,v,p),j[Fr]=u,Tr(j),v=j;break e;case"link":var B=vC("link","href",O).get(v+(p.href||""));if(B){for(var K=0;KLn&&(B=Ln,Ln=Ot,Ot=B);var ge=SN(K,Ot),me=SN(K,Ln);if(ge&&me&&(Ce.rangeCount!==1||Ce.anchorNode!==ge.node||Ce.anchorOffset!==ge.offset||Ce.focusNode!==me.node||Ce.focusOffset!==me.offset)){var be=De.createRange();be.setStart(ge.node,ge.offset),Ce.removeAllRanges(),Ot>Ln?(Ce.addRange(be),Ce.extend(me.node,me.offset)):(be.setEnd(me.node,me.offset),Ce.addRange(be))}}}}for(De=[],Ce=K;Ce=Ce.parentNode;)Ce.nodeType===1&&De.push({element:Ce,left:Ce.scrollLeft,top:Ce.scrollTop});for(typeof K.focus=="function"&&K.focus(),K=0;Kp?32:p,P.T=null,p=y2,y2=null;var j=Qo,B=ql;if($r=0,vd=Qo=null,ql=0,(Tn&6)!==0)throw Error(r(331));var K=Tn;if(Tn|=4,k8(j.current),b8(j,j.current,B,p),Tn=K,Lf(0,!1),xe&&typeof xe.onPostCommitFiberRoot=="function")try{xe.onPostCommitFiberRoot(ie,j)}catch{}return!0}finally{W.p=O,P.T=v,F8(u,d)}}function Q8(u,d,p){d=Bi(p,d),d=Zb(u.stateNode,d,2),u=Po(u,d,2),u!==null&&(Bs(u,2),qa(u))}function An(u,d,p){if(u.tag===3)Q8(u,u,p);else for(;d!==null;){if(d.tag===3){Q8(d,u,p);break}else if(d.tag===1){var v=d.stateNode;if(typeof d.type.getDerivedStateFromError=="function"||typeof v.componentDidCatch=="function"&&($o===null||!$o.has(v))){u=Bi(p,u),p=H7(2),v=Po(d,p,2),v!==null&&(V7(p,v,d,u),Bs(v,2),qa(v));break}}d=d.return}}function k2(u,d,p){var v=u.pingCache;if(v===null){v=u.pingCache=new uX;var O=new Set;v.set(d,O)}else O=v.get(d),O===void 0&&(O=new Set,v.set(d,O));O.has(p)||(p2=!0,O.add(p),u=pX.bind(null,u,d,p),d.then(u,u))}function pX(u,d,p){var v=u.pingCache;v!==null&&v.delete(d),u.pingedLanes|=u.suspendedLanes&p,u.warmLanes&=~p,Fn===u&&(Jt&p)===p&&(xr===4||xr===3&&(Jt&62914560)===Jt&&300>Dt()-xg?(Tn&2)===0&&yd(u,0):g2|=p,xd===Jt&&(xd=0)),qa(u)}function H8(u,d){d===0&&(d=pr()),u=Qc(u,d),u!==null&&(Bs(u,d),qa(u))}function gX(u){var d=u.memoizedState,p=0;d!==null&&(p=d.retryLane),H8(u,p)}function xX(u,d){var p=0;switch(u.tag){case 31:case 13:var v=u.stateNode,O=u.memoizedState;O!==null&&(p=O.retryLane);break;case 19:v=u.stateNode;break;case 22:v=u.stateNode._retryCache;break;default:throw Error(r(314))}v!==null&&v.delete(d),H8(u,p)}function vX(u,d){return lt(u,d)}var Og=null,wd=null,O2=!1,jg=!1,j2=!1,Vo=0;function qa(u){u!==wd&&u.next===null&&(wd===null?Og=wd=u:wd=wd.next=u),jg=!0,O2||(O2=!0,bX())}function Lf(u,d){if(!j2&&jg){j2=!0;do for(var p=!1,v=Og;v!==null;){if(u!==0){var O=v.pendingLanes;if(O===0)var j=0;else{var B=v.suspendedLanes,K=v.pingedLanes;j=(1<<31-dt(42|u)+1)-1,j&=O&~(B&~K),j=j&201326741?j&201326741|1:j?j|2:0}j!==0&&(p=!0,G8(v,j))}else j=Jt,j=mr(v,v===Fn?j:0,v.cancelPendingCommit!==null||v.timeoutHandle!==-1),(j&3)===0||Yr(v,j)||(p=!0,G8(v,j));v=v.next}while(p);j2=!1}}function yX(){V8()}function V8(){jg=O2=!1;var u=0;Vo!==0&&_X()&&(u=Vo);for(var d=Dt(),p=null,v=Og;v!==null;){var O=v.next,j=U8(v,d);j===0?(v.next=null,p===null?Og=O:p.next=O,O===null&&(wd=p)):(p=v,(u!==0||(j&3)!==0)&&(jg=!0)),v=O}$r!==0&&$r!==5||Lf(u),Vo!==0&&(Vo=0)}function U8(u,d){for(var p=u.suspendedLanes,v=u.pingedLanes,O=u.expirationTimes,j=u.pendingLanes&-62914561;0K)break;var Ee=ue.transferSize,De=ue.initiatorType;Ee&&nC(De)&&(ue=ue.responseEnd,B+=Ee*(ue"u"?null:document;function mC(u,d,p){var v=Sd;if(v&&typeof d=="string"&&d){var O=Li(d);O='link[rel="'+u+'"][href="'+O+'"]',typeof p=="string"&&(O+='[crossorigin="'+p+'"]'),fC.has(O)||(fC.add(O),u={rel:u,crossOrigin:p,href:d},v.querySelector(O)===null&&(d=v.createElement("link"),us(d,"link",u),Tr(d),v.head.appendChild(d)))}}function BX(u){Fl.D(u),mC("dns-prefetch",u,null)}function qX(u,d){Fl.C(u,d),mC("preconnect",u,d)}function FX(u,d,p){Fl.L(u,d,p);var v=Sd;if(v&&u&&d){var O='link[rel="preload"][as="'+Li(d)+'"]';d==="image"&&p&&p.imageSrcSet?(O+='[imagesrcset="'+Li(p.imageSrcSet)+'"]',typeof p.imageSizes=="string"&&(O+='[imagesizes="'+Li(p.imageSizes)+'"]')):O+='[href="'+Li(u)+'"]';var j=O;switch(d){case"style":j=kd(u);break;case"script":j=Od(u)}Vi.has(j)||(u=m({rel:"preload",href:d==="image"&&p&&p.imageSrcSet?void 0:u,as:d},p),Vi.set(j,u),v.querySelector(O)!==null||d==="style"&&v.querySelector(Ff(j))||d==="script"&&v.querySelector($f(j))||(d=v.createElement("link"),us(d,"link",u),Tr(d),v.head.appendChild(d)))}}function $X(u,d){Fl.m(u,d);var p=Sd;if(p&&u){var v=d&&typeof d.as=="string"?d.as:"script",O='link[rel="modulepreload"][as="'+Li(v)+'"][href="'+Li(u)+'"]',j=O;switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":j=Od(u)}if(!Vi.has(j)&&(u=m({rel:"modulepreload",href:u},d),Vi.set(j,u),p.querySelector(O)===null)){switch(v){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(p.querySelector($f(j)))return}v=p.createElement("link"),us(v,"link",u),Tr(v),p.head.appendChild(v)}}}function QX(u,d,p){Fl.S(u,d,p);var v=Sd;if(v&&u){var O=To(v).hoistableStyles,j=kd(u);d=d||"default";var B=O.get(j);if(!B){var K={loading:0,preload:null};if(B=v.querySelector(Ff(j)))K.loading=5;else{u=m({rel:"stylesheet",href:u,"data-precedence":d},p),(p=Vi.get(j))&&F2(u,p);var ue=B=v.createElement("link");Tr(ue),us(ue,"link",u),ue._p=new Promise(function(Se,Ee){ue.onload=Se,ue.onerror=Ee}),ue.addEventListener("load",function(){K.loading|=1}),ue.addEventListener("error",function(){K.loading|=2}),K.loading|=4,_g(B,d,v)}B={type:"stylesheet",instance:B,count:1,state:K},O.set(j,B)}}}function HX(u,d){Fl.X(u,d);var p=Sd;if(p&&u){var v=To(p).hoistableScripts,O=Od(u),j=v.get(O);j||(j=p.querySelector($f(O)),j||(u=m({src:u,async:!0},d),(d=Vi.get(O))&&$2(u,d),j=p.createElement("script"),Tr(j),us(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function VX(u,d){Fl.M(u,d);var p=Sd;if(p&&u){var v=To(p).hoistableScripts,O=Od(u),j=v.get(O);j||(j=p.querySelector($f(O)),j||(u=m({src:u,async:!0,type:"module"},d),(d=Vi.get(O))&&$2(u,d),j=p.createElement("script"),Tr(j),us(j,"link",u),p.head.appendChild(j)),j={type:"script",instance:j,count:1,state:null},v.set(O,j))}}function pC(u,d,p,v){var O=(O=ne.current)?Eg(O):null;if(!O)throw Error(r(446));switch(u){case"meta":case"title":return null;case"style":return typeof p.precedence=="string"&&typeof p.href=="string"?(d=kd(p.href),p=To(O).hoistableStyles,v=p.get(d),v||(v={type:"style",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};case"link":if(p.rel==="stylesheet"&&typeof p.href=="string"&&typeof p.precedence=="string"){u=kd(p.href);var j=To(O).hoistableStyles,B=j.get(u);if(B||(O=O.ownerDocument||O,B={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},j.set(u,B),(j=O.querySelector(Ff(u)))&&!j._p&&(B.instance=j,B.state.loading=5),Vi.has(u)||(p={rel:"preload",as:"style",href:p.href,crossOrigin:p.crossOrigin,integrity:p.integrity,media:p.media,hrefLang:p.hrefLang,referrerPolicy:p.referrerPolicy},Vi.set(u,p),j||UX(O,u,p,B.state))),d&&v===null)throw Error(r(528,""));return B}if(d&&v!==null)throw Error(r(529,""));return null;case"script":return d=p.async,p=p.src,typeof p=="string"&&d&&typeof d!="function"&&typeof d!="symbol"?(d=Od(p),p=To(O).hoistableScripts,v=p.get(d),v||(v={type:"script",instance:null,count:0,state:null},p.set(d,v)),v):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,u))}}function kd(u){return'href="'+Li(u)+'"'}function Ff(u){return'link[rel="stylesheet"]['+u+"]"}function gC(u){return m({},u,{"data-precedence":u.precedence,precedence:null})}function UX(u,d,p,v){u.querySelector('link[rel="preload"][as="style"]['+d+"]")?v.loading=1:(d=u.createElement("link"),v.preload=d,d.addEventListener("load",function(){return v.loading|=1}),d.addEventListener("error",function(){return v.loading|=2}),us(d,"link",p),Tr(d),u.head.appendChild(d))}function Od(u){return'[src="'+Li(u)+'"]'}function $f(u){return"script[async]"+u}function xC(u,d,p){if(d.count++,d.instance===null)switch(d.type){case"style":var v=u.querySelector('style[data-href~="'+Li(p.href)+'"]');if(v)return d.instance=v,Tr(v),v;var O=m({},p,{"data-href":p.href,"data-precedence":p.precedence,href:null,precedence:null});return v=(u.ownerDocument||u).createElement("style"),Tr(v),us(v,"style",O),_g(v,p.precedence,u),d.instance=v;case"stylesheet":O=kd(p.href);var j=u.querySelector(Ff(O));if(j)return d.state.loading|=4,d.instance=j,Tr(j),j;v=gC(p),(O=Vi.get(O))&&F2(v,O),j=(u.ownerDocument||u).createElement("link"),Tr(j);var B=j;return B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),us(j,"link",v),d.state.loading|=4,_g(j,p.precedence,u),d.instance=j;case"script":return j=Od(p.src),(O=u.querySelector($f(j)))?(d.instance=O,Tr(O),O):(v=p,(O=Vi.get(j))&&(v=m({},p),$2(v,O)),u=u.ownerDocument||u,O=u.createElement("script"),Tr(O),us(O,"link",v),u.head.appendChild(O),d.instance=O);case"void":return null;default:throw Error(r(443,d.type))}else d.type==="stylesheet"&&(d.state.loading&4)===0&&(v=d.instance,d.state.loading|=4,_g(v,p.precedence,u));return d.instance}function _g(u,d,p){for(var v=p.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=v.length?v[v.length-1]:null,j=O,B=0;B title"):null)}function WX(u,d,p){if(p===1||d.itemProp!=null)return!1;switch(u){case"meta":case"title":return!0;case"style":if(typeof d.precedence!="string"||typeof d.href!="string"||d.href==="")break;return!0;case"link":if(typeof d.rel!="string"||typeof d.href!="string"||d.href===""||d.onLoad||d.onError)break;switch(d.rel){case"stylesheet":return u=d.disabled,typeof d.precedence=="string"&&u==null;default:return!0}case"script":if(d.async&&typeof d.async!="function"&&typeof d.async!="symbol"&&!d.onLoad&&!d.onError&&d.src&&typeof d.src=="string")return!0}return!1}function bC(u){return!(u.type==="stylesheet"&&(u.state.loading&3)===0)}function GX(u,d,p,v){if(p.type==="stylesheet"&&(typeof v.media!="string"||matchMedia(v.media).matches!==!1)&&(p.state.loading&4)===0){if(p.instance===null){var O=kd(v.href),j=d.querySelector(Ff(O));if(j){d=j._p,d!==null&&typeof d=="object"&&typeof d.then=="function"&&(u.count++,u=Ag.bind(u),d.then(u,u)),p.state.loading|=4,p.instance=j,Tr(j);return}j=d.ownerDocument||d,v=gC(v),(O=Vi.get(O))&&F2(v,O),j=j.createElement("link"),Tr(j);var B=j;B._p=new Promise(function(K,ue){B.onload=K,B.onerror=ue}),us(j,"link",v),p.instance=j}u.stylesheets===null&&(u.stylesheets=new Map),u.stylesheets.set(p,d),(d=p.state.preload)&&(p.state.loading&3)===0&&(u.count++,p=Ag.bind(u),d.addEventListener("load",p),d.addEventListener("error",p))}}var Q2=0;function XX(u,d){return u.stylesheets&&u.count===0&&Dg(u,u.stylesheets),0Q2?50:800)+d);return u.unsuspend=p,function(){u.unsuspend=null,clearTimeout(v),clearTimeout(O)}}:null}function Ag(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Dg(this,this.stylesheets);else if(this.unsuspend){var u=this.unsuspend;this.unsuspend=null,u()}}}var Rg=null;function Dg(u,d){u.stylesheets=null,u.unsuspend!==null&&(u.count++,Rg=new Map,d.forEach(YX,u),Rg=null,Ag.call(u))}function YX(u,d){if(!(d.state.loading&4)){var p=Rg.get(u);if(p)var v=p.get(null);else{p=new Map,Rg.set(u,p);for(var O=u.querySelectorAll("link[data-precedence],style[data-precedence]"),j=0;j"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Z2.exports=nZ(),Z2.exports}var sZ=rZ();function uz(t,e){return function(){return t.apply(e,arguments)}}const{toString:iZ}=Object.prototype,{getPrototypeOf:t6}=Object,{iterator:Dv,toStringTag:dz}=Symbol,zv=(t=>e=>{const n=iZ.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Aa=t=>(t=t.toLowerCase(),e=>zv(e)===t),Pv=t=>e=>typeof e===t,{isArray:Dh}=Array,ph=Pv("undefined");function P0(t){return t!==null&&!ph(t)&&t.constructor!==null&&!ph(t.constructor)&&ni(t.constructor.isBuffer)&&t.constructor.isBuffer(t)}const hz=Aa("ArrayBuffer");function aZ(t){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(t):e=t&&t.buffer&&hz(t.buffer),e}const lZ=Pv("string"),ni=Pv("function"),fz=Pv("number"),L0=t=>t!==null&&typeof t=="object",oZ=t=>t===!0||t===!1,Xx=t=>{if(zv(t)!=="object")return!1;const e=t6(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(dz in t)&&!(Dv in t)},cZ=t=>{if(!L0(t)||P0(t))return!1;try{return Object.keys(t).length===0&&Object.getPrototypeOf(t)===Object.prototype}catch{return!1}},uZ=Aa("Date"),dZ=Aa("File"),hZ=Aa("Blob"),fZ=Aa("FileList"),mZ=t=>L0(t)&&ni(t.pipe),pZ=t=>{let e;return t&&(typeof FormData=="function"&&t instanceof FormData||ni(t.append)&&((e=zv(t))==="formdata"||e==="object"&&ni(t.toString)&&t.toString()==="[object FormData]"))},gZ=Aa("URLSearchParams"),[xZ,vZ,yZ,bZ]=["ReadableStream","Request","Response","Headers"].map(Aa),wZ=t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I0(t,e,{allOwnKeys:n=!1}={}){if(t===null||typeof t>"u")return;let r,s;if(typeof t!="object"&&(t=[t]),Dh(t))for(r=0,s=t.length;r0;)if(s=n[r],e===s.toLowerCase())return s;return null}const fu=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,pz=t=>!ph(t)&&t!==fu;function A3(){const{caseless:t,skipUndefined:e}=pz(this)&&this||{},n={},r=(s,i)=>{const a=t&&mz(n,i)||i;Xx(n[a])&&Xx(s)?n[a]=A3(n[a],s):Xx(s)?n[a]=A3({},s):Dh(s)?n[a]=s.slice():(!e||!ph(s))&&(n[a]=s)};for(let s=0,i=arguments.length;s(I0(e,(s,i)=>{n&&ni(s)?t[i]=uz(s,n):t[i]=s},{allOwnKeys:r}),t),kZ=t=>(t.charCodeAt(0)===65279&&(t=t.slice(1)),t),OZ=(t,e,n,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),n&&Object.assign(t.prototype,n)},jZ=(t,e,n,r)=>{let s,i,a;const o={};if(e=e||{},t==null)return e;do{for(s=Object.getOwnPropertyNames(t),i=s.length;i-- >0;)a=s[i],(!r||r(a,t,e))&&!o[a]&&(e[a]=t[a],o[a]=!0);t=n!==!1&&t6(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},NZ=(t,e,n)=>{t=String(t),(n===void 0||n>t.length)&&(n=t.length),n-=e.length;const r=t.indexOf(e,n);return r!==-1&&r===n},CZ=t=>{if(!t)return null;if(Dh(t))return t;let e=t.length;if(!fz(e))return null;const n=new Array(e);for(;e-- >0;)n[e]=t[e];return n},TZ=(t=>e=>t&&e instanceof t)(typeof Uint8Array<"u"&&t6(Uint8Array)),EZ=(t,e)=>{const r=(t&&t[Dv]).call(t);let s;for(;(s=r.next())&&!s.done;){const i=s.value;e.call(t,i[0],i[1])}},_Z=(t,e)=>{let n;const r=[];for(;(n=t.exec(e))!==null;)r.push(n);return r},MZ=Aa("HTMLFormElement"),AZ=t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),UC=(({hasOwnProperty:t})=>(e,n)=>t.call(e,n))(Object.prototype),RZ=Aa("RegExp"),gz=(t,e)=>{const n=Object.getOwnPropertyDescriptors(t),r={};I0(n,(s,i)=>{let a;(a=e(s,i,t))!==!1&&(r[i]=a||s)}),Object.defineProperties(t,r)},DZ=t=>{gz(t,(e,n)=>{if(ni(t)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=t[n];if(ni(r)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},zZ=(t,e)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Dh(t)?r(t):r(String(t).split(e)),n},PZ=()=>{},LZ=(t,e)=>t!=null&&Number.isFinite(t=+t)?t:e;function IZ(t){return!!(t&&ni(t.append)&&t[dz]==="FormData"&&t[Dv])}const BZ=t=>{const e=new Array(10),n=(r,s)=>{if(L0(r)){if(e.indexOf(r)>=0)return;if(P0(r))return r;if(!("toJSON"in r)){e[s]=r;const i=Dh(r)?[]:{};return I0(r,(a,o)=>{const c=n(a,s+1);!ph(c)&&(i[o]=c)}),e[s]=void 0,i}}return r};return n(t,0)},qZ=Aa("AsyncFunction"),FZ=t=>t&&(L0(t)||ni(t))&&ni(t.then)&&ni(t.catch),xz=((t,e)=>t?setImmediate:e?((n,r)=>(fu.addEventListener("message",({source:s,data:i})=>{s===fu&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),fu.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",ni(fu.postMessage)),$Z=typeof queueMicrotask<"u"?queueMicrotask.bind(fu):typeof process<"u"&&process.nextTick||xz,QZ=t=>t!=null&&ni(t[Dv]),Oe={isArray:Dh,isArrayBuffer:hz,isBuffer:P0,isFormData:pZ,isArrayBufferView:aZ,isString:lZ,isNumber:fz,isBoolean:oZ,isObject:L0,isPlainObject:Xx,isEmptyObject:cZ,isReadableStream:xZ,isRequest:vZ,isResponse:yZ,isHeaders:bZ,isUndefined:ph,isDate:uZ,isFile:dZ,isBlob:hZ,isRegExp:RZ,isFunction:ni,isStream:mZ,isURLSearchParams:gZ,isTypedArray:TZ,isFileList:fZ,forEach:I0,merge:A3,extend:SZ,trim:wZ,stripBOM:kZ,inherits:OZ,toFlatObject:jZ,kindOf:zv,kindOfTest:Aa,endsWith:NZ,toArray:CZ,forEachEntry:EZ,matchAll:_Z,isHTMLForm:MZ,hasOwnProperty:UC,hasOwnProp:UC,reduceDescriptors:gz,freezeMethods:DZ,toObjectSet:zZ,toCamelCase:AZ,noop:PZ,toFiniteNumber:LZ,findKey:mz,global:fu,isContextDefined:pz,isSpecCompliantForm:IZ,toJSONObject:BZ,isAsyncFn:qZ,isThenable:FZ,setImmediate:xz,asap:$Z,isIterable:QZ};function Bt(t,e,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}Oe.inherits(Bt,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Oe.toJSONObject(this.config),code:this.code,status:this.status}}});const vz=Bt.prototype,yz={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(t=>{yz[t]={value:t}});Object.defineProperties(Bt,yz);Object.defineProperty(vz,"isAxiosError",{value:!0});Bt.from=(t,e,n,r,s,i)=>{const a=Object.create(vz);Oe.toFlatObject(t,a,function(f){return f!==Error.prototype},h=>h!=="isAxiosError");const o=t&&t.message?t.message:"Error",c=e==null&&t?t.code:e;return Bt.call(a,o,c,n,r,s),t&&a.cause==null&&Object.defineProperty(a,"cause",{value:t,configurable:!0}),a.name=t&&t.name||"Error",i&&Object.assign(a,i),a};const HZ=null;function R3(t){return Oe.isPlainObject(t)||Oe.isArray(t)}function bz(t){return Oe.endsWith(t,"[]")?t.slice(0,-2):t}function WC(t,e,n){return t?t.concat(e).map(function(s,i){return s=bz(s),!n&&i?"["+s+"]":s}).join(n?".":""):e}function VZ(t){return Oe.isArray(t)&&!t.some(R3)}const UZ=Oe.toFlatObject(Oe,{},null,function(e){return/^is[A-Z]/.test(e)});function Lv(t,e,n){if(!Oe.isObject(t))throw new TypeError("target must be an object");e=e||new FormData,n=Oe.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(w,S){return!Oe.isUndefined(S[w])});const r=n.metaTokens,s=n.visitor||f,i=n.dots,a=n.indexes,c=(n.Blob||typeof Blob<"u"&&Blob)&&Oe.isSpecCompliantForm(e);if(!Oe.isFunction(s))throw new TypeError("visitor must be a function");function h(y){if(y===null)return"";if(Oe.isDate(y))return y.toISOString();if(Oe.isBoolean(y))return y.toString();if(!c&&Oe.isBlob(y))throw new Bt("Blob is not supported. Use a Buffer instead.");return Oe.isArrayBuffer(y)||Oe.isTypedArray(y)?c&&typeof Blob=="function"?new Blob([y]):Buffer.from(y):y}function f(y,w,S){let k=y;if(y&&!S&&typeof y=="object"){if(Oe.endsWith(w,"{}"))w=r?w:w.slice(0,-2),y=JSON.stringify(y);else if(Oe.isArray(y)&&VZ(y)||(Oe.isFileList(y)||Oe.endsWith(w,"[]"))&&(k=Oe.toArray(y)))return w=bz(w),k.forEach(function(C,T){!(Oe.isUndefined(C)||C===null)&&e.append(a===!0?WC([w],T,i):a===null?w:w+"[]",h(C))}),!1}return R3(y)?!0:(e.append(WC(S,w,i),h(y)),!1)}const m=[],g=Object.assign(UZ,{defaultVisitor:f,convertValue:h,isVisitable:R3});function x(y,w){if(!Oe.isUndefined(y)){if(m.indexOf(y)!==-1)throw Error("Circular reference detected in "+w.join("."));m.push(y),Oe.forEach(y,function(k,N){(!(Oe.isUndefined(k)||k===null)&&s.call(e,k,Oe.isString(N)?N.trim():N,w,g))===!0&&x(k,w?w.concat(N):[N])}),m.pop()}}if(!Oe.isObject(t))throw new TypeError("data must be an object");return x(t),e}function GC(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,function(r){return e[r]})}function n6(t,e){this._pairs=[],t&&Lv(t,this,e)}const wz=n6.prototype;wz.append=function(e,n){this._pairs.push([e,n])};wz.toString=function(e){const n=e?function(r){return e.call(this,r,GC)}:GC;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function WZ(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Sz(t,e,n){if(!e)return t;const r=n&&n.encode||WZ;Oe.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(e,n):i=Oe.isURLSearchParams(e)?e.toString():new n6(e,n).toString(r),i){const a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+i}return t}class XC{constructor(){this.handlers=[]}use(e,n,r){return this.handlers.push({fulfilled:e,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Oe.forEach(this.handlers,function(r){r!==null&&e(r)})}}const kz={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},GZ=typeof URLSearchParams<"u"?URLSearchParams:n6,XZ=typeof FormData<"u"?FormData:null,YZ=typeof Blob<"u"?Blob:null,KZ={isBrowser:!0,classes:{URLSearchParams:GZ,FormData:XZ,Blob:YZ},protocols:["http","https","file","blob","url","data"]},r6=typeof window<"u"&&typeof document<"u",D3=typeof navigator=="object"&&navigator||void 0,ZZ=r6&&(!D3||["ReactNative","NativeScript","NS"].indexOf(D3.product)<0),JZ=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",eJ=r6&&window.location.href||"http://localhost",tJ=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:r6,hasStandardBrowserEnv:ZZ,hasStandardBrowserWebWorkerEnv:JZ,navigator:D3,origin:eJ},Symbol.toStringTag,{value:"Module"})),ws={...tJ,...KZ};function nJ(t,e){return Lv(t,new ws.classes.URLSearchParams,{visitor:function(n,r,s,i){return ws.isNode&&Oe.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...e})}function rJ(t){return Oe.matchAll(/\w+|\[(\w*)]/g,t).map(e=>e[0]==="[]"?"":e[1]||e[0])}function sJ(t){const e={},n=Object.keys(t);let r;const s=n.length;let i;for(r=0;r=n.length;return a=!a&&Oe.isArray(s)?s.length:a,c?(Oe.hasOwnProp(s,a)?s[a]=[s[a],r]:s[a]=r,!o):((!s[a]||!Oe.isObject(s[a]))&&(s[a]=[]),e(n,r,s[a],i)&&Oe.isArray(s[a])&&(s[a]=sJ(s[a])),!o)}if(Oe.isFormData(t)&&Oe.isFunction(t.entries)){const n={};return Oe.forEachEntry(t,(r,s)=>{e(rJ(r),s,n,0)}),n}return null}function iJ(t,e,n){if(Oe.isString(t))try{return(e||JSON.parse)(t),Oe.trim(t)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(t)}const B0={transitional:kz,adapter:["xhr","http","fetch"],transformRequest:[function(e,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=Oe.isObject(e);if(i&&Oe.isHTMLForm(e)&&(e=new FormData(e)),Oe.isFormData(e))return s?JSON.stringify(Oz(e)):e;if(Oe.isArrayBuffer(e)||Oe.isBuffer(e)||Oe.isStream(e)||Oe.isFile(e)||Oe.isBlob(e)||Oe.isReadableStream(e))return e;if(Oe.isArrayBufferView(e))return e.buffer;if(Oe.isURLSearchParams(e))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return nJ(e,this.formSerializer).toString();if((o=Oe.isFileList(e))||r.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return Lv(o?{"files[]":e}:e,c&&new c,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),iJ(e)):e}],transformResponse:[function(e){const n=this.transitional||B0.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(Oe.isResponse(e)||Oe.isReadableStream(e))return e;if(e&&Oe.isString(e)&&(r&&!this.responseType||s)){const a=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(e,this.parseReviver)}catch(o){if(a)throw o.name==="SyntaxError"?Bt.from(o,Bt.ERR_BAD_RESPONSE,this,null,this.response):o}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:ws.classes.FormData,Blob:ws.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Oe.forEach(["delete","get","head","post","put","patch"],t=>{B0.headers[t]={}});const aJ=Oe.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),lJ=t=>{const e={};let n,r,s;return t&&t.split(` +`).forEach(function(a){s=a.indexOf(":"),n=a.substring(0,s).trim().toLowerCase(),r=a.substring(s+1).trim(),!(!n||e[n]&&aJ[n])&&(n==="set-cookie"?e[n]?e[n].push(r):e[n]=[r]:e[n]=e[n]?e[n]+", "+r:r)}),e},YC=Symbol("internals");function Xf(t){return t&&String(t).trim().toLowerCase()}function Yx(t){return t===!1||t==null?t:Oe.isArray(t)?t.map(Yx):String(t)}function oJ(t){const e=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(t);)e[r[1]]=r[2];return e}const cJ=t=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim());function tw(t,e,n,r,s){if(Oe.isFunction(r))return r.call(this,e,n);if(s&&(e=n),!!Oe.isString(e)){if(Oe.isString(r))return e.indexOf(r)!==-1;if(Oe.isRegExp(r))return r.test(e)}}function uJ(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,n,r)=>n.toUpperCase()+r)}function dJ(t,e){const n=Oe.toCamelCase(" "+e);["get","set","has"].forEach(r=>{Object.defineProperty(t,r+n,{value:function(s,i,a){return this[r].call(this,e,s,i,a)},configurable:!0})})}let ri=class{constructor(e){e&&this.set(e)}set(e,n,r){const s=this;function i(o,c,h){const f=Xf(c);if(!f)throw new Error("header name must be a non-empty string");const m=Oe.findKey(s,f);(!m||s[m]===void 0||h===!0||h===void 0&&s[m]!==!1)&&(s[m||c]=Yx(o))}const a=(o,c)=>Oe.forEach(o,(h,f)=>i(h,f,c));if(Oe.isPlainObject(e)||e instanceof this.constructor)a(e,n);else if(Oe.isString(e)&&(e=e.trim())&&!cJ(e))a(lJ(e),n);else if(Oe.isObject(e)&&Oe.isIterable(e)){let o={},c,h;for(const f of e){if(!Oe.isArray(f))throw TypeError("Object iterator must return a key-value pair");o[h=f[0]]=(c=o[h])?Oe.isArray(c)?[...c,f[1]]:[c,f[1]]:f[1]}a(o,n)}else e!=null&&i(n,e,r);return this}get(e,n){if(e=Xf(e),e){const r=Oe.findKey(this,e);if(r){const s=this[r];if(!n)return s;if(n===!0)return oJ(s);if(Oe.isFunction(n))return n.call(this,s,r);if(Oe.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,n){if(e=Xf(e),e){const r=Oe.findKey(this,e);return!!(r&&this[r]!==void 0&&(!n||tw(this,this[r],r,n)))}return!1}delete(e,n){const r=this;let s=!1;function i(a){if(a=Xf(a),a){const o=Oe.findKey(r,a);o&&(!n||tw(r,r[o],o,n))&&(delete r[o],s=!0)}}return Oe.isArray(e)?e.forEach(i):i(e),s}clear(e){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!e||tw(this,this[i],i,e,!0))&&(delete this[i],s=!0)}return s}normalize(e){const n=this,r={};return Oe.forEach(this,(s,i)=>{const a=Oe.findKey(r,i);if(a){n[a]=Yx(s),delete n[i];return}const o=e?uJ(i):String(i).trim();o!==i&&delete n[i],n[o]=Yx(s),r[o]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const n=Object.create(null);return Oe.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=e&&Oe.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,n])=>e+": "+n).join(` +`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(s=>r.set(s)),r}static accessor(e){const r=(this[YC]=this[YC]={accessors:{}}).accessors,s=this.prototype;function i(a){const o=Xf(a);r[o]||(dJ(s,a),r[o]=!0)}return Oe.isArray(e)?e.forEach(i):i(e),this}};ri.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Oe.reduceDescriptors(ri.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}});Oe.freezeMethods(ri);function nw(t,e){const n=this||B0,r=e||n,s=ri.from(r.headers);let i=r.data;return Oe.forEach(t,function(o){i=o.call(n,i,s.normalize(),e?e.status:void 0)}),s.normalize(),i}function jz(t){return!!(t&&t.__CANCEL__)}function zh(t,e,n){Bt.call(this,t??"canceled",Bt.ERR_CANCELED,e,n),this.name="CanceledError"}Oe.inherits(zh,Bt,{__CANCEL__:!0});function Nz(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new Bt("Request failed with status code "+n.status,[Bt.ERR_BAD_REQUEST,Bt.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function hJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function fJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let s=0,i=0,a;return e=e!==void 0?e:1e3,function(c){const h=Date.now(),f=r[i];a||(a=h),n[s]=c,r[s]=h;let m=i,g=0;for(;m!==s;)g+=n[m++],m=m%t;if(s=(s+1)%t,s===i&&(i=(i+1)%t),h-a{n=f,s=null,i&&(clearTimeout(i),i=null),t(...h)};return[(...h)=>{const f=Date.now(),m=f-n;m>=r?a(h,f):(s=h,i||(i=setTimeout(()=>{i=null,a(s)},r-m)))},()=>s&&a(s)]}const N1=(t,e,n=3)=>{let r=0;const s=fJ(50,250);return mJ(i=>{const a=i.loaded,o=i.lengthComputable?i.total:void 0,c=a-r,h=s(c),f=a<=o;r=a;const m={loaded:a,total:o,progress:o?a/o:void 0,bytes:c,rate:h||void 0,estimated:h&&o&&f?(o-a)/h:void 0,event:i,lengthComputable:o!=null,[e?"download":"upload"]:!0};t(m)},n)},KC=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},ZC=t=>(...e)=>Oe.asap(()=>t(...e)),pJ=ws.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,ws.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(ws.origin),ws.navigator&&/(msie|trident)/i.test(ws.navigator.userAgent)):()=>!0,gJ=ws.hasStandardBrowserEnv?{write(t,e,n,r,s,i,a){if(typeof document>"u")return;const o=[`${t}=${encodeURIComponent(e)}`];Oe.isNumber(n)&&o.push(`expires=${new Date(n).toUTCString()}`),Oe.isString(r)&&o.push(`path=${r}`),Oe.isString(s)&&o.push(`domain=${s}`),i===!0&&o.push("secure"),Oe.isString(a)&&o.push(`SameSite=${a}`),document.cookie=o.join("; ")},read(t){if(typeof document>"u")return null;const e=document.cookie.match(new RegExp("(?:^|; )"+t+"=([^;]*)"));return e?decodeURIComponent(e[1]):null},remove(t){this.write(t,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function xJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function vJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function Cz(t,e,n){let r=!xJ(e);return t&&(r||n==!1)?vJ(t,e):e}const JC=t=>t instanceof ri?{...t}:t;function Cu(t,e){e=e||{};const n={};function r(h,f,m,g){return Oe.isPlainObject(h)&&Oe.isPlainObject(f)?Oe.merge.call({caseless:g},h,f):Oe.isPlainObject(f)?Oe.merge({},f):Oe.isArray(f)?f.slice():f}function s(h,f,m,g){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h,m,g)}else return r(h,f,m,g)}function i(h,f){if(!Oe.isUndefined(f))return r(void 0,f)}function a(h,f){if(Oe.isUndefined(f)){if(!Oe.isUndefined(h))return r(void 0,h)}else return r(void 0,f)}function o(h,f,m){if(m in e)return r(h,f);if(m in t)return r(void 0,h)}const c={url:i,method:i,data:i,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(h,f,m)=>s(JC(h),JC(f),m,!0)};return Oe.forEach(Object.keys({...t,...e}),function(f){const m=c[f]||s,g=m(t[f],e[f],f);Oe.isUndefined(g)&&m!==o||(n[f]=g)}),n}const Tz=t=>{const e=Cu({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:a,auth:o}=e;if(e.headers=a=ri.from(a),e.url=Sz(Cz(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),o&&a.set("Authorization","Basic "+btoa((o.username||"")+":"+(o.password?unescape(encodeURIComponent(o.password)):""))),Oe.isFormData(n)){if(ws.hasStandardBrowserEnv||ws.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(Oe.isFunction(n.getHeaders)){const c=n.getHeaders(),h=["content-type","content-length"];Object.entries(c).forEach(([f,m])=>{h.includes(f.toLowerCase())&&a.set(f,m)})}}if(ws.hasStandardBrowserEnv&&(r&&Oe.isFunction(r)&&(r=r(e)),r||r!==!1&&pJ(e.url))){const c=s&&i&&gJ.read(i);c&&a.set(s,c)}return e},yJ=typeof XMLHttpRequest<"u",bJ=yJ&&function(t){return new Promise(function(n,r){const s=Tz(t);let i=s.data;const a=ri.from(s.headers).normalize();let{responseType:o,onUploadProgress:c,onDownloadProgress:h}=s,f,m,g,x,y;function w(){x&&x(),y&&y(),s.cancelToken&&s.cancelToken.unsubscribe(f),s.signal&&s.signal.removeEventListener("abort",f)}let S=new XMLHttpRequest;S.open(s.method.toUpperCase(),s.url,!0),S.timeout=s.timeout;function k(){if(!S)return;const C=ri.from("getAllResponseHeaders"in S&&S.getAllResponseHeaders()),_={data:!o||o==="text"||o==="json"?S.responseText:S.response,status:S.status,statusText:S.statusText,headers:C,config:t,request:S};Nz(function(M){n(M),w()},function(M){r(M),w()},_),S=null}"onloadend"in S?S.onloadend=k:S.onreadystatechange=function(){!S||S.readyState!==4||S.status===0&&!(S.responseURL&&S.responseURL.indexOf("file:")===0)||setTimeout(k)},S.onabort=function(){S&&(r(new Bt("Request aborted",Bt.ECONNABORTED,t,S)),S=null)},S.onerror=function(T){const _=T&&T.message?T.message:"Network Error",E=new Bt(_,Bt.ERR_NETWORK,t,S);E.event=T||null,r(E),S=null},S.ontimeout=function(){let T=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const _=s.transitional||kz;s.timeoutErrorMessage&&(T=s.timeoutErrorMessage),r(new Bt(T,_.clarifyTimeoutError?Bt.ETIMEDOUT:Bt.ECONNABORTED,t,S)),S=null},i===void 0&&a.setContentType(null),"setRequestHeader"in S&&Oe.forEach(a.toJSON(),function(T,_){S.setRequestHeader(_,T)}),Oe.isUndefined(s.withCredentials)||(S.withCredentials=!!s.withCredentials),o&&o!=="json"&&(S.responseType=s.responseType),h&&([g,y]=N1(h,!0),S.addEventListener("progress",g)),c&&S.upload&&([m,x]=N1(c),S.upload.addEventListener("progress",m),S.upload.addEventListener("loadend",x)),(s.cancelToken||s.signal)&&(f=C=>{S&&(r(!C||C.type?new zh(null,t,S):C),S.abort(),S=null)},s.cancelToken&&s.cancelToken.subscribe(f),s.signal&&(s.signal.aborted?f():s.signal.addEventListener("abort",f)));const N=hJ(s.url);if(N&&ws.protocols.indexOf(N)===-1){r(new Bt("Unsupported protocol "+N+":",Bt.ERR_BAD_REQUEST,t));return}S.send(i||null)})},wJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,s;const i=function(h){if(!s){s=!0,o();const f=h instanceof Error?h:this.reason;r.abort(f instanceof Bt?f:new zh(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,i(new Bt(`timeout ${e} of ms exceeded`,Bt.ETIMEDOUT))},e);const o=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),t=null)};t.forEach(h=>h.addEventListener("abort",i));const{signal:c}=r;return c.unsubscribe=()=>Oe.asap(o),c}},SJ=function*(t,e){let n=t.byteLength;if(n{const s=kJ(t,e);let i=0,a,o=c=>{a||(a=!0,r&&r(c))};return new ReadableStream({async pull(c){try{const{done:h,value:f}=await s.next();if(h){o(),c.close();return}let m=f.byteLength;if(n){let g=i+=m;n(g)}c.enqueue(new Uint8Array(f))}catch(h){throw o(h),h}},cancel(c){return o(c),s.return()}},{highWaterMark:2})},t9=64*1024,{isFunction:Vg}=Oe,jJ=(({Request:t,Response:e})=>({Request:t,Response:e}))(Oe.global),{ReadableStream:n9,TextEncoder:r9}=Oe.global,s9=(t,...e)=>{try{return!!t(...e)}catch{return!1}},NJ=t=>{t=Oe.merge.call({skipUndefined:!0},jJ,t);const{fetch:e,Request:n,Response:r}=t,s=e?Vg(e):typeof fetch=="function",i=Vg(n),a=Vg(r);if(!s)return!1;const o=s&&Vg(n9),c=s&&(typeof r9=="function"?(y=>w=>y.encode(w))(new r9):async y=>new Uint8Array(await new n(y).arrayBuffer())),h=i&&o&&s9(()=>{let y=!1;const w=new n(ws.origin,{body:new n9,method:"POST",get duplex(){return y=!0,"half"}}).headers.has("Content-Type");return y&&!w}),f=a&&o&&s9(()=>Oe.isReadableStream(new r("").body)),m={stream:f&&(y=>y.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(y=>{!m[y]&&(m[y]=(w,S)=>{let k=w&&w[y];if(k)return k.call(w);throw new Bt(`Response type '${y}' is not supported`,Bt.ERR_NOT_SUPPORT,S)})});const g=async y=>{if(y==null)return 0;if(Oe.isBlob(y))return y.size;if(Oe.isSpecCompliantForm(y))return(await new n(ws.origin,{method:"POST",body:y}).arrayBuffer()).byteLength;if(Oe.isArrayBufferView(y)||Oe.isArrayBuffer(y))return y.byteLength;if(Oe.isURLSearchParams(y)&&(y=y+""),Oe.isString(y))return(await c(y)).byteLength},x=async(y,w)=>{const S=Oe.toFiniteNumber(y.getContentLength());return S??g(w)};return async y=>{let{url:w,method:S,data:k,signal:N,cancelToken:C,timeout:T,onDownloadProgress:_,onUploadProgress:E,responseType:M,headers:q,withCredentials:L="same-origin",fetchOptions:I}=Tz(y),$=e||fetch;M=M?(M+"").toLowerCase():"text";let V=wJ([N,C&&C.toAbortSignal()],T),ee=null;const z=V&&V.unsubscribe&&(()=>{V.unsubscribe()});let H;try{if(E&&h&&S!=="get"&&S!=="head"&&(H=await x(q,k))!==0){let se=new n(w,{method:"POST",body:k,duplex:"half"}),G;if(Oe.isFormData(k)&&(G=se.headers.get("content-type"))&&q.setContentType(G),se.body){const[F,U]=KC(H,N1(ZC(E)));k=e9(se.body,t9,F,U)}}Oe.isString(L)||(L=L?"include":"omit");const P=i&&"credentials"in n.prototype,W={...I,signal:V,method:S.toUpperCase(),headers:q.normalize().toJSON(),body:k,duplex:"half",credentials:P?L:void 0};ee=i&&new n(w,W);let J=await(i?$(ee,I):$(w,W));const X=f&&(M==="stream"||M==="response");if(f&&(_||X&&z)){const se={};["status","statusText","headers"].forEach(te=>{se[te]=J[te]});const G=Oe.toFiniteNumber(J.headers.get("content-length")),[F,U]=_&&KC(G,N1(ZC(_),!0))||[];J=new r(e9(J.body,t9,F,()=>{U&&U(),z&&z()}),se)}M=M||"text";let R=await m[Oe.findKey(m,M)||"text"](J,y);return!X&&z&&z(),await new Promise((se,G)=>{Nz(se,G,{data:R,headers:ri.from(J.headers),status:J.status,statusText:J.statusText,config:y,request:ee})})}catch(P){throw z&&z(),P&&P.name==="TypeError"&&/Load failed|fetch/i.test(P.message)?Object.assign(new Bt("Network Error",Bt.ERR_NETWORK,y,ee),{cause:P.cause||P}):Bt.from(P,P&&P.code,y,ee)}}},CJ=new Map,Ez=t=>{let e=t&&t.env||{};const{fetch:n,Request:r,Response:s}=e,i=[r,s,n];let a=i.length,o=a,c,h,f=CJ;for(;o--;)c=i[o],h=f.get(c),h===void 0&&f.set(c,h=o?new Map:NJ(e)),f=h;return h};Ez();const s6={http:HZ,xhr:bJ,fetch:{get:Ez}};Oe.forEach(s6,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const i9=t=>`- ${t}`,TJ=t=>Oe.isFunction(t)||t===null||t===!1;function EJ(t,e){t=Oe.isArray(t)?t:[t];const{length:n}=t;let r,s;const i={};for(let a=0;a`adapter ${c} `+(h===!1?"is not supported by the environment":"is not available in the build"));let o=n?a.length>1?`since : +`+a.map(i9).join(` +`):" "+i9(a[0]):"as no adapter specified";throw new Bt("There is no suitable adapter to dispatch the request "+o,"ERR_NOT_SUPPORT")}return s}const _z={getAdapter:EJ,adapters:s6};function rw(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new zh(null,t)}function a9(t){return rw(t),t.headers=ri.from(t.headers),t.data=nw.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),_z.getAdapter(t.adapter||B0.adapter,t)(t).then(function(r){return rw(t),r.data=nw.call(t,t.transformResponse,r),r.headers=ri.from(r.headers),r},function(r){return jz(r)||(rw(t),r&&r.response&&(r.response.data=nw.call(t,t.transformResponse,r.response),r.response.headers=ri.from(r.response.headers))),Promise.reject(r)})}const Mz="1.13.2",Iv={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{Iv[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const l9={};Iv.transitional=function(e,n,r){function s(i,a){return"[Axios v"+Mz+"] Transitional option '"+i+"'"+a+(r?". "+r:"")}return(i,a,o)=>{if(e===!1)throw new Bt(s(a," has been removed"+(n?" in "+n:"")),Bt.ERR_DEPRECATED);return n&&!l9[a]&&(l9[a]=!0,console.warn(s(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(i,a,o):!0}};Iv.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function _J(t,e,n){if(typeof t!="object")throw new Bt("options must be an object",Bt.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let s=r.length;for(;s-- >0;){const i=r[s],a=e[i];if(a){const o=t[i],c=o===void 0||a(o,i,t);if(c!==!0)throw new Bt("option "+i+" must be "+c,Bt.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Bt("Unknown option "+i,Bt.ERR_BAD_OPTION)}}const Kx={assertOptions:_J,validators:Iv},Fa=Kx.validators;let wu=class{constructor(e){this.defaults=e||{},this.interceptors={request:new XC,response:new XC}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+i):r.stack=i}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Cu(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&Kx.assertOptions(r,{silentJSONParsing:Fa.transitional(Fa.boolean),forcedJSONParsing:Fa.transitional(Fa.boolean),clarifyTimeoutError:Fa.transitional(Fa.boolean)},!1),s!=null&&(Oe.isFunction(s)?n.paramsSerializer={serialize:s}:Kx.assertOptions(s,{encode:Fa.function,serialize:Fa.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Kx.assertOptions(n,{baseUrl:Fa.spelling("baseURL"),withXsrfToken:Fa.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=i&&Oe.merge(i.common,i[n.method]);i&&Oe.forEach(["delete","get","head","post","put","patch","common"],y=>{delete i[y]}),n.headers=ri.concat(a,i);const o=[];let c=!0;this.interceptors.request.forEach(function(w){typeof w.runWhen=="function"&&w.runWhen(n)===!1||(c=c&&w.synchronous,o.unshift(w.fulfilled,w.rejected))});const h=[];this.interceptors.response.forEach(function(w){h.push(w.fulfilled,w.rejected)});let f,m=0,g;if(!c){const y=[a9.bind(this),void 0];for(y.unshift(...o),y.push(...h),g=y.length,f=Promise.resolve(n);m{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const a=new Promise(o=>{r.subscribe(o),i=o}).then(s);return a.cancel=function(){r.unsubscribe(i)},a},e(function(i,a,o){r.reason||(r.reason=new zh(i,a,o),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new Az(function(s){e=s}),cancel:e}}};function AJ(t){return function(n){return t.apply(null,n)}}function RJ(t){return Oe.isObject(t)&&t.isAxiosError===!0}const z3={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(z3).forEach(([t,e])=>{z3[e]=t});function Rz(t){const e=new wu(t),n=uz(wu.prototype.request,e);return Oe.extend(n,wu.prototype,e,{allOwnKeys:!0}),Oe.extend(n,e,null,{allOwnKeys:!0}),n.create=function(s){return Rz(Cu(t,s))},n}const br=Rz(B0);br.Axios=wu;br.CanceledError=zh;br.CancelToken=MJ;br.isCancel=jz;br.VERSION=Mz;br.toFormData=Lv;br.AxiosError=Bt;br.Cancel=br.CanceledError;br.all=function(e){return Promise.all(e)};br.spread=AJ;br.isAxiosError=RJ;br.mergeConfig=Cu;br.AxiosHeaders=ri;br.formToJSON=t=>Oz(Oe.isHTMLForm(t)?new FormData(t):t);br.getAdapter=_z.getAdapter;br.HttpStatusCode=z3;br.default=br;const{Axios:VTe,AxiosError:UTe,CanceledError:WTe,isCancel:GTe,CancelToken:XTe,VERSION:YTe,all:KTe,Cancel:ZTe,isAxiosError:JTe,spread:eEe,toFormData:tEe,AxiosHeaders:nEe,HttpStatusCode:rEe,formToJSON:sEe,getAdapter:iEe,mergeConfig:aEe}=br,DJ=(t,e)=>{const n=new Array(t.length+e.length);for(let r=0;r({classGroupId:t,validator:e}),Dz=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),C1="-",o9=[],PJ="arbitrary..",LJ=t=>{const e=BJ(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return IJ(a);const o=a.split(C1),c=o[0]===""&&o.length>1?1:0;return zz(o,c,e)},getConflictingClassGroupIds:(a,o)=>{if(o){const c=r[a],h=n[a];return c?h?DJ(h,c):c:h||o9}return n[a]||o9}}},zz=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],i=n.nextPart.get(s);if(i){const h=zz(t,e+1,i);if(h)return h}const a=n.validators;if(a===null)return;const o=e===0?t.join(C1):t.slice(e).join(C1),c=a.length;for(let h=0;ht.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),r=e.slice(0,n);return r?PJ+r:void 0})(),BJ=t=>{const{theme:e,classGroups:n}=t;return qJ(n,e)},qJ=(t,e)=>{const n=Dz();for(const r in t){const s=t[r];i6(s,n,r,e)}return n},i6=(t,e,n,r)=>{const s=t.length;for(let i=0;i{if(typeof t=="string"){$J(t,e,n);return}if(typeof t=="function"){QJ(t,e,n,r);return}HJ(t,e,n,r)},$J=(t,e,n)=>{const r=t===""?e:Pz(e,t);r.classGroupId=n},QJ=(t,e,n,r)=>{if(VJ(t)){i6(t(r),e,n,r);return}e.validators===null&&(e.validators=[]),e.validators.push(zJ(n,t))},HJ=(t,e,n,r)=>{const s=Object.entries(t),i=s.length;for(let a=0;a{let n=t;const r=e.split(C1),s=r.length;for(let i=0;i"isThemeGetter"in t&&t.isThemeGetter===!0,UJ=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),r=Object.create(null);const s=(i,a)=>{n[i]=a,e++,e>t&&(e=0,r=n,n=Object.create(null))};return{get(i){let a=n[i];if(a!==void 0)return a;if((a=r[i])!==void 0)return s(i,a),a},set(i,a){i in n?n[i]=a:s(i,a)}}},P3="!",c9=":",WJ=[],u9=(t,e,n,r,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:r,isExternal:s}),GJ=t=>{const{prefix:e,experimentalParseClassName:n}=t;let r=s=>{const i=[];let a=0,o=0,c=0,h;const f=s.length;for(let w=0;wc?h-c:void 0;return u9(i,x,g,y)};if(e){const s=e+c9,i=r;r=a=>a.startsWith(s)?i(a.slice(s.length)):u9(WJ,!1,a,void 0,!0)}if(n){const s=r;r=i=>n({className:i,parseClassName:s})}return r},XJ=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,r)=>{e.set(n,1e6+r)}),n=>{const r=[];let s=[];for(let i=0;i0&&(s.sort(),r.push(...s),s=[]),r.push(a)):s.push(a)}return s.length>0&&(s.sort(),r.push(...s)),r}},YJ=t=>({cache:UJ(t.cacheSize),parseClassName:GJ(t),sortModifiers:XJ(t),...LJ(t)}),KJ=/\s+/,ZJ=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s,sortModifiers:i}=e,a=[],o=t.trim().split(KJ);let c="";for(let h=o.length-1;h>=0;h-=1){const f=o[h],{isExternal:m,modifiers:g,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:w}=n(f);if(m){c=f+(c.length>0?" "+c:c);continue}let S=!!w,k=r(S?y.substring(0,w):y);if(!k){if(!S){c=f+(c.length>0?" "+c:c);continue}if(k=r(y),!k){c=f+(c.length>0?" "+c:c);continue}S=!1}const N=g.length===0?"":g.length===1?g[0]:i(g).join(":"),C=x?N+P3:N,T=C+k;if(a.indexOf(T)>-1)continue;a.push(T);const _=s(k,S);for(let E=0;E<_.length;++E){const M=_[E];a.push(C+M)}c=f+(c.length>0?" "+c:c)}return c},JJ=(...t)=>{let e=0,n,r,s="";for(;e{if(typeof t=="string")return t;let e,n="";for(let r=0;r{let n,r,s,i;const a=c=>{const h=e.reduce((f,m)=>m(f),t());return n=YJ(h),r=n.cache.get,s=n.cache.set,i=o,o(c)},o=c=>{const h=r(c);if(h)return h;const f=ZJ(c,n);return s(c,f),f};return i=a,(...c)=>i(JJ(...c))},tee=[],Qr=t=>{const e=n=>n[t]||tee;return e.isThemeGetter=!0,e},Iz=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Bz=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nee=/^\d+\/\d+$/,ree=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,see=/\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$/,iee=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,aee=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,lee=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Nd=t=>nee.test(t),Qt=t=>!!t&&!Number.isNaN(Number(t)),Zo=t=>!!t&&Number.isInteger(Number(t)),sw=t=>t.endsWith("%")&&Qt(t.slice(0,-1)),$l=t=>ree.test(t),oee=()=>!0,cee=t=>see.test(t)&&!iee.test(t),qz=()=>!1,uee=t=>aee.test(t),dee=t=>lee.test(t),hee=t=>!it(t)&&!at(t),fee=t=>Ph(t,Qz,qz),it=t=>Iz.test(t),nu=t=>Ph(t,Hz,cee),iw=t=>Ph(t,vee,Qt),d9=t=>Ph(t,Fz,qz),mee=t=>Ph(t,$z,dee),Ug=t=>Ph(t,Vz,uee),at=t=>Bz.test(t),Yf=t=>Lh(t,Hz),pee=t=>Lh(t,yee),h9=t=>Lh(t,Fz),gee=t=>Lh(t,Qz),xee=t=>Lh(t,$z),Wg=t=>Lh(t,Vz,!0),Ph=(t,e,n)=>{const r=Iz.exec(t);return r?r[1]?e(r[1]):n(r[2]):!1},Lh=(t,e,n=!1)=>{const r=Bz.exec(t);return r?r[1]?e(r[1]):n:!1},Fz=t=>t==="position"||t==="percentage",$z=t=>t==="image"||t==="url",Qz=t=>t==="length"||t==="size"||t==="bg-size",Hz=t=>t==="length",vee=t=>t==="number",yee=t=>t==="family-name",Vz=t=>t==="shadow",bee=()=>{const t=Qr("color"),e=Qr("font"),n=Qr("text"),r=Qr("font-weight"),s=Qr("tracking"),i=Qr("leading"),a=Qr("breakpoint"),o=Qr("container"),c=Qr("spacing"),h=Qr("radius"),f=Qr("shadow"),m=Qr("inset-shadow"),g=Qr("text-shadow"),x=Qr("drop-shadow"),y=Qr("blur"),w=Qr("perspective"),S=Qr("aspect"),k=Qr("ease"),N=Qr("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],_=()=>[...T(),at,it],E=()=>["auto","hidden","clip","visible","scroll"],M=()=>["auto","contain","none"],q=()=>[at,it,c],L=()=>[Nd,"full","auto",...q()],I=()=>[Zo,"none","subgrid",at,it],$=()=>["auto",{span:["full",Zo,at,it]},Zo,at,it],V=()=>[Zo,"auto",at,it],ee=()=>["auto","min","max","fr",at,it],z=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],P=()=>["auto",...q()],W=()=>[Nd,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],J=()=>[t,at,it],X=()=>[...T(),h9,d9,{position:[at,it]}],R=()=>["no-repeat",{repeat:["","x","y","space","round"]}],se=()=>["auto","cover","contain",gee,fee,{size:[at,it]}],G=()=>[sw,Yf,nu],F=()=>["","none","full",h,at,it],U=()=>["",Qt,Yf,nu],te=()=>["solid","dashed","dotted","double"],ne=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>[Qt,sw,h9,d9],ae=()=>["","none",y,at,it],re=()=>["none",Qt,at,it],le=()=>["none",Qt,at,it],_e=()=>[Qt,at,it],Ge=()=>[Nd,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[$l],breakpoint:[$l],color:[oee],container:[$l],"drop-shadow":[$l],ease:["in","out","in-out"],font:[hee],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[$l],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[$l],shadow:[$l],spacing:["px",Qt],text:[$l],"text-shadow":[$l],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Nd,it,at,S]}],container:["container"],columns:[{columns:[Qt,it,at,o]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:_()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:M()}],"overscroll-x":[{"overscroll-x":M()}],"overscroll-y":[{"overscroll-y":M()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:L()}],"inset-x":[{"inset-x":L()}],"inset-y":[{"inset-y":L()}],start:[{start:L()}],end:[{end:L()}],top:[{top:L()}],right:[{right:L()}],bottom:[{bottom:L()}],left:[{left:L()}],visibility:["visible","invisible","collapse"],z:[{z:[Zo,"auto",at,it]}],basis:[{basis:[Nd,"full","auto",o,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Qt,Nd,"auto","initial","none",it]}],grow:[{grow:["",Qt,at,it]}],shrink:[{shrink:["",Qt,at,it]}],order:[{order:[Zo,"first","last","none",at,it]}],"grid-cols":[{"grid-cols":I()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":I()}],"row-start-end":[{row:$()}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ee()}],"auto-rows":[{"auto-rows":ee()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...z(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...z()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":z()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:P()}],mx:[{mx:P()}],my:[{my:P()}],ms:[{ms:P()}],me:[{me:P()}],mt:[{mt:P()}],mr:[{mr:P()}],mb:[{mb:P()}],ml:[{ml:P()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:W()}],w:[{w:[o,"screen",...W()]}],"min-w":[{"min-w":[o,"screen","none",...W()]}],"max-w":[{"max-w":[o,"screen","none","prose",{screen:[a]},...W()]}],h:[{h:["screen","lh",...W()]}],"min-h":[{"min-h":["screen","lh","none",...W()]}],"max-h":[{"max-h":["screen","lh",...W()]}],"font-size":[{text:["base",n,Yf,nu]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[r,at,iw]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",sw,it]}],"font-family":[{font:[pee,it,e]}],"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,at,it]}],"line-clamp":[{"line-clamp":[Qt,"none",at,iw]}],leading:[{leading:[i,...q()]}],"list-image":[{"list-image":["none",at,it]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",at,it]}],"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:[...te(),"wavy"]}],"text-decoration-thickness":[{decoration:[Qt,"from-font","auto",at,nu]}],"text-decoration-color":[{decoration:J()}],"underline-offset":[{"underline-offset":[Qt,"auto",at,it]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",at,it]}],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",at,it]}],"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:R()}],"bg-size":[{bg:se()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Zo,at,it],radial:["",at,it],conic:[Zo,at,it]},xee,mee]}],"bg-color":[{bg:J()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:J()}],"gradient-via":[{via:J()}],"gradient-to":[{to:J()}],rounded:[{rounded:F()}],"rounded-s":[{"rounded-s":F()}],"rounded-e":[{"rounded-e":F()}],"rounded-t":[{"rounded-t":F()}],"rounded-r":[{"rounded-r":F()}],"rounded-b":[{"rounded-b":F()}],"rounded-l":[{"rounded-l":F()}],"rounded-ss":[{"rounded-ss":F()}],"rounded-se":[{"rounded-se":F()}],"rounded-ee":[{"rounded-ee":F()}],"rounded-es":[{"rounded-es":F()}],"rounded-tl":[{"rounded-tl":F()}],"rounded-tr":[{"rounded-tr":F()}],"rounded-br":[{"rounded-br":F()}],"rounded-bl":[{"rounded-bl":F()}],"border-w":[{border:U()}],"border-w-x":[{"border-x":U()}],"border-w-y":[{"border-y":U()}],"border-w-s":[{"border-s":U()}],"border-w-e":[{"border-e":U()}],"border-w-t":[{"border-t":U()}],"border-w-r":[{"border-r":U()}],"border-w-b":[{"border-b":U()}],"border-w-l":[{"border-l":U()}],"divide-x":[{"divide-x":U()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":U()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...te(),"hidden","none"]}],"divide-style":[{divide:[...te(),"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:[...te(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Qt,at,it]}],"outline-w":[{outline:["",Qt,Yf,nu]}],"outline-color":[{outline:J()}],shadow:[{shadow:["","none",f,Wg,Ug]}],"shadow-color":[{shadow:J()}],"inset-shadow":[{"inset-shadow":["none",m,Wg,Ug]}],"inset-shadow-color":[{"inset-shadow":J()}],"ring-w":[{ring:U()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:J()}],"ring-offset-w":[{"ring-offset":[Qt,nu]}],"ring-offset-color":[{"ring-offset":J()}],"inset-ring-w":[{"inset-ring":U()}],"inset-ring-color":[{"inset-ring":J()}],"text-shadow":[{"text-shadow":["none",g,Wg,Ug]}],"text-shadow-color":[{"text-shadow":J()}],opacity:[{opacity:[Qt,at,it]}],"mix-blend":[{"mix-blend":[...ne(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ne()}],"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":[Qt]}],"mask-image-linear-from-pos":[{"mask-linear-from":Y()}],"mask-image-linear-to-pos":[{"mask-linear-to":Y()}],"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":Y()}],"mask-image-t-to-pos":[{"mask-t-to":Y()}],"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":Y()}],"mask-image-r-to-pos":[{"mask-r-to":Y()}],"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":Y()}],"mask-image-b-to-pos":[{"mask-b-to":Y()}],"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":Y()}],"mask-image-l-to-pos":[{"mask-l-to":Y()}],"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":Y()}],"mask-image-x-to-pos":[{"mask-x-to":Y()}],"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":Y()}],"mask-image-y-to-pos":[{"mask-y-to":Y()}],"mask-image-y-from-color":[{"mask-y-from":J()}],"mask-image-y-to-color":[{"mask-y-to":J()}],"mask-image-radial":[{"mask-radial":[at,it]}],"mask-image-radial-from-pos":[{"mask-radial-from":Y()}],"mask-image-radial-to-pos":[{"mask-radial-to":Y()}],"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":T()}],"mask-image-conic-pos":[{"mask-conic":[Qt]}],"mask-image-conic-from-pos":[{"mask-conic-from":Y()}],"mask-image-conic-to-pos":[{"mask-conic-to":Y()}],"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:R()}],"mask-size":[{mask:se()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",at,it]}],filter:[{filter:["","none",at,it]}],blur:[{blur:ae()}],brightness:[{brightness:[Qt,at,it]}],contrast:[{contrast:[Qt,at,it]}],"drop-shadow":[{"drop-shadow":["","none",x,Wg,Ug]}],"drop-shadow-color":[{"drop-shadow":J()}],grayscale:[{grayscale:["",Qt,at,it]}],"hue-rotate":[{"hue-rotate":[Qt,at,it]}],invert:[{invert:["",Qt,at,it]}],saturate:[{saturate:[Qt,at,it]}],sepia:[{sepia:["",Qt,at,it]}],"backdrop-filter":[{"backdrop-filter":["","none",at,it]}],"backdrop-blur":[{"backdrop-blur":ae()}],"backdrop-brightness":[{"backdrop-brightness":[Qt,at,it]}],"backdrop-contrast":[{"backdrop-contrast":[Qt,at,it]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Qt,at,it]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Qt,at,it]}],"backdrop-invert":[{"backdrop-invert":["",Qt,at,it]}],"backdrop-opacity":[{"backdrop-opacity":[Qt,at,it]}],"backdrop-saturate":[{"backdrop-saturate":[Qt,at,it]}],"backdrop-sepia":[{"backdrop-sepia":["",Qt,at,it]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",at,it]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Qt,"initial",at,it]}],ease:[{ease:["linear","initial",k,at,it]}],delay:[{delay:[Qt,at,it]}],animate:[{animate:["none",N,at,it]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,at,it]}],"perspective-origin":[{"perspective-origin":_()}],rotate:[{rotate:re()}],"rotate-x":[{"rotate-x":re()}],"rotate-y":[{"rotate-y":re()}],"rotate-z":[{"rotate-z":re()}],scale:[{scale:le()}],"scale-x":[{"scale-x":le()}],"scale-y":[{"scale-y":le()}],"scale-z":[{"scale-z":le()}],"scale-3d":["scale-3d"],skew:[{skew:_e()}],"skew-x":[{"skew-x":_e()}],"skew-y":[{"skew-y":_e()}],transform:[{transform:[at,it,"","none","gpu","cpu"]}],"transform-origin":[{origin:_()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ge()}],"translate-x":[{"translate-x":Ge()}],"translate-y":[{"translate-y":Ge()}],"translate-z":[{"translate-z":Ge()}],"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",at,it]}],"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":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"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",at,it]}],fill:[{fill:["none",...J()]}],"stroke-w":[{stroke:[Qt,Yf,nu,iw]}],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"]}},wee=eee(bee);function ye(...t){return wee(SD(t))}const Tt=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("rounded-xl border bg-card text-card-foreground shadow",t),...e}));Tt.displayName="Card";const vn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("flex flex-col space-y-1.5 p-6",t),...e}));vn.displayName="CardHeader";const yn=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("font-semibold leading-none tracking-tight",t),...e}));yn.displayName="CardTitle";const zr=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));zr.displayName="CardDescription";const En=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("p-6 pt-0",t),...e}));En.displayName="CardContent";const Uz=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("flex items-center p-6 pt-0",t),...e}));Uz.displayName="CardFooter";var aw="rovingFocusGroup.onEntryFocus",See={bubbles:!1,cancelable:!0},q0="RovingFocusGroup",[L3,Wz,kee]=jv(q0),[Oee,Bv]=ua(q0,[kee]),[jee,Nee]=Oee(q0),Gz=b.forwardRef((t,e)=>l.jsx(L3.Provider,{scope:t.__scopeRovingFocusGroup,children:l.jsx(L3.Slot,{scope:t.__scopeRovingFocusGroup,children:l.jsx(Cee,{...t,ref:e})})}));Gz.displayName=q0;var Cee=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:a,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:c,onEntryFocus:h,preventScrollOnEntryFocus:f=!1,...m}=t,g=b.useRef(null),x=Dn(e,g),y=M0(i),[w,S]=wo({prop:a,defaultProp:o??null,onChange:c,caller:q0}),[k,N]=b.useState(!1),C=bs(h),T=Wz(n),_=b.useRef(!1),[E,M]=b.useState(0);return b.useEffect(()=>{const q=g.current;if(q)return q.addEventListener(aw,C),()=>q.removeEventListener(aw,C)},[C]),l.jsx(jee,{scope:n,orientation:r,dir:y,loop:s,currentTabStopId:w,onItemFocus:b.useCallback(q=>S(q),[S]),onItemShiftTab:b.useCallback(()=>N(!0),[]),onFocusableItemAdd:b.useCallback(()=>M(q=>q+1),[]),onFocusableItemRemove:b.useCallback(()=>M(q=>q-1),[]),children:l.jsx(nn.div,{tabIndex:k||E===0?-1:0,"data-orientation":r,...m,ref:x,style:{outline:"none",...t.style},onMouseDown:Ze(t.onMouseDown,()=>{_.current=!0}),onFocus:Ze(t.onFocus,q=>{const L=!_.current;if(q.target===q.currentTarget&&L&&!k){const I=new CustomEvent(aw,See);if(q.currentTarget.dispatchEvent(I),!I.defaultPrevented){const $=T().filter(P=>P.focusable),V=$.find(P=>P.active),ee=$.find(P=>P.id===w),H=[V,ee,...$].filter(Boolean).map(P=>P.ref.current);Kz(H,f)}}_.current=!1}),onBlur:Ze(t.onBlur,()=>N(!1))})})}),Xz="RovingFocusGroupItem",Yz=b.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:a,...o}=t,c=Ei(),h=i||c,f=Nee(Xz,n),m=f.currentTabStopId===h,g=Wz(n),{onFocusableItemAdd:x,onFocusableItemRemove:y,currentTabStopId:w}=f;return b.useEffect(()=>{if(r)return x(),()=>y()},[r,x,y]),l.jsx(L3.ItemSlot,{scope:n,id:h,focusable:r,active:s,children:l.jsx(nn.span,{tabIndex:m?0:-1,"data-orientation":f.orientation,...o,ref:e,onMouseDown:Ze(t.onMouseDown,S=>{r?f.onItemFocus(h):S.preventDefault()}),onFocus:Ze(t.onFocus,()=>f.onItemFocus(h)),onKeyDown:Ze(t.onKeyDown,S=>{if(S.key==="Tab"&&S.shiftKey){f.onItemShiftTab();return}if(S.target!==S.currentTarget)return;const k=_ee(S,f.orientation,f.dir);if(k!==void 0){if(S.metaKey||S.ctrlKey||S.altKey||S.shiftKey)return;S.preventDefault();let C=g().filter(T=>T.focusable).map(T=>T.ref.current);if(k==="last")C.reverse();else if(k==="prev"||k==="next"){k==="prev"&&C.reverse();const T=C.indexOf(S.currentTarget);C=f.loop?Mee(C,T+1):C.slice(T+1)}setTimeout(()=>Kz(C))}}),children:typeof a=="function"?a({isCurrentTabStop:m,hasTabStop:w!=null}):a})})});Yz.displayName=Xz;var Tee={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Eee(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function _ee(t,e,n){const r=Eee(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Tee[r]}function Kz(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function Mee(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Zz=Gz,Jz=Yz,qv="Tabs",[Aee]=ua(qv,[Bv]),eP=Bv(),[Ree,a6]=Aee(qv),tP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:a="horizontal",dir:o,activationMode:c="automatic",...h}=t,f=M0(o),[m,g]=wo({prop:r,onChange:s,defaultProp:i??"",caller:qv});return l.jsx(Ree,{scope:n,baseId:Ei(),value:m,onValueChange:g,orientation:a,dir:f,activationMode:c,children:l.jsx(nn.div,{dir:f,"data-orientation":a,...h,ref:e})})});tP.displayName=qv;var nP="TabsList",rP=b.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=a6(nP,n),a=eP(n);return l.jsx(Zz,{asChild:!0,...a,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(nn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});rP.displayName=nP;var sP="TabsTrigger",iP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,a=a6(sP,n),o=eP(n),c=oP(a.baseId,r),h=cP(a.baseId,r),f=r===a.value;return l.jsx(Jz,{asChild:!0,...o,focusable:!s,active:f,children:l.jsx(nn.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":h,"data-state":f?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:Ze(t.onMouseDown,m=>{!s&&m.button===0&&m.ctrlKey===!1?a.onValueChange(r):m.preventDefault()}),onKeyDown:Ze(t.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&a.onValueChange(r)}),onFocus:Ze(t.onFocus,()=>{const m=a.activationMode!=="manual";!f&&!s&&m&&a.onValueChange(r)})})})});iP.displayName=sP;var aP="TabsContent",lP=b.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...a}=t,o=a6(aP,n),c=oP(o.baseId,r),h=cP(o.baseId,r),f=r===o.value,m=b.useRef(f);return b.useEffect(()=>{const g=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(g)},[]),l.jsx(Ps,{present:s||f,children:({present:g})=>l.jsx(nn.div,{"data-state":f?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":c,hidden:!g,id:h,tabIndex:0,...a,ref:e,style:{...t.style,animationDuration:m.current?"0s":void 0},children:g&&i})})});lP.displayName=aP;function oP(t,e){return`${t}-trigger-${e}`}function cP(t,e){return`${t}-content-${e}`}var Dee=tP,uP=rP,dP=iP,hP=lP;const na=Dee,_i=b.forwardRef(({className:t,...e},n)=>l.jsx(uP,{ref:n,className:ye("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));_i.displayName=uP.displayName;const Et=b.forwardRef(({className:t,...e},n)=>l.jsx(dP,{ref:n,className:ye("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all duration-300 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Et.displayName=dP.displayName;const Kt=b.forwardRef(({className:t,...e},n)=>l.jsx(hP,{ref:n,className:ye("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=active]:animate-in data-[state=active]:fade-in data-[state=active]:duration-300",t),...e}));Kt.displayName=hP.displayName;function zee(t,e){return b.useReducer((n,r)=>e[n][r]??n,t)}var l6="ScrollArea",[fP]=ua(l6),[Pee,da]=fP(l6),mP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...a}=t,[o,c]=b.useState(null),[h,f]=b.useState(null),[m,g]=b.useState(null),[x,y]=b.useState(null),[w,S]=b.useState(null),[k,N]=b.useState(0),[C,T]=b.useState(0),[_,E]=b.useState(!1),[M,q]=b.useState(!1),L=Dn(e,$=>c($)),I=M0(s);return l.jsx(Pee,{scope:n,type:r,dir:I,scrollHideDelay:i,scrollArea:o,viewport:h,onViewportChange:f,content:m,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:_,onScrollbarXEnabledChange:E,scrollbarY:w,onScrollbarYChange:S,scrollbarYEnabled:M,onScrollbarYEnabledChange:q,onCornerWidthChange:N,onCornerHeightChange:T,children:l.jsx(nn.div,{dir:I,...a,ref:L,style:{position:"relative","--radix-scroll-area-corner-width":k+"px","--radix-scroll-area-corner-height":C+"px",...t.style}})})});mP.displayName=l6;var pP="ScrollAreaViewport",gP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,a=da(pP,n),o=b.useRef(null),c=Dn(e,o,a.onViewportChange);return l.jsxs(l.Fragment,{children:[l.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),l.jsx(nn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...t.style},children:l.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});gP.displayName=pP;var dl="ScrollAreaScrollbar",o6=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=da(dl,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:a}=s,o=t.orientation==="horizontal";return b.useEffect(()=>(o?i(!0):a(!0),()=>{o?i(!1):a(!1)}),[o,i,a]),s.type==="hover"?l.jsx(Lee,{...r,ref:e,forceMount:n}):s.type==="scroll"?l.jsx(Iee,{...r,ref:e,forceMount:n}):s.type==="auto"?l.jsx(xP,{...r,ref:e,forceMount:n}):s.type==="always"?l.jsx(c6,{...r,ref:e}):null});o6.displayName=dl;var Lee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=da(dl,t.__scopeScrollArea),[i,a]=b.useState(!1);return b.useEffect(()=>{const o=s.scrollArea;let c=0;if(o){const h=()=>{window.clearTimeout(c),a(!0)},f=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return o.addEventListener("pointerenter",h),o.addEventListener("pointerleave",f),()=>{window.clearTimeout(c),o.removeEventListener("pointerenter",h),o.removeEventListener("pointerleave",f)}}},[s.scrollArea,s.scrollHideDelay]),l.jsx(Ps,{present:n||i,children:l.jsx(xP,{"data-state":i?"visible":"hidden",...r,ref:e})})}),Iee=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=da(dl,t.__scopeScrollArea),i=t.orientation==="horizontal",a=$v(()=>c("SCROLL_END"),100),[o,c]=zee("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return b.useEffect(()=>{if(o==="idle"){const h=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(h)}},[o,s.scrollHideDelay,c]),b.useEffect(()=>{const h=s.viewport,f=i?"scrollLeft":"scrollTop";if(h){let m=h[f];const g=()=>{const x=h[f];m!==x&&(c("SCROLL"),a()),m=x};return h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,i,c,a]),l.jsx(Ps,{present:n||o!=="hidden",children:l.jsx(c6,{"data-state":o==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Ze(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Ze(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),xP=b.forwardRef((t,e)=>{const n=da(dl,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,a]=b.useState(!1),o=t.orientation==="horizontal",c=$v(()=>{if(n.viewport){const h=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=t,s=da(dl,t.__scopeScrollArea),i=b.useRef(null),a=b.useRef(0),[o,c]=b.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=SP(o.viewport,o.content),f={...r,sizes:o,onSizesChange:c,hasThumb:h>0&&h<1,onThumbChange:g=>i.current=g,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:g=>a.current=g};function m(g,x){return Hee(g,a.current,o,x)}return n==="horizontal"?l.jsx(Bee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollLeft,x=f9(g,o,s.dir);i.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollLeft=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollLeft=m(g,s.dir))}}):n==="vertical"?l.jsx(qee,{...f,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const g=s.viewport.scrollTop,x=f9(g,o);i.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{s.viewport&&(s.viewport.scrollTop=g)},onDragScroll:g=>{s.viewport&&(s.viewport.scrollTop=m(g))}}):null}),Bee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=da(dl,t.__scopeScrollArea),[a,o]=b.useState(),c=b.useRef(null),h=Dn(e,c,i.onScrollbarXChange);return b.useEffect(()=>{c.current&&o(getComputedStyle(c.current))},[c]),l.jsx(yP,{"data-orientation":"horizontal",...s,ref:h,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.x),onDragScroll:f=>t.onDragScroll(f.x),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollLeft+f.deltaX;t.onWheelScroll(g),OP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:E1(a.paddingLeft),paddingEnd:E1(a.paddingRight)}})}})}),qee=b.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=da(dl,t.__scopeScrollArea),[a,o]=b.useState(),c=b.useRef(null),h=Dn(e,c,i.onScrollbarYChange);return b.useEffect(()=>{c.current&&o(getComputedStyle(c.current))},[c]),l.jsx(yP,{"data-orientation":"vertical",...s,ref:h,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fv(n)+"px",...t.style},onThumbPointerDown:f=>t.onThumbPointerDown(f.y),onDragScroll:f=>t.onDragScroll(f.y),onWheelScroll:(f,m)=>{if(i.viewport){const g=i.viewport.scrollTop+f.deltaY;t.onWheelScroll(g),OP(g,m)&&f.preventDefault()}},onResize:()=>{c.current&&i.viewport&&a&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:E1(a.paddingTop),paddingEnd:E1(a.paddingBottom)}})}})}),[Fee,vP]=fP(dl),yP=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:a,onThumbPointerDown:o,onThumbPositionChange:c,onDragScroll:h,onWheelScroll:f,onResize:m,...g}=t,x=da(dl,n),[y,w]=b.useState(null),S=Dn(e,L=>w(L)),k=b.useRef(null),N=b.useRef(""),C=x.viewport,T=r.content-r.viewport,_=bs(f),E=bs(c),M=$v(m,10);function q(L){if(k.current){const I=L.clientX-k.current.left,$=L.clientY-k.current.top;h({x:I,y:$})}}return b.useEffect(()=>{const L=I=>{const $=I.target;y?.contains($)&&_(I,T)};return document.addEventListener("wheel",L,{passive:!1}),()=>document.removeEventListener("wheel",L,{passive:!1})},[C,y,T,_]),b.useEffect(E,[r,E]),gh(y,M),gh(x.content,M),l.jsx(Fee,{scope:n,scrollbar:y,hasThumb:s,onThumbChange:bs(i),onThumbPointerUp:bs(a),onThumbPositionChange:E,onThumbPointerDown:bs(o),children:l.jsx(nn.div,{...g,ref:S,style:{position:"absolute",...g.style},onPointerDown:Ze(t.onPointerDown,L=>{L.button===0&&(L.target.setPointerCapture(L.pointerId),k.current=y.getBoundingClientRect(),N.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),q(L))}),onPointerMove:Ze(t.onPointerMove,q),onPointerUp:Ze(t.onPointerUp,L=>{const I=L.target;I.hasPointerCapture(L.pointerId)&&I.releasePointerCapture(L.pointerId),document.body.style.webkitUserSelect=N.current,x.viewport&&(x.viewport.style.scrollBehavior=""),k.current=null})})})}),T1="ScrollAreaThumb",bP=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=vP(T1,t.__scopeScrollArea);return l.jsx(Ps,{present:n||s.hasThumb,children:l.jsx($ee,{ref:e,...r})})}),$ee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=da(T1,n),a=vP(T1,n),{onThumbPositionChange:o}=a,c=Dn(e,m=>a.onThumbChange(m)),h=b.useRef(void 0),f=$v(()=>{h.current&&(h.current(),h.current=void 0)},100);return b.useEffect(()=>{const m=i.viewport;if(m){const g=()=>{if(f(),!h.current){const x=Vee(m,o);h.current=x,o()}};return o(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[i.viewport,f,o]),l.jsx(nn.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Ze(t.onPointerDownCapture,m=>{const x=m.target.getBoundingClientRect(),y=m.clientX-x.left,w=m.clientY-x.top;a.onThumbPointerDown({x:y,y:w})}),onPointerUp:Ze(t.onPointerUp,a.onThumbPointerUp)})});bP.displayName=T1;var u6="ScrollAreaCorner",wP=b.forwardRef((t,e)=>{const n=da(u6,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?l.jsx(Qee,{...t,ref:e}):null});wP.displayName=u6;var Qee=b.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=da(u6,n),[i,a]=b.useState(0),[o,c]=b.useState(0),h=!!(i&&o);return gh(s.scrollbarX,()=>{const f=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(f),c(f)}),gh(s.scrollbarY,()=>{const f=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(f),a(f)}),h?l.jsx(nn.div,{...r,ref:e,style:{width:i,height:o,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function E1(t){return t?parseInt(t,10):0}function SP(t,e){const n=t/e;return isNaN(n)?0:n}function Fv(t){const e=SP(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Hee(t,e,n,r="ltr"){const s=Fv(n),i=s/2,a=e||i,o=s-a,c=n.scrollbar.paddingStart+a,h=n.scrollbar.size-n.scrollbar.paddingEnd-o,f=n.content-n.viewport,m=r==="ltr"?[0,f]:[f*-1,0];return kP([c,h],m)(t)}function f9(t,e,n="ltr"){const r=Fv(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,a=e.content-e.viewport,o=i-r,c=n==="ltr"?[0,a]:[a*-1,0],h=Hk(t,c);return kP([0,a],[0,o])(h)}function kP(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function OP(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return(function s(){const i={left:t.scrollLeft,top:t.scrollTop},a=n.left!==i.left,o=n.top!==i.top;(a||o)&&e(),n=i,r=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(r)};function $v(t,e){const n=bs(t),r=b.useRef(0);return b.useEffect(()=>()=>window.clearTimeout(r.current),[]),b.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function gh(t,e){const n=bs(e);Qk(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var jP=mP,Uee=gP,Wee=wP;const on=b.forwardRef(({className:t,children:e,viewportRef:n,...r},s)=>l.jsxs(jP,{ref:s,className:ye("relative overflow-hidden",t),...r,children:[l.jsx(Uee,{ref:n,className:"h-full w-full rounded-[inherit]",children:e}),l.jsx(I3,{}),l.jsx(I3,{orientation:"horizontal"}),l.jsx(Wee,{})]}));on.displayName=jP.displayName;const I3=b.forwardRef(({className:t,orientation:e="vertical",...n},r)=>l.jsx(o6,{ref:r,orientation:e,className:ye("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:l.jsx(bP,{className:"relative flex-1 rounded-full bg-border"})}));I3.displayName=o6.displayName;function m9({className:t,...e}){return l.jsx("div",{className:ye("animate-pulse rounded-md bg-primary/10",t),...e})}function Gee(t,e=[]){let n=[];function r(i,a){const o=b.createContext(a);o.displayName=i+"Context";const c=n.length;n=[...n,a];const h=m=>{const{scope:g,children:x,...y}=m,w=g?.[t]?.[c]||o,S=b.useMemo(()=>y,Object.values(y));return l.jsx(w.Provider,{value:S,children:x})};h.displayName=i+"Provider";function f(m,g){const x=g?.[t]?.[c]||o,y=b.useContext(x);if(y)return y;if(a!==void 0)return a;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[h,f]}const s=()=>{const i=n.map(a=>b.createContext(a));return function(o){const c=o?.[t]||i;return b.useMemo(()=>({[`__scope${t}`]:{...o,[t]:c}}),[o,c])}};return s.scopeName=t,[r,Xee(s,...e)]}function Xee(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const a=r.reduce((o,{useScope:c,scopeName:h})=>{const m=c(i)[`__scope${h}`];return{...o,...m}},{});return b.useMemo(()=>({[`__scope${e.scopeName}`]:a}),[a])}};return n.scopeName=e.scopeName,n}var Yee=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],NP=Yee.reduce((t,e)=>{const n=Vk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),d6="Progress",h6=100,[Kee]=Gee(d6),[Zee,Jee]=Kee(d6),CP=b.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=ete,...a}=t;(s||s===0)&&!p9(s)&&console.error(tte(`${s}`,"Progress"));const o=p9(s)?s:h6;r!==null&&!g9(r,o)&&console.error(nte(`${r}`,"Progress"));const c=g9(r,o)?r:null,h=_1(c)?i(c,o):void 0;return l.jsx(Zee,{scope:n,value:c,max:o,children:l.jsx(NP.div,{"aria-valuemax":o,"aria-valuemin":0,"aria-valuenow":_1(c)?c:void 0,"aria-valuetext":h,role:"progressbar","data-state":_P(c,o),"data-value":c??void 0,"data-max":o,...a,ref:e})})});CP.displayName=d6;var TP="ProgressIndicator",EP=b.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=Jee(TP,n);return l.jsx(NP.div,{"data-state":_P(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});EP.displayName=TP;function ete(t,e){return`${Math.round(t/e*100)}%`}function _P(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function _1(t){return typeof t=="number"}function p9(t){return _1(t)&&!isNaN(t)&&t>0}function g9(t,e){return _1(t)&&!isNaN(t)&&t<=e&&t>=0}function tte(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${h6}\`.`}function nte(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - - less than the value passed to \`max\` (or ${l6} if no \`max\` prop is set) + - less than the value passed to \`max\` (or ${h6} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. -Defaulting to \`null\`.`}var SP=vP,$ee=bP;const I0=b.forwardRef(({className:t,value:e,...n},r)=>o.jsx(SP,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:o.jsx($ee,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));I0.displayName=SP.displayName;const Qee={light:"",dark:".dark"},kP=b.createContext(null);function OP(){const t=b.useContext(kP);if(!t)throw new Error("useChart must be used within a ");return t}const Dd=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),l=`chart-${t||a.replace(/:/g,"")}`;return o.jsx(kP.Provider,{value:{config:r},children:o.jsxs("div",{"data-chart":l,ref:i,className:ye("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[o.jsx(Hee,{id:l,config:r}),o.jsx(JX,{children:n})]})})});Dd.displayName="Chart";const Hee=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?o.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(Qee).map(([r,s])=>` +Defaulting to \`null\`.`}var MP=CP,rte=EP;const F0=b.forwardRef(({className:t,value:e,...n},r)=>l.jsx(MP,{ref:r,className:ye("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",t),...n,children:l.jsx(rte,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));F0.displayName=MP.displayName;const ste={light:"",dark:".dark"},AP=b.createContext(null);function RP(){const t=b.useContext(AP);if(!t)throw new Error("useChart must be used within a ");return t}const Pd=b.forwardRef(({id:t,className:e,children:n,config:r,...s},i)=>{const a=b.useId(),o=`chart-${t||a.replace(/:/g,"")}`;return l.jsx(AP.Provider,{value:{config:r},children:l.jsxs("div",{"data-chart":o,ref:i,className:ye("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none",e),...s,children:[l.jsx(ite,{id:o,config:r}),l.jsx(mY,{children:n})]})})});Pd.displayName="Chart";const ite=({id:t,config:e})=>{const n=Object.entries(e).filter(([,r])=>r.theme||r.color);return n.length?l.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(ste).map(([r,s])=>` ${s} [data-chart=${t}] { -${n.map(([i,a])=>{const l=a.theme?.[r]||a.color;return l?` --color-${i}: ${l};`:null}).join(` +${n.map(([i,a])=>{const o=a.theme?.[r]||a.color;return o?` --color-${i}: ${o};`:null}).join(` `)} } `).join(` -`)}}):null},Xf=eY,zd=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:l,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g},x)=>{const{config:y}=OP(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,N=`${g||k?.dataKey||k?.name||"value"}`,C=z3(y,k,N),T=!g&&typeof a=="string"?y[a]?.label||a:C?.label;return l?o.jsx("div",{className:ye("font-medium",c),children:l(T,e)}):T?o.jsx("div",{className:ye("font-medium",c),children:T}):null},[a,l,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return o.jsxs("div",{ref:x,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:w,o.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,N)=>{const C=`${m||k.name||k.dataKey||"value"}`,T=z3(y,k,C),_=f||k.payload.fill||k.color;return o.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&k?.value!==void 0&&k.name?h(k.value,k.name,k,N,k.payload):o.jsxs(o.Fragment,{children:[T?.icon?o.jsx(T.icon,{}):!i&&o.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),o.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[o.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,o.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&o.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});zd.displayName="ChartTooltip";const Vee=tY,jP=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=OP();return n?.length?o.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(l=>l.type!=="none").map(l=>{const c=`${s||l.dataKey||"value"}`,h=z3(a,l,c);return o.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?o.jsx(h.icon,{}):o.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:l.color}}),h?.label]},l.value)})}):null});jP.displayName="ChartLegend";function z3(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const u9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,d9=hD,Lh=(t,e)=>n=>{var r;if(e?.variants==null)return d9(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(h=>{const f=n?.[h],m=i?.[h];if(f===null)return null;const g=u9(f)||u9(m);return s[h][g]}),l=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...x}=f;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...l}[w]):{...i,...l}[w]===S})?[...h,m,g]:h},[]);return d9(t,a,c,n?.class,n?.className)},qm=Lh("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"}}),me=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?ZY:"button";return o.jsx(a,{className:ye(qm({variant:e,size:n,className:t})),ref:i,...s})});me.displayName="Button";function Uee(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(24),[c,h]=b.useState(!0),[f,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const L=await gr.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:L.data.hitokoto,from:L.data.from||L.data.from_who||"未知"})}catch(L){console.error("获取一言失败:",L),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=b.useCallback(async()=>{try{const L=localStorage.getItem("access-token"),I=await gr.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${L}`}});e(I.data),r(!1),i(100)}catch(L){console.error("Failed to fetch dashboard data:",L),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const L=setTimeout(()=>i(15),200),I=setTimeout(()=>i(30),800),$=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ee=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),H=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(L),clearTimeout(I),clearTimeout($),clearTimeout(V),clearTimeout(ee),clearTimeout(z),clearTimeout(H)}},[n]),b.useEffect(()=>{w(),y()},[w,y]),b.useEffect(()=>{if(!c)return;const L=setInterval(()=>{w()},3e4);return()=>clearInterval(L)},[c,w]),n||!t)return o.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:o.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[o.jsx(Ti,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(I0,{value:s,className:"h-2"}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:N,daily_data:C,recent_activity:T}=t,_=L=>{const I=Math.floor(L/3600),$=Math.floor(L%3600/60);return`${I}小时${$}分钟`},E=L=>new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),M=k.slice(0,6).map(L=>({name:L.model_name,value:L.request_count,fill:`hsl(var(--chart-${k.indexOf(L)%5+1}))`})),q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx(ll,{value:a.toString(),onValueChange:L=>l(Number(L)),children:o.jsxs(ro,{className:"grid grid-cols-3 w-full sm:w-auto",children:[o.jsx(Jt,{value:"24",children:"24小时"}),o.jsx(Jt,{value:"168",children:"7天"}),o.jsx(Jt,{value:"720",children:"30天"})]})}),o.jsxs(me,{variant:c?"default":"outline",size:"sm",onClick:()=>h(!c),className:"gap-2",children:[o.jsx(Ti,{className:`h-4 w-4 ${c?"animate-spin":""}`}),o.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:w,children:o.jsx(Ti,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"总请求数"}),o.jsx(dK,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"总花费"}),o.jsx(hK,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"Token消耗"}),o.jsx(b3,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"平均响应"}),o.jsx(w3,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"在线时长"}),o.jsx(Gd,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsx(An,{children:o.jsx("div",{className:"text-xl font-bold",children:_(S.online_time)})})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"消息处理"}),o.jsx(E0,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),o.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"成本效率"}),o.jsx(fK,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),o.jsxs(ll,{defaultValue:"trends",className:"space-y-4",children:[o.jsxs(ro,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[o.jsx(Jt,{value:"trends",children:"趋势"}),o.jsx(Jt,{value:"models",children:"模型"}),o.jsx(Jt,{value:"activity",children:"活动"}),o.jsx(Jt,{value:"daily",children:"日统计"})]}),o.jsxs(Pn,{value:"trends",className:"space-y-4",children:[o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"请求趋势"}),o.jsxs(Fr,{children:["最近",a,"小时的请求量变化"]})]}),o.jsx(An,{children:o.jsx(Dd,{config:q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(nY,{data:N,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>E(L)})}),o.jsx(rY,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"花费趋势"}),o.jsx(Fr,{children:"API调用成本变化"})]}),o.jsx(An,{children:o.jsx(Dd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(H2,{data:N,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>E(L)})}),o.jsx(Fg,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"Token消耗"}),o.jsx(Fr,{children:"Token使用量变化"})]}),o.jsx(An,{children:o.jsx(Dd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:o.jsxs(H2,{data:N,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>E(L)})}),o.jsx(Fg,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),o.jsx(Pn,{value:"models",className:"space-y-4",children:o.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"模型请求分布"}),o.jsx(Fr,{children:"各模型使用占比"})]}),o.jsx(An,{children:o.jsx(Dd,{config:Object.fromEntries(k.slice(0,6).map((L,I)=>[L.model_name,{label:L.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:o.jsxs(sY,{children:[o.jsx(Xf,{content:o.jsx(zd,{})}),o.jsx(iY,{data:M,cx:"50%",cy:"50%",labelLine:!1,label:({name:L,percent:I})=>`${L} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:M.map((L,I)=>o.jsx(aY,{fill:L.fill},`cell-${I}`))})]})})})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"模型详细统计"}),o.jsx(Fr,{children:"请求数、花费和性能"})]}),o.jsx(An,{children:o.jsx(kn,{className:"h-[300px] sm:h-[400px]",children:o.jsx("div",{className:"space-y-3",children:k.map((L,I)=>o.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:L.model_name}),o.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),o.jsx("span",{className:"ml-1 font-medium",children:L.request_count.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1 font-medium",children:["¥",L.total_cost.toFixed(2)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[(L.total_tokens/1e3).toFixed(1),"K"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),o.jsxs("span",{className:"ml-1 font-medium",children:[L.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),o.jsx(Pn,{value:"activity",children:o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"最近活动"}),o.jsx(Fr,{children:"最新的API调用记录"})]}),o.jsx(An,{children:o.jsx(kn,{className:"h-[400px] sm:h-[500px]",children:o.jsx("div",{className:"space-y-2",children:T.map((L,I)=>o.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm truncate",children:L.model}),o.jsx("div",{className:"text-xs text-muted-foreground",children:L.request_type})]}),o.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(L.timestamp)})]}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),o.jsx("span",{className:"ml-1",children:L.tokens})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"花费:"}),o.jsxs("span",{className:"ml-1",children:["¥",L.cost.toFixed(4)]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),o.jsxs("span",{className:"ml-1",children:[L.time_cost.toFixed(2),"s"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground",children:"状态:"}),o.jsx("span",{className:`ml-1 ${L.status==="success"?"text-green-600":"text-red-600"}`,children:L.status})]})]})]},I))})})})]})}),o.jsx(Pn,{value:"daily",children:o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"每日统计"}),o.jsx(Fr,{children:"最近7天的数据汇总"})]}),o.jsx(An,{children:o.jsx(Dd,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:o.jsxs(H2,{data:C,children:[o.jsx(Bg,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),o.jsx(qg,{dataKey:"timestamp",tickFormatter:L=>{const I=new Date(L);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Vf,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),o.jsx(Xf,{content:o.jsx(zd,{labelFormatter:L=>new Date(L).toLocaleDateString("zh-CN")})}),o.jsx(Vee,{content:o.jsx(jP,{})}),o.jsx(Fg,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),o.jsx(Fg,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),o.jsxs(_t,{className:"border-2 border-primary/20",children:[o.jsx(wn,{className:"pb-3",children:o.jsx(Sn,{className:"text-lg",children:"每日一言"})}),o.jsx(An,{children:g?o.jsxs("div",{className:"space-y-2",children:[o.jsx(o9,{className:"h-6 w-3/4"}),o.jsx(o9,{className:"h-4 w-1/4"})]}):f?o.jsxs("div",{className:"space-y-2",children:[o.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',f.hitokoto,'"']}),o.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",f.from]})]}):null})]})]})})}const Wee={theme:"system",setTheme:()=>null},NP=b.createContext(Wee),c6=()=>{const t=b.useContext(NP);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},Gee=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},CP=b.createContext(void 0),TP=()=>{const t=b.useContext(CP);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var Iv="Switch",[Xee]=Ta(Iv),[Yee,Kee]=Xee(Iv),EP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:l,value:c="on",onCheckedChange:h,form:f,...m}=t,[g,x]=b.useState(null),y=qn(e,C=>x(C)),w=b.useRef(!1),S=g?f||!!g.closest("form"):!0,[k,N]=Cc({prop:s,defaultProp:i??!1,onChange:h,caller:Iv});return o.jsxs(Yee,{scope:n,checked:k,disabled:l,children:[o.jsx(xn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":RP(k),"data-disabled":l?"":void 0,disabled:l,value:c,...m,ref:y,onClick:Ze(t.onClick,C=>{N(T=>!T),S&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),S&&o.jsx(AP,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:l,form:f,style:{transform:"translateX(-100%)"}})]})});EP.displayName=Iv;var _P="SwitchThumb",MP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=Kee(_P,n);return o.jsx(xn.span,{"data-state":RP(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});MP.displayName=_P;var Zee="SwitchBubbleInput",AP=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),l=qn(a,i),c=CD(n),h=TD(e);return b.useEffect(()=>{const f=a.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(f,n),f.dispatchEvent(y)}},[c,n,r]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});AP.displayName=Zee;function RP(t){return t?"checked":"unchecked"}var DP=EP,Jee=MP;const Tt=b.forwardRef(({className:t,...e},n)=>o.jsx(DP,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:o.jsx(Jee,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Tt.displayName=DP.displayName;const ete=Lh("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),de=b.forwardRef(({className:t,...e},n)=>o.jsx(ED,{ref:n,className:ye(ete(),t),...e}));de.displayName=ED.displayName;const Pe=b.forwardRef(({className:t,type:e,...n},r)=>o.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Pe.displayName="Input";const tte=5,nte=5e3;let tw=0;function rte(){return tw=(tw+1)%Number.MAX_SAFE_INTEGER,tw.toString()}const nw=new Map,h9=t=>{if(nw.has(t))return;const e=setTimeout(()=>{nw.delete(t),km({type:"REMOVE_TOAST",toastId:t})},nte);nw.set(t,e)},ste=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,tte)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?h9(n):t.toasts.forEach(r=>{h9(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Xx=[];let Yx={toasts:[]};function km(t){Yx=ste(Yx,t),Xx.forEach(e=>{e(Yx)})}function ite({...t}){const e=rte(),n=s=>km({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>km({type:"DISMISS_TOAST",toastId:e});return km({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Wr(){const[t,e]=b.useState(Yx);return b.useEffect(()=>(Xx.push(e),()=>{const n=Xx.indexOf(e);n>-1&&Xx.splice(n,1)}),[t]),{...t,toast:ite,dismiss:n=>km({type:"DISMISS_TOAST",toastId:n})}}const ate=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function ote(t){const e=ate.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const u6="0.11.5",d6="MaiBot Dashboard",lte=`${d6} v${u6}`,cte=(t="v")=>`${t}${u6}`,zr=Vk,h6=_D,ute=Fk,zP=b.forwardRef(({className:t,...e},n)=>o.jsx(kv,{ref:n,className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));zP.displayName=kv.displayName;const Sr=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(ute,{children:[o.jsx(zP,{}),o.jsxs(Ov,{ref:r,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,o.jsxs($k,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(_0,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Sr.displayName=Ov.displayName;const kr=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});kr.displayName="DialogHeader";const Ds=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Ds.displayName="DialogFooter";const Or=b.forwardRef(({className:t,...e},n)=>o.jsx(Qk,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));Or.displayName=Qk.displayName;const ps=b.forwardRef(({className:t,...e},n)=>o.jsx(Hk,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));ps.displayName=Hk.displayName;var dte=Symbol("radix.slottable");function hte(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=dte,e}var PP="AlertDialog",[fte]=Ta(PP,[MD]),yl=MD(),LP=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return o.jsx(Vk,{...r,...n,modal:!0})};LP.displayName=PP;var mte="AlertDialogTrigger",IP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(_D,{...s,...r,ref:e})});IP.displayName=mte;var pte="AlertDialogPortal",BP=t=>{const{__scopeAlertDialog:e,...n}=t,r=yl(e);return o.jsx(Fk,{...r,...n})};BP.displayName=pte;var gte="AlertDialogOverlay",qP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(kv,{...s,...r,ref:e})});qP.displayName=gte;var Kd="AlertDialogContent",[xte,vte]=fte(Kd),yte=hte("AlertDialogContent"),FP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=yl(n),a=b.useRef(null),l=qn(e,a),c=b.useRef(null);return o.jsx(JY,{contentName:Kd,titleName:$P,docsSlug:"alert-dialog",children:o.jsx(xte,{scope:n,cancelRef:c,children:o.jsxs(Ov,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Ze(s.onOpenAutoFocus,h=>{h.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[o.jsx(yte,{children:r}),o.jsx(wte,{contentRef:a})]})})})});FP.displayName=Kd;var $P="AlertDialogTitle",QP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(Qk,{...s,...r,ref:e})});QP.displayName=$P;var HP="AlertDialogDescription",VP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx(Hk,{...s,...r,ref:e})});VP.displayName=HP;var bte="AlertDialogAction",UP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=yl(n);return o.jsx($k,{...s,...r,ref:e})});UP.displayName=bte;var WP="AlertDialogCancel",GP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=vte(WP,n),i=yl(n),a=qn(e,s);return o.jsx($k,{...i,...r,ref:a})});GP.displayName=WP;var wte=({contentRef:t})=>{const e=`\`${Kd}\` requires a description for the component to be accessible for screen reader users. +`)}}):null},Kf=pY,Ld=b.forwardRef(({active:t,payload:e,className:n,indicator:r="dot",hideLabel:s=!1,hideIndicator:i=!1,label:a,labelFormatter:o,labelClassName:c,formatter:h,color:f,nameKey:m,labelKey:g},x)=>{const{config:y}=RP(),w=b.useMemo(()=>{if(s||!e?.length)return null;const[k]=e,N=`${g||k?.dataKey||k?.name||"value"}`,C=B3(y,k,N),T=!g&&typeof a=="string"?y[a]?.label||a:C?.label;return o?l.jsx("div",{className:ye("font-medium",c),children:o(T,e)}):T?l.jsx("div",{className:ye("font-medium",c),children:T}):null},[a,o,e,s,c,y,g]);if(!t||!e?.length)return null;const S=e.length===1&&r!=="dot";return l.jsxs("div",{ref:x,className:ye("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[S?null:w,l.jsx("div",{className:"grid gap-1.5",children:e.filter(k=>k.type!=="none").map((k,N)=>{const C=`${m||k.name||k.dataKey||"value"}`,T=B3(y,k,C),_=f||k.payload.fill||k.color;return l.jsx("div",{className:ye("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",r==="dot"&&"items-center"),children:h&&k?.value!==void 0&&k.name?h(k.value,k.name,k,N,k.payload):l.jsxs(l.Fragment,{children:[T?.icon?l.jsx(T.icon,{}):!i&&l.jsx("div",{className:ye("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":r==="dot","w-1":r==="line","w-0 border-[1.5px] border-dashed bg-transparent":r==="dashed","my-0.5":S&&r==="dashed"}),style:{"--color-bg":_,"--color-border":_}}),l.jsxs("div",{className:ye("flex flex-1 justify-between leading-none",S?"items-end":"items-center"),children:[l.jsxs("div",{className:"grid gap-1.5",children:[S?w:null,l.jsx("span",{className:"text-muted-foreground",children:T?.label||k.name})]}),k.value&&l.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:k.value.toLocaleString()})]})]})},k.dataKey)})})]})});Ld.displayName="ChartTooltip";const ate=gY,DP=b.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:r="bottom",nameKey:s},i)=>{const{config:a}=RP();return n?.length?l.jsx("div",{ref:i,className:ye("flex items-center justify-center gap-4",r==="top"?"pb-3":"pt-3",t),children:n.filter(o=>o.type!=="none").map(o=>{const c=`${s||o.dataKey||"value"}`,h=B3(a,o,c);return l.jsxs("div",{className:ye("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[h?.icon&&!e?l.jsx(h.icon,{}):l.jsx("div",{className:"h-2 w-2 shrink-0 rounded-[2px]",style:{backgroundColor:o.color}}),h?.label]},o.value)})}):null});DP.displayName="ChartLegend";function B3(t,e,n){if(typeof e!="object"||e===null)return;const r="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let s=n;return n in e&&typeof e[n]=="string"?s=e[n]:r&&n in r&&typeof r[n]=="string"&&(s=r[n]),s in t?t[s]:t[n]}const x9=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,v9=SD,Ih=(t,e)=>n=>{var r;if(e?.variants==null)return v9(t,n?.class,n?.className);const{variants:s,defaultVariants:i}=e,a=Object.keys(s).map(h=>{const f=n?.[h],m=i?.[h];if(f===null)return null;const g=x9(f)||x9(m);return s[h][g]}),o=n&&Object.entries(n).reduce((h,f)=>{let[m,g]=f;return g===void 0||(h[m]=g),h},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,f)=>{let{class:m,className:g,...x}=f;return Object.entries(x).every(y=>{let[w,S]=y;return Array.isArray(S)?S.includes({...i,...o}[w]):{...i,...o}[w]===S})?[...h,m,g]:h},[]);return v9(t,a,c,n?.class,n?.className)},Qm=Ih("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"}}),fe=b.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const a=r?fK:"button";return l.jsx(a,{className:ye(Qm({variant:e,size:n,className:t})),ref:i,...s})});fe.displayName="Button";function lte(){const[t,e]=b.useState(null),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(24),[c,h]=b.useState(!0),[f,m]=b.useState(null),[g,x]=b.useState(!0),y=b.useCallback(async()=>{try{x(!0);const L=await br.get("https://v1.hitokoto.cn/?c=a&c=b&c=c&c=d&c=h&c=i&c=k");m({hitokoto:L.data.hitokoto,from:L.data.from||L.data.from_who||"未知"})}catch(L){console.error("获取一言失败:",L),m({hitokoto:"人生就像一盒巧克力,你永远不知道下一颗是什么味道。",from:"阿甘正传"})}finally{x(!1)}},[]),w=b.useCallback(async()=>{try{const L=localStorage.getItem("access-token"),I=await br.get(`/api/webui/statistics/dashboard?hours=${a}`,{headers:{Authorization:`Bearer ${L}`}});e(I.data),r(!1),i(100)}catch(L){console.error("Failed to fetch dashboard data:",L),r(!1),i(100)}},[a]);if(b.useEffect(()=>{if(!n)return;i(0);const L=setTimeout(()=>i(15),200),I=setTimeout(()=>i(30),800),$=setTimeout(()=>i(45),2e3),V=setTimeout(()=>i(60),4e3),ee=setTimeout(()=>i(75),6500),z=setTimeout(()=>i(85),9e3),H=setTimeout(()=>i(92),11e3);return()=>{clearTimeout(L),clearTimeout(I),clearTimeout($),clearTimeout(V),clearTimeout(ee),clearTimeout(z),clearTimeout(H)}},[n]),b.useEffect(()=>{w(),y()},[w,y]),b.useEffect(()=>{if(!c)return;const L=setInterval(()=>{w()},3e4);return()=>clearInterval(L)},[c,w]),n||!t)return l.jsx("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:l.jsxs("div",{className:"text-center space-y-6 w-full max-w-md px-4",children:[l.jsx(ti,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-lg font-medium",children:"加载统计数据中..."}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"正在获取麦麦运行数据"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(F0,{value:s,className:"h-2"}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:[s,"%"]})]})]})});const{summary:S,model_stats:k,hourly_data:N,daily_data:C,recent_activity:T}=t,_=L=>{const I=Math.floor(L/3600),$=Math.floor(L%3600/60);return`${I}小时${$}分钟`},E=L=>new Date(L).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}),M=k.slice(0,6).map(L=>({name:L.model_name,value:L.request_count,fill:`hsl(var(--chart-${k.indexOf(L)%5+1}))`})),q={requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"},tokens:{label:"Tokens",color:"hsl(var(--chart-3))"}};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"实时监控面板"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"麦麦运行状态和统计数据一览"})]}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsx(na,{value:a.toString(),onValueChange:L=>o(Number(L)),children:l.jsxs(_i,{className:"grid grid-cols-3 w-full sm:w-auto",children:[l.jsx(Et,{value:"24",children:"24小时"}),l.jsx(Et,{value:"168",children:"7天"}),l.jsx(Et,{value:"720",children:"30天"})]})}),l.jsxs(fe,{variant:c?"default":"outline",size:"sm",onClick:()=>h(!c),className:"gap-2",children:[l.jsx(ti,{className:`h-4 w-4 ${c?"animate-spin":""}`}),l.jsx("span",{className:"hidden sm:inline",children:"自动刷新"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:w,children:l.jsx(ti,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"总请求数"}),l.jsx(NK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:S.total_requests.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["最近",a<48?a+"小时":Math.floor(a/24)+"天"]})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"总花费"}),l.jsx(CK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:["¥",S.total_cost.toFixed(2)]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.cost_per_hour>0?`¥${S.cost_per_hour.toFixed(2)}/小时`:"暂无数据"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"Token消耗"}),l.jsx(N3,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[(S.total_tokens/1e3).toFixed(1),"K"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:S.tokens_per_hour>0?`${(S.tokens_per_hour/1e3).toFixed(1)}K/小时`:"暂无数据"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"平均响应"}),l.jsx(C3,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsxs("div",{className:"text-2xl font-bold",children:[S.avg_response_time.toFixed(2),"s"]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"API平均耗时"})]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 sm:grid-cols-3",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"在线时长"}),l.jsx(Yd,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsx(En,{children:l.jsx("div",{className:"text-xl font-bold",children:_(S.online_time)})})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"消息处理"}),l.jsx(A0,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-xl font-bold",children:S.total_messages.toLocaleString()}),l.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["回复 ",S.total_replies.toLocaleString()," 条"]})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"成本效率"}),l.jsx(TK,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-xl font-bold",children:S.total_messages>0?`¥${(S.total_cost/S.total_messages*100).toFixed(2)}`:"¥0.00"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"每100条消息"})]})]})]}),l.jsxs(na,{defaultValue:"trends",className:"space-y-4",children:[l.jsxs(_i,{className:"grid w-full grid-cols-2 sm:grid-cols-4",children:[l.jsx(Et,{value:"trends",children:"趋势"}),l.jsx(Et,{value:"models",children:"模型"}),l.jsx(Et,{value:"activity",children:"活动"}),l.jsx(Et,{value:"daily",children:"日统计"})]}),l.jsxs(Kt,{value:"trends",className:"space-y-4",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"请求趋势"}),l.jsxs(zr,{children:["最近",a,"小时的请求量变化"]})]}),l.jsx(En,{children:l.jsx(Pd,{config:q,className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(xY,{data:N,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>E(L)})}),l.jsx(vY,{type:"monotone",dataKey:"requests",stroke:"var(--color-requests)",strokeWidth:2})]})})})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"花费趋势"}),l.jsx(zr,{children:"API调用成本变化"})]}),l.jsx(En,{children:l.jsx(Pd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(Y2,{data:N,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>E(L)})}),l.jsx(Hg,{dataKey:"cost",fill:"var(--color-cost)"})]})})})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"Token消耗"}),l.jsx(zr,{children:"Token使用量变化"})]}),l.jsx(En,{children:l.jsx(Pd,{config:q,className:"h-[250px] sm:h-[300px] w-full aspect-auto",children:l.jsxs(Y2,{data:N,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>E(L),angle:-45,textAnchor:"end",height:60,stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>E(L)})}),l.jsx(Hg,{dataKey:"tokens",fill:"var(--color-tokens)"})]})})})]})]})]}),l.jsx(Kt,{value:"models",className:"space-y-4",children:l.jsxs("div",{className:"grid gap-4 grid-cols-1 lg:grid-cols-2",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"模型请求分布"}),l.jsx(zr,{children:"各模型使用占比"})]}),l.jsx(En,{children:l.jsx(Pd,{config:Object.fromEntries(k.slice(0,6).map((L,I)=>[L.model_name,{label:L.model_name,color:`hsl(var(--chart-${I%5+1}))`}])),className:"h-[300px] sm:h-[400px] w-full aspect-auto",children:l.jsxs(yY,{children:[l.jsx(Kf,{content:l.jsx(Ld,{})}),l.jsx(bY,{data:M,cx:"50%",cy:"50%",labelLine:!1,label:({name:L,percent:I})=>`${L} ${I?(I*100).toFixed(0):0}%`,outerRadius:100,dataKey:"value",children:M.map((L,I)=>l.jsx(wY,{fill:L.fill},`cell-${I}`))})]})})})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"模型详细统计"}),l.jsx(zr,{children:"请求数、花费和性能"})]}),l.jsx(En,{children:l.jsx(on,{className:"h-[300px] sm:h-[400px]",children:l.jsx("div",{className:"space-y-3",children:k.map((L,I)=>l.jsxs("div",{className:"p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("h4",{className:"font-semibold text-sm truncate flex-1 min-w-0",children:L.model_name}),l.jsx("div",{className:"w-3 h-3 rounded-full ml-2 flex-shrink-0",style:{backgroundColor:`hsl(var(--chart-${I%5+1}))`}})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"请求数:"}),l.jsx("span",{className:"ml-1 font-medium",children:L.request_count.toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1 font-medium",children:["¥",L.total_cost.toFixed(2)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[(L.total_tokens/1e3).toFixed(1),"K"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"平均耗时:"}),l.jsxs("span",{className:"ml-1 font-medium",children:[L.avg_response_time.toFixed(2),"s"]})]})]})]},I))})})})]})]})}),l.jsx(Kt,{value:"activity",children:l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"最近活动"}),l.jsx(zr,{children:"最新的API调用记录"})]}),l.jsx(En,{children:l.jsx(on,{className:"h-[400px] sm:h-[500px]",children:l.jsx("div",{className:"space-y-2",children:T.map((L,I)=>l.jsxs("div",{className:"p-3 sm:p-4 rounded-lg border bg-card hover:bg-accent/50 transition-colors",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm truncate",children:L.model}),l.jsx("div",{className:"text-xs text-muted-foreground",children:L.request_type})]}),l.jsx("div",{className:"text-xs text-muted-foreground flex-shrink-0",children:E(L.timestamp)})]}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-2 text-xs",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"Tokens:"}),l.jsx("span",{className:"ml-1",children:L.tokens})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"花费:"}),l.jsxs("span",{className:"ml-1",children:["¥",L.cost.toFixed(4)]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"耗时:"}),l.jsxs("span",{className:"ml-1",children:[L.time_cost.toFixed(2),"s"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground",children:"状态:"}),l.jsx("span",{className:`ml-1 ${L.status==="success"?"text-green-600":"text-red-600"}`,children:L.status})]})]})]},I))})})})]})}),l.jsx(Kt,{value:"daily",children:l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"每日统计"}),l.jsx(zr,{children:"最近7天的数据汇总"})]}),l.jsx(En,{children:l.jsx(Pd,{config:{requests:{label:"请求数",color:"hsl(var(--chart-1))"},cost:{label:"花费(¥)",color:"hsl(var(--chart-2))"}},className:"h-[400px] sm:h-[500px] w-full aspect-auto",children:l.jsxs(Y2,{data:C,children:[l.jsx($g,{strokeDasharray:"3 3",stroke:"hsl(var(--muted-foreground) / 0.2)"}),l.jsx(Qg,{dataKey:"timestamp",tickFormatter:L=>{const I=new Date(L);return`${I.getMonth()+1}/${I.getDate()}`},stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{yAxisId:"left",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Wf,{yAxisId:"right",orientation:"right",stroke:"hsl(var(--muted-foreground))",tick:{fill:"hsl(var(--muted-foreground))"}}),l.jsx(Kf,{content:l.jsx(Ld,{labelFormatter:L=>new Date(L).toLocaleDateString("zh-CN")})}),l.jsx(ate,{content:l.jsx(DP,{})}),l.jsx(Hg,{yAxisId:"left",dataKey:"requests",fill:"var(--color-requests)"}),l.jsx(Hg,{yAxisId:"right",dataKey:"cost",fill:"var(--color-cost)"})]})})})]})})]}),l.jsxs(Tt,{className:"border-2 border-primary/20",children:[l.jsx(vn,{className:"pb-3",children:l.jsx(yn,{className:"text-lg",children:"每日一言"})}),l.jsx(En,{children:g?l.jsxs("div",{className:"space-y-2",children:[l.jsx(m9,{className:"h-6 w-3/4"}),l.jsx(m9,{className:"h-4 w-1/4"})]}):f?l.jsxs("div",{className:"space-y-2",children:[l.jsxs("p",{className:"text-lg font-medium leading-relaxed italic",children:['"',f.hitokoto,'"']}),l.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["—— ",f.from]})]}):null})]})]})})}const ote={theme:"system",setTheme:()=>null},zP=b.createContext(ote),f6=()=>{const t=b.useContext(zP);if(t===void 0)throw new Error("useTheme must be used within a ThemeProvider");return t},cte=(t,e,n)=>{const r=document.documentElement.classList.contains("no-animations");if(!document.startViewTransition||r){e(t);return}const s=n.clientX,i=n.clientY,a=Math.hypot(Math.max(s,innerWidth-s),Math.max(i,innerHeight-i));document.startViewTransition(()=>{e(t)}).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${s}px ${i}px)`,`circle(${a}px at ${s}px ${i}px)`]},{duration:500,easing:"ease-in-out",pseudoElement:"::view-transition-new(root)"})})},PP=b.createContext(void 0),LP=()=>{const t=b.useContext(PP);if(t===void 0)throw new Error("useAnimation must be used within an AnimationProvider");return t};var Qv="Switch",[ute]=ua(Qv),[dte,hte]=ute(Qv),IP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:a,disabled:o,value:c="on",onCheckedChange:h,form:f,...m}=t,[g,x]=b.useState(null),y=Dn(e,C=>x(C)),w=b.useRef(!1),S=g?f||!!g.closest("form"):!0,[k,N]=wo({prop:s,defaultProp:i??!1,onChange:h,caller:Qv});return l.jsxs(dte,{scope:n,checked:k,disabled:o,children:[l.jsx(nn.button,{type:"button",role:"switch","aria-checked":k,"aria-required":a,"data-state":$P(k),"data-disabled":o?"":void 0,disabled:o,value:c,...m,ref:y,onClick:Ze(t.onClick,C=>{N(T=>!T),S&&(w.current=C.isPropagationStopped(),w.current||C.stopPropagation())})}),S&&l.jsx(FP,{control:g,bubbles:!w.current,name:r,value:c,checked:k,required:a,disabled:o,form:f,style:{transform:"translateX(-100%)"}})]})});IP.displayName=Qv;var BP="SwitchThumb",qP=b.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=hte(BP,n);return l.jsx(nn.span,{"data-state":$P(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});qP.displayName=BP;var fte="SwitchBubbleInput",FP=b.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const a=b.useRef(null),o=Dn(a,i),c=PD(n),h=LD(e);return b.useEffect(()=>{const f=a.current;if(!f)return;const m=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(m,"checked").set;if(c!==n&&x){const y=new Event("click",{bubbles:r});x.call(f,n),f.dispatchEvent(y)}},[c,n,r]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:o,style:{...s.style,...h,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});FP.displayName=fte;function $P(t){return t?"checked":"unchecked"}var QP=IP,mte=qP;const _t=b.forwardRef(({className:t,...e},n)=>l.jsx(QP,{className:ye("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...e,ref:n,children:l.jsx(mte,{className:ye("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));_t.displayName=QP.displayName;const pte=Ih("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),de=b.forwardRef(({className:t,...e},n)=>l.jsx(ID,{ref:n,className:ye(pte(),t),...e}));de.displayName=ID.displayName;const Pe=b.forwardRef(({className:t,type:e,...n},r)=>l.jsx("input",{type:e,className:ye("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Pe.displayName="Input";const gte=5,xte=5e3;let lw=0;function vte(){return lw=(lw+1)%Number.MAX_SAFE_INTEGER,lw.toString()}const ow=new Map,y9=t=>{if(ow.has(t))return;const e=setTimeout(()=>{ow.delete(t),jm({type:"REMOVE_TOAST",toastId:t})},xte);ow.set(t,e)},yte=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,gte)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?y9(n):t.toasts.forEach(r=>{y9(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},Zx=[];let Jx={toasts:[]};function jm(t){Jx=yte(Jx,t),Zx.forEach(e=>{e(Jx)})}function bte({...t}){const e=vte(),n=s=>jm({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>jm({type:"DISMISS_TOAST",toastId:e});return jm({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function Gr(){const[t,e]=b.useState(Jx);return b.useEffect(()=>(Zx.push(e),()=>{const n=Zx.indexOf(e);n>-1&&Zx.splice(n,1)}),[t]),{...t,toast:bte,dismiss:n=>jm({type:"DISMISS_TOAST",toastId:n})}}const wte=[{id:"minLength",label:"长度至少 10 位",description:"Token 长度必须大于等于 10 个字符",validate:t=>t.length>=10},{id:"hasUppercase",label:"包含大写字母",description:"至少包含一个大写字母 (A-Z)",validate:t=>/[A-Z]/.test(t)},{id:"hasLowercase",label:"包含小写字母",description:"至少包含一个小写字母 (a-z)",validate:t=>/[a-z]/.test(t)},{id:"hasSpecialChar",label:"包含特殊符号",description:"至少包含一个特殊符号 (!@#$%^&*()_+-=[]{}|;:,.<>?/)",validate:t=>/[!@#$%^&*()_+\-=[\]{}|;:,.<>?/]/.test(t)}];function Ste(t){const e=wte.map(r=>({id:r.id,label:r.label,description:r.description,passed:r.validate(t)}));return{isValid:e.every(r=>r.passed),rules:e}}const m6="0.11.5",p6="MaiBot Dashboard",kte=`${p6} v${m6}`,Ote=(t="v")=>`${t}${m6}`,fr=Xk,Bh=BD,jte=Uk,g6=Tv,HP=b.forwardRef(({className:t,...e},n)=>l.jsx(Nv,{ref:n,className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));HP.displayName=Nv.displayName;const rr=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(jte,{children:[l.jsx(HP,{}),l.jsxs(Cv,{ref:r,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,l.jsxs(Tv,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[l.jsx(R0,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));rr.displayName=Cv.displayName;const sr=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});sr.displayName="DialogHeader";const ts=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ts.displayName="DialogFooter";const ir=b.forwardRef(({className:t,...e},n)=>l.jsx(Wk,{ref:n,className:ye("text-lg font-semibold leading-none tracking-tight",t),...e}));ir.displayName=Wk.displayName;const Ir=b.forwardRef(({className:t,...e},n)=>l.jsx(Gk,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));Ir.displayName=Gk.displayName;var Nte=Symbol("radix.slottable");function Cte(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Nte,e}var VP="AlertDialog",[Tte]=ua(VP,[qD]),So=qD(),UP=t=>{const{__scopeAlertDialog:e,...n}=t,r=So(e);return l.jsx(Xk,{...r,...n,modal:!0})};UP.displayName=VP;var Ete="AlertDialogTrigger",WP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(BD,{...s,...r,ref:e})});WP.displayName=Ete;var _te="AlertDialogPortal",GP=t=>{const{__scopeAlertDialog:e,...n}=t,r=So(e);return l.jsx(Uk,{...r,...n})};GP.displayName=_te;var Mte="AlertDialogOverlay",XP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Nv,{...s,...r,ref:e})});XP.displayName=Mte;var Zd="AlertDialogContent",[Ate,Rte]=Tte(Zd),Dte=Cte("AlertDialogContent"),YP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=So(n),a=b.useRef(null),o=Dn(e,a),c=b.useRef(null);return l.jsx(mK,{contentName:Zd,titleName:KP,docsSlug:"alert-dialog",children:l.jsx(Ate,{scope:n,cancelRef:c,children:l.jsxs(Cv,{role:"alertdialog",...i,...s,ref:o,onOpenAutoFocus:Ze(s.onOpenAutoFocus,h=>{h.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:h=>h.preventDefault(),onInteractOutside:h=>h.preventDefault(),children:[l.jsx(Dte,{children:r}),l.jsx(Pte,{contentRef:a})]})})})});YP.displayName=Zd;var KP="AlertDialogTitle",ZP=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Wk,{...s,...r,ref:e})});ZP.displayName=KP;var JP="AlertDialogDescription",eL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Gk,{...s,...r,ref:e})});eL.displayName=JP;var zte="AlertDialogAction",tL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=So(n);return l.jsx(Tv,{...s,...r,ref:e})});tL.displayName=zte;var nL="AlertDialogCancel",rL=b.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=Rte(nL,n),i=So(n),a=Dn(e,s);return l.jsx(Tv,{...i,...r,ref:a})});rL.displayName=nL;var Pte=({contentRef:t})=>{const e=`\`${Zd}\` requires a description for the component to be accessible for screen reader users. -You can add a description to the \`${Kd}\` by passing a \`${HP}\` component as a child, which also benefits sighted users by adding visible context to the dialog. +You can add a description to the \`${Zd}\` by passing a \`${JP}\` component as a child, which also benefits sighted users by adding visible context to the dialog. -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Kd}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Zd}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Ste=LP,kte=IP,Ote=BP,XP=qP,YP=FP,KP=UP,ZP=GP,JP=QP,eL=VP;const jn=Ste,Vr=kte,jte=Ote,tL=b.forwardRef(({className:t,...e},n)=>o.jsx(XP,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));tL.displayName=XP.displayName;const cn=b.forwardRef(({className:t,...e},n)=>o.jsxs(jte,{children:[o.jsx(tL,{}),o.jsx(YP,{ref:n,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));cn.displayName=YP.displayName;const un=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});un.displayName="AlertDialogHeader";const dn=({className:t,...e})=>o.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});dn.displayName="AlertDialogFooter";const hn=b.forwardRef(({className:t,...e},n)=>o.jsx(JP,{ref:n,className:ye("text-lg font-semibold",t),...e}));hn.displayName=JP.displayName;const fn=b.forwardRef(({className:t,...e},n)=>o.jsx(eL,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));fn.displayName=eL.displayName;const mn=b.forwardRef(({className:t,...e},n)=>o.jsx(KP,{ref:n,className:ye(qm(),t),...e}));mn.displayName=KP.displayName;const pn=b.forwardRef(({className:t,...e},n)=>o.jsx(ZP,{ref:n,className:ye(qm({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));pn.displayName=ZP.displayName;function Nte(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),o.jsxs(ll,{defaultValue:"appearance",className:"w-full",children:[o.jsxs(ro,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[o.jsxs(Jt,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(UD,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"外观"})]}),o.jsxs(Jt,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(mK,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"安全"})]}),o.jsxs(Jt,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(vu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"其他"})]}),o.jsxs(Jt,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[o.jsx(wa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),o.jsx("span",{children:"关于"})]})]}),o.jsxs(kn,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[o.jsx(Pn,{value:"appearance",className:"mt-0",children:o.jsx(Cte,{})}),o.jsx(Pn,{value:"security",className:"mt-0",children:o.jsx(Tte,{})}),o.jsx(Pn,{value:"other",className:"mt-0",children:o.jsx(Ete,{})}),o.jsx(Pn,{value:"about",className:"mt-0",children:o.jsx(_te,{})})]})]})]})}function f9(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,l=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,h=Math.max(a,l,c),f=Math.min(a,l,c);let m=0,g=0;const x=(h+f)/2;if(h!==f){const y=h-f;switch(g=x>.5?y/(2-h-f):y/(h+f),h){case a:m=((l-c)/y+(llocalStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";f9(h)},[]);const c=h=>{l(h),localStorage.setItem("accent-color",h),f9(h)};return o.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[o.jsx(rw,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),o.jsx(rw,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),o.jsx(rw,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(Hi,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),o.jsx(Hi,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),o.jsx(Hi,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),o.jsx(Hi,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),o.jsx(Hi,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),o.jsx(Hi,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),o.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[o.jsx(Hi,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),o.jsx(Hi,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),o.jsx(Hi,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),o.jsx(Hi,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),o.jsx(Hi,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),o.jsx(Hi,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-1",children:o.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:h=>c(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),o.jsx("div",{className:"flex-1",children:o.jsx(Pe,{type:"text",value:a,onChange:h=>c(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),o.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[o.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(de,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),o.jsx(Tt,{id:"animations",checked:n,onCheckedChange:r})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-4",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5 flex-1",children:[o.jsx(de,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),o.jsx(Tt,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function Tte(){const t=Ca(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[l,c]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,N]=b.useState(""),[C,T]=b.useState(!1),{toast:_}=Wr(),E=b.useMemo(()=>ote(r),[r]),M=()=>localStorage.getItem("access-token")||"",q=async z=>{try{await navigator.clipboard.writeText(z),y(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},L=async()=>{if(!r.trim()){_({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const z=E.rules.filter(H=>!H.passed).map(H=>H.label).join(", ");_({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}f(!0);try{const z=M(),H=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),_({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):_({title:"更新失败",description:P.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),_({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{f(!1)}},I=async()=>{g(!0);try{const z=M(),H=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",P.token),n(P.token),N(P.token),S(!0),T(!1),_({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):_({title:"生成失败",description:P.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),_({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},$=async()=>{try{await navigator.clipboard.writeText(k),T(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{S(!1),setTimeout(()=>{N(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ee=z=>{z||V()};return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx(zr,{open:w,onOpenChange:ee,children:o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(Xd,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),o.jsx(ps,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[o.jsx(de,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),o.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Xd,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"重要提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),o.jsx("li",{children:"请立即复制并保存到安全的位置"}),o.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),o.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),o.jsxs(Ds,{className:"gap-2 sm:gap-0",children:[o.jsx(me,{variant:"outline",onClick:$,className:"gap-2",children:C?o.jsxs(o.Fragment,{children:[o.jsx(dc,{className:"h-4 w-4 text-green-500"}),"已复制"]}):o.jsxs(o.Fragment,{children:[o.jsx(S3,{className:"h-4 w-4"}),"复制 Token"]})}),o.jsx(me,{onClick:V,children:"我已保存,关闭"})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),o.jsx("div",{className:"space-y-3 sm:space-y-4",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"relative flex-1",children:[o.jsx(Pe,{id:"current-token",type:i?"text":"password",value:e||M(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),o.jsx("button",{onClick:()=>{e||n(M()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?o.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsx(me,{variant:"outline",size:"icon",onClick:()=>q(M()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?o.jsx(dc,{className:"h-4 w-4 text-green-500"}):o.jsx(S3,{className:"h-4 w-4"})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[o.jsx(Ti,{className:ye("h-4 w-4",m&&"animate-spin")}),o.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),o.jsx("span",{className:"sm:hidden",children:"生成"})]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重新生成 Token"}),o.jsx(fn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:I,children:"确认生成"})]})]})]})]})]}),o.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{id:"new-token",type:l?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),o.jsx("button",{onClick:()=>c(!l),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:l?"隐藏":"显示",children:l?o.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&o.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),o.jsx("div",{className:"space-y-1.5",children:E.rules.map(z=>o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?o.jsx(pc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):o.jsx(pK,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),o.jsx("span",{className:ye(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),E.isValid&&o.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:o.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[o.jsx(dc,{className:"h-4 w-4"}),o.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),o.jsx(me,{onClick:L,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),o.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[o.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),o.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),o.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),o.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),o.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),o.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),o.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Ete(){const t=Ca(),{toast:e}=Wr(),[n,r]=b.useState(!1),s=async()=>{r(!0);try{const i=localStorage.getItem("access-token"),a=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${i}`}}),l=await a.json();a.ok&&l.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:l.message||"无法重置配置状态",variant:"destructive"})}catch(i){console.error("重置配置状态错误:",i),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return o.jsx("div",{className:"space-y-4 sm:space-y-6",children:o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),o.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[o.jsx("div",{className:"space-y-2",children:o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{variant:"outline",disabled:n,className:"gap-2",children:[o.jsx(gK,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重新配置"}),o.jsx(fn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:s,children:"确认重置"})]})]})]})]})]})})}function _te(){return o.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[o.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:o.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[o.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:o.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),o.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),o.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ye("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[o.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:o.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",o.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.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"})})]})]})]})}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",d6]}),o.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("p",{children:["版本: ",u6]}),o.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),o.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",o.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"React 19.2.0"}),o.jsx("li",{children:"TypeScript 5.7.2"}),o.jsx("li",{children:"Vite 6.0.7"}),o.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"shadcn/ui"}),o.jsx("li",{children:"Radix UI"}),o.jsx("li",{children:"Tailwind CSS 3.4.17"}),o.jsx("li",{children:"Lucide Icons"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"后端"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Python 3.12+"}),o.jsx("li",{children:"FastAPI"}),o.jsx("li",{children:"Uvicorn"}),o.jsx("li",{children:"WebSocket"})]})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),o.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[o.jsx("li",{children:"Bun / npm"}),o.jsx("li",{children:"ESLint 9.17.0"}),o.jsx("li",{children:"PostCSS"})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),o.jsx(kn,{className:"h-[300px] sm:h-[400px]",children:o.jsxs("div",{className:"space-y-4 pr-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"React",description:"用户界面构建库",license:"MIT"}),o.jsx(ar,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),o.jsx(ar,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),o.jsx(ar,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),o.jsx(ar,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),o.jsx(ar,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),o.jsx(ar,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),o.jsx(ar,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),o.jsx(ar,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),o.jsx(ar,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),o.jsx(ar,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),o.jsx(ar,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),o.jsx(ar,{name:"Pydantic",description:"数据验证库",license:"MIT"}),o.jsx(ar,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),o.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[o.jsx(ar,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),o.jsx(ar,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),o.jsx(ar,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),o.jsx(ar,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[o.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:o.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[o.jsx("div",{className:"flex-shrink-0 mt-0.5",children:o.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:o.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function ar({name:t,description:e,license:n}){return o.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-medium text-foreground truncate",children:t}),o.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),o.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function rw({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&o.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),o.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),o.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),o.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Hi({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return o.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&o.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),o.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[o.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),o.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class Mte{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),l=this.perm[r]+s,c=this.perm[l],h=this.perm[l+1],f=this.perm[r+1]+s,m=this.perm[f],g=this.perm[f+1];return this.mix(this.mix(this.dot(this.grad3[c%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function Ate(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Mte(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,l=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(L=>L.remove()),a.paths=[];const k=10,N=32,C=w+200,T=S+30,_=Math.ceil(C/k),E=Math.ceil(T/N),M=(w-k*_)/2,q=(S-N*E)/2;for(let L=0;L<=_;L++){const I=[];for(let V=0;V<=E;V++){const ee={x:M+k*L,y:q+N*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(ee)}const $=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild($),a.paths.push($),a.lines.push(I)}},h=w=>{const{lines:S,mouse:k,noise:N}=a;S.forEach(C=>{C.forEach(T=>{const _=N.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(_)*32,T.wave.y=Math.sin(_)*16;const E=T.x-k.sx,M=T.y-k.sy,q=Math.hypot(E,M),L=Math.max(175,k.vs);if(q{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:S}=a;w.forEach((k,N)=>{let C=f(k[0],!1),T=`M ${C.x} ${C.y}`;k.forEach((_,E)=>{const M=E===k.length-1;C=f(_,!M),T+=`L ${C.x} ${C.y}`}),S[N].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,N=S.y-S.ly,C=Math.hypot(k,N);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(N,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),h(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{l(),c()};return l(),c(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),o.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[o.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),o.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:o.jsx("style",{children:` +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return b.useEffect(()=>{document.getElementById(t.current?.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Lte=UP,Ite=WP,Bte=GP,sL=XP,iL=YP,aL=tL,lL=rL,oL=ZP,cL=eL;const wn=Lte,Lr=Ite,qte=Bte,uL=b.forwardRef(({className:t,...e},n)=>l.jsx(sL,{className:ye("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));uL.displayName=sL.displayName;const un=b.forwardRef(({className:t,...e},n)=>l.jsxs(qte,{children:[l.jsx(uL,{}),l.jsx(iL,{ref:n,className:ye("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));un.displayName=iL.displayName;const dn=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col space-y-2 text-center sm:text-left",t),...e});dn.displayName="AlertDialogHeader";const hn=({className:t,...e})=>l.jsx("div",{className:ye("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});hn.displayName="AlertDialogFooter";const fn=b.forwardRef(({className:t,...e},n)=>l.jsx(oL,{ref:n,className:ye("text-lg font-semibold",t),...e}));fn.displayName=oL.displayName;const mn=b.forwardRef(({className:t,...e},n)=>l.jsx(cL,{ref:n,className:ye("text-sm text-muted-foreground",t),...e}));mn.displayName=cL.displayName;const pn=b.forwardRef(({className:t,...e},n)=>l.jsx(aL,{ref:n,className:ye(Qm(),t),...e}));pn.displayName=aL.displayName;const gn=b.forwardRef(({className:t,...e},n)=>l.jsx(lL,{ref:n,className:ye(Qm({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));gn.displayName=lL.displayName;function Fte(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"系统设置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理您的应用偏好设置"})]})}),l.jsxs(na,{defaultValue:"appearance",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-2 sm:grid-cols-4 gap-0.5 sm:gap-1 h-auto p-1",children:[l.jsxs(Et,{value:"appearance",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(tz,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"外观"})]}),l.jsxs(Et,{value:"security",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(EK,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"安全"})]}),l.jsxs(Et,{value:"other",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(yu,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"其他"})]}),l.jsxs(Et,{value:"about",className:"gap-1 sm:gap-2 text-xs sm:text-sm px-2 sm:px-3 py-2",children:[l.jsx(Oa,{className:"h-3.5 w-3.5 sm:h-4 sm:w-4",strokeWidth:2,fill:"none"}),l.jsx("span",{children:"关于"})]})]}),l.jsxs(on,{className:"h-[calc(100vh-240px)] sm:h-[calc(100vh-280px)] mt-4 sm:mt-6",children:[l.jsx(Kt,{value:"appearance",className:"mt-0",children:l.jsx($te,{})}),l.jsx(Kt,{value:"security",className:"mt-0",children:l.jsx(Qte,{})}),l.jsx(Kt,{value:"other",className:"mt-0",children:l.jsx(Hte,{})}),l.jsx(Kt,{value:"about",className:"mt-0",children:l.jsx(Vte,{})})]})]})]})}function b9(t){const e=document.documentElement,r={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[t];if(r)e.style.setProperty("--primary",r.hsl),r.gradient?(e.style.setProperty("--primary-gradient",r.gradient),e.classList.add("has-gradient")):(e.style.removeProperty("--primary-gradient"),e.classList.remove("has-gradient"));else if(t.startsWith("#")){const s=i=>{i=i.replace("#","");const a=parseInt(i.substring(0,2),16)/255,o=parseInt(i.substring(2,4),16)/255,c=parseInt(i.substring(4,6),16)/255,h=Math.max(a,o,c),f=Math.min(a,o,c);let m=0,g=0;const x=(h+f)/2;if(h!==f){const y=h-f;switch(g=x>.5?y/(2-h-f):y/(h+f),h){case a:m=((o-c)/y+(olocalStorage.getItem("accent-color")||"blue");b.useEffect(()=>{const h=localStorage.getItem("accent-color")||"blue";b9(h)},[]);const c=h=>{o(h),localStorage.setItem("accent-color",h),b9(h)};return l.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题模式"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 sm:gap-4",children:[l.jsx(cw,{value:"light",current:t,onChange:e,label:"浅色",description:"始终使用浅色主题"}),l.jsx(cw,{value:"dark",current:t,onChange:e,label:"深色",description:"始终使用深色主题"}),l.jsx(cw,{value:"system",current:t,onChange:e,label:"跟随系统",description:"根据系统设置自动切换"})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"主题色"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"单色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Ui,{value:"blue",current:a,onChange:c,label:"蓝色",colorClass:"bg-blue-500"}),l.jsx(Ui,{value:"purple",current:a,onChange:c,label:"紫色",colorClass:"bg-purple-500"}),l.jsx(Ui,{value:"green",current:a,onChange:c,label:"绿色",colorClass:"bg-green-500"}),l.jsx(Ui,{value:"orange",current:a,onChange:c,label:"橙色",colorClass:"bg-orange-500"}),l.jsx(Ui,{value:"pink",current:a,onChange:c,label:"粉色",colorClass:"bg-pink-500"}),l.jsx(Ui,{value:"red",current:a,onChange:c,label:"红色",colorClass:"bg-red-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"渐变色"}),l.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-6 gap-2 sm:gap-3",children:[l.jsx(Ui,{value:"gradient-sunset",current:a,onChange:c,label:"日落",colorClass:"bg-gradient-to-r from-orange-500 to-pink-500"}),l.jsx(Ui,{value:"gradient-ocean",current:a,onChange:c,label:"海洋",colorClass:"bg-gradient-to-r from-blue-500 to-cyan-500"}),l.jsx(Ui,{value:"gradient-forest",current:a,onChange:c,label:"森林",colorClass:"bg-gradient-to-r from-green-500 to-emerald-500"}),l.jsx(Ui,{value:"gradient-aurora",current:a,onChange:c,label:"极光",colorClass:"bg-gradient-to-r from-purple-500 to-pink-500"}),l.jsx(Ui,{value:"gradient-fire",current:a,onChange:c,label:"烈焰",colorClass:"bg-gradient-to-r from-red-500 to-orange-500"}),l.jsx(Ui,{value:"gradient-twilight",current:a,onChange:c,label:"暮光",colorClass:"bg-gradient-to-r from-indigo-500 to-purple-500"})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"text-xs sm:text-sm font-medium mb-2 sm:mb-3",children:"自定义颜色"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-1",children:l.jsx("input",{type:"color",value:a.startsWith("#")?a:"#3b82f6",onChange:h=>c(h.target.value),className:"h-10 sm:h-12 w-full rounded-lg border-2 border-border cursor-pointer",title:"选择自定义颜色"})}),l.jsx("div",{className:"flex-1",children:l.jsx(Pe,{type:"text",value:a,onChange:h=>c(h.target.value),placeholder:"#3b82f6",className:"font-mono text-sm"})})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground mt-2",children:"点击色块选择颜色,或手动输入 HEX 颜色代码"})]})]})]}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"动画效果"}),l.jsxs("div",{className:"space-y-2 sm:space-y-3",children:[l.jsx("div",{className:"rounded-lg border bg-card p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(de,{htmlFor:"animations",className:"text-base font-medium cursor-pointer",children:"启用动画效果"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后将禁用所有过渡动画和特效,提升性能"})]}),l.jsx(_t,{id:"animations",checked:n,onCheckedChange:r})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-4",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5 flex-1",children:[l.jsx(de,{htmlFor:"waves-background",className:"text-base font-medium cursor-pointer",children:"登录页波浪背景"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭后登录页将使用纯色背景,适合低性能设备"})]}),l.jsx(_t,{id:"waves-background",checked:s,onCheckedChange:i})]})})]})]})]})}function Qte(){const t=Ma(),[e,n]=b.useState(""),[r,s]=b.useState(""),[i,a]=b.useState(!1),[o,c]=b.useState(!1),[h,f]=b.useState(!1),[m,g]=b.useState(!1),[x,y]=b.useState(!1),[w,S]=b.useState(!1),[k,N]=b.useState(""),[C,T]=b.useState(!1),{toast:_}=Gr(),E=b.useMemo(()=>Ste(r),[r]),M=()=>localStorage.getItem("access-token")||"",q=async z=>{try{await navigator.clipboard.writeText(z),y(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"}),setTimeout(()=>y(!1),2e3)}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},L=async()=>{if(!r.trim()){_({title:"输入错误",description:"请输入新的 Token",variant:"destructive"});return}if(!E.isValid){const z=E.rules.filter(H=>!H.passed).map(H=>H.label).join(", ");_({title:"格式错误",description:`Token 不符合要求: ${z}`,variant:"destructive"});return}f(!0);try{const z=M(),H=await fetch("/api/webui/auth/update",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`},body:JSON.stringify({new_token:r.trim()})}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",r.trim()),s(""),e&&n(r.trim()),_({title:"更新成功",description:"Access Token 已更新,即将跳转到登录页"}),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},1500)):_({title:"更新失败",description:P.message||"无法更新 Token",variant:"destructive"})}catch(z){console.error("更新 Token 错误:",z),_({title:"更新失败",description:"连接服务器失败",variant:"destructive"})}finally{f(!1)}},I=async()=>{g(!0);try{const z=M(),H=await fetch("/api/webui/auth/regenerate",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`}}),P=await H.json();H.ok&&P.success?(localStorage.setItem("access-token",P.token),n(P.token),N(P.token),S(!0),T(!1),_({title:"生成成功",description:"新的 Access Token 已生成,请及时保存"})):_({title:"生成失败",description:P.message||"无法生成新 Token",variant:"destructive"})}catch(z){console.error("生成 Token 错误:",z),_({title:"生成失败",description:"连接服务器失败",variant:"destructive"})}finally{g(!1)}},$=async()=>{try{await navigator.clipboard.writeText(k),T(!0),_({title:"复制成功",description:"Token 已复制到剪贴板"})}catch{_({title:"复制失败",description:"请手动复制 Token",variant:"destructive"})}},V=()=>{S(!1),setTimeout(()=>{N(""),T(!1)},300),setTimeout(()=>{localStorage.removeItem("access-token"),t({to:"/auth"})},500)},ee=z=>{z||V()};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx(fr,{open:w,onOpenChange:ee,children:l.jsxs(rr,{className:"sm:max-w-md",children:[l.jsxs(sr,{children:[l.jsxs(ir,{className:"flex items-center gap-2",children:[l.jsx(ja,{className:"h-5 w-5 text-yellow-500"}),"新的 Access Token"]}),l.jsx(Ir,{children:"这是您的新 Token,请立即保存。关闭此窗口后将跳转到登录页面。"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"rounded-lg border-2 border-primary/20 bg-primary/5 p-4",children:[l.jsx(de,{className:"text-xs text-muted-foreground mb-2 block",children:"您的新 Token (64位安全令牌)"}),l.jsx("div",{className:"font-mono text-sm break-all select-all bg-background p-3 rounded border",children:k})]}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ja,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"重要提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"此 Token 仅显示一次,关闭后无法再查看"}),l.jsx("li",{children:"请立即复制并保存到安全的位置"}),l.jsx("li",{children:"关闭窗口后将自动跳转到登录页面"}),l.jsx("li",{children:"请使用新 Token 重新登录系统"})]})]})]})})]}),l.jsxs(ts,{className:"gap-2 sm:gap-0",children:[l.jsx(fe,{variant:"outline",onClick:$,className:"gap-2",children:C?l.jsxs(l.Fragment,{children:[l.jsx(so,{className:"h-4 w-4 text-green-500"}),"已复制"]}):l.jsxs(l.Fragment,{children:[l.jsx(k1,{className:"h-4 w-4"}),"复制 Token"]})}),l.jsx(fe,{onClick:V,children:"我已保存,关闭"})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"当前 Access Token"}),l.jsx("div",{className:"space-y-3 sm:space-y-4",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"current-token",className:"text-sm",children:"您的访问令牌"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"relative flex-1",children:[l.jsx(Pe,{id:"current-token",type:i?"text":"password",value:e||M(),readOnly:!0,className:"pr-10 font-mono text-sm",placeholder:"点击查看按钮显示 Token"}),l.jsx("button",{onClick:()=>{e||n(M()),a(!i)},className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:i?"隐藏":"显示",children:i?l.jsx(O1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(aa,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsx(fe,{variant:"outline",size:"icon",onClick:()=>q(M()),title:"复制到剪贴板",className:"flex-shrink-0",children:x?l.jsx(so,{className:"h-4 w-4 text-green-500"}):l.jsx(k1,{className:"h-4 w-4"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{variant:"outline",disabled:m,className:"gap-2 flex-1 sm:flex-none",children:[l.jsx(ti,{className:ye("h-4 w-4",m&&"animate-spin")}),l.jsx("span",{className:"hidden sm:inline",children:"重新生成"}),l.jsx("span",{className:"sm:hidden",children:"生成"})]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重新生成 Token"}),l.jsx(mn,{children:"这将生成一个新的 64 位安全令牌,并使当前 Token 立即失效。 您需要使用新 Token 重新登录系统。此操作不可撤销,确定要继续吗?"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:I,children:"确认生成"})]})]})]})]})]}),l.jsx("p",{className:"text-[10px] sm:text-xs text-muted-foreground",children:"请妥善保管您的 Access Token,不要泄露给他人"})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"自定义 Access Token"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"new-token",className:"text-sm",children:"新的访问令牌"}),l.jsxs("div",{className:"relative",children:[l.jsx(Pe,{id:"new-token",type:o?"text":"password",value:r,onChange:z=>s(z.target.value),className:"pr-10 font-mono text-sm",placeholder:"输入自定义 Token"}),l.jsx("button",{onClick:()=>c(!o),className:"absolute right-2 top-1/2 -translate-y-1/2 p-1.5 hover:bg-accent rounded",title:o?"隐藏":"显示",children:o?l.jsx(O1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(aa,{className:"h-4 w-4 text-muted-foreground"})})]}),r&&l.jsxs("div",{className:"mt-3 space-y-2 p-3 rounded-lg bg-muted/50",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"Token 安全要求:"}),l.jsx("div",{className:"space-y-1.5",children:E.rules.map(z=>l.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[z.passed?l.jsx(xc,{className:"h-4 w-4 text-green-500 flex-shrink-0"}):l.jsx(_K,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),l.jsx("span",{className:ye(z.passed?"text-green-600 dark:text-green-400":"text-muted-foreground"),children:z.label})]},z.id))}),E.isValid&&l.jsx("div",{className:"mt-2 pt-2 border-t border-border",children:l.jsxs("div",{className:"flex items-center gap-2 text-sm text-green-600 dark:text-green-400",children:[l.jsx(so,{className:"h-4 w-4"}),l.jsx("span",{className:"font-medium",children:"Token 格式正确,可以使用"})]})})]})]}),l.jsx(fe,{onClick:L,disabled:h||!E.isValid||!r,className:"w-full sm:w-auto",children:h?"更新中...":"更新自定义 Token"})]})]}),l.jsxs("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3 sm:p-4",children:[l.jsx("h4",{className:"text-sm sm:text-base font-semibold text-yellow-900 dark:text-yellow-200 mb-2",children:"安全提示"}),l.jsxs("ul",{className:"text-xs sm:text-sm text-yellow-800 dark:text-yellow-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"重新生成 Token 会创建系统随机生成的 64 位安全令牌"}),l.jsx("li",{children:"自定义 Token 必须满足所有安全要求才能使用"}),l.jsx("li",{children:"更新 Token 后,旧的 Token 将立即失效"}),l.jsx("li",{children:"请在安全的环境下查看和复制 Token"}),l.jsx("li",{children:"如果怀疑 Token 泄露,请立即重新生成或更新"}),l.jsx("li",{children:"建议使用系统生成的 Token 以获得最高安全性"})]})]})]})}function Hte(){const t=Ma(),{toast:e}=Gr(),[n,r]=b.useState(!1),[s,i]=b.useState(!1);if(s)throw new Error("这是一个手动触发的测试错误,用于验证错误边界组件是否正常工作。");const a=async()=>{r(!0);try{const o=localStorage.getItem("access-token"),c=await fetch("/api/webui/setup/reset",{method:"POST",headers:{Authorization:`Bearer ${o}`}}),h=await c.json();c.ok&&h.success?(e({title:"重置成功",description:"即将进入初次配置向导"}),setTimeout(()=>{t({to:"/setup"})},1e3)):e({title:"重置失败",description:h.message||"无法重置配置状态",variant:"destructive"})}catch(o){console.error("重置配置状态错误:",o),e({title:"重置失败",description:"连接服务器失败",variant:"destructive"})}finally{r(!1)}};return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"配置向导"}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"重新进行初次配置向导,可以帮助您重新设置系统的基础配置。"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{variant:"outline",disabled:n,className:"gap-2",children:[l.jsx(MK,{className:ye("h-4 w-4",n&&"animate-spin")}),"重新进行初次配置"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重新配置"}),l.jsx(mn,{children:"这将带您重新进入初次配置向导。您可以重新设置系统的基础配置项。确定要继续吗?"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:a,children:"确认重置"})]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border border-dashed border-yellow-500/50 bg-yellow-500/5 p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4 flex items-center gap-2",children:[l.jsx(ja,{className:"h-5 w-5 text-yellow-500"}),"开发者工具"]}),l.jsxs("div",{className:"space-y-3 sm:space-y-4",children:[l.jsx("div",{className:"space-y-2",children:l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"以下功能仅供开发调试使用,可能会导致页面崩溃或异常。"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{variant:"destructive",className:"gap-2",children:[l.jsx(ja,{className:"h-4 w-4"}),"触发测试错误"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认触发错误"}),l.jsx(mn,{children:"这将手动触发一个 React 错误,用于测试错误边界组件的显示效果。 页面将显示错误界面,您可以通过刷新页面或点击返回首页来恢复。"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>i(!0),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认触发"})]})]})]})]})]})]})}function Vte(){return l.jsxs("div",{className:"space-y-4 sm:space-y-6",children:[l.jsx("div",{className:"rounded-lg border-2 border-primary/30 bg-gradient-to-r from-primary/5 to-primary/10 p-4 sm:p-6",children:l.jsxs("div",{className:"flex items-start gap-3 sm:gap-4",children:[l.jsx("div",{className:"flex-shrink-0 rounded-lg bg-primary/10 p-2 sm:p-3",children:l.jsx("svg",{className:"h-6 w-6 sm:h-8 sm:w-8 text-primary",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"text-lg sm:text-xl font-bold text-foreground mb-2",children:"开源项目"}),l.jsx("p",{className:"text-sm sm:text-base text-muted-foreground mb-3",children:"本项目在 GitHub 开源,欢迎 Star ⭐ 支持!"}),l.jsxs("a",{href:"https://github.com/Mai-with-u/MaiBot-Dashboard",target:"_blank",rel:"noopener noreferrer",className:ye("inline-flex items-center gap-2 px-4 py-2 rounded-lg","bg-primary text-primary-foreground font-medium text-sm","hover:bg-primary/90 transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[l.jsx("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:l.jsx("path",{fillRule:"evenodd",d:"M12 2C6.477 2 2 6.484 2 12.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 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 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.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z",clipRule:"evenodd"})}),"前往 GitHub",l.jsx("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.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"})})]})]})]})}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsxs("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:["关于 ",p6]}),l.jsxs("div",{className:"space-y-2 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("p",{children:["版本: ",m6]}),l.jsx("p",{children:"麦麦(MaiBot)的现代化 Web 管理界面"})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"作者"}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"MaiBot 核心"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"Mai-with-u"})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium",children:"WebUI"}),l.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground",children:["Mai-with-u ",l.jsx("a",{href:"https://github.com/DrSmoothl",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline",children:"@MotricSeven"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"技术栈"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3 text-xs sm:text-sm text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"前端框架"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"React 19.2.0"}),l.jsx("li",{children:"TypeScript 5.7.2"}),l.jsx("li",{children:"Vite 6.0.7"}),l.jsx("li",{children:"TanStack Router 1.94.2"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"UI 组件"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"shadcn/ui"}),l.jsx("li",{children:"Radix UI"}),l.jsx("li",{children:"Tailwind CSS 3.4.17"}),l.jsx("li",{children:"Lucide Icons"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"后端"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Python 3.12+"}),l.jsx("li",{children:"FastAPI"}),l.jsx("li",{children:"Uvicorn"}),l.jsx("li",{children:"WebSocket"})]})]}),l.jsxs("div",{className:"space-y-1.5",children:[l.jsx("p",{className:"font-medium text-foreground",children:"构建工具"}),l.jsxs("ul",{className:"space-y-0.5 list-disc list-inside",children:[l.jsx("li",{children:"Bun / npm"}),l.jsx("li",{children:"ESLint 9.17.0"}),l.jsx("li",{children:"PostCSS"})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源库感谢"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mb-3",children:"本项目使用了以下优秀的开源库,感谢他们的贡献:"}),l.jsx(on,{className:"h-[300px] sm:h-[400px]",children:l.jsxs("div",{className:"space-y-4 pr-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"UI 框架与组件"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"React",description:"用户界面构建库",license:"MIT"}),l.jsx(or,{name:"shadcn/ui",description:"优雅的 React 组件库",license:"MIT"}),l.jsx(or,{name:"Radix UI",description:"无样式的可访问组件库",license:"MIT"}),l.jsx(or,{name:"Tailwind CSS",description:"实用优先的 CSS 框架",license:"MIT"}),l.jsx(or,{name:"Lucide React",description:"精美的图标库",license:"ISC"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"路由与状态管理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"TanStack Router",description:"类型安全的路由库",license:"MIT"}),l.jsx(or,{name:"Zustand",description:"轻量级状态管理",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"表单处理"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"React Hook Form",description:"高性能表单库",license:"MIT"}),l.jsx(or,{name:"Zod",description:"TypeScript 优先的 schema 验证",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"工具库"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"clsx",description:"条件 className 构建工具",license:"MIT"}),l.jsx(or,{name:"tailwind-merge",description:"Tailwind 类名合并工具",license:"MIT"}),l.jsx(or,{name:"class-variance-authority",description:"组件变体管理",license:"Apache-2.0"}),l.jsx(or,{name:"date-fns",description:"现代化日期处理库",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"动画效果"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"Framer Motion",description:"React 动画库",license:"MIT"}),l.jsx(or,{name:"vaul",description:"抽屉组件动画",license:"MIT"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"后端框架"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"FastAPI",description:"现代化 Python Web 框架",license:"MIT"}),l.jsx(or,{name:"Uvicorn",description:"ASGI 服务器",license:"BSD-3-Clause"}),l.jsx(or,{name:"Pydantic",description:"数据验证库",license:"MIT"}),l.jsx(or,{name:"python-multipart",description:"文件上传支持",license:"Apache-2.0"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:"开发工具"}),l.jsxs("div",{className:"grid gap-2 text-xs sm:text-sm",children:[l.jsx(or,{name:"TypeScript",description:"JavaScript 的超集",license:"Apache-2.0"}),l.jsx(or,{name:"Vite",description:"下一代前端构建工具",license:"MIT"}),l.jsx(or,{name:"ESLint",description:"JavaScript 代码检查工具",license:"MIT"}),l.jsx(or,{name:"PostCSS",description:"CSS 转换工具",license:"MIT"})]})]})]})})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6",children:[l.jsx("h3",{className:"text-base sm:text-lg font-semibold mb-3 sm:mb-4",children:"开源许可"}),l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"rounded-lg bg-primary/5 border border-primary/20 p-3 sm:p-4",children:l.jsxs("div",{className:"flex items-start gap-2 sm:gap-3",children:[l.jsx("div",{className:"flex-shrink-0 mt-0.5",children:l.jsx("div",{className:"rounded-md bg-primary/10 px-2 py-1",children:l.jsx("span",{className:"text-xs sm:text-sm font-bold text-primary",children:"GPLv3"})})}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"text-sm sm:text-base font-semibold text-foreground mb-1",children:"MaiBot WebUI"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目采用 GNU General Public License v3.0 开源许可证。 您可以自由地使用、修改和分发本软件,但必须保持相同的开源许可。"})]})]})}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground",children:"本项目依赖的所有开源库均遵循各自的开源许可证(MIT、Apache-2.0、BSD 等)。 感谢所有开源贡献者的无私奉献。"})]})]})]})}function or({name:t,description:e,license:n}){return l.jsxs("div",{className:"flex items-start justify-between gap-2 rounded-lg border bg-muted/30 p-2.5 sm:p-3",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("p",{className:"font-medium text-foreground truncate",children:t}),l.jsx("p",{className:"text-muted-foreground text-xs mt-0.5",children:e})]}),l.jsx("span",{className:"inline-flex items-center rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary flex-shrink-0",children:n})]})}function cw({value:t,current:e,onChange:n,label:r,description:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-3 sm:p-4 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-2 right-2 sm:top-3 sm:right-3 h-2 w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"text-sm sm:text-base font-medium",children:r}),l.jsx("div",{className:"text-[10px] sm:text-xs text-muted-foreground",children:s})]}),l.jsxs("div",{className:"mt-2 sm:mt-3 flex gap-1",children:[t==="light"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-200"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-300"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-400"})]}),t==="dark"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-slate-900"})]}),t==="system"&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-200 to-slate-700"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-300 to-slate-800"}),l.jsx("div",{className:"h-2 w-2 rounded-full bg-gradient-to-r from-slate-400 to-slate-900"})]})]})]})}function Ui({value:t,current:e,onChange:n,label:r,colorClass:s}){const i=e===t;return l.jsxs("button",{onClick:()=>n(t),className:ye("relative rounded-lg border-2 p-2 sm:p-3 text-left transition-all","hover:border-primary/50 hover:bg-accent/50",i?"border-primary bg-accent":"border-border"),children:[i&&l.jsx("div",{className:"absolute top-1.5 right-1.5 sm:top-2 sm:right-2 h-1.5 w-1.5 sm:h-2 sm:w-2 rounded-full bg-primary"}),l.jsxs("div",{className:"flex flex-col items-center gap-1.5 sm:gap-2",children:[l.jsx("div",{className:ye("h-8 w-8 sm:h-10 sm:w-10 rounded-full",s)}),l.jsx("div",{className:"text-[10px] sm:text-xs font-medium text-center",children:r})]})]})}class Ute{grad3;p;perm;constructor(e=0){this.grad3=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],this.p=[];for(let n=0;n<256;n++)this.p[n]=Math.floor(Math.random()*256);this.perm=[];for(let n=0;n<512;n++)this.perm[n]=this.p[n&255]}dot(e,n,r){return e[0]*n+e[1]*r}mix(e,n,r){return(1-r)*e+r*n}fade(e){return e*e*e*(e*(e*6-15)+10)}perlin2(e,n){const r=Math.floor(e)&255,s=Math.floor(n)&255;e-=Math.floor(e),n-=Math.floor(n);const i=this.fade(e),a=this.fade(n),o=this.perm[r]+s,c=this.perm[o],h=this.perm[o+1],f=this.perm[r+1]+s,m=this.perm[f],g=this.perm[f+1];return this.mix(this.mix(this.dot(this.grad3[c%12],e,n),this.dot(this.grad3[m%12],e-1,n),i),this.mix(this.dot(this.grad3[h%12],e,n-1),this.dot(this.grad3[g%12],e-1,n-1),i),a)}}function Wte(){const t=b.useRef(null),e=b.useRef(null),n=b.useRef(void 0),r=b.useRef({mouse:{x:-10,y:0,lx:0,ly:0,sx:0,sy:0,v:0,vs:0,a:0,set:!1},lines:[],paths:[],noise:new Ute(Math.random()),bounding:null});return b.useEffect(()=>{const s=e.current,i=t.current;if(!s||!i)return;const a=r.current,o=()=>{const w=s.getBoundingClientRect();a.bounding=w,i.style.width=`${w.width}px`,i.style.height=`${w.height}px`},c=()=>{if(!a.bounding)return;const{width:w,height:S}=a.bounding;a.lines=[],a.paths.forEach(L=>L.remove()),a.paths=[];const k=10,N=32,C=w+200,T=S+30,_=Math.ceil(C/k),E=Math.ceil(T/N),M=(w-k*_)/2,q=(S-N*E)/2;for(let L=0;L<=_;L++){const I=[];for(let V=0;V<=E;V++){const ee={x:M+k*L,y:q+N*V,wave:{x:0,y:0},cursor:{x:0,y:0,vx:0,vy:0}};I.push(ee)}const $=document.createElementNS("http://www.w3.org/2000/svg","path");i.appendChild($),a.paths.push($),a.lines.push(I)}},h=w=>{const{lines:S,mouse:k,noise:N}=a;S.forEach(C=>{C.forEach(T=>{const _=N.perlin2((T.x+w*.0125)*.002,(T.y+w*.005)*.0015)*12;T.wave.x=Math.cos(_)*32,T.wave.y=Math.sin(_)*16;const E=T.x-k.sx,M=T.y-k.sy,q=Math.hypot(E,M),L=Math.max(175,k.vs);if(q{const k={x:w.x+w.wave.x+(S?w.cursor.x:0),y:w.y+w.wave.y+(S?w.cursor.y:0)};return k.x=Math.round(k.x*10)/10,k.y=Math.round(k.y*10)/10,k},m=()=>{const{lines:w,paths:S}=a;w.forEach((k,N)=>{let C=f(k[0],!1),T=`M ${C.x} ${C.y}`;k.forEach((_,E)=>{const M=E===k.length-1;C=f(_,!M),T+=`L ${C.x} ${C.y}`}),S[N].setAttribute("d",T)})},g=w=>{const{mouse:S}=a;S.sx+=(S.x-S.sx)*.1,S.sy+=(S.y-S.sy)*.1;const k=S.x-S.lx,N=S.y-S.ly,C=Math.hypot(k,N);S.v=C,S.vs+=(C-S.vs)*.1,S.vs=Math.min(100,S.vs),S.lx=S.x,S.ly=S.y,S.a=Math.atan2(N,k),s&&(s.style.setProperty("--x",`${S.sx}px`),s.style.setProperty("--y",`${S.sy}px`)),h(w),m(),n.current=requestAnimationFrame(g)},x=w=>{if(!a.bounding)return;const{mouse:S}=a;S.x=w.pageX-a.bounding.left,S.y=w.pageY-a.bounding.top+window.scrollY,S.set||(S.sx=S.x,S.sy=S.y,S.lx=S.x,S.ly=S.y,S.set=!0)},y=()=>{o(),c()};return o(),c(),window.addEventListener("resize",y),window.addEventListener("mousemove",x),n.current=requestAnimationFrame(g),()=>{window.removeEventListener("resize",y),window.removeEventListener("mousemove",x),n.current&&cancelAnimationFrame(n.current)}},[]),l.jsxs("div",{ref:e,className:"waves-background",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"hidden",pointerEvents:"none"},children:[l.jsx("div",{className:"waves-cursor",style:{position:"absolute",top:0,left:0,width:"0.5rem",height:"0.5rem",background:"hsl(var(--primary) / 0.3)",borderRadius:"50%",transform:"translate3d(calc(var(--x, -0.5rem) - 50%), calc(var(--y, 50%) - 50%), 0)",willChange:"transform",pointerEvents:"none"}}),l.jsx("svg",{ref:t,style:{display:"block",width:"100%",height:"100%"},children:l.jsx("style",{children:` path { fill: none; stroke: hsl(var(--primary) / 0.20); stroke-width: 1px; } - `})})]})}function Rte(){const t=Ca();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function nL(){return!!localStorage.getItem("access-token")}function Dte(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Ca(),{enableWavesBackground:l,setEnableWavesBackground:c}=TP(),{theme:h,setTheme:f}=c6();b.useEffect(()=>{nL()&&a({to:"/"})},[a]);const g=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,x=()=>{f(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.ok&&k.valid){localStorage.setItem("access-token",t.trim());const N=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),C=await N.json();N.ok&&C.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return o.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[l&&o.jsx(Ate,{}),o.jsxs(_t,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[o.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?o.jsx(k3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):o.jsx(O3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),o.jsxs(wn,{className:"space-y-4 text-center",children:[o.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(EC,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(Sn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),o.jsx(Fr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),o.jsx(An,{children:o.jsxs("form",{onSubmit:y,className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),o.jsxs("div",{className:"relative",children:[o.jsx(WD,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),o.jsx(Pe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&o.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[o.jsx(Ou,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),o.jsx("span",{children:s})]}),o.jsx(me,{type:"submit",className:"w-full",disabled:n,children:n?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),o.jsxs(zr,{children:[o.jsx(h6,{asChild:!0,children:o.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[o.jsx(xK,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),o.jsxs(Sr,{className:"sm:max-w-md",children:[o.jsxs(kr,{children:[o.jsxs(Or,{className:"flex items-center gap-2",children:[o.jsx(EC,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),o.jsx(ps,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(vK,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),o.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[o.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),o.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(tl,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"flex-1 space-y-2",children:[o.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),o.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:o.jsx("code",{className:"text-primary",children:"data/webui.json"})}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",o.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),o.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Ou,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),o.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[o.jsx("p",{className:"font-semibold",children:"安全提示"}),o.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[o.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),o.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[o.jsx(w3,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsxs(hn,{className:"flex items-center gap-2",children:[o.jsx(w3,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),o.jsx(fn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),o.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),o.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:o.jsx("p",{children:lte})})]})}const nr=b.forwardRef(({className:t,...e},n)=>o.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));nr.displayName="Textarea";var zte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pte=zte.reduce((t,e)=>{const n=qk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Lte="Separator",m9="horizontal",Ite=["horizontal","vertical"],rL=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=m9,...s}=t,i=Bte(r)?r:m9,l=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return o.jsx(Pte.div,{"data-orientation":i,...l,...s,ref:e})});rL.displayName=Lte;function Bte(t){return Ite.includes(t)}var sL=rL;const Fm=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>o.jsx(sL,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));Fm.displayName=sL.displayName;const qte=Lh("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 Ln({className:t,variant:e,...n}){return o.jsx("div",{className:ye(qte({variant:e}),t),...n})}function Fte({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"qq_account",children:"QQ账号 *"}),o.jsx(Pe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"nickname",children:"昵称 *"}),o.jsx(Pe,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{children:"别名"}),o.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>o.jsxs(Ln,{variant:"secondary",className:"gap-1",children:[s,o.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:o.jsx(_0,{className:"h-3 w-3"})})]},i))}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),o.jsx(me,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function $te({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"personality",children:"人格特征 *"}),o.jsx(nr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"reply_style",children:"表达风格 *"}),o.jsx(nr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"interest",children:"兴趣 *"}),o.jsx(nr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"plan_style",children:"群聊说话规则 *"}),o.jsx(nr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),o.jsx(nr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function Qte({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),o.jsx(Pe,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"max_reg_num",children:"最大表情包数量"}),o.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"do_replace",children:"达到最大数量时替换"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),o.jsx(Tt,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(Pe,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"steal_emoji",children:"偷取表情包"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),o.jsx(Tt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"content_filtration",children:"启用表情包过滤"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),o.jsx(Tt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(Pe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function Hte({config:t,onChange:e}){return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"enable_tool",children:"启用工具系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),o.jsx(Tt,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"enable_mood",children:"启用情绪系统"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),o.jsx(Tt,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&o.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),o.jsx(Pe,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"emotion_style",children:"情感特征"}),o.jsx(nr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),o.jsx(Fm,{}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(de,{htmlFor:"all_global",children:"启用全局黑话模式"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),o.jsx(Tt,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function Vte({config:t,onChange:e}){const[n,r]=b.useState(!1);return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:"mt-0.5",children:o.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),o.jsxs("div",{className:"flex-1 text-sm",children:[o.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),o.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),o.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",o.jsx(Yd,{className:"h-3 w-3"})]})]})]})}),o.jsxs("div",{className:"space-y-3",children:[o.jsx(de,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),o.jsxs("div",{className:"relative",children:[o.jsx(Pe,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),o.jsx(me,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?o.jsx(b1,{className:"h-4 w-4 text-muted-foreground"}):o.jsx(sa,{className:"h-4 w-4 text-muted-foreground"})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),o.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[o.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),o.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[o.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),o.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),o.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),o.jsx("li",{children:"SenseVoice - 语音识别"}),o.jsx("li",{children:"BGE-M3 - 文本嵌入"}),o.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),o.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:o.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[o.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function mt(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function Nt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function Ute(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function Wte(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function Gte(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function Xte(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function Yte(){const t=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function Kte(t){const e=await mt("/api/webui/config/bot/section/bot",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function Zte(t){const e=await mt("/api/webui/config/bot/section/personality",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function Jte(t){const e=await mt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function ene(t){const e=[];e.push(mt("/api/webui/config/bot/section/tool",{method:"POST",headers:Nt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(mt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Nt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(mt("/api/webui/config/bot/section/mood",{method:"POST",headers:Nt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function tne(t){const e=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},l=await mt("/api/webui/config/model",{method:"POST",headers:Nt(),body:JSON.stringify(a)});if(!l.ok){const c=await l.json();throw new Error(c.detail||"保存模型配置失败")}return await l.json()}async function p9(){const t=localStorage.getItem("access-token"),e=await mt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}async function Bv(){const t=await mt("/api/webui/system/restart",{method:"POST",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function nne(){const t=await mt("/api/webui/system/status",{method:"GET",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function rne(){const t=Ca(),{toast:e}=Wr(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,h]=b.useState(!0),[f,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 + `})})]})}function Gte(){const t=Ma();b.useEffect(()=>{localStorage.getItem("access-token")||t({to:"/auth"})},[t])}function dL(){return!!localStorage.getItem("access-token")}function Xte(){const[t,e]=b.useState(""),[n,r]=b.useState(!1),[s,i]=b.useState(""),a=Ma(),{enableWavesBackground:o,setEnableWavesBackground:c}=LP(),{theme:h,setTheme:f}=f6();b.useEffect(()=>{dL()&&a({to:"/"})},[a]);const g=h==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":h,x=()=>{f(g==="dark"?"light":"dark")},y=async w=>{if(w.preventDefault(),i(""),!t.trim()){i("请输入 Access Token");return}r(!0);try{const S=await fetch("/api/webui/auth/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t.trim()})}),k=await S.json();if(S.ok&&k.valid){localStorage.setItem("access-token",t.trim());const N=await fetch("/api/webui/setup/status",{method:"GET",headers:{Authorization:`Bearer ${t.trim()}`}}),C=await N.json();N.ok&&C.is_first_setup?a({to:"/setup"}):a({to:"/"})}else i(k.message||"Token 验证失败,请检查后重试")}catch(S){console.error("Token 验证错误:",S),i("连接服务器失败,请检查网络连接")}finally{r(!1)}};return l.jsxs("div",{className:"relative flex min-h-screen items-center justify-center overflow-hidden bg-background p-4",children:[o&&l.jsx(Wte,{}),l.jsxs(Tt,{className:"relative z-10 w-full max-w-md shadow-2xl backdrop-blur-xl bg-card/80 border-border/50",children:[l.jsx("button",{onClick:x,className:"absolute right-4 top-4 rounded-lg p-2 hover:bg-accent transition-colors z-10 text-foreground",title:g==="dark"?"切换到浅色模式":"切换到深色模式",children:g==="dark"?l.jsx(T3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"}):l.jsx(E3,{className:"h-5 w-5",strokeWidth:2.5,fill:"none"})}),l.jsxs(vn,{className:"space-y-4 text-center",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(PC,{className:"h-8 w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(yn,{className:"text-2xl font-bold",children:"欢迎使用 MaiBot"}),l.jsx(zr,{className:"text-base",children:"请输入您的 Access Token 以继续访问系统"})]})]}),l.jsx(En,{children:l.jsxs("form",{onSubmit:y,className:"space-y-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"token",className:"text-sm font-medium",children:"Access Token"}),l.jsxs("div",{className:"relative",children:[l.jsx(nz,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground",strokeWidth:2,fill:"none"}),l.jsx(Pe,{id:"token",type:"password",placeholder:"请输入您的 Access Token",value:t,onChange:w=>e(w.target.value),className:ye("pl-10",s&&"border-red-500 focus-visible:ring-red-500"),disabled:n,autoFocus:!0,autoComplete:"off"})]})]}),s&&l.jsxs("div",{className:"flex items-center gap-2 rounded-md bg-red-50 p-3 text-sm text-red-600 dark:bg-red-950/50 dark:text-red-400",children:[l.jsx(ju,{className:"h-4 w-4 flex-shrink-0",strokeWidth:2,fill:"none"}),l.jsx("span",{children:s})]}),l.jsx(fe,{type:"submit",className:"w-full",disabled:n,children:n?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),"验证中..."]}):"验证并进入"}),l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-primary hover:text-primary/80 transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(Av,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我没有 Token,我该去哪里获得 Token?"]})}),l.jsxs(rr,{className:"sm:max-w-md",children:[l.jsxs(sr,{children:[l.jsxs(ir,{className:"flex items-center gap-2",children:[l.jsx(PC,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"如何获取 Access Token"]}),l.jsx(Ir,{children:"Access Token 是访问 MaiBot WebUI 的唯一凭证,请按以下方式获取"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(AK,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式一:查看启动日志"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"在 MaiBot 启动时,控制台会显示 WebUI Access Token。"}),l.jsxs("div",{className:"rounded bg-background p-2 font-mono text-xs",children:[l.jsx("p",{className:"text-muted-foreground",children:"🔑 WebUI Access Token: abc123..."}),l.jsx("p",{className:"text-muted-foreground",children:"💡 请使用此 Token 登录 WebUI"})]})]})]})}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(io,{className:"h-5 w-5 text-primary flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"flex-1 space-y-2",children:[l.jsx("h4",{className:"font-semibold text-sm",children:"方式二:查看配置文件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"Token 保存在项目根目录的配置文件中:"}),l.jsx("div",{className:"rounded bg-background p-2 font-mono text-xs break-all",children:l.jsx("code",{className:"text-primary",children:"data/webui.json"})}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["打开此文件,复制 ",l.jsx("code",{className:"px-1 py-0.5 bg-background rounded",children:"access_token"})," 字段的值"]})]})]})}),l.jsx("div",{className:"rounded-lg border border-yellow-200 dark:border-yellow-900 bg-yellow-50 dark:bg-yellow-950/30 p-3",children:l.jsxs("div",{className:"flex gap-2",children:[l.jsx(ju,{className:"h-4 w-4 text-yellow-600 dark:text-yellow-500 flex-shrink-0 mt-0.5",strokeWidth:2,fill:"none"}),l.jsxs("div",{className:"text-sm text-yellow-800 dark:text-yellow-300 space-y-1",children:[l.jsx("p",{className:"font-semibold",children:"安全提示"}),l.jsxs("ul",{className:"list-disc list-inside space-y-0.5 text-xs",children:[l.jsx("li",{children:"请妥善保管您的 Token,不要泄露给他人"}),l.jsx("li",{children:"如需重置 Token,请在登录后前往系统设置"})]})]})]})})]})]})]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs("button",{className:"w-full text-center text-sm text-muted-foreground hover:text-foreground transition-colors underline-offset-4 hover:underline flex items-center justify-center gap-1",children:[l.jsx(C3,{className:"h-4 w-4",strokeWidth:2,fill:"none"}),"我觉得这个界面很卡怎么办?"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsxs(fn,{className:"flex items-center gap-2",children:[l.jsx(C3,{className:"h-5 w-5 text-primary",strokeWidth:2,fill:"none"}),"关闭背景动画"]}),l.jsx(mn,{children:"背景动画可能会在低性能设备上造成卡顿。关闭动画可以显著提升界面流畅度。"})]}),l.jsx("div",{className:"rounded-lg border bg-muted/50 p-4 space-y-2",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"关闭动画后,背景将变为纯色,但不影响任何功能的使用。您可以随时在系统设置中重新开启动画。"})}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>c(!1),children:"关闭动画"})]})]})]})]})})]}),l.jsx("div",{className:"absolute bottom-4 left-0 right-0 text-center text-xs text-muted-foreground",children:l.jsx("p",{children:kte})})]})}const dr=b.forwardRef(({className:t,...e},n)=>l.jsx("textarea",{className:ye("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));dr.displayName="Textarea";var Yte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Kte=Yte.reduce((t,e)=>{const n=Vk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),Zte="Separator",w9="horizontal",Jte=["horizontal","vertical"],hL=b.forwardRef((t,e)=>{const{decorative:n,orientation:r=w9,...s}=t,i=ene(r)?r:w9,o=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return l.jsx(Kte.div,{"data-orientation":i,...o,...s,ref:e})});hL.displayName=Zte;function ene(t){return Jte.includes(t)}var fL=hL;const Hm=b.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...r},s)=>l.jsx(fL,{ref:s,decorative:n,orientation:e,className:ye("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));Hm.displayName=fL.displayName;const tne=Ih("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 In({className:t,variant:e,...n}){return l.jsx("div",{className:ye(tne({variant:e}),t),...n})}function nne({config:t,onChange:e}){const n=s=>{s.trim()&&!t.alias_names.includes(s.trim())&&e({...t,alias_names:[...t.alias_names,s.trim()]})},r=s=>{e({...t,alias_names:t.alias_names.filter((i,a)=>a!==s)})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"qq_account",children:"QQ账号 *"}),l.jsx(Pe,{id:"qq_account",type:"number",placeholder:"请输入机器人的QQ账号",value:t.qq_account||"",onChange:s=>e({...t,qq_account:Number(s.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人登录使用的QQ账号"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"nickname",children:"昵称 *"}),l.jsx(Pe,{id:"nickname",placeholder:"请输入机器人的昵称",value:t.nickname,onChange:s=>e({...t,nickname:s.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的主要称呼名称"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{children:"别名"}),l.jsx("div",{className:"flex flex-wrap gap-2 mb-2",children:t.alias_names.map((s,i)=>l.jsxs(In,{variant:"secondary",className:"gap-1",children:[s,l.jsx("button",{type:"button",onClick:()=>r(i),className:"ml-1 hover:text-destructive",children:l.jsx(R0,{className:"h-3 w-3"})})]},i))}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{id:"alias_input",placeholder:"输入别名后按回车添加",onKeyPress:s=>{s.key==="Enter"&&(n(s.target.value),s.target.value="")}}),l.jsx(fe,{type:"button",variant:"outline",onClick:()=>{const s=document.getElementById("alias_input");s&&(n(s.value),s.value="")},children:"添加"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人的其他称呼,可以添加多个"})]})]})}function rne({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"personality",children:"人格特征 *"}),l.jsx(dr,{id:"personality",placeholder:"描述机器人的人格特质和身份特征(建议120字以内)",value:t.personality,onChange:n=>e({...t,personality:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:是一个女大学生,现在在读大二,会刷贴吧"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"reply_style",children:"表达风格 *"}),l.jsx(dr,{id:"reply_style",placeholder:"描述机器人说话的表达风格、表达习惯",value:t.reply_style,onChange:n=>e({...t,reply_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"例如:回复平淡一些,简短一些,说中文,参考贴吧、知乎和微博的回复风格"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"interest",children:"兴趣 *"}),l.jsx(dr,{id:"interest",placeholder:"描述机器人感兴趣的话题",value:t.interest,onChange:n=>e({...t,interest:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"会影响机器人对什么话题进行回复"})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"plan_style",children:"群聊说话规则 *"}),l.jsx(dr,{id:"plan_style",placeholder:"机器人在群聊中的行为风格和规则",value:t.plan_style,onChange:n=>e({...t,plan_style:n.target.value}),rows:4}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在群聊中如何行动,例如回复频率、条件等"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"private_plan_style",children:"私聊说话规则 *"}),l.jsx(dr,{id:"private_plan_style",placeholder:"机器人在私聊中的行为风格和规则",value:t.private_plan_style,onChange:n=>e({...t,private_plan_style:n.target.value}),rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"定义机器人在私聊中的行为方式"})]})]})}function sne({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(t.emoji_chance*100).toFixed(0),"%"]})]}),l.jsx(Pe,{id:"emoji_chance",type:"range",min:"0",max:"1",step:"0.1",value:t.emoji_chance,onChange:n=>e({...t,emoji_chance:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人发送表情包的概率"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"max_reg_num",children:"最大表情包数量"}),l.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",max:"200",value:t.max_reg_num,onChange:n=>e({...t,max_reg_num:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"机器人最多保存的表情包数量"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"do_replace",children:"达到最大数量时替换"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"开启后会删除旧表情包,关闭则不再收集新表情包"})]}),l.jsx(_t,{id:"do_replace",checked:t.do_replace,onCheckedChange:n=>e({...t,do_replace:n})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Pe,{id:"check_interval",type:"number",min:"1",max:"120",value:t.check_interval,onChange:n=>e({...t,check_interval:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包注册、破损、删除的时间间隔"})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"steal_emoji",children:"偷取表情包"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人将一些表情包据为己有"})]}),l.jsx(_t,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:n=>e({...t,steal_emoji:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"content_filtration",children:"启用表情包过滤"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只保存符合要求的表情包"})]}),l.jsx(_t,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:n=>e({...t,content_filtration:n})})]}),t.content_filtration&&l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Pe,{id:"filtration_prompt",placeholder:"例如:符合公序良俗",value:t.filtration_prompt,onChange:n=>e({...t,filtration_prompt:n.target.value})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"描述表情包应该符合的要求"})]})]})}function ine({config:t,onChange:e}){return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"enable_tool",children:"启用工具系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人使用各种工具增强功能"})]}),l.jsx(_t,{id:"enable_tool",checked:t.enable_tool,onCheckedChange:n=>e({...t,enable_tool:n})})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"enable_mood",children:"启用情绪系统"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"让机器人具有情绪变化能力"})]}),l.jsx(_t,{id:"enable_mood",checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})})]}),t.enable_mood&&l.jsxs("div",{className:"ml-6 space-y-6 border-l-2 border-primary/20 pl-6",children:[l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"mood_update_threshold",children:"情绪更新阈值"}),l.jsx(Pe,{id:"mood_update_threshold",type:"number",min:"0.1",max:"10",step:"0.1",value:t.mood_update_threshold||1,onChange:n=>e({...t,mood_update_threshold:Number(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"值越高,情绪更新越慢"})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"emotion_style",children:"情感特征"}),l.jsx(dr,{id:"emotion_style",placeholder:"描述情绪的变化情况,例如:情绪较为稳定,但遭遇特定事件时起伏较大",value:t.emotion_style||"",onChange:n=>e({...t,emotion_style:n.target.value}),rows:2}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响机器人的情绪变化方式"})]})]}),l.jsx(Hm,{}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx(de,{htmlFor:"all_global",children:"启用全局黑话模式"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"允许机器人学习和使用群组黑话"})]}),l.jsx(_t,{id:"all_global",checked:t.all_global,onCheckedChange:n=>e({...t,all_global:n})})]})]})}function ane({config:t,onChange:e}){const[n,r]=b.useState(!1);return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-4",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx("div",{className:"mt-0.5",children:l.jsx("svg",{className:"h-5 w-5 text-blue-600 dark:text-blue-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),l.jsxs("div",{className:"flex-1 text-sm",children:[l.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100 mb-1",children:"关于硅基流动 (SiliconFlow)"}),l.jsx("p",{className:"text-blue-700 dark:text-blue-300 mb-2",children:"硅基流动提供了完整的模型覆盖,包括 DeepSeek V3、Qwen、视觉模型、语音识别和嵌入模型。 只需一个 API Key 即可使用麦麦的所有功能!"}),l.jsxs("a",{href:"https://cloud.siliconflow.cn",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-blue-600 dark:text-blue-400 hover:underline font-medium",children:["前往硅基流动获取 API Key",l.jsx(Kd,{className:"h-3 w-3"})]})]})]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsx(de,{htmlFor:"siliconflow_api_key",children:"SiliconFlow API Key *"}),l.jsxs("div",{className:"relative",children:[l.jsx(Pe,{id:"siliconflow_api_key",type:n?"text":"password",placeholder:"sk-...",value:t.api_key,onChange:s=>e({api_key:s.target.value}),className:"font-mono pr-10"}),l.jsx(fe,{type:"button",variant:"ghost",size:"sm",className:"absolute right-0 top-0 h-full px-3 hover:bg-transparent",onClick:()=>r(!n),children:n?l.jsx(O1,{className:"h-4 w-4 text-muted-foreground"}):l.jsx(aa,{className:"h-4 w-4 text-muted-foreground"})})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"请输入您的硅基流动 API 密钥。获取后,麦麦将自动配置所有必需的模型。"})]}),l.jsxs("div",{className:"rounded-lg bg-muted/50 p-4 text-sm space-y-2",children:[l.jsx("p",{className:"font-medium",children:"将自动配置以下模型:"}),l.jsxs("ul",{className:"list-disc list-inside space-y-1 text-muted-foreground ml-2",children:[l.jsx("li",{children:"DeepSeek V3 - 主要对话和工具模型"}),l.jsx("li",{children:"Qwen3 30B - 高频小任务和工具调用"}),l.jsx("li",{children:"Qwen3 VL 30B - 图像识别"}),l.jsx("li",{children:"SenseVoice - 语音识别"}),l.jsx("li",{children:"BGE-M3 - 文本嵌入"}),l.jsx("li",{children:"知识库相关模型 (LPMM)"})]})]}),l.jsx("div",{className:"rounded-lg border border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/30 p-4",children:l.jsxs("p",{className:"text-sm text-amber-900 dark:text-amber-100",children:[l.jsx("span",{className:"font-medium",children:"💡 提示:"}),'完成向导后,您可以在"系统设置 → 模型配置"中添加更多 API 提供商和模型。']})})]})}async function mt(t,e){const n=await fetch(t,e);if(n.status===401)throw localStorage.removeItem("access-token"),window.location.href="/auth",new Error("认证失败,请重新登录");return n}function Nt(){return{"Content-Type":"application/json",Authorization:`Bearer ${localStorage.getItem("access-token")}`}}async function lne(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取Bot配置失败");const n=(await t.json()).config.bot||{};return{qq_account:n.qq_account||0,nickname:n.nickname||"",alias_names:n.alias_names||[]}}async function one(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取人格配置失败");const n=(await t.json()).config.personality||{};return{personality:n.personality||"",reply_style:n.reply_style||"",interest:n.interest||"",plan_style:n.plan_style||"",private_plan_style:n.private_plan_style||""}}async function cne(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取表情包配置失败");const n=(await t.json()).config.emoji||{};return{emoji_chance:n.emoji_chance??.4,max_reg_num:n.max_reg_num??40,do_replace:n.do_replace??!0,check_interval:n.check_interval??10,steal_emoji:n.steal_emoji??!0,content_filtration:n.content_filtration??!1,filtration_prompt:n.filtration_prompt||""}}async function une(){const t=await mt("/api/webui/config/bot",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取其他配置失败");const n=(await t.json()).config,r=n.tool||{},s=n.mood||{},i=n.jargon||{};return{enable_tool:r.enable_tool??!0,enable_mood:s.enable_mood??!1,mood_update_threshold:s.mood_update_threshold,emotion_style:s.emotion_style,all_global:i.all_global??!0}}async function dne(){const t=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!t.ok)throw new Error("读取模型配置失败");return{api_key:((await t.json()).config.api_providers||[]).find(i=>i.name==="SiliconFlow")?.api_key||""}}async function hne(t){const e=await mt("/api/webui/config/bot/section/bot",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存Bot基础配置失败")}return await e.json()}async function fne(t){const e=await mt("/api/webui/config/bot/section/personality",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存人格配置失败")}return await e.json()}async function mne(t){const e=await mt("/api/webui/config/bot/section/emoji",{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"保存表情包配置失败")}return await e.json()}async function pne(t){const e=[];e.push(mt("/api/webui/config/bot/section/tool",{method:"POST",headers:Nt(),body:JSON.stringify({enable_tool:t.enable_tool})})),e.push(mt("/api/webui/config/bot/section/jargon",{method:"POST",headers:Nt(),body:JSON.stringify({all_global:t.all_global})}));const n={enable_mood:t.enable_mood};t.enable_mood&&(n.mood_update_threshold=t.mood_update_threshold||1,n.emotion_style=t.emotion_style||""),e.push(mt("/api/webui/config/bot/section/mood",{method:"POST",headers:Nt(),body:JSON.stringify(n)}));const r=await Promise.all(e);for(const s of r)if(!s.ok){const i=await s.json();throw new Error(i.detail||"保存其他配置失败")}return{success:!0}}async function gne(t){const e=await mt("/api/webui/config/model",{method:"GET",headers:Nt()});if(!e.ok)throw new Error("读取模型配置失败");const r=(await e.json()).config,s=r.api_providers||[],i=s.findIndex(c=>c.name==="SiliconFlow");i>=0?s[i]={...s[i],api_key:t.api_key}:s.push({name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",api_key:t.api_key,client_type:"openai",max_retry:3,timeout:120,retry_interval:5});const a={...r,api_providers:s},o=await mt("/api/webui/config/model",{method:"POST",headers:Nt(),body:JSON.stringify(a)});if(!o.ok){const c=await o.json();throw new Error(c.detail||"保存模型配置失败")}return await o.json()}async function S9(){const t=localStorage.getItem("access-token"),e=await mt("/api/webui/setup/complete",{method:"POST",headers:{Authorization:`Bearer ${t}`}});if(!e.ok){const n=await e.json();throw new Error(n.message||"标记配置完成失败")}return await e.json()}async function Hv(){const t=await mt("/api/webui/system/restart",{method:"POST",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"重启失败")}return await t.json()}async function xne(){const t=await mt("/api/webui/system/status",{method:"GET",headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取状态失败")}return await t.json()}function vne(){const t=Ma(),{toast:e}=Gr(),[n,r]=b.useState(0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!0),[f,m]=b.useState({qq_account:0,nickname:"",alias_names:[]}),[g,x]=b.useState({personality:"是一个女大学生,现在在读大二,会刷贴吧。",reply_style:"请回复的平淡一些,简短一些,说中文,不要刻意突出自身学科背景。可以参考贴吧,知乎和微博的回复风格。",interest:"对技术相关话题,游戏和动漫相关话题感兴趣,也对日常话题感兴趣,不喜欢太过沉重严肃的话题",plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 3.请控制你的发言频率,不要太过频繁的发言 4.如果有人对你感到厌烦,请减少回复 5.如果有人对你进行攻击,或者情绪激动,请你以合适的方法应对`,private_plan_style:`1.思考**所有**的可用的action中的**每个动作**是否符合当下条件,如果动作使用条件符合聊天内容就使用 2.如果相同的内容已经被执行,请不要重复执行 -3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[N,C]=b.useState({api_key:""}),[T,_]=b.useState(!1),[E,M]=b.useState(""),q=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:bK},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:GD},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Xk},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:vu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:WD}],L=(n+1)/q.length*100;b.useEffect(()=>{(async()=>{try{h(!0);const[W,J,X,R,se]=await Promise.all([Ute(),Wte(),Gte(),Xte(),Yte()]);m(W),x(J),w(X),k(R),C(se)}catch(W){e({title:"加载配置失败",description:W instanceof Error?W.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const I=async()=>{l(!0);try{switch(n){case 0:await Kte(f);break;case 1:await Zte(g);break;case 2:await Jte(y);break;case 3:await ene(S);break;case 4:await tne(N);break}return e({title:"保存成功",description:`${q[n].title}配置已保存`}),!0}catch(P){return e({title:"保存失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"}),!1}finally{l(!1)}},$=async()=>{await I()&&n{n>0&&r(n-1)},ee=async()=>{i(!0),_(!0);try{if(M("正在保存API配置..."),!await I()){i(!1),_(!1);return}M("正在完成初始化..."),await p9(),M("正在重启麦麦..."),await Bv(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),M("等待麦麦重启完成...");const W=60;let J=0,X=!1;for(;JsetTimeout(R,1e3));try{(await nne()).running&&(X=!0,M("重启成功!正在跳转..."))}catch{J++}}if(!X)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(P){_(!1),e({title:"配置失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await p9(),t({to:"/"})}catch(P){e({title:"跳过失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},H=()=>{switch(n){case 0:return o.jsx(Fte,{config:f,onChange:m});case 1:return o.jsx($te,{config:g,onChange:x});case 2:return o.jsx(Qte,{config:y,onChange:w});case 3:return o.jsx(Hte,{config:S,onChange:k});case 4:return o.jsx(Vte,{config:N,onChange:C});default:return null}};return o.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[T&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:o.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[o.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:o.jsx(dh,{className:"h-10 w-10 animate-spin text-primary"})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground",children:E})]}),o.jsx("div",{className:"w-full",children:o.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:o.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),o.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[o.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),o.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),c?o.jsxs("div",{className:"relative z-10 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:o.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),o.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),o.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[o.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:o.jsx(yK,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),o.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),o.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",d6," 的初始配置"]})]}),o.jsxs("div",{className:"mb-6 md:mb-8",children:[o.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[o.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",q.length]}),o.jsxs("span",{className:"font-medium text-primary",children:[Math.round(L),"%"]})]}),o.jsx(I0,{value:L,className:"h-2"})]}),o.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:q.map((P,W)=>{const J=P.icon;return o.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Wt({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[o.jsx(w1,{className:"h-4 w-4"}),"返回首页"]}),o.jsxs(me,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[o.jsx(XD,{className:"h-4 w-4"}),"返回上一页"]})]}),o.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:o.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var aL=["PageUp","PageDown"],oL=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],lL={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},Ih="Slider",[P3,sne,ine]=Sv(Ih),[cL]=Ta(Ih,[ine]),[ane,qv]=cL(Ih),uL=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),C=a==="horizontal"?one:lne,[T=[],_]=Cc({prop:f,defaultProp:h,onChange:$=>{[...S.current][k.current]?.focus(),m($)}}),E=b.useRef(T);function M($){const V=fne(T,$);I($,V)}function q($){I($,k.current)}function L(){const $=E.current[k.current];T[k.current]!==$&&g(T)}function I($,V,{commit:ee}={commit:!1}){const z=xne(i),H=vne(Math.round(($-r)/i)*i+r,z),P=Bk(H,[r,s]);_((W=[])=>{const J=dne(W,P,V);if(gne(J,c*i)){k.current=J.indexOf(P);const X=String(J)!==String(W);return X&&ee&&g(J),X?J:W}else return W})}return o.jsx(ane,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:o.jsx(P3.Provider,{scope:t.__scopeSlider,children:o.jsx(P3.Slot,{scope:t.__scopeSlider,children:o.jsx(C,{"aria-disabled":l,"data-disabled":l?"":void 0,...w,ref:e,onPointerDown:Ze(w.onPointerDown,()=>{l||(E.current=T)}),min:r,max:s,inverted:x,onSlideStart:l?void 0:M,onSlideMove:l?void 0:q,onSlideEnd:l?void 0:L,onHomeKeyDown:()=>!l&&I(r,0,{commit:!0}),onEndKeyDown:()=>!l&&I(s,T.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:V})=>{if(!l){const H=aL.includes($.key)||$.shiftKey&&oL.includes($.key)?10:1,P=k.current,W=T[P],J=i*H*V;I(W+J,P,{commit:!0})}}})})})})});uL.displayName=Ih;var[dL,hL]=cL(Ih,{startEdge:"left",endEdge:"right",size:"width",direction:1}),one=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:l,onSlideEnd:c,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),x=qn(e,C=>g(C)),y=b.useRef(void 0),w=T0(s),S=w==="ltr",k=S&&!i||!S&&i;function N(C){const T=y.current||m.getBoundingClientRect(),_=[0,T.width],M=f6(_,k?[n,r]:[r,n]);return y.current=T,M(C-T.left)}return o.jsx(dL,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:o.jsx(fL,{dir:w,"data-orientation":"horizontal",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=N(C.clientX);a?.(T)},onSlideMove:C=>{const T=N(C.clientX);l?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:C=>{const _=lL[k?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:_?-1:1})}})})}),lne=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:l,onStepKeyDown:c,...h}=t,f=b.useRef(null),m=qn(e,f),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||f.current.getBoundingClientRect(),k=[0,S.height],C=f6(k,x?[r,n]:[n,r]);return g.current=S,C(w-S.top)}return o.jsx(dL,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(fL,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,l?.()},onStepKeyDown:w=>{const k=lL[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),fL=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:l,onStepKeyDown:c,...h}=t,f=qv(Ih,n);return o.jsx(xn.span,{...h,ref:e,onKeyDown:Ze(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(l(m),m.preventDefault()):aL.concat(oL).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:Ze(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:Ze(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:Ze(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),mL="SliderTrack",pL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=qv(mL,n);return o.jsx(xn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});pL.displayName=mL;var L3="SliderRange",gL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=qv(L3,n),i=hL(L3,n),a=b.useRef(null),l=qn(e,a),c=s.values.length,h=s.values.map(g=>yL(g,s.min,s.max)),f=c>1?Math.min(...h):0,m=100-Math.max(...h);return o.jsx(xn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});gL.displayName=L3;var I3="SliderThumb",xL=b.forwardRef((t,e)=>{const n=sne(t.__scopeSlider),[r,s]=b.useState(null),i=qn(e,l=>s(l)),a=b.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return o.jsx(cne,{...t,ref:i,index:a})}),cne=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=qv(I3,n),l=hL(I3,n),[c,h]=b.useState(null),f=qn(e,N=>h(N)),m=c?a.form||!!c.closest("form"):!0,g=TD(c),x=a.values[r],y=x===void 0?0:yL(x,a.min,a.max),w=hne(r,a.values.length),S=g?.[l.size],k=S?mne(S,y,l.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${y}% + ${k}px)`},children:[o.jsx(P3.ItemSlot,{scope:t.__scopeSlider,children:o.jsx(xn.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:f,style:x===void 0?{display:"none"}:t.style,onFocus:Ze(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&o.jsx(vL,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});xL.displayName=I3;var une="RadioBubbleInput",vL=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=qn(s,r),a=CD(e);return b.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&f){const m=new Event("input",{bubbles:!0});f.call(l,e),l.dispatchEvent(m)}},[a,e]),o.jsx(xn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});vL.displayName=une;function dne(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function yL(t,e,n){const i=100/(n-e)*(t-e);return Bk(i,[0,100])}function hne(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function fne(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function mne(t,e,n){const r=t/2,i=f6([0,50],[0,r]);return(r-i(e)*n)*n}function pne(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function gne(t,e){if(e>0){const n=pne(t);return Math.min(...n)>=e}return!0}function f6(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function xne(t){return(String(t).split(".")[1]||"").length}function vne(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var bL=uL,yne=pL,bne=gL,wne=xL;const B0=b.forwardRef(({className:t,...e},n)=>o.jsxs(bL,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[o.jsx(yne,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:o.jsx(bne,{className:"absolute h-full bg-primary"})}),o.jsx(wne,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));B0.displayName=bL.displayName;const Dt=iK,zt=aK,Mt=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(AD,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,o.jsx(eK,{asChild:!0,children:o.jsx(Im,{className:"h-4 w-4 opacity-50"})})]}));Mt.displayName=AD.displayName;const wL=b.forwardRef(({className:t,...e},n)=>o.jsx(RD,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(j3,{className:"h-4 w-4"})}));wL.displayName=RD.displayName;const SL=b.forwardRef(({className:t,...e},n)=>o.jsx(DD,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:o.jsx(Im,{className:"h-4 w-4"})}));SL.displayName=DD.displayName;const At=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>o.jsx(tK,{children:o.jsxs(zD,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[o.jsx(wL,{}),o.jsx(nK,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),o.jsx(SL,{})]})}));At.displayName=zD.displayName;const Sne=b.forwardRef(({className:t,...e},n)=>o.jsx(PD,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));Sne.displayName=PD.displayName;const ze=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(LD,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(rK,{children:o.jsx(dc,{className:"h-4 w-4"})})}),o.jsx(sK,{children:e})]}));ze.displayName=LD.displayName;const kne=b.forwardRef(({className:t,...e},n)=>o.jsx(ID,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));kne.displayName=ID.displayName;function One(t){const e=jne(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(Cne);if(c){const h=c.props.children,f=l.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function jne(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=Ene(s),l=Tne(i,s.props);return s.type!==b.Fragment&&(l.ref=r?mc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Nne=Symbol("radix.slottable");function Cne(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Nne}function Tne(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Ene(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Fv="Popover",[kL]=Ta(Fv,[Ah]),q0=Ah(),[_ne,Tc]=kL(Fv),OL=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,l=q0(e),c=b.useRef(null),[h,f]=b.useState(!1),[m,g]=Cc({prop:r,defaultProp:s??!1,onChange:i,caller:Fv});return o.jsx(Nv,{...l,children:o.jsx(_ne,{scope:e,contentId:ea(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:h,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:a,children:n})})};OL.displayName=Fv;var jL="PopoverAnchor",Mne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Tc(jL,n),i=q0(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:l}=s;return b.useEffect(()=>(a(),()=>l()),[a,l]),o.jsx(Cv,{...i,...r,ref:e})});Mne.displayName=jL;var NL="PopoverTrigger",CL=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Tc(NL,n),i=q0(n),a=qn(e,s.triggerRef),l=o.jsx(xn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":AL(s.open),...r,ref:a,onClick:Ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:o.jsx(Cv,{asChild:!0,...i,children:l})});CL.displayName=NL;var m6="PopoverPortal",[Ane,Rne]=kL(m6,{forceMount:void 0}),TL=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Tc(m6,e);return o.jsx(Ane,{scope:e,forceMount:n,children:o.jsx(ai,{present:n||i.open,children:o.jsx(jv,{asChild:!0,container:s,children:r})})})};TL.displayName=m6;var gh="PopoverContent",EL=b.forwardRef((t,e)=>{const n=Rne(gh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Tc(gh,t.__scopePopover);return o.jsx(ai,{present:r||i.open,children:i.modal?o.jsx(zne,{...s,ref:e}):o.jsx(Pne,{...s,ref:e})})});EL.displayName=gh;var Dne=One("PopoverContent.RemoveScroll"),zne=b.forwardRef((t,e)=>{const n=Tc(gh,t.__scopePopover),r=b.useRef(null),s=qn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return BD(a)},[]),o.jsx(qD,{as:Dne,allowPinchZoom:!0,children:o.jsx(_L,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ze(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(t.onPointerDownOutside,a=>{const l=a.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,h=l.button===2||c;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Ze(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Pne=b.forwardRef((t,e)=>{const n=Tc(gh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return o.jsx(_L,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),_L=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:h,onInteractOutside:f,...m}=t,g=Tc(gh,n),x=q0(n);return FD(),o.jsx($D,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:o.jsx(Uk,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:o.jsx(Wk,{"data-state":AL(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),ML="PopoverClose",Lne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Tc(ML,n);return o.jsx(xn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,()=>s.onOpenChange(!1))})});Lne.displayName=ML;var Ine="PopoverArrow",Bne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=q0(n);return o.jsx(Gk,{...s,...r,ref:e})});Bne.displayName=Ine;function AL(t){return t?"open":"closed"}var qne=OL,Fne=CL,$ne=TL,RL=EL;const cl=qne,ul=Fne,so=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>o.jsx($ne,{children:o.jsx(RL,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",t),...r})}));so.displayName=RL.displayName;const Ec="/api/webui/config";async function g9(){const e=await(await mt(`${Ec}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Zd(){const e=await(await mt(`${Ec}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function x9(t){const n=await(await mt(`${Ec}/bot`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Qne(){const e=await(await mt(`${Ec}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function Hne(t){const n=await(await mt(`${Ec}/bot/raw`,{method:"POST",headers:Nt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function T1(t){const n=await(await mt(`${Ec}/model`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function Vne(t,e){const r=await(await mt(`${Ec}/bot/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function B3(t,e){const r=await(await mt(`${Ec}/model/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const Une=Lh("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),nl=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx("div",{ref:r,role:"alert",className:ye(Une({variant:e}),t),...n}));nl.displayName="Alert";const Wne=b.forwardRef(({className:t,...e},n)=>o.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));Wne.displayName="AlertTitle";const rl=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));rl.displayName="AlertDescription";function p6({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,l]=b.useState(0),[c,h]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{l(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),f()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const f=()=>{const x=async()=>{try{if(h(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{c<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return o.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:o.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[o.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&o.jsxs(o.Fragment,{children:[o.jsx(dh,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&o.jsxs(o.Fragment,{children:[o.jsx(dh,{className:"h-16 w-16 text-primary animate-spin"}),o.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),o.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&o.jsxs(o.Fragment,{children:[o.jsx(pc,{className:"h-16 w-16 text-green-500"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&o.jsxs(o.Fragment,{children:[o.jsx(Ou,{className:"h-16 w-16 text-destructive"}),o.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),o.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(I0,{value:n,className:"h-2"}),o.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[o.jsxs("span",{children:[n,"%"]}),o.jsxs("span",{children:["已用时: ",m(a)]})]})]}),o.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:o.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),o.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:o.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&o.jsxs("div",{className:"flex gap-2",children:[o.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),o.jsx("button",{onClick:()=>{i("checking"),h(0),f()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let q3=[],DL=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=DL[r])e=r+1;else return!0;if(e==n)return!1}}function v9(t){return t>=127462&&t<=127487}const y9=8205;function Xne(t,e,n=!0,r=!0){return(n?zL:Yne)(t,e,r)}function zL(t,e,n){if(e==t.length)return e;e&&PL(t.charCodeAt(e))&&LL(t.charCodeAt(e-1))&&e--;let r=sw(t,e);for(e+=b9(r);e=0&&v9(sw(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function Yne(t,e,n){for(;e>0;){let r=zL(t,e-2,n);if(r=56320&&t<57344}function LL(t){return t>=55296&&t<56320}function b9(t){return t<65536?1:2}class an{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=xh(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),Kx.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=xh(this,e,n);let r=[];return this.decompose(e,n,r,0),Kx.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Om(this),i=new Om(e);for(let a=n,l=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(l+=s.value.length,s.done||l>=r)return!0}}iter(e=1){return new Om(this,e)}iterRange(e,n=this.length){return new IL(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new BL(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?an.empty:e.length<=32?new br(e):Kx.from(br.split(e,[]))}}class br extends an{constructor(e,n=Kne(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],l=s+a.length;if((n?r:l)>=e)return new Zne(s,l,r,a);s=l+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new br(w9(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),l=Zx(i.text,a.text.slice(),0,i.length);if(l.length<=32)r.push(new br(l,a.length+i.length));else{let c=l.length>>1;r.push(new br(l.slice(0,c)),new br(l.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof br))return super.replace(e,n,r);[e,n]=xh(this,e,n);let s=Zx(this.text,Zx(r.text,w9(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new br(s,i):Kx.from(br.split(s,[]),i)}sliceString(e,n=this.length,r=` -`){[e,n]=xh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=l.slice(Math.max(0,e-i),n-i)),i=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new br(r,s)),r=[],s=-1);return s>-1&&n.push(new br(r,s)),n}}let Kx=class Pd extends an{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],l=s+a.length,c=r+a.lines-1;if((n?c:l)>=e)return a.lineInner(e,n,r,s);s=l+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let h=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!h?r.push(l):l.decompose(e-a,n-a,r,h)}a=c+1}}replace(e,n,r){if([e,n]=xh(this,e,n),r.lines=i&&n<=l){let c=a.replace(e-i,n-i,r),h=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>h>>6){let f=this.children.slice();return f[s]=c,new Pd(f,this.length-(n-e)+r.length)}return super.replace(i,l,c)}i=l+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` -`){[e,n]=xh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=l.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Pd))return 0;let r=0,[s,i,a,l]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==l)return r;let c=this.children[s],h=e.children[i];if(c!=h)return r+c.scanIdentical(h,n);r+=c.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new br(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,l=[],c=0,h=-1,f=[];function m(x){let y;if(x.lines>i&&x instanceof Pd)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),l.push(x)):x instanceof br&&c&&(y=f[f.length-1])instanceof br&&x.lines+y.lines<=32?(c+=x.lines,h+=x.length+1,f[f.length-1]=new br(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,h+=x.length+1,f.push(x))}function g(){c!=0&&(l.push(f.length==1?f[0]:Pd.from(f,h)),h=-1,c=f.length=0)}for(let x of e)m(x);return g(),l.length==1?l[0]:new Pd(l,n)}};an.empty=new br([""],0);function Kne(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Zx(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(c>r&&(l=l.slice(0,r-s)),s0?1:(e instanceof br?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,l=s instanceof br?s.text.length:s.children.length;if(a==(n>0?l:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(s instanceof br){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof br?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class IL{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Om(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class BL{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(an.prototype[Symbol.iterator]=function(){return this.iter()},Om.prototype[Symbol.iterator]=IL.prototype[Symbol.iterator]=BL.prototype[Symbol.iterator]=function(){return this});class Zne{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function xh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function hs(t,e,n=!0,r=!0){return Xne(t,e,n,r)}function Jne(t){return t>=56320&&t<57344}function ere(t){return t>=55296&&t<56320}function Ys(t,e){let n=t.charCodeAt(e);if(!ere(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Jne(r)?(n-55296<<10)+(r-56320)+65536:n}function g6(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Ua(t){return t<65536?1:2}const F3=/\r\n?|\n/;var ds=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(ds||(ds={}));class no{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=l}else{if(r!=ds.Simple&&h>=e&&(r==ds.TrackDel&&se||r==ds.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!l)return e==s||n<0?i:i+c;i+=c}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&l>=e)return sn?"cover":!0;s=l}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new no(e)}static create(e){return new no(e)}}class $r extends no{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return $3(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return Q3(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=l,n[s+1]=a;let c=s>>1;for(;r.length0&&lc(r,n,i.text),i.forward(f),l+=f}let h=e[a++];for(;l>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,l=null;function c(f=!1){if(!f&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?an.of(x.split(r||F3)):x:an.empty,w=y.length;if(m==g&&w==0)return;ma&&vs(s,m-a,-1),vs(s,g-m,w),lc(i,s,y),a=g}}return h(e),c(!l),l}static empty(e){return new $r(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;sl&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function lc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)l=t.sections[a++],c=t.sections[a++];e(s,h,i,f,m),s=h,i=f}}}function Q3(t,e,n,r=!1){let s=[],i=r?[]:null,a=new $m(t),l=new $m(e);for(let c=-1;;){if(a.done&&l.len||l.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&l.ins==-1){let h=Math.min(a.len,l.len);vs(s,h,-1),a.forward(h),l.forward(h)}else if(l.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(l.len=0&&c=0){let h=0,f=a.len;for(;f;)if(l.ins==-1){let m=Math.min(f,l.len);h+=m,f-=m,l.forward(m)}else if(l.ins==0&&l.lenc||a.ins>=0&&a.len>c)&&(l||r.length>h),i.forward2(c),a.forward(c)}}}}class $m{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?an.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?an.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class fu{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new fu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ae.range(e.anchor,e.head)}static create(e,n,r){return new fu(e,n,r)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ae(e.ranges.map(n=>fu.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ae.range(c,l):Ae.range(l,c))}}return new Ae(e,n)}}function FL(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let x6=0;class et{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=x6++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new et(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:v6),!!e.static,e.enables)}of(e){return new Jx([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Jx(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Jx(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function v6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Jx{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=x6++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,l=this.type==2,c=!1,h=!1,f=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?h=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&f.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||h&&(g.docChanged||g.selection)||H3(m,f)){let x=r(m);if(l?!S9(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=_1(g,y);if(this.dependencies.every(S=>S instanceof et?g.facet(S)===m.facet(S):S instanceof rs?g.field(S,!1)==m.field(S,!1):!0)||(l?S9(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function S9(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function l(c){let h=[];for(let f=0;fr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Vg).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(Vg),a=s.facet(Vg),l;return(l=i.find(c=>c.field==this))&&l!=a.find(c=>c.field==this)?(r.values[n]=l.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Vg.of({field:this,create:e})]}get extension(){return this}}const cu={lowest:4,low:3,default:2,high:1,highest:0};function Yf(t){return e=>new $L(e,t)}const _c={highest:Yf(cu.highest),high:Yf(cu.high),default:Yf(cu.default),low:Yf(cu.low),lowest:Yf(cu.lowest)};class $L{constructor(e,n){this.inner=e,this.prec=n}}class $v{of(e){return new V3(this,e)}reconfigure(e){return $v.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class V3{constructor(e,n){this.compartment=e,this.inner=n}}class E1{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of nre(e,n,a))g instanceof rs?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let l=Object.create(null),c=[],h=[];for(let g of s)l[g.id]=h.length<<1,h.push(x=>g.slot(x));let f=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=f&&f[g]||[];if(x.every(S=>S.type==0))if(l[y.id]=c.length<<1|1,v6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(l[S.id]=c.length<<1|1,c.push(S.value)):(l[S.id]=h.length<<1,h.push(k=>S.dynamicSlot(k)));l[y.id]=h.length<<1,h.push(S=>tre(S,y,x))}}let m=h.map(g=>g(l));return new E1(e,a,m,l,c,i)}}function nre(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,l){let c=s.get(a);if(c!=null){if(c<=l)return;let h=r[c].indexOf(a);h>-1&&r[c].splice(h,1),a instanceof V3&&n.delete(a.compartment)}if(s.set(a,l),Array.isArray(a))for(let h of a)i(h,l);else if(a instanceof V3){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;n.set(a.compartment,h),i(h,l)}else if(a instanceof $L)i(a.inner,a.prec);else if(a instanceof rs)r[l].push(a),a.provides&&i(a.provides,l);else if(a instanceof Jx)r[l].push(a),a.facet.extensions&&i(a.facet.extensions,cu.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,l)}}return i(t,cu.default),r.reduce((a,l)=>a.concat(l))}function jm(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function _1(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const QL=et.define(),U3=et.define({combine:t=>t.some(e=>e),static:!0}),HL=et.define({combine:t=>t.length?t[0]:void 0,static:!0}),VL=et.define(),UL=et.define(),WL=et.define(),GL=et.define({combine:t=>t.length?t[0]:!1});class lo{constructor(e,n){this.type=e,this.value=n}static define(){return new rre}}class rre{of(e){return new lo(this,e)}}class sre{constructor(e){this.map=e}of(e){return new Et(this,e)}}class Et{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Et(this.type,n)}is(e){return this.type==e}static define(e={}){return new sre(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}Et.reconfigure=Et.define();Et.appendConfig=Et.define();class Dr{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&FL(r,n.newLength),i.some(l=>l.type==Dr.time)||(this.annotations=i.concat(Dr.time.of(Date.now())))}static create(e,n,r,s,i,a){return new Dr(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Dr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Dr.time=lo.define();Dr.userEvent=lo.define();Dr.addToHistory=lo.define();Dr.remote=lo.define();function ire(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof Dr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Dr?t=i[0]:t=YL(e,Jd(i),!1)}return t}function ore(t){let e=t.startState,n=e.facet(WL),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=XL(r,W3(e,i,t.changes.newLength),!0))}return r==t?t:Dr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const lre=[];function Jd(t){return t==null?lre:Array.isArray(t)?t:[t]}var rr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(rr||(rr={}));const cre=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let G3;try{G3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ure(t){if(G3)return G3.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||cre.test(n)))return!0}return!1}function dre(t){return e=>{if(!/\S/.test(e))return rr.Space;if(ure(e))return rr.Word;for(let n=0;n-1)return rr.Word;return rr.Other}}class rn{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let l=0;ls.set(h,c)),n=null),s.set(l.value.compartment,l.value.extension)):l.is(Et.reconfigure)?(n=null,r=l.value):l.is(Et.appendConfig)&&(n=null,r=Jd(r).concat(l.value));let i;n?i=e.startState.values.slice():(n=E1.resolve(r,s,this),i=new rn(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let a=e.startState.facet(U3)?e.newSelection:e.newSelection.asSingle();new rn(n,e.newDoc,a,i,(l,c)=>c.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=Jd(r.effects);for(let l=1;la.spec.fromJSON(l,c)))}}return rn.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=E1.resolve(e.extensions||[],new Map),r=e.doc instanceof an?e.doc:an.of((e.doc||"").split(n.staticFacet(rn.lineSeparator)||F3)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return FL(s,r.length),n.staticFacet(U3)||(s=s.asSingle()),new rn(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(rn.tabSize)}get lineBreak(){return this.facet(rn.lineSeparator)||` -`}get readOnly(){return this.facet(GL)}phrase(e,...n){for(let r of this.facet(rn.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(QL))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return dre(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,l=e-r;for(;a>0;){let c=hs(n,a,!1);if(i(n.slice(c,a))!=rr.Word)break;a=c}for(;lt.length?t[0]:4});rn.lineSeparator=HL;rn.readOnly=GL;rn.phrases=et.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});rn.languageData=QL;rn.changeFilter=VL;rn.transactionFilter=UL;rn.transactionExtender=WL;$v.reconfigure=Et.define();function co(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],l=r[i];if(l===void 0)r[i]=a;else if(!(l===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class Nu{eq(e){return this==e}range(e,n=e){return X3.create(e,n,this)}}Nu.prototype.startSide=Nu.prototype.endSide=0;Nu.prototype.point=!1;Nu.prototype.mapMode=ds.TrackDel;let X3=class KL{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new KL(e,n,r)}};function Y3(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class y6{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,l=i.length;;){if(a==l)return a;let c=a+l>>1,h=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return h>=0?a:l;h>=0?l=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&h.startSide>0&&h.endSide<=0)continue;(x-g||h.endSide-h.startSide)<0||(a<0&&(a=g),h.point&&(l=Math.max(l,x-g)),r.push(h),s.push(g-a),i.push(x-a))}return{mapped:r.length?new y6(s,i,r,l):null,pos:a}}}class ln{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new ln(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(Y3)),this.isEmpty)return n.length?ln.of(n):this;let l=new ZL(this,null,-1).goto(0),c=0,h=[],f=new dl;for(;l.value||c=0){let m=n[c++];f.addInner(m.from,m.to,m.value)||h.push(m)}else l.rangeIndex==1&&l.chunkIndexthis.chunkEnd(l.chunkIndex)||il.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Qm.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Qm.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),l=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=k9(a,l,r),h=new Kf(a,c,i),f=new Kf(l,c,i);r.iterGaps((m,g,x)=>O9(h,m,f,g,x,s)),r.empty&&r.length==0&&O9(h,0,f,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),a=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let l=k9(i,a),c=new Kf(i,l,0).goto(r),h=new Kf(a,l,0).goto(r);for(;;){if(c.to!=h.to||!K3(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>s)return!0;c.next(),h.next()}}static spans(e,n,r,s,i=-1){let a=new Kf(e,null,i).goto(n),l=n,c=a.openStart;for(;;){let h=Math.min(a.to,r);if(a.point){let f=a.activeForPoint(a.to),m=a.pointFroml&&(s.span(l,h,a.active,c),c=a.openEnd(h));if(a.to>r)return c+(a.point&&a.to>r?1:0);l=a.to,a.next()}}static of(e,n=!1){let r=new dl;for(let s of e instanceof X3?[e]:n?hre(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return ln.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=ln.empty;s=s.nextLayer)n=new ln(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}ln.empty=new ln([],[],null,-1);function hre(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(Y3);e=r}return t}ln.empty.nextLayer=ln.empty;class dl{finishChunk(e){this.chunks.push(new y6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new dl)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(ln.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=ln.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function k9(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new ZL(a,n,r,i));return s.length==1?s[0]:new Qm(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)iw(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)iw(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),iw(this.heap,0)}}}function iw(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Kf{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Qm.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Ug(this.active,e),Ug(this.activeTo,e),Ug(this.activeRank,e),this.minActive=j9(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;Wg(this.active,n,r),Wg(this.activeTo,n,s),Wg(this.activeRank,n,i),e&&Wg(e,n,this.cursor.from),this.minActive=j9(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Ug(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function O9(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,l=r,c=r-e;for(;;){let h=t.to+c-n.to,f=h||t.endSide-n.endSide,m=f<0?t.to+c:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&K3(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,g,t.point,n.point):g>l&&!K3(t.active,n.active)&&i.compareRange(l,g,t.active,n.active),m>a)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),l=m,f<=0&&t.next(),f>=0&&n.next()}}function K3(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function j9(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=hs(t,s)}return r===!0?-1:t.length}const J3="ͼ",N9=typeof Symbol>"u"?"__"+J3:Symbol.for(J3),eS=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),C9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class gc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,l,c,h){let f=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&l==null)return c.push(a[0]+";");for(let x in l){let y=l[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,f,g)}else y!=null&&f.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(f.length||g)&&c.push((r&&!m&&!h?a.map(r):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=C9[N9]||1;return C9[N9]=e+1,J3+e.toString(36)}static mount(e,n,r){let s=e[eS],i=r&&r.nonce;s?i&&s.setNonce(i):s=new fre(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let T9=new Map;class fre{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=T9.get(r);if(i)return e[eS]=i;this.sheet=new s.CSSStyleSheet,T9.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[eS]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,l),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},mre=typeof navigator<"u"&&/Mac/.test(navigator.platform),pre=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var us=0;us<10;us++)xc[48+us]=xc[96+us]=String(us);for(var us=1;us<=24;us++)xc[us+111]="F"+us;for(var us=65;us<=90;us++)xc[us]=String.fromCharCode(us+32),Hm[us]=String.fromCharCode(us);for(var aw in xc)Hm.hasOwnProperty(aw)||(Hm[aw]=xc[aw]);function gre(t){var e=mre&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||pre&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Hm:xc)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function $n(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Ye={mac:_9||/Mac/.test(Es.platform),windows:/Win/.test(Es.platform),linux:/Linux|X11/.test(Es.platform),ie:Qv,ie_version:eI?tS.documentMode||6:rS?+rS[1]:nS?+nS[1]:0,gecko:E9,gecko_version:E9?+(/Firefox\/(\d+)/.exec(Es.userAgent)||[0,0])[1]:0,chrome:!!ow,chrome_version:ow?+ow[1]:0,ios:_9,android:/Android\b/.test(Es.userAgent),webkit_version:xre?+(/\bAppleWebKit\/(\d+)/.exec(Es.userAgent)||[0,0])[1]:0,safari:sS,safari_version:sS?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Es.userAgent)||[0,0])[1]:0,tabSize:tS.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Vm(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function iS(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function e1(t,e){if(!e.anchorNode)return!1;try{return iS(t,e.anchorNode)}catch{return!1}}function vh(t){return t.nodeType==3?Tu(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Nm(t,e,n,r){return n?M9(t,e,n,r,-1)||M9(t,e,n,r,1):!1}function Cu(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function M1(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function M9(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:io(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=Cu(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?io(t):0}else return!1}}function io(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function vre(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function tI(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function yre(t,e,n,r,s,i,a,l){let c=t.ownerDocument,h=c.defaultView||window;for(let f=t,m=!1;f&&!m;)if(f.nodeType==1){let g,x=f==c.body,y=1,w=1;if(x)g=vre(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(m=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let N=f.getBoundingClientRect();({scaleX:y,scaleY:w}=tI(f,N)),g={left:N.left,right:N.left+f.clientWidth*y,top:N.top,bottom:N.top+f.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function bre(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class wre{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?io(n):0),r,Math.min(e.focusOffset,r?io(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let au=null;Ye.safari&&Ye.safari_version>=26&&(au=!1);function nI(t){if(t.setActive)return t.setActive();if(au)return t.focus(au);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(au==null?{get preventScroll(){return au={preventScroll:!0},!0}}:void 0),!au){au=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function iI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=io(n)}else if(n.parentNode&&!M1(n))r=Cu(n),n=n.parentNode;else return null}}function aI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,h);if(g>=e&&s==-1&&(s=c,i=h),h>n&&m.dom.parentNode==this.dom){a=c,l=f;break}f=g,h=g+m.breakAfter}return{from:i,to:l<0?r+this.length:l,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=b6){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function lI(t,e,n,r,s,i,a,l,c){let{children:h}=t,f=h.length?h[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&f&&!a&&!g&&i.length<2&&f.merge(n,s,i.length?m:null,n==0,l,c))){if(r0&&(!a&&i.length&&f.merge(n,f.length,i[0],!1,l,0)?f.breakAfter=i.shift().breakAfter:(nOre||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new ka(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new ws(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return jre(this.dom,e,n)}}class hl extends In{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(rI(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof hl&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new hl(this.mark,n,a)}domAtPos(e){return uI(this,e)}coordsAt(e,n){return hI(this,e,n)}}function jre(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?Ye.chrome||Ye.gecko||(e?(s--,a=1):i=0)?0:l.length-1];return Ye.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(l,h=>h.width)||c),a?F0(c,a<0):c||null}class Ko extends In{static create(e,n,r){return new Ko(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=Ko.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,a){return r&&(!(r instanceof Ko)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?ws.before(this.dom):ws.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let l=a?s.length-1:0;i=s[l],!(e>0?l==0:l==s.length-1||i.top0?ws.before(this.dom):ws.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return an.empty}get isHidden(){return!0}}ka.prototype.children=Ko.prototype.children=yh.prototype.children=b6;function uI(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof hl&&s.length&&(r=s[s.length-1])instanceof hl&&r.mark.eq(e.mark)?dI(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function hI(t,e,n){let r=null,s=-1,i=null,a=-1;function l(h,f){for(let m=0,g=0;m=f&&(x.children.length?l(x,f-g):(!i||i.isHidden&&(n>0||Cre(i,x)))&&(y>f||g==y&&x.getSide()>0)?(i=x,a=f-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function oS(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function Tre(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new vc(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=fI(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new vc(e,r,s,n,e.widget||null,!0)}static line(e){return new Q0(e)}static set(e,n=!1){return ln.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ft.none=ln.empty;class $0 extends ft{constructor(e){let{start:n,end:r}=fI(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof $0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&A1(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}$0.prototype.point=!1;class Q0 extends ft{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Q0&&this.spec.class==e.spec.class&&A1(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Q0.prototype.mapMode=ds.TrackBefore;Q0.prototype.point=!0;class vc extends ft{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?ds.TrackBefore:ds.TrackAfter:ds.TrackDel}get type(){return this.startSide!=this.endSide?As.WidgetRange:this.startSide<=0?As.WidgetBefore:As.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof vc&&Ere(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}vc.prototype.point=!0;function fI(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function Ere(t,e){return t==e||!!(t&&e&&t.compare(e))}function t1(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Rr extends In{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof Rr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),cI(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new Rr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){A1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){dI(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=aS(n,this.attrs||{})),r&&(this.attrs=aS({class:r},this.attrs||{}))}domAtPos(e){return uI(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(rI(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(oS(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&In.get(s)instanceof hl;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=In.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Ye.ios||!this.children.some(i=>i instanceof ka))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof ka)||/[^ -~]/.test(r.text))return null;let s=vh(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=hI(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof Rr)return i;if(a>n)break}s=a+i.breakAfter}return null}}class sl extends In{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof sl)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class lS extends uo{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Cm{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof sl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Rr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Gg(new yh(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof sl)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:l,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(l){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Gg(new ka(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof vc){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof vc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new sl(r.widget||bh.block,l,r));else{let c=Ko.create(r.widget||bh.inline,l,l?0:r.startSide),h=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e0),f=!c.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(m.append(Gg(new yh(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(Gg(c,s),i),this.atCursorPos=f,this.pendingBuffer=f?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new Cm(e,n,r,i);return a.openEnd=ln.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Gg(t,e){for(let n of e)t=new hl(n,[t],t.length);return t}class bh extends uo{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}bh.inline=new bh("span");bh.block=new bh("div");var Jn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Jn||(Jn={}));const Eu=Jn.LTR,w6=Jn.RTL;function mI(t){let e=[];for(let n=0;n=n){if(l.level==r)return a;(i<0||(s!=0?s<0?l.fromn:e[i].level>l.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function gI(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if(Ba[w+1]==-x){let S=Ba[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(Qn[m]=Qn[Ba[w]]=k),l=w;break}}else{if(Ba.length==189)break;Ba[l++]=m,Ba[l++]=g,Ba[l++]=c}else if((y=Qn[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=l-3;S>=0;S-=3){let k=Ba[S+2];if(k&2)break;if(w)Ba[S+2]|=2;else{if(k&4)break;Ba[S+2]|=4}}}}}function zre(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,l=sc;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),Qn[--y]=x;c=f}else i=h,c++}}}function uS(t,e,n,r,s,i,a){let l=r%2?2:1;if(r%2==s%2)for(let c=e,h=0;cc&&a.push(new cc(c,w.from,x));let S=w.direction==Eu!=!(x%2);dS(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(f?Qn[y]!=l:Qn[y]==l))break;y++}g?uS(t,c,y,r+1,s,g,a):ce;){let f=!0,m=!1;if(!h||c>i[h-1].to){let w=Qn[c-1];w!=l&&(f=!1,m=w==16)}let g=!f&&l==1?[]:null,x=f?r:r+1,y=c;e:for(;;)if(h&&y==i[h-1].to){if(m)break e;let w=i[--h];if(!f)for(let S=w.from,k=h;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(Qn[S-1]==l)break e;break}}if(g)g.push(w);else{w.toQn.length;)Qn[Qn.length]=256;let r=[],s=e==Eu?0:1;return dS(t,s,s,n,0,t.length,r),r}function xI(t){return[new cc(0,t,0)]}let vI="";function Lre(t,e,n,r,s){var i;let a=r.head-t.from,l=cc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[l],h=c.side(s,n);if(a==h){let g=l+=s?1:-1;if(g<0||g>=e.length)return null;c=e[l=g],a=c.side(!s,n),h=c.side(s,n)}let f=hs(t.text,a,c.forward(s,n));(fc.to)&&(f=h),vI=t.text.slice(Math.min(a,f),Math.max(a,f));let m=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return m&&f==h&&m.level+(s?0:1)t.some(e=>e)}),NI=et.define({combine:t=>t.some(e=>e)}),CI=et.define();class th{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new th(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new th(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Xg=Et.define({map:(t,e)=>t.map(e)}),TI=Et.define();function Zs(t,e,n){let r=t.facet(SI);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Yo=et.define({combine:t=>t.length?t[0]:!0});let Bre=0;const Hd=et.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let c=[];return a&&c.push(Um.of(h=>{let f=h.plugin(l);return f?a(f):ft.none})),i&&c.push(i(l)),c})}static fromClass(e,n){return jr.define((r,s)=>new e(r,s),n)}}class lw{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Zs(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Zs(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Zs(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const EI=et.define(),O6=et.define(),Um=et.define(),_I=et.define(),H0=et.define(),MI=et.define();function z9(t,e){let n=t.state.facet(MI);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return ln.spans(r,e.from,e.to,{point(){},span(i,a,l,c){let h=i-e.from,f=a-e.from,m=s;for(let g=l.length-1;g>=0;g--,c--){let x=l[g].spec.bidiIsolate,y;if(x==null&&(x=Ire(e.text,h,f)),c>0&&m.length&&(y=m[m.length-1]).to==h&&y.direction==x)y.to=f,m=y.inner;else{let w={from:h,to:f,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const AI=et.define();function j6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(AI)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const hm=et.define();class ta{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ta(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAf)break;i+=2}if(!c)return r;new ta(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,l=c.toB}}}class R1{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=$r.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,l,c)=>s.push(new ta(i,a,l,c))),this.changedRanges=s}static create(e,n,r){return new R1(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class P9 extends In{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ft.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Rr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ta(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!Ure(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?Fre(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new ta(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Ye.ie||Ye.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,l=this.updateDeco(),c=Hre(a,l,e.changes);return r=ta.extendWithRanges(r,c),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Ye.chrome||Ye.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!l)break;let{fromA:c,toA:h,fromB:f,toB:m}=l,g,x,y,w;if(r&&r.range.fromBf){let T=Cm.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),_=Cm.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=_.openEnd;let E=this.compositionView(r);_.breakAtStart?E.breakAfter=1:_.content.length&&E.merge(E.length,E.length,_.content[0],!1,_.openStart,0)&&(E.breakAfter=_.content[0].breakAfter,_.content.shift()),T.content.length&&E.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(E).concat(_.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=Cm.build(this.view.state.doc,f,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(h,1),{i:N,off:C}=i.findPos(c,-1);lI(this,N,C,S,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(TI)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new ka(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new hl(s,[n],n.length);let r=new Rr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let l=In.get(i);l&&l!=a&&(l.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(Yo)||this.dom.tabIndex>-1)&&e1(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(l.anchor)),h=l.empty?c:this.moveToLine(this.domAtPos(l.head));if(Ye.gecko&&l.empty&&!this.hasComposition&&qre(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=h=new ws(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!Nm(c.node,c.offset,f.anchorNode,f.anchorOffset)||!Nm(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,l))&&(this.view.observer.ignore(()=>{Ye.android&&Ye.chrome&&this.dom.contains(f.focusNode)&&Vre(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=Vm(this.view.root);if(m)if(l.empty){if(Ye.gecko){let g=$re(c.node,c.offset);if(g&&g!=3){let x=(g==1?iI:aI)(c.node,c.offset);x&&(c=new ws(x.node,x.offset))}}m.collapse(c.node,c.offset),l.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=l.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(h.node,h.offset)}catch{}}else{let g=document.createRange();l.anchor>l.head&&([c,h]=[h,c]),g.setEnd(h.node,h.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new ws(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new ws(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Nm(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Vm(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=Rr.find(this,n.head);if(!a)return;let l=a.posAtStart;if(n.head==l||n.head==l+a.length)return;let c=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(n.head+n.assoc);r.collapse(f.node,f.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=In.get(n.childNodes[s]);i instanceof Rr&&(r=i.domAtPos(i.length))}return r?new ws(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=In.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let l=this.children[a],c=i-l.breakAfter,h=c-l.length;if(ce||l.covers(1))&&(!r||l instanceof Rr&&!(r instanceof Rr&&n>=0)))r=l,s=h;else if(r&&h==e&&c==e&&l instanceof sl&&Math.abs(n)<2){if(l.deco.startSide<0)break;a&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof Rr))return null;for(;s.children.length;){let{i:l,off:c}=s.childPos(r,1);for(;;l++){if(l==s.children.length)return null;if((s=s.children[l]).length)break}r=c}if(!(s instanceof ka))return null;let i=hs(s.text,r);if(i==r)return null;let a=Tu(s.dom,r,i).getClientRects();for(let l=0;lMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,c=this.view.textDirection==Jn.LTR;for(let h=0,f=0;fs)break;if(h>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?vh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>l&&(l=k,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=g)}}}h=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Jn.RTL:Jn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Rr){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=vh(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new oI(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let l=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ft.replace({widget:new lS(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return ft.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Um).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(_I).map((i,a)=>{let l=typeof i=="function";return l&&(r=!0),l?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(ln.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=j6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:l,offsetHeight:c}=this.view.scrollDOM;yre(this.view.scrollDOM,a,n.heads instanceof Ko||s.children.some(r);return r(this.children[n])}}function qre(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function RI(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=iI(n.focusNode,n.focusOffset),s=aI(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let l=In.get(s.node);if(!l||l instanceof ka&&l.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=In.get(r.node);!c||c instanceof ka&&c.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function Fre(t,e,n){let r=RI(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,l=s.nodeValue;if(/[\n\r]/.test(l)||t.state.doc.sliceString(r.from,r.to)!=l)return null;let c=e.invertedDesc,h=new ta(c.mapPos(i),c.mapPos(a),i,a),f=[];for(let m=s.parentNode;;m=m.parentNode){let g=In.get(m);if(g instanceof hl)f.push({node:m,deco:g.mark});else{if(g instanceof Rr||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:h,text:s,marks:f,line:m};if(m!=t.contentDOM)f.push({node:m,deco:new $0({inclusive:!0,attributes:Tre(m),tagName:m.tagName.toLowerCase()})});else return null}}}function $re(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function Wre(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ae.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,l=i;n<0?a=hs(s.text,i,!1):l=hs(s.text,i);let c=r(s.text.slice(a,l));for(;a>0;){let h=hs(s.text,a,!1);if(r(s.text.slice(h,a))!=c)break;a=h}for(;lt?e.left-t:Math.max(0,t-e.right)}function Xre(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function cw(t,e){return t.tope.top+1}function L9(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function fS(t,e,n){let r,s,i,a,l=!1,c,h,f,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=vh(y);for(let S=0;SC||a==C&&i>N)&&(r=y,s=k,i=N,a=C,l=N?e0:Sk.bottom&&(!f||f.bottomk.top)&&(h=y,m=k):f&&cw(f,k)?f=I9(f,k.bottom):m&&cw(m,k)&&(m=L9(m,k.top))}}if(f&&f.bottom>=n?(r=c,s=f):m&&m.top<=n&&(r=h,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return B9(r,g,n);if(l&&r.contentEditable!="false")return fS(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function B9(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let l=0;ln?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&m=(f.left+f.right)/2,x=g;if(Ye.chrome||Ye.gecko){let y=Tu(t,l).getBoundingClientRect();Math.abs(y.left-f.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:l+(x?1:0)};s=l+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function DI(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),l=a.top+t.viewState.paddingTop,c,{docHeight:h}=t.viewState,{x:f,y:m}=e,g=m-l;if(g<0)return 0;if(g>h)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,_=!1;c=t.elementAtHeight(g),c.type!=As.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=h);){if(_)return n?null:0;_=!0,r=-r}m=l+g;let x=c.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:q9(t,a,c,f,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(f,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(f=Math.max(a.left+1,Math.min(a.right-1,f)),S=w.elementFromPoint(f,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,N=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(f,m);T&&({offsetNode:k,offset:N}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(f,m);T&&({startContainer:k,startOffset:N}=T)}k&&(!t.contentDOM.contains(k)||Ye.safari&&Yre(k,N,f)||Ye.chrome&&Kre(k,N,f))&&(k=void 0),k&&(N=Math.min(io(k),N))}if(!k||!t.docView.dom.contains(k)){let T=Rr.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:N}=fS(T.dom,f,m))}let C=t.docView.nearest(k);if(!C)return null;if(C.isWidget&&((i=C.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=C.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-l)*.5)/l);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+Z3(a,i,t.state.tabSize)}function zI(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return Tu(t,r-1,r).getBoundingClientRect().right>n}function Yre(t,e,n){return zI(t,e,n)}function Kre(t,e,n){if(e!=0)return zI(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():Tu(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function mS(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==As.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function Zre(t,e,n,r){let s=mS(t,e.head,e.assoc||-1),i=!r||s.type!=As.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),l=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(l==Jn.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ae.cursor(c,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function F9(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let l=e,c=null;;){let h=Lre(s,i,a,l,n),f=vI;if(!h){if(s.number==(n?t.state.doc.lines:1))return l;f=` -`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(c){if(!c(f))return l}else{if(!r)return h;c=r(f)}l=h}}function Jre(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==rr.Space&&(s=a),s==a}}function ese(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let a=e.goalColumn,l,c=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),f=t.documentTop;if(h)a==null&&(a=h.left-c.left),l=i<0?h.top:h.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),l=(i<0?x.top:x.bottom)+f}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=l+(g+x)*i,w=DI(t,{x:m,y},!1,i);if(yc.bottom||(i<0?ws)){let S=t.docView.coordsForChar(w),k=!S||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,ri)&&!rse(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(l=s.exec(n))&&(i=l.index,a=l[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=In.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(nse(e,r.node,r.offset)?n:0))}}function nse(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=i||a?[]:ase(e),c=new tse(l,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=ose(l,this.bounds.from)}else{let l=e.observer.selectionRange,c=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!iS(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=a&&a.node==l.anchorNode&&a.offset==l.anchorOffset||!iS(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),f=e.viewport;if((Ye.ios||Ye.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ae.range(h,c)):this.newSel=Ae.single(h,c)}}}function LI(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:l}=e.bounds,c=s.from,h=null;(i===8||Ye.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Ye.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` - `&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:an.of([" "])}),n)return N6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),l=t.inputState.lastSelectionOrigin,l=="select.pointer"&&(r=PI(t.state.facet(H0).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:l}),!0}else return!1}function N6(t,e,n,r=-1){if(Ye.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Ye.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&eh(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&eh(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&eh(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,l=()=>a||(a=ise(t,e,n));return t.state.facet(kI).some(c=>c(t,e.from,e.to,i,l))||t.dispatch(l()),!0}function ise(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let c=e.fromm(t)),h,c);e.from==f&&(a=f)}if(a>-1)r={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let c=s.changes(e),h=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let f=t.state.sliceDoc(e.from,e.to),m,g=n&&RI(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:c,range:h||y.map(c)};let w=y.to-x,S=w-f.length;if(t.state.sliceDoc(S,w)!=f||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),N=y.to-i.to;return{changes:k,range:h?Ae.range(Math.max(0,h.anchor+N),Math.max(0,h.head+N)):y.map(k)}})}else r={changes:c,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,l+=".compose",t.inputState.compositionFirstChange&&(l+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:l,scrollIntoView:!0})}function II(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&l>0&&t.charCodeAt(a-1)==e.charCodeAt(l-1);)a--,l--;if(r=="end"){let c=Math.max(0,i-Math.min(a,l));n-=a+c-i}if(a=a?i-n:0;i-=c,l=i+(l-a),a=i}else if(l=l?i-n:0;i-=c,a=i+(a-l),l=i}return{from:i,toA:a,toB:l}}function ase(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new $9(n,r)),(s!=n||i!=r)&&e.push(new $9(s,i))),e}function ose(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ae.single(n+e,r+e):null}class lse{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ye.safari&&e.contentDOM.addEventListener("input",()=>null),Ye.gecko&&Ose(e.contentDOM.ownerDocument)}handleEvent(e){!gse(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=cse(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,l=r[i];l&&a!=!l.handlers.length&&(s.removeEventListener(i,this.handleEvent),l=null),l||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&qI.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ye.android&&Ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=BI.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||use.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Ye.safari&&!Ye.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Q9(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Zs(n.state,s)}}}function cse(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let l in i){let c=i[l];c&&n(l).handlers.push(Q9(r.value,c))}if(a)for(let l in a){let c=a[l];c&&n(l).observers.push(Q9(r.value,c))}}for(let r in Oa)n(r).handlers.push(Oa[r]);for(let r in ia)n(r).observers.push(ia[r]);return e}const BI=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],use="dthko",qI=[16,17,18,20,91,92,224,225],Yg=6;function Kg(t){return Math.max(0,t)*.7+8}function dse(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class hse{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=bre(e.contentDOM),this.atoms=e.state.facet(H0).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(rn.allowMultipleSelections)&&fse(e,n),this.dragging=pse(e,n)&&QI(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&dse(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:l}=this.scrollParents.y.getBoundingClientRect());let c=j6(this.view);e.clientX-c.left<=s+Yg?n=-Kg(s-e.clientX):e.clientX+c.right>=a-Yg&&(n=Kg(e.clientX-a)),e.clientY-c.top<=i+Yg?r=-Kg(i-e.clientY):e.clientY+c.bottom>=l-Yg&&(r=Kg(e.clientY-l)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=PI(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function fse(t,e){let n=t.state.facet(yI);return n.length?n[0](e):Ye.mac?e.metaKey:e.ctrlKey}function mse(t,e){let n=t.state.facet(bI);return n.length?n[0](e):Ye.mac?!e.altKey:!e.ctrlKey}function pse(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Vm(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function gse(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=In.get(n))&&r.ignoreEvent(e))return!1;return!0}const Oa=Object.create(null),ia=Object.create(null),FI=Ye.ie&&Ye.ie_version<15||Ye.ios&&Ye.webkit_version<604;function xse(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),$I(t,n.value)},50)}function Hv(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function $I(t,e){e=Hv(t.state,S6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(pS!=null&&n.selection.ranges.every(c=>c.empty)&&pS==i.toString()){let c=-1;r=n.changeByRange(h=>{let f=n.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:m},range:Ae.cursor(h.from+m.length)}})}else a?r=n.changeByRange(c=>{let h=i.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:Ae.cursor(c.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}ia.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Oa.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);ia.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};ia.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Oa.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(wI))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=bse(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new hse(t,e,n,r)),r&&t.observer.ignore(()=>{nI(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function H9(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return Wre(t.state,e,n);{let s=Rr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,l=s?s.posAtEnd:i.to;return le>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function vse(t,e,n,r){let s=Rr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&V9(n,r,a))return-1;let l=s.coordsAt(i,1);return l&&V9(n,r,l)?1:a&&a.bottom>=r?-1:1}function U9(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:vse(t,n,e.clientX,e.clientY)}}const yse=Ye.ie&&Ye.ie_version<=11;let W9=null,G9=0,X9=0;function QI(t){if(!yse)return t.detail;let e=W9,n=X9;return W9=t,X9=Date.now(),G9=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(G9+1)%3:1}function bse(t,e){let n=U9(t,e),r=QI(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,l){let c=U9(t,i),h,f=H9(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=H9(t,n.pos,n.bias,r),g=Math.min(m.from,f.from),x=Math.max(m.to,f.to);f=g1&&(h=wse(s,c.pos))?h:l?s.addRange(f):Ae.create([f])}}}function wse(t,e){for(let n=0;n=e)return Ae.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Oa.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Ae.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Hv(t.state,k6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Oa.dragend=t=>(t.inputState.draggedContent=null,!1);function Y9(t,e,n,r){if(n=Hv(t.state,S6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&mse(t,e)?{from:i.from,to:i.to}:null,l={from:s,insert:n},c=t.state.changes(a?[a,l]:l);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Oa.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&Y9(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[a]=l.result),i()},l.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Y9(t,e,r,!0),!0}return!1};Oa.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=FI?null:e.clipboardData;return n?($I(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(xse(t),!1)};function Sse(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function kse(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:Hv(t,k6,e.join(t.lineBreak)),ranges:n,linewise:r}}let pS=null;Oa.copy=Oa.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=kse(t.state);if(!n&&!s)return!1;pS=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=FI?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Sse(t,n),!1)};const HI=lo.define();function VI(t,e){let n=[];for(let r of t.facet(OI)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:HI.of(!0)}):null}function UI(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=VI(t.state,e);n?t.dispatch(n):t.update([])}},10)}ia.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),UI(t)};ia.blur=t=>{t.observer.clearSelectionRange(),UI(t)};ia.compositionstart=ia.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};ia.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ye.chrome&&Ye.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};ia.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Oa.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let l=a[0],c=t.posAtDOM(l.startContainer,l.startOffset),h=t.posAtDOM(l.endContainer,l.endOffset);return N6(t,{from:c,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Ye.chrome&&Ye.android&&(s=BI.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ye.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ye.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>ia.compositionend(t,e),20),!1};const K9=new Set;function Ose(t){K9.has(t)||(K9.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const Z9=["pre-wrap","normal","pre-line","break-spaces"];let wh=!1;function J9(){wh=!1}class jse{constructor(e){this.lineWrapping=e,this.doc=an.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Z9.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>n1&&(wh=!0),this.height=e)}replace(e,n,r){return Rs.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let l=s.length-1;l>=0;l--){let{fromA:c,toA:h,fromB:f,toB:m}=s[l],g=i.lineAt(c,Zn.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=h?g:i.lineAt(h,Zn.ByPosNoHeight,r,0,0);for(m+=x.to-h,h=x.to;l>0&&g.from<=s[l-1].toA;)c=s[l-1].fromA,f=s[l-1].fromB,l--,ci*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,s-=l.size}else if(i>s*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Oi extends WI{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Wa(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Oi||s instanceof cs&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof cs?s=new Oi(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):Rs.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class cs extends Rs{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,l=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(l=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:l}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:l,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof cs?r[r.length-1]=new cs(i.length+s):r.push(null,new cs(s-1))}if(e>0){let i=r[0];i instanceof cs?r[0]=new cs(e+i.length):r.unshift(new cs(e-1),null)}return Rs.of(r)}decomposeLeft(e,n){n.push(new cs(e-1),null)}decomposeRight(e,n){n.push(null,new cs(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],l=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new cs(s.from-n-1).updateHeight(e,n));l<=i&&s.more;){let f=e.doc.lineAt(l).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=n1&&(c=-2);let g=new Oi(f,m);g.outdated=!1,a.push(g),l+=f+1}l<=i&&a.push(null,new cs(i-l).updateHeight(e,l));let h=Rs.of(a);return(c<0||Math.abs(h.height-this.height)>=n1||Math.abs(c-this.heightMetrics(e,n).perLine)>=n1)&&(wh=!0),D1(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Cse extends Rs{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return el))return h;let f=n==Zn.ByPosNoHeight?Zn.ByPosNoHeight:Zn.ByPos;return c?h.join(this.right.lineAt(l,f,r,a,l)):this.left.lineAt(l,f,r,s,i).join(h)}forEachLine(e,n,r,s,i,a){let l=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e=c&&this.right.forEachLine(e,n,r,l,c,a);else{let h=this.lineAt(c,Zn.ByPos,r,s,i);e=e&&h.from<=n&&a(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,l,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let l of r)i.push(l);if(e>0&&eT(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?Rs.of(this.break?[e,null,n]:[e,n]):(this.left=D1(this.left,e),this.right=D1(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,l=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=l+a.length&&s.more?c=a=a.updateHeight(e,l,r,s):a.updateHeight(e,l,r),c?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function eT(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof cs&&(r=t[e+1])instanceof cs&&t.splice(e-1,3,new cs(n.length+1+r.length))}const Tse=5;class C6{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Oi?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Oi(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=Tse)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new Oi(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new cs(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Oi)return e;let n=new Oi(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Oi)&&!this.isCovered?this.nodes.push(new Oi(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&m.overflow!="visible"){let g=f.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),l=Math.max(l,g.top),c=Math.min(h==t.parentNode?s.innerHeight:c,g.bottom)}h=m.position=="absolute"||m.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:l-(n.top+e),bottom:Math.max(l,c)-(n.top+e)}}function Ase(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function Rse(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class dw{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new jse(n),this.stateDeco=e.facet(Um).filter(r=>typeof r!="function"),this.heightMap=Rs.empty().applyChanges(this.stateDeco,an.empty,this.heightOracle.setDoc(e.doc),[new ta(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ft.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new Zg(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?nT:new T6(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(mm(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Um).filter(f=>typeof f!="function");let s=e.changedRanges,i=ta.extendWithRanges(s,Ese(r,this.stateDeco,e?e.changes:$r.empty(this.state.doc.length))),a=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);J9(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||wh)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(NI)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Jn.RTL:Jn.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),l=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,f=0;if(l.width&&l.height){let{scaleX:T,scaleY:_}=tI(n,l);(T>.005&&Math.abs(this.scaleX-T)>.005||_>.005&&Math.abs(this.scaleY-_)>.005)&&(this.scaleX=T,this.scaleY=_,h|=16,a=c=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=sI(e.scrollDOM);let y=(this.printing?Rse:Mse)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(c=!0)),!this.inView&&!this.scrollTarget&&!Ase(e.dom))return 0;let N=l.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(N-this.contentDOMWidth)>s.charWidth){let{lineHeight:_,charWidth:E,textHeight:M}=e.docView.measureTextSize();a=_>0&&s.refresh(i,_,E,M,Math.max(5,N/E),T),a&&(e.docView.minWidth=0,h|=16)}w>0&&S>0?f=Math.max(w,S):w<0&&S<0&&(f=Math.min(w,S)),J9();for(let _ of this.viewports){let E=_.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(_);this.heightMap=(a?Rs.empty().applyChanges(this.stateDeco,an.empty,this.heightOracle,[new ta(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Nse(_.from,E))}wh&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:l}=this,c=new Zg(s.lineAt(a-r*1e3,Zn.ByHeight,i,0,0).from,s.lineAt(l+(1-r)*1e3,Zn.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hc.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(h,Zn.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&h=l+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=Jn.LTR&&!r)return[];let l=[],c=(f,m,g,x)=>{if(m-ff&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-f)k.fromN));if(!S){if(mC.from<=m&&C.to>=m)){let C=n.moveToLineBoundary(Ae.cursor(m),!1,!0).head;C>f&&(m=C)}let k=this.gapSize(g,f,m,x),N=r||k<2e6?k:2e6;S=new dw(f,m,k,N)}l.push(S)},h=f=>{if(f.length2e6)for(let E of e)E.from>=f.from&&E.fromf.from&&c(f.from,x,f,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];ln.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||mm(this.heightMap.lineAt(e,Zn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||mm(this.heightMap.lineAt(this.scaler.fromDOM(e),Zn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return mm(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let Zg=class{constructor(e,n){this.from=e,this.to=n}};function zse(t,e,n){let r=[],s=t,i=0;return ln.spans(n,t,e,{span(){},point(a,l){a>s&&(r.push({from:s,to:a}),i+=a-s),s=l}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],l=a-i;if(r<=l)return i+r;r-=l}}function ex(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function Pse(t,e){for(let n of t)if(e(n))return n}const nT={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class T6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:l,to:c})=>{let h=n.lineAt(l,Zn.ByPos,e,0,0).top,f=n.lineAt(c,Zn.ByPos,e,0,0).bottom;return s+=f-h,{from:l,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let l of this.viewports)l.domTop=a+(l.top-i)*this.scale,a=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function mm(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Wa(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>mm(s,e)):t._content)}const tx=et.define({combine:t=>t.join(" ")}),gS=et.define({combine:t=>t.indexOf(!0)>-1}),xS=gc.newName(),GI=gc.newName(),XI=gc.newName(),YI={"&light":"."+GI,"&dark":"."+XI};function vS(t,e,n){return new gc(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const Lse=vS("."+xS,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},YI),Ise={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},hw=Ye.ie&&Ye.ie_version<=11;class Bse{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new wre,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Ye.ie&&Ye.ie_version<=11||Ye.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ye.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ye.chrome&&Ye.chrome_version<126)&&(this.editContext=new Fse(e),e.state.facet(Yo)&&(e.contentDOM.editContext=this.editContext.editContext)),hw&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Yo)?r.root.activeElement!=this.dom:!e1(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ye.ie&&Ye.ie_version<=11||Ye.android&&Ye.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Nm(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Vm(e.root);if(!n)return!1;let r=Ye.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&qse(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=e1(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&eh(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&e1(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new sse(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=LI(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=rT(n,e.previousSibling||e.target.previousSibling,-1),s=rT(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Yo)!=e.state.facet(Yo)&&(e.view.contentDOM.editContext=e.state.facet(Yo)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function rT(t,e,n){for(;e;){let r=In.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function sT(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return Nm(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function qse(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return sT(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?sT(t,n):null}class Fse{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,l=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:l,drifted:!1});let h=c-l>r.text.length;l==this.from&&ithis.to&&(c=i);let f=II(e.state.sliceDoc(l,c),r.text,(h?s.from:s.to)-l,h?"end":null);if(!f){let g=Ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:f.from+l,to:f.toA+l,insert:an.of(r.text.slice(f.from,f.toB).split(` -`))};if((Ye.mac||Ye.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:l,to:c,insert:an.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);N6(e,m,Ae.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),l=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,l=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(l)){let c=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(c{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Vm(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,l,c,h)=>{if(r)return;let f=h.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=f,this.to+=f;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=f,this.to+=f;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),h.toString()),this.to+=f}n+=f}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class We{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Sre(e.parent)||document,this.viewState=new tT(e.state||rn.create(e)),e.scrollTo&&e.scrollTo.is(Xg)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Hd).map(s=>new lw(s));for(let s of this.plugins)s.update(this);this.observer=new Bse(this),this.inputState=new lse(this),this.inputState.ensureHandlers(this.plugins),this.docView=new P9(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Dr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,l=0,c=null;e.some(g=>g.annotation(HI))?(this.inputState.notifiedFocused=a,l=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=VI(i,a),c||(l=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(f=null)):this.observer.clear(),i.facet(rn.phrases)!=this.state.facet(rn.phrases))return this.setState(i);s=R1.create(this,i,e),s.flags|=l;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new th(x.empty?x:Ae.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(Xg)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=z1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(hm)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(tx)!=s.state.facet(tx)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(hS))try{g(s)}catch(x){Zs(this.state,x,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!LI(this,f)&&h.force&&eh(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new tT(e),this.plugins=e.facet(Hd).map(r=>new lw(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new P9(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Hd),r=e.state.facet(Hd);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new lw(i));else{let l=this.plugins[a];l.mustUpdate=e,s.push(l)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(a<0)if(sI(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(x=>{try{return x.read(this)}catch(y){return Zs(this.state,y),iT}}),m=R1.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(hS))l(n)}get themeClasses(){return xS+" "+(this.state.facet(gS)?XI:GI)+" "+this.state.facet(tx)}updateAttrs(){let e=aT(this,EI,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Yo)?"true":"false",class:"cm-content",style:`${Ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),aT(this,O6,n);let r=this.observer.ignore(()=>{let s=oS(this.contentDOM,this.contentAttrs,n),i=oS(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(We.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(hm);let e=this.state.facet(We.cspNonce);gc.mount(this.root,this.styleModules.concat(Lse).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return uw(this,e,F9(this,e,n,r))}moveByGroup(e,n){return uw(this,e,F9(this,e,n,r=>Jre(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ae.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return Zre(this,e,n,r)}moveVertically(e,n,r){return uw(this,e,ese(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),DI(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[cc.find(i,e-s.from,-1,n)];return F0(r,a.dir==Jn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(jI)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$se)return xI(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||gI(i.isolates,r=z9(this,e))))return i.order;r||(r=z9(this,e));let s=Pre(e.text,n,r);return this.bidiCache.push(new z1(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{nI(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Xg.of(new th(typeof e=="number"?Ae.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Xg.of(new th(Ae.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return jr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return jr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=gc.newName(),s=[tx.of(r),hm.of(vS(`.${r}`,e))];return n&&n.dark&&s.push(gS.of(!0)),s}static baseTheme(e){return _c.lowest(hm.of(vS("."+xS,e,YI)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&In.get(r)||In.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}We.styleModule=hm;We.inputHandler=kI;We.clipboardInputFilter=S6;We.clipboardOutputFilter=k6;We.scrollHandler=CI;We.focusChangeEffect=OI;We.perLineTextDirection=jI;We.exceptionSink=SI;We.updateListener=hS;We.editable=Yo;We.mouseSelectionStyle=wI;We.dragMovesSelection=bI;We.clickAddsSelectionRange=yI;We.decorations=Um;We.outerDecorations=_I;We.atomicRanges=H0;We.bidiIsolatedRanges=MI;We.scrollMargins=AI;We.darkTheme=gS;We.cspNonce=et.define({combine:t=>t.length?t[0]:""});We.contentAttributes=O6;We.editorAttributes=EI;We.lineWrapping=We.contentAttributes.of({class:"cm-lineWrapping"});We.announce=Et.define();const $se=4096,iT={};class z1{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Jn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&aS(a,n)}return n}const Qse=Ye.mac?"mac":Ye.windows?"win":Ye.linux?"linux":"key";function Hse(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,l;for(let c=0;cr.concat(s),[]))),n}function Use(t,e,n){return ZI(KI(t.state),e,t,n)}let ac=null;const Wse=4e3;function Gse(t,e=Qse){let n=Object.create(null),r=Object.create(null),s=(a,l)=>{let c=r[a];if(c==null)r[a]=l;else if(c!=l)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,l,c,h,f)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=l.split(/ (?!$)/).map(k=>Hse(k,e));for(let k=1;k{let T=ac={view:C,prefix:N,scope:a};return setTimeout(()=>{ac==T&&(ac=null)},Wse),!0}]})}let w=y.join(" ");s(w,!1);let S=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});c&&S.run.push(c),h&&(S.preventDefault=!0),f&&(S.stopPropagation=!0)};for(let a of t){let l=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let h of l){let f=n[h]||(n[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in f)f[g].run.push(x=>m(x,yS))}let c=a[e]||a.key;if(c)for(let h of l)i(h,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(h,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let yS=null;function ZI(t,e,n,r){yS=e;let s=gre(e),i=Ys(s,0),a=Ua(i)==s.length&&s!=" ",l="",c=!1,h=!1,f=!1;ac&&ac.view==n&&ac.scope==r&&(l=ac.prefix+" ",qI.indexOf(e.keyCode)<0&&(h=!0,ac=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(f=!0),!0;S.preventDefault&&(S.stopPropagation&&(f=!0),h=!0)}return!1},x=t[r],y,w;return x&&(g(x[l+nx(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ye.windows&&e.ctrlKey&&e.altKey)&&!(Ye.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=xc[e.keyCode])&&y!=s?(g(x[l+nx(y,e,!0)])||e.shiftKey&&(w=Hm[e.keyCode])!=s&&w!=y&&g(x[l+nx(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[l+nx(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),h&&(c=!0),c&&f&&e.stopPropagation(),yS=null,c}class U0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=JI(e);return[new U0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return Xse(e,n,r)}}function JI(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Jn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function lT(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,l=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return l==null||c==null?r:{from:Math.max(r.from,Math.min(l,c)),to:Math.min(r.to,Math.max(l,c))}}function Xse(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Jn.LTR,a=t.contentDOM,l=a.getBoundingClientRect(),c=JI(t),h=a.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),m=l.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),g=l.right-(f?parseInt(f.paddingRight):0),x=mS(t,r,1),y=mS(t,s,-1),w=x.type==As.Text?x:null,S=y.type==As.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=lT(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=lT(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return N(C(n.from,n.to,w));{let _=w?C(n.from,null,w):T(x,!1),E=S?C(null,n.to,S):T(y,!0),M=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2V&&z.from=P)break;R>H&&$(Math.max(X,H),_==null&&X<=V,Math.min(R,P),E==null&&R>=ee,J.dir)}if(H=W.to+1,H>=P)break}return I.length==0&&$(V,_==null,ee,E==null,t.textDirection),{top:q,bottom:L,horizontal:I}}function T(_,E){let M=l.top+(E?_.top:_.bottom);return{top:M,bottom:M,horizontal:[]}}}function Yse(t,e){return t.constructor==e.constructor&&t.eq(e)}class Kse{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(r1)!=e.state.facet(r1)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(r1);for(;n!Yse(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Ye.safari&&Ye.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const r1=et.define();function eB(t){return[jr.define(e=>new Kse(e,t)),r1.of(t)]}const Wm=et.define({combine(t){return co(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Zse(t={}){return[Wm.of(t),Jse,eie,tie,NI.of(!0)]}function tB(t){return t.startState.facet(Wm)!=t.state.facet(Wm)}const Jse=eB({above:!0,markers(t){let{state:e}=t,n=e.facet(Wm),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:Ae.cursor(s.head,s.head>s.anchor?-1:1);for(let c of U0.forRange(t,a,l))r.push(c)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=tB(t);return n&&cT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){cT(e.state,t)},class:"cm-cursorLayer"});function cT(t,e){e.style.animationDuration=t.facet(Wm).cursorBlinkRate+"ms"}const eie=eB({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:U0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||tB(t)},class:"cm-selectionLayer"}),tie=_c.highest(We.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),nB=Et.define({map(t,e){return t==null?null:e.mapPos(t)}}),pm=rs.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(nB)?r.value:n,t)}}),nie=jr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(pm);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(pm)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(pm),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(pm)!=t&&this.view.dispatch({effects:nB.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function rie(){return[pm,nie]}function uT(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,l;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;l=e.exec(i.value);)s(a+l.index,l)}function sie(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class iie{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(l,c,h,f)=>s(f,h,h+l[0].length,l,c);else if(typeof r=="function")this.addMatch=(l,c,h,f)=>{let m=r(l,c,h);m&&f(h,h+l[0].length,m)};else if(r)this.addMatch=(l,c,h,f)=>f(h,h+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new dl,r=n.add.bind(n);for(let{from:s,to:i}of sie(e,this.maxLength))uT(e.state.doc,this.regexp,s,i,(a,l)=>this.addMatch(l,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,l,c)=>{c>=e.view.viewport.from&&l<=e.view.viewport.to&&(r=Math.min(l,r),s=Math.max(c,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),l=Math.min(i.to,s);if(l>=a){let c=e.state.doc.lineAt(a),h=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){f=a;break}for(;lg.push(k.range(w,S));if(c==h)for(this.regexp.lastIndex=f-c.from;(x=this.regexp.exec(c.text))&&x.indexthis.addMatch(S,e,w,y));n=n.update({filterFrom:f,filterTo:m,filter:(w,S)=>wm,add:g})}}return n}}const bS=/x/.unicode!=null?"gu":"g",aie=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,bS),oie={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let fw=null;function lie(){var t;if(fw==null&&typeof document<"u"&&document.body){let e=document.body.style;fw=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return fw||!1}const s1=et.define({combine(t){let e=co(t,{render:null,specialChars:aie,addSpecialChars:null});return(e.replaceTabs=!lie())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,bS)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,bS)),e}});function cie(t={}){return[s1.of(t),uie()]}let dT=null;function uie(){return dT||(dT=jr.fromClass(class{constructor(t){this.view=t,this.decorations=ft.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(s1)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new iie({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Ys(e[0],0);if(i==9){let a=s.lineAt(r),l=n.state.tabSize,c=Bh(a.text,l,r-a.from);return ft.replace({widget:new mie((l-c%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ft.replace({widget:new fie(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(s1);t.startState.facet(s1)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const die="•";function hie(t){return t>=32?die:t==10?"␤":String.fromCharCode(9216+t)}class fie extends uo{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=hie(this.code),r=e.state.phrase("Control character")+" "+(oie[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class mie extends uo{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function pie(){return xie}const gie=ft.line({class:"cm-activeLine"}),xie=jr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(gie.range(s.from)),e=s.from)}return ft.set(n)}},{decorations:t=>t.decorations});class vie extends uo{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?vh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=F0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function yie(t){let e=jr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ft.set([ft.widget({widget:new vie(t),side:1}).range(0)]):ft.none}get decorations(){return this.view.state.doc.length?ft.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,We.contentAttributes.of({"aria-placeholder":t})]:e}const wS=2e3;function bie(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>wS||n.off>wS||e.col<0||n.col<0){let a=Math.min(e.off,n.off),l=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let h=t.doc.line(c);h.length<=l&&i.push(Ae.range(h.from+a,h.to+l))}}else{let a=Math.min(e.col,n.col),l=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let h=t.doc.line(c),f=Z3(h.text,a,t.tabSize,!0);if(f<0)i.push(Ae.cursor(h.to));else{let m=Z3(h.text,l,t.tabSize);i.push(Ae.range(h.from+f,h.from+m))}}}return i}function wie(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function hT(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>wS?-1:s==r.length?wie(t,e.clientX):Bh(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function Sie(t,e){let n=hT(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let l=hT(t,s);if(!l)return r;let c=bie(t.state,n,l);return c.length?a?Ae.create(c.concat(r.ranges)):Ae.create(c):r}}:null}function kie(t){let e=(n=>n.altKey&&n.button==0);return We.mouseSelectionStyle.of((n,r)=>e(r)?Sie(n,r):null)}const Oie={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},jie={style:"cursor: crosshair"};function Nie(t={}){let[e,n]=Oie[t.key||"Alt"],r=jr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,We.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?jie:null})]}const rx="-10000px";class rB{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],l=n?[]:null;for(let c=0;cn[h]=c),n.length=l.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function Cie(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const mw=et.define({combine:t=>{var e,n,r;return{position:Ye.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||Cie}}}),fT=new WeakMap,E6=jr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(mw);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new rB(t,_6,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(mw);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=rx,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Ye.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=j6(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let l=this.manager.tooltipViews[a];return l.getCoords?l.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(mw).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let l=0;l=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){f.style.top=rx;continue}let x=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=fT.get(h))!==null&&e!==void 0?e:g.bottom-g.top,k=h.offset||Eie,N=this.view.textDirection==Jn.LTR,C=g.width>r.right-r.left?N?r.left:r.right-g.width:N?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[l];!c.strictSide&&(T?m.top-S-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[l]=!T);let _=(T?m.top-r.top:r.bottom-m.bottom)-y;if(_C&&q.topE&&(E=T?q.top-S-2-y:q.bottom+y+2);if(this.position=="absolute"?(f.style.top=(E-t.parent.top)/i+"px",mT(f,(C-t.parent.left)/s)):(f.style.top=E/i+"px",mT(f,C/s)),x){let q=m.left+(N?k.x:-k.x)-(C+14-7);x.style.left=q/s+"px"}h.overlap!==!0&&a.push({left:C,top:E,right:M,bottom:E+S}),f.classList.toggle("cm-tooltip-above",T),f.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=rx}},{eventObservers:{scroll(){this.maybeMeasure()}}});function mT(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Tie=We.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Eie={x:0,y:0},_6=et.define({enables:[E6,Tie]}),P1=et.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Vv{static create(e){return new Vv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new rB(e,P1,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const _ie=_6.compute([P1],t=>{let e=t.facet(P1);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Vv.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Mie{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;el.bottom||n.xl.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(f=>f.from<=s&&f.to>=s),h=c&&c.dir==Jn.RTL?-1:1;i=n.x{this.pending==l&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>Zs(e.state,c,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(E6),n=e?e.manager.tooltips.findIndex(r=>r.create==Vv.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!Aie(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,l=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==l?this.view.posAtCoords(this.lastMove)!=a:!Rie(this.view,a,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const sx=4;function Aie(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let l=a.getBoundingClientRect();s=Math.min(l.top,s),i=Math.max(l.bottom,i)}return e.clientX>=n-sx&&e.clientX<=r+sx&&e.clientY>=s-sx&&e.clientY<=i+sx}function Rie(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),l=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,l)=e&&c<=n}function Die(t,e={}){let n=Et.define(),r=rs.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let l of s){let c=i.changes.mapPos(l.pos,-1,ds.TrackDel);if(c!=null){let h=Object.assign(Object.create(null),l);h.pos=c,h.end!=null&&(h.end=i.changes.mapPos(h.end)),a.push(h)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(zie)&&(s=[]);return s},provide:s=>P1.from(s)});return{active:r,extension:[r,jr.define(s=>new Mie(s,t,r,n,e.hoverTime||300)),_ie]}}function sB(t,e){let n=t.plugin(E6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const zie=Et.define(),pT=et.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Gm(t,e){let n=t.plugin(iB),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const iB=jr.fromClass(class{constructor(t){this.input=t.state.facet(Xm),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(pT);this.top=new ix(t,!0,e.topContainer),this.bottom=new ix(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(pT);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ix(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ix(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Xm);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],l=[];for(let c of r){let h=this.specs.indexOf(c),f;h<0?(f=c(t.view),l.push(f)):(f=this.panels[h],f.update&&f.update(t)),s.push(f),(f.top?i:a).push(f)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of l)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ix{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=gT(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=gT(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function gT(t){let e=t.nextSibling;return t.remove(),e}const Xm=et.define({enables:iB});class fl extends Nu{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}fl.prototype.elementClass="";fl.prototype.toDOM=void 0;fl.prototype.mapMode=ds.TrackBefore;fl.prototype.startSide=fl.prototype.endSide=-1;fl.prototype.point=!0;const i1=et.define(),Pie=et.define(),Lie={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>ln.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Em=et.define();function Iie(t){return[aB(),Em.of({...Lie,...t})]}const xT=et.define({combine:t=>t.some(e=>e)});function aB(t){return[Bie]}const Bie=jr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Em).map(e=>new yT(t,e)),this.fixed=!t.state.facet(xT);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(xT)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=ln.iter(this.view.state.facet(i1),this.view.viewport.from),r=[],s=this.gutters.map(i=>new qie(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let l of i.type)if(l.type==As.Text&&a){SS(n,r,l.from);for(let c of s)c.line(this.view,l,r);a=!1}else if(l.widget)for(let c of s)c.widget(this.view,l)}else if(i.type==As.Text){SS(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Em),n=t.state.facet(Em),r=t.docChanged||t.heightChanged||t.viewportChanged||!ln.eq(t.startState.facet(i1),t.state.facet(i1),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new yT(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Jn.LTR?{left:r,right:s}:{right:r,left:s}})});function vT(t){return Array.isArray(t)?t:[t]}function SS(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class qie{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=ln.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let l=new oB(e,a,i,r);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];SS(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(Pie)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class yT{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let l=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,l,s)&&s.preventDefault()});this.markers=vT(n.markers(e)),n.initialSpacer&&(this.spacer=new oB(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=vT(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!ln.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class oB{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Fie(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let l=a,c=ii(l,c,h)||a(l,c,h):a}return r}})}});class pw extends fl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function gw(t,e){return t.state.facet(Vd).formatNumber(e,t.state)}const Hie=Em.compute([Vd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet($ie)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new pw(gw(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(Qie)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Vd)!=e.state.facet(Vd),initialSpacer(e){return new pw(gw(e,bT(e.state.doc.lines)))},updateSpacer(e,n){let r=gw(n.view,bT(n.view.state.doc.lines));return r==e.number?e:new pw(r)},domEventHandlers:t.facet(Vd).domEventHandlers,side:"before"}));function Vie(t={}){return[Vd.of(t),aB(),Hie]}function bT(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(Uie.range(s)))}return ln.of(e)});function Gie(){return Wie}const lB=1024;let Xie=0;class xw{constructor(e,n){this.from=e,this.to=n}}class Qt{constructor(e={}){this.id=Xie++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=zs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Qt.closedBy=new Qt({deserialize:t=>t.split(" ")});Qt.openedBy=new Qt({deserialize:t=>t.split(" ")});Qt.group=new Qt({deserialize:t=>t.split(" ")});Qt.isolate=new Qt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Qt.contextHash=new Qt({perNode:!0});Qt.lookAhead=new Qt({perNode:!0});Qt.mounted=new Qt({perNode:!0});class L1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Qt.mounted.id]}}const Yie=Object.create(null);class zs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):Yie,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new zs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Qt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Qt.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}zs.none=new zs("",Object.create(null),0,8);class Uv{constructor(e){this.types=e;for(let n=0;n0;for(let c=this.cursor(a|Hr.IncludeAnonymous);;){let h=!1;if(c.from<=i&&c.to>=s&&(!l&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&r&&(l||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:R6(zs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Hn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Hn(zs.none,n,r,s)))}static build(e){return eae(e)}}Hn.empty=new Hn(zs.none,[],[],0);class M6{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new M6(this.buffer,this.index)}}class yc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return zs.none}toString(){let e=[];for(let n=0;n0));c=a[c+3]);return l}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let l=e,c=0;l=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Ym(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?l.length:-1;e!=h;e+=n){let f=l[e],m=c[e]+a.from;if(cB(s,r,m,m+f.length)){if(f instanceof yc){if(i&Hr.ExcludeBuffers)continue;let g=f.findChild(0,f.buffer.length,n,r-m,s);if(g>-1)return new Ya(new Kie(a,f,e,m),null,g)}else if(i&Hr.IncludeAnonymous||!f.type.isAnonymous||A6(f)){let g;if(!(i&Hr.IgnoreMounts)&&(g=L1.get(f))&&!g.overlay)return new ni(g.tree,m,e,a);let x=new ni(f,m,e,a);return i&Hr.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?f.children.length-1:0,n,r,s)}}}if(i&Hr.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Hr.IgnoreOverlays)&&(s=L1.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:l}of s.overlay)if((n>0?a<=i:a=i:l>i))return new ni(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ST(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function kS(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Kie{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Ya extends uB{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new Ya(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Hr.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new Ya(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ya(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Ya(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new Hn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function dB(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let l=new ni(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Ym(l,e,n,!1))}}return s?dB(s):r}class OS{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof ni)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof ni?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Hr.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Hr.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Hr.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let l=r._tree.children[i];if(this.mode&Hr.IncludeAnonymous||l instanceof yc||!l.type.isAnonymous||A6(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return kS(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function A6(t){return t.children.some(e=>e instanceof yc||!e.type.isAnonymous||A6(e))}function eae(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=lB,reused:i=[],minRepeatType:a=r.types.length}=t,l=Array.isArray(n)?new M6(n,n.length):n,c=r.types,h=0,f=0;function m(_,E,M,q,L,I){let{id:$,start:V,end:ee,size:z}=l,H=f,P=h;if(z<0)if(l.next(),z==-1){let se=i[$];M.push(se),q.push(V-_);return}else if(z==-3){h=$;return}else if(z==-4){f=$;return}else throw new RangeError(`Unrecognized record size: ${z}`);let W=c[$],J,X,R=V-_;if(ee-V<=s&&(X=S(l.pos-E,L))){let se=new Uint16Array(X.size-X.skip),G=l.pos-X.size,F=se.length;for(;l.pos>G;)F=k(X.start,se,F);J=new yc(se,ee-X.start,r),R=X.start-_}else{let se=l.pos-z;l.next();let G=[],F=[],U=$>=a?$:-1,te=0,ne=ee;for(;l.pos>se;)U>=0&&l.id==U&&l.size>=0?(l.end<=ne-s&&(y(G,F,V,te,l.end,ne,U,H,P),te=G.length,ne=l.end),l.next()):I>2500?g(V,se,G,F):m(V,se,G,F,U,I+1);if(U>=0&&te>0&&te-1&&te>0){let Y=x(W,P);J=R6(W,G,F,0,G.length,0,ee-V,Y,Y)}else J=w(W,G,F,ee-V,H-ee,P)}M.push(J),q.push(R)}function g(_,E,M,q){let L=[],I=0,$=-1;for(;l.pos>E;){let{id:V,start:ee,end:z,size:H}=l;if(H>4)l.next();else{if($>-1&&ee<$)break;$<0&&($=z-s),L.push(V,ee,z),I++,l.next()}}if(I){let V=new Uint16Array(I*4),ee=L[L.length-2];for(let z=L.length-3,H=0;z>=0;z-=3)V[H++]=L[z],V[H++]=L[z+1]-ee,V[H++]=L[z+2]-ee,V[H++]=H;M.push(new yc(V,L[2]-ee,r)),q.push(ee-_)}}function x(_,E){return(M,q,L)=>{let I=0,$=M.length-1,V,ee;if($>=0&&(V=M[$])instanceof Hn){if(!$&&V.type==_&&V.length==L)return V;(ee=V.prop(Qt.lookAhead))&&(I=q[$]+V.length+ee)}return w(_,M,q,L,I,E)}}function y(_,E,M,q,L,I,$,V,ee){let z=[],H=[];for(;_.length>q;)z.push(_.pop()),H.push(E.pop()+M-L);_.push(w(r.types[$],z,H,I-L,V-I,ee)),E.push(L-M)}function w(_,E,M,q,L,I,$){if(I){let V=[Qt.contextHash,I];$=$?[V].concat($):[V]}if(L>25){let V=[Qt.lookAhead,L];$=$?[V].concat($):[V]}return new Hn(_,E,M,q,$)}function S(_,E){let M=l.fork(),q=0,L=0,I=0,$=M.end-s,V={size:0,start:0,skip:0};e:for(let ee=M.pos-_;M.pos>ee;){let z=M.size;if(M.id==E&&z>=0){V.size=q,V.start=L,V.skip=I,I+=4,q+=4,M.next();continue}let H=M.pos-z;if(z<0||H=a?4:0,W=M.start;for(M.next();M.pos>H;){if(M.size<0)if(M.size==-3)P+=4;else break e;else M.id>=a&&(P+=4);M.next()}L=W,q+=z,I+=P}return(E<0||q==_)&&(V.size=q,V.start=L,V.skip=I),V.size>4?V:void 0}function k(_,E,M){let{id:q,start:L,end:I,size:$}=l;if(l.next(),$>=0&&q4){let ee=l.pos-($-4);for(;l.pos>ee;)M=k(_,E,M)}E[--M]=V,E[--M]=I-_,E[--M]=L-_,E[--M]=q}else $==-3?h=q:$==-4&&(f=q);return M}let N=[],C=[];for(;l.pos>0;)m(t.start||0,t.bufferStart||0,N,C,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:N.length?C[0]+N[0].length:0;return new Hn(c[t.topID],N.reverse(),C.reverse(),T)}const kT=new WeakMap;function a1(t,e){if(!t.isAnonymous||e instanceof yc||e.type!=t)return 1;let n=kT.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Hn)){n=1;break}n+=a1(t,r)}kT.set(e,n)}return n}function R6(t,e,n,r,s,i,a,l,c){let h=0;for(let y=r;y=f)break;E+=M}if(C==T+1){if(E>f){let M=y[T];x(M.children,M.positions,0,M.children.length,w[T]+N);continue}m.push(y[T])}else{let M=w[C-1]+y[C-1].length-_;m.push(R6(t,y,w,T,C,_,M,null,c))}g.push(_+N-i)}}return x(e,n,r,s,0),(l||c)(m,g,a)}class tae{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof Ya?this.setBuffer(e.context.buffer,e.index,n):e instanceof ni&&this.map.set(e.tree,n)}get(e){return e instanceof Ya?this.getBuffer(e.context.buffer,e.index):e instanceof ni?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class wu{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new wu(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let l=0,c=0,h=0;;l++){let f=l=r)for(;a&&a.from=g.from||m<=g.to||h){let x=Math.max(g.from,c)-h,y=Math.min(g.to,m)-h;g=x>=y?null:new wu(x,y,g.tree,g.offset+h,l>0,!!f)}if(g&&s.push(g),a.to>m)break;a=inew xw(s.from,s.to)):[new xw(0,0)]:[new xw(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class nae{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Qt({perNode:!0});let rae=0;class Ui{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=rae++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Ui&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Ui(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new I1(e);return r=>r.modified.indexOf(n)>-1?r:I1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let sae=0;class I1{constructor(e){this.name=e,this.instances=[],this.id=sae++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&iae(n,l.modified));if(r)return r;let s=[],i=new Ui(e.name,s,e,n);for(let l of n)l.instances.push(i);let a=aae(n);for(let l of e.set)if(!l.modified.length)for(let c of a)s.push(I1.get(l,c));return i}}function iae(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function aae(t){let e=[[]];for(let n=0;nr.length-n.length)}function z6(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,l=s;for(let m=0;;){if(l=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);l=s.slice(m)}let c=i.length-1,h=i[c];if(!h)throw new RangeError("Invalid path: "+s);let f=new Km(r,a,c>0?i.slice(0,c):null);e[h]=f.sort(e[h])}}return hB.add(e)}const hB=new Qt({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new Km(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class Km{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let l of i)for(let c of l.set){let h=n[c.id];if(h){a=a?a+" "+h:h;break}}return a},scope:r}}function oae(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function lae(t,e,n,r=0,s=t.length){let i=new cae(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class cae{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:l,to:c}=e;if(l>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let h=s,f=uae(e)||Km.empty,m=oae(i,f.tags);if(m&&(h&&(h+=" "),h+=m,f.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,l),h),f.opaque)return;let g=e.tree&&e.tree.prop(Qt.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+l,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=l;;S++){let N=S=C||!e.nextSibling())););if(!N||C>r)break;k=N.to+l,k>n&&(this.highlightRange(x.cursor(),Math.max(n,N.from+l),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),h))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function uae(t){let e=t.type.prop(hB);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ue=Ui.define,ox=Ue(),nc=Ue(),OT=Ue(nc),jT=Ue(nc),rc=Ue(),lx=Ue(rc),vw=Ue(rc),$a=Ue(),nu=Ue($a),qa=Ue(),Fa=Ue(),jS=Ue(),Zf=Ue(jS),cx=Ue(),ve={comment:ox,lineComment:Ue(ox),blockComment:Ue(ox),docComment:Ue(ox),name:nc,variableName:Ue(nc),typeName:OT,tagName:Ue(OT),propertyName:jT,attributeName:Ue(jT),className:Ue(nc),labelName:Ue(nc),namespace:Ue(nc),macroName:Ue(nc),literal:rc,string:lx,docString:Ue(lx),character:Ue(lx),attributeValue:Ue(lx),number:vw,integer:Ue(vw),float:Ue(vw),bool:Ue(rc),regexp:Ue(rc),escape:Ue(rc),color:Ue(rc),url:Ue(rc),keyword:qa,self:Ue(qa),null:Ue(qa),atom:Ue(qa),unit:Ue(qa),modifier:Ue(qa),operatorKeyword:Ue(qa),controlKeyword:Ue(qa),definitionKeyword:Ue(qa),moduleKeyword:Ue(qa),operator:Fa,derefOperator:Ue(Fa),arithmeticOperator:Ue(Fa),logicOperator:Ue(Fa),bitwiseOperator:Ue(Fa),compareOperator:Ue(Fa),updateOperator:Ue(Fa),definitionOperator:Ue(Fa),typeOperator:Ue(Fa),controlOperator:Ue(Fa),punctuation:jS,separator:Ue(jS),bracket:Zf,angleBracket:Ue(Zf),squareBracket:Ue(Zf),paren:Ue(Zf),brace:Ue(Zf),content:$a,heading:nu,heading1:Ue(nu),heading2:Ue(nu),heading3:Ue(nu),heading4:Ue(nu),heading5:Ue(nu),heading6:Ue(nu),contentSeparator:Ue($a),list:Ue($a),quote:Ue($a),emphasis:Ue($a),strong:Ue($a),link:Ue($a),monospace:Ue($a),strikethrough:Ue($a),inserted:Ue(),deleted:Ue(),changed:Ue(),invalid:Ue(),meta:cx,documentMeta:Ue(cx),annotation:Ue(cx),processingInstruction:Ue(cx),definition:Ui.defineModifier("definition"),constant:Ui.defineModifier("constant"),function:Ui.defineModifier("function"),standard:Ui.defineModifier("standard"),local:Ui.defineModifier("local"),special:Ui.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof Ui&&(e.name=t)}fB([{tag:ve.link,class:"tok-link"},{tag:ve.heading,class:"tok-heading"},{tag:ve.emphasis,class:"tok-emphasis"},{tag:ve.strong,class:"tok-strong"},{tag:ve.keyword,class:"tok-keyword"},{tag:ve.atom,class:"tok-atom"},{tag:ve.bool,class:"tok-bool"},{tag:ve.url,class:"tok-url"},{tag:ve.labelName,class:"tok-labelName"},{tag:ve.inserted,class:"tok-inserted"},{tag:ve.deleted,class:"tok-deleted"},{tag:ve.literal,class:"tok-literal"},{tag:ve.string,class:"tok-string"},{tag:ve.number,class:"tok-number"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],class:"tok-string2"},{tag:ve.variableName,class:"tok-variableName"},{tag:ve.local(ve.variableName),class:"tok-variableName tok-local"},{tag:ve.definition(ve.variableName),class:"tok-variableName tok-definition"},{tag:ve.special(ve.variableName),class:"tok-variableName2"},{tag:ve.definition(ve.propertyName),class:"tok-propertyName tok-definition"},{tag:ve.typeName,class:"tok-typeName"},{tag:ve.namespace,class:"tok-namespace"},{tag:ve.className,class:"tok-className"},{tag:ve.macroName,class:"tok-macroName"},{tag:ve.propertyName,class:"tok-propertyName"},{tag:ve.operator,class:"tok-operator"},{tag:ve.comment,class:"tok-comment"},{tag:ve.meta,class:"tok-meta"},{tag:ve.invalid,class:"tok-invalid"},{tag:ve.punctuation,class:"tok-punctuation"}]);var yw;const mu=new Qt;function mB(t){return et.define({combine:t?e=>e.concat(t):void 0})}const dae=new Qt;class Xi{constructor(e,n,r=[],s=""){this.data=e,this.name=s,rn.prototype.hasOwnProperty("tree")||Object.defineProperty(rn.prototype,"tree",{get(){return es(this)}}),this.parser=n,this.extension=[bc.of(this),rn.languageData.of((i,a,l)=>{let c=NT(i,a,l),h=c.type.prop(mu);if(!h)return[];let f=i.facet(h),m=c.type.prop(dae);if(m){let g=c.resolve(a-c.from,l);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(f)}}return f})].concat(r)}isActiveAt(e,n,r=-1){return NT(e,n,r).type.prop(mu)==this.data}findRegions(e){let n=e.facet(bc);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(mu)==this.data){r.push({from:a,to:a+i.length});return}let l=i.prop(Qt.mounted);if(l){if(l.tree.prop(mu)==this.data){if(l.overlay)for(let c of l.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(l.overlay){let c=r.length;if(s(l.tree,l.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),e.name)}configure(e,n){return new Zm(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function es(t){let e=t.field(Xi.state,!1);return e?e.tree:Hn.empty}class hae{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let Jf=null;class Sh{constructor(e,n,r=[],s,i,a,l,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=l,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new Sh(e,n,[],Hn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new hae(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Hn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(wu.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Jf;Jf=this;try{return e()}finally{Jf=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=CT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:l}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,m,g)=>c.push({fromA:h,toA:f,fromB:m,toB:g})),r=wu.applyChanges(r,c),s=Hn.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);fe.from&&(this.fragments=CT(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends D6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=Jf;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new Hn(zs.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Jf}}function CT(t,e,n){return wu.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class kh{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new kh(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=Sh.create(e.facet(bc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new kh(r)}}Xi.state=rs.define({create:kh.init,update(t,e){for(let n of e.effects)if(n.is(Xi.setState))return n.value;return e.startState.facet(bc)!=e.state.facet(bc)?kh.init(e.state):t.apply(e)}});let pB=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(pB=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const bw=typeof navigator<"u"&&(!((yw=navigator.scheduling)===null||yw===void 0)&&yw.isInputPending)?()=>navigator.scheduling.isInputPending():null,fae=jr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Xi.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Xi.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=pB(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,c=i.context.work(()=>bw&&bw()||Date.now()>a,s+(l?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Xi.setState.of(new kh(i.context))})),this.chunkBudget>0&&!(c&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Zs(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),bc=et.define({combine(t){return t.length?t[0]:null},enables:t=>[Xi.state,fae,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class gB{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const mae=et.define(),W0=et.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function _u(t){let e=t.facet(W0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Jm(t,e){let n="",r=t.tabSize,s=t.facet(W0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?pae(t,n,e):null}class Wv{constructor(e,n={}){this.state=e,this.options=n,this.unit=_u(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Bh(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Gv=new Qt;function pae(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return xB(r,t,n)}function xB(t,e,n){for(let r=t;r;r=r.next){let s=xae(r.node);if(s)return s(L6.create(e,n,r))}return 0}function gae(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function xae(t){let e=t.type.prop(Gv);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Qt.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>vB(a,!0,1,void 0,i&&!gae(a)?s.from:void 0)}return t.parent==null?vae:null}function vae(){return 0}class L6 extends Wv{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new L6(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(yae(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return xB(this.context.next,this.base,this.pos)}}function yae(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function bae(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let l=n.to;;){let c=e.childAfter(l);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}l=c.to}}function ww({closing:t,align:e=!0,units:n=1}){return r=>vB(r,e,n,t)}function vB(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,l=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?bae(t):null;return c?l?t.column(c.from):t.column(c.to):t.baseIndent+(l?0:t.unit*n)}function TT({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const wae=200;function Sae(){return rn.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+wae)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:a}=t,l=-1,c=[];for(let{head:h}of a.selection.ranges){let f=a.doc.lineAt(h);if(f.from==l)continue;l=f.from;let m=P6(a,f.from);if(m==null)continue;let g=/^\s*/.exec(f.text)[0],x=Jm(a,m);g!=x&&c.push({from:f.from,to:f.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const kae=et.define(),I6=new Qt;function yB(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&l.from=e&&h.to>n&&(i=h)}}return i}function jae(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function B1(t,e,n){for(let r of t.facet(kae)){let s=r(t,e,n);if(s)return s}return Oae(t,e,n)}function bB(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const Xv=Et.define({map:bB}),G0=Et.define({map:bB});function wB(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Mu=rs.define({create(){return ft.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=ET(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(Xv)&&!Nae(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(OB),s=r?ft.replace({widget:new Rae(r(e.state,n.value))}):_T;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(G0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=ET(t,e.selection.main.head)),t},provide:t=>We.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function q1(t,e,n){var r;let s=null;return(r=t.field(Mu,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function Nae(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function SB(t,e){return t.field(Mu,!1)?e:e.concat(Et.appendConfig.of(jB()))}const Cae=t=>{for(let e of wB(t)){let n=B1(t.state,e.from,e.to);if(n)return t.dispatch({effects:SB(t.state,[Xv.of(n),kB(t,n)])}),!0}return!1},Tae=t=>{if(!t.state.field(Mu,!1))return!1;let e=[];for(let n of wB(t)){let r=q1(t.state,n.from,n.to);r&&e.push(G0.of(r),kB(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function kB(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return We.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const Eae=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Mu,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(G0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},Mae=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:Cae},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Tae},{key:"Ctrl-Alt-[",run:Eae},{key:"Ctrl-Alt-]",run:_ae}],Aae={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},OB=et.define({combine(t){return co(t,Aae)}});function jB(t){return[Mu,Pae]}function NB(t,e){let{state:n}=t,r=n.facet(OB),s=a=>{let l=t.lineBlockAt(t.posAtDOM(a.target)),c=q1(t.state,l.from,l.to);c&&t.dispatch({effects:G0.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const _T=ft.replace({widget:new class extends uo{toDOM(t){return NB(t,null)}}});class Rae extends uo{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return NB(e,this.value)}}const Dae={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Sw extends fl{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function zae(t={}){let e={...Dae,...t},n=new Sw(e,!0),r=new Sw(e,!1),s=jr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(bc)!=a.state.facet(bc)||a.startState.field(Mu,!1)!=a.state.field(Mu,!1)||es(a.startState)!=es(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let l=new dl;for(let c of a.viewportLineBlocks){let h=q1(a.state,c.from,c.to)?r:B1(a.state,c.from,c.to)?n:null;h&&l.add(c.from,c.from,h)}return l.finish()}}),{domEventHandlers:i}=e;return[s,Iie({class:"cm-foldGutter",markers(a){var l;return((l=a.plugin(s))===null||l===void 0?void 0:l.markers)||ln.empty},initialSpacer(){return new Sw(e,!1)},domEventHandlers:{...i,click:(a,l,c)=>{if(i.click&&i.click(a,l,c))return!0;let h=q1(a.state,l.from,l.to);if(h)return a.dispatch({effects:G0.of(h)}),!0;let f=B1(a.state,l.from,l.to);return f?(a.dispatch({effects:Xv.of(f)}),!0):!1}}}),jB()]}const Pae=We.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class X0{constructor(e,n){this.specs=e;let r;function s(l){let c=gc.newName();return(r||(r=Object.create(null)))["."+c]=l,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Xi?l=>l.prop(mu)==a.data:a?l=>l==a:void 0,this.style=fB(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new gc(r):null,this.themeType=n.themeType}static define(e,n){return new X0(e,n||{})}}const NS=et.define(),CB=et.define({combine(t){return t.length?[t[0]]:null}});function kw(t){let e=t.facet(NS);return e.length?e:t.facet(CB)}function TB(t,e){let n=[Iae],r;return t instanceof X0&&(t.module&&n.push(We.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(CB.of(t)):r?n.push(NS.computeN([We.darkTheme],s=>s.facet(We.darkTheme)==(r=="dark")?[t]:[])):n.push(NS.of(t)),n}class Lae{constructor(e){this.markCache=Object.create(null),this.tree=es(e.state),this.decorations=this.buildDeco(e,kw(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=es(e.state),r=kw(e.state),s=r!=kw(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ft.none;let r=new dl;for(let{from:s,to:i}of e.visibleRanges)lae(this.tree,n,(a,l,c)=>{r.add(a,l,this.markCache[c]||(this.markCache[c]=ft.mark({class:c})))},s,i);return r.finish()}}const Iae=_c.high(jr.fromClass(Lae,{decorations:t=>t.decorations})),Bae=X0.define([{tag:ve.meta,color:"#404740"},{tag:ve.link,textDecoration:"underline"},{tag:ve.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strong,fontWeight:"bold"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.keyword,color:"#708"},{tag:[ve.atom,ve.bool,ve.url,ve.contentSeparator,ve.labelName],color:"#219"},{tag:[ve.literal,ve.inserted],color:"#164"},{tag:[ve.string,ve.deleted],color:"#a11"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],color:"#e40"},{tag:ve.definition(ve.variableName),color:"#00f"},{tag:ve.local(ve.variableName),color:"#30a"},{tag:[ve.typeName,ve.namespace],color:"#085"},{tag:ve.className,color:"#167"},{tag:[ve.special(ve.variableName),ve.macroName],color:"#256"},{tag:ve.definition(ve.propertyName),color:"#00c"},{tag:ve.comment,color:"#940"},{tag:ve.invalid,color:"#f00"}]),qae=We.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),EB=1e4,_B="()[]{}",MB=et.define({combine(t){return co(t,{afterCursor:!0,brackets:_B,maxScanDistance:EB,renderMatch:Qae})}}),Fae=ft.mark({class:"cm-matchingBracket"}),$ae=ft.mark({class:"cm-nonmatchingBracket"});function Qae(t){let e=[],n=t.matched?Fae:$ae;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const Hae=rs.define({create(){return ft.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(MB);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=Ka(e.state,s.head,-1,r)||s.head>0&&Ka(e.state,s.head-1,1,r)||r.afterCursor&&(Ka(e.state,s.head,1,r)||s.headWe.decorations.from(t)}),Vae=[Hae,qae];function Uae(t={}){return[MB.of(t),Vae]}const Wae=new Qt;function CS(t,e,n){let r=t.prop(e<0?Qt.openedBy:Qt.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function TS(t){let e=t.type.prop(Wae);return e?e(t.node):t}function Ka(t,e,n,r={}){let s=r.maxScanDistance||EB,i=r.brackets||_B,a=es(t),l=a.resolveInner(e,n);for(let c=l;c;c=c.parent){let h=CS(c.type,n,i);if(h&&c.from0?e>=f.from&&ef.from&&e<=f.to))return Gae(t,e,n,c,f,h,i)}}return Xae(t,e,n,a,l.type,s,i)}function Gae(t,e,n,r,s,i,a){let l=r.parent,c={from:s.from,to:s.to},h=0,f=l?.cursor();if(f&&(n<0?f.childBefore(r.from):f.childAfter(r.to)))do if(n<0?f.to<=r.from:f.from>=r.to){if(h==0&&i.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!f.next().done&&g<=i;){let x=f.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,S=n>0?x.length:-1;w!=S;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:h,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return f.done?{start:h,matched:!1}:null}function MT(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function Yae(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||Kae,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||F6,mergeTokens:t.mergeTokens!==!1}}function Kae(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const AT=new WeakMap;class B6 extends Xi{constructor(e){let n=mB(e.languageData),r=Yae(e),s,i=new class extends D6{createParse(a,l,c){return new Jae(s,a,l,c)}};super(n,i,[],e.name),this.topNode=noe(n,this),s=this,this.streamParser=r,this.stateAfter=new Qt({perNode:!0}),this.tokenTable=e.tokenTable?new PB(r.tokenTable):toe}static define(e){return new B6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=AT.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let l=e.children[a],c=n+e.positions[a],h=l instanceof Hn&&c=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],l=e.children[i],c;if(an&&q6(t,i.tree,0-i.offset,n,l),h;if(c&&c.pos<=r&&(h=RB(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:h}}return{state:t.streamParser.startState(s?_u(s):4),tree:Hn.empty}}let Jae=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=Sh.get(),a=s[0].from,{state:l,tree:c}=Zae(e,r,a,this.to,i?.state);this.state=l,this.parsedPos=this.chunkStart=a+c.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(_u(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=Sh.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` +3.某句话如果已经被回复过,不要重复回复`}),[y,w]=b.useState({emoji_chance:.4,max_reg_num:40,do_replace:!0,check_interval:10,steal_emoji:!0,content_filtration:!1,filtration_prompt:"符合公序良俗"}),[S,k]=b.useState({enable_tool:!0,enable_mood:!1,mood_update_threshold:1,emotion_style:"情绪较为稳定,但遇遇特定事件的时候起伏较大",all_global:!0}),[N,C]=b.useState({api_key:""}),[T,_]=b.useState(!1),[E,M]=b.useState(""),q=[{id:"bot-basic",title:"Bot基础",description:"配置机器人的基本信息",icon:DK},{id:"personality",title:"人格配置",description:"定义机器人的性格和说话风格",icon:rz},{id:"emoji",title:"表情包",description:"配置表情包相关设置",icon:Jk},{id:"other",title:"其他设置",description:"工具、情绪系统等配置",icon:yu},{id:"siliconflow",title:"API配置",description:"配置硅基流动API密钥",icon:nz}],L=(n+1)/q.length*100;b.useEffect(()=>{(async()=>{try{h(!0);const[W,J,X,R,se]=await Promise.all([lne(),one(),cne(),une(),dne()]);m(W),x(J),w(X),k(R),C(se)}catch(W){e({title:"加载配置失败",description:W instanceof Error?W.message:"无法加载现有配置,将使用默认值",variant:"destructive"})}finally{h(!1)}})()},[e]);const I=async()=>{o(!0);try{switch(n){case 0:await hne(f);break;case 1:await fne(g);break;case 2:await mne(y);break;case 3:await pne(S);break;case 4:await gne(N);break}return e({title:"保存成功",description:`${q[n].title}配置已保存`}),!0}catch(P){return e({title:"保存失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"}),!1}finally{o(!1)}},$=async()=>{await I()&&n{n>0&&r(n-1)},ee=async()=>{i(!0),_(!0);try{if(M("正在保存API配置..."),!await I()){i(!1),_(!1);return}M("正在完成初始化..."),await S9(),M("正在重启麦麦..."),await Hv(),e({title:"配置完成",description:"麦麦正在重启以应用新配置..."}),M("等待麦麦重启完成...");const W=60;let J=0,X=!1;for(;JsetTimeout(R,1e3));try{(await xne()).running&&(X=!0,M("重启成功!正在跳转..."))}catch{J++}}if(!X)throw new Error("重启超时,请手动检查麦麦状态");setTimeout(()=>{t({to:"/"})},1e3)}catch(P){_(!1),e({title:"配置失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}finally{i(!1)}},z=async()=>{try{await S9(),t({to:"/"})}catch(P){e({title:"跳过失败",description:P instanceof Error?P.message:"未知错误",variant:"destructive"})}},H=()=>{switch(n){case 0:return l.jsx(nne,{config:f,onChange:m});case 1:return l.jsx(rne,{config:g,onChange:x});case 2:return l.jsx(sne,{config:y,onChange:w});case 3:return l.jsx(ine,{config:S,onChange:k});case 4:return l.jsx(ane,{config:N,onChange:C});default:return null}};return l.jsxs("div",{className:"relative flex min-h-screen flex-col items-center justify-center overflow-hidden bg-gradient-to-br from-primary/5 via-background to-secondary/5 p-4 md:p-6",children:[T&&l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm",children:l.jsxs("div",{className:"mx-auto flex max-w-md flex-col items-center space-y-6 rounded-lg border bg-card p-8 text-center shadow-lg",children:[l.jsx("div",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10",children:l.jsx(hh,{className:"h-10 w-10 animate-spin text-primary"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground",children:E})]}),l.jsx("div",{className:"w-full",children:l.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-secondary",children:l.jsx("div",{className:"h-full w-full animate-pulse bg-primary",style:{animation:"pulse 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite"}})})}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"请稍候,这可能需要一分钟..."})]})}),l.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[l.jsx("div",{className:"absolute left-1/4 top-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-primary/5 blur-3xl"}),l.jsx("div",{className:"absolute right-1/4 bottom-1/4 h-64 w-64 md:h-96 md:w-96 rounded-full bg-secondary/5 blur-3xl"})]}),c?l.jsxs("div",{className:"relative z-10 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center",children:l.jsx("div",{className:"h-12 w-12 animate-spin rounded-full border-4 border-primary border-t-transparent"})}),l.jsx("p",{className:"text-lg font-medium",children:"加载配置中..."}),l.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"正在读取现有配置"})]}):l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"relative z-10 w-full max-w-4xl",children:[l.jsxs("div",{className:"mb-6 md:mb-8 text-center",children:[l.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 md:h-16 md:w-16 items-center justify-center rounded-2xl bg-primary/10",children:l.jsx(RK,{className:"h-6 w-6 md:h-8 md:w-8 text-primary",strokeWidth:2,fill:"none"})}),l.jsx("h1",{className:"mb-2 text-2xl md:text-3xl font-bold",children:"首次配置向导"}),l.jsxs("p",{className:"text-sm md:text-base text-muted-foreground",children:["让我们一起完成 ",p6," 的初始配置"]})]}),l.jsxs("div",{className:"mb-6 md:mb-8",children:[l.jsxs("div",{className:"mb-2 flex items-center justify-between text-xs md:text-sm",children:[l.jsxs("span",{className:"text-muted-foreground",children:["步骤 ",n+1," / ",q.length]}),l.jsxs("span",{className:"font-medium text-primary",children:[Math.round(L),"%"]})]}),l.jsx(F0,{value:L,className:"h-2"})]}),l.jsx("div",{className:"mb-6 md:mb-8 flex justify-between",children:q.map((P,W)=>{const J=P.icon;return l.jsxs("div",{className:ye("flex flex-1 flex-col items-center gap-1 md:gap-2",Wt({to:"/"}),className:"gap-2 w-full sm:w-auto",children:[l.jsx(qm,{className:"h-4 w-4"}),"返回首页"]}),l.jsxs(fe,{size:"lg",variant:"outline",onClick:()=>window.history.back(),className:"gap-2 w-full sm:w-auto",children:[l.jsx(sz,{className:"h-4 w-4"}),"返回上一页"]})]}),l.jsx("div",{className:"mt-12 pt-8 border-t border-border",children:l.jsx("p",{className:"text-sm text-muted-foreground",children:"如果您认为这是一个错误,请联系系统管理员"})})]})})}var pL=["PageUp","PageDown"],gL=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],xL={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},qh="Slider",[q3,yne,bne]=jv(qh),[vL]=ua(qh,[bne]),[wne,Vv]=vL(qh),yL=b.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:a="horizontal",disabled:o=!1,minStepsBetweenThumbs:c=0,defaultValue:h=[r],value:f,onValueChange:m=()=>{},onValueCommit:g=()=>{},inverted:x=!1,form:y,...w}=t,S=b.useRef(new Set),k=b.useRef(0),C=a==="horizontal"?Sne:kne,[T=[],_]=wo({prop:f,defaultProp:h,onChange:$=>{[...S.current][k.current]?.focus(),m($)}}),E=b.useRef(T);function M($){const V=Tne(T,$);I($,V)}function q($){I($,k.current)}function L(){const $=E.current[k.current];T[k.current]!==$&&g(T)}function I($,V,{commit:ee}={commit:!1}){const z=Ane(i),H=Rne(Math.round(($-r)/i)*i+r,z),P=Hk(H,[r,s]);_((W=[])=>{const J=Nne(W,P,V);if(Mne(J,c*i)){k.current=J.indexOf(P);const X=String(J)!==String(W);return X&&ee&&g(J),X?J:W}else return W})}return l.jsx(wne,{scope:t.__scopeSlider,name:n,disabled:o,min:r,max:s,valueIndexToChangeRef:k,thumbs:S.current,values:T,orientation:a,form:y,children:l.jsx(q3.Provider,{scope:t.__scopeSlider,children:l.jsx(q3.Slot,{scope:t.__scopeSlider,children:l.jsx(C,{"aria-disabled":o,"data-disabled":o?"":void 0,...w,ref:e,onPointerDown:Ze(w.onPointerDown,()=>{o||(E.current=T)}),min:r,max:s,inverted:x,onSlideStart:o?void 0:M,onSlideMove:o?void 0:q,onSlideEnd:o?void 0:L,onHomeKeyDown:()=>!o&&I(r,0,{commit:!0}),onEndKeyDown:()=>!o&&I(s,T.length-1,{commit:!0}),onStepKeyDown:({event:$,direction:V})=>{if(!o){const H=pL.includes($.key)||$.shiftKey&&gL.includes($.key)?10:1,P=k.current,W=T[P],J=i*H*V;I(W+J,P,{commit:!0})}}})})})})});yL.displayName=qh;var[bL,wL]=vL(qh,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Sne=b.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:a,onSlideMove:o,onSlideEnd:c,onStepKeyDown:h,...f}=t,[m,g]=b.useState(null),x=Dn(e,C=>g(C)),y=b.useRef(void 0),w=M0(s),S=w==="ltr",k=S&&!i||!S&&i;function N(C){const T=y.current||m.getBoundingClientRect(),_=[0,T.width],M=x6(_,k?[n,r]:[r,n]);return y.current=T,M(C-T.left)}return l.jsx(bL,{scope:t.__scopeSlider,startEdge:k?"left":"right",endEdge:k?"right":"left",direction:k?1:-1,size:"width",children:l.jsx(SL,{dir:w,"data-orientation":"horizontal",...f,ref:x,style:{...f.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const T=N(C.clientX);a?.(T)},onSlideMove:C=>{const T=N(C.clientX);o?.(T)},onSlideEnd:()=>{y.current=void 0,c?.()},onStepKeyDown:C=>{const _=xL[k?"from-left":"from-right"].includes(C.key);h?.({event:C,direction:_?-1:1})}})})}),kne=b.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:a,onSlideEnd:o,onStepKeyDown:c,...h}=t,f=b.useRef(null),m=Dn(e,f),g=b.useRef(void 0),x=!s;function y(w){const S=g.current||f.current.getBoundingClientRect(),k=[0,S.height],C=x6(k,x?[r,n]:[n,r]);return g.current=S,C(w-S.top)}return l.jsx(bL,{scope:t.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:l.jsx(SL,{"data-orientation":"vertical",...h,ref:m,style:{...h.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:w=>{const S=y(w.clientY);i?.(S)},onSlideMove:w=>{const S=y(w.clientY);a?.(S)},onSlideEnd:()=>{g.current=void 0,o?.()},onStepKeyDown:w=>{const k=xL[x?"from-bottom":"from-top"].includes(w.key);c?.({event:w,direction:k?-1:1})}})})}),SL=b.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:a,onEndKeyDown:o,onStepKeyDown:c,...h}=t,f=Vv(qh,n);return l.jsx(nn.span,{...h,ref:e,onKeyDown:Ze(t.onKeyDown,m=>{m.key==="Home"?(a(m),m.preventDefault()):m.key==="End"?(o(m),m.preventDefault()):pL.concat(gL).includes(m.key)&&(c(m),m.preventDefault())}),onPointerDown:Ze(t.onPointerDown,m=>{const g=m.target;g.setPointerCapture(m.pointerId),m.preventDefault(),f.thumbs.has(g)?g.focus():r(m)}),onPointerMove:Ze(t.onPointerMove,m=>{m.target.hasPointerCapture(m.pointerId)&&s(m)}),onPointerUp:Ze(t.onPointerUp,m=>{const g=m.target;g.hasPointerCapture(m.pointerId)&&(g.releasePointerCapture(m.pointerId),i(m))})})}),kL="SliderTrack",OL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Vv(kL,n);return l.jsx(nn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});OL.displayName=kL;var F3="SliderRange",jL=b.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Vv(F3,n),i=wL(F3,n),a=b.useRef(null),o=Dn(e,a),c=s.values.length,h=s.values.map(g=>TL(g,s.min,s.max)),f=c>1?Math.min(...h):0,m=100-Math.max(...h);return l.jsx(nn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:o,style:{...t.style,[i.startEdge]:f+"%",[i.endEdge]:m+"%"}})});jL.displayName=F3;var $3="SliderThumb",NL=b.forwardRef((t,e)=>{const n=yne(t.__scopeSlider),[r,s]=b.useState(null),i=Dn(e,o=>s(o)),a=b.useMemo(()=>r?n().findIndex(o=>o.ref.current===r):-1,[n,r]);return l.jsx(One,{...t,ref:i,index:a})}),One=b.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,a=Vv($3,n),o=wL($3,n),[c,h]=b.useState(null),f=Dn(e,N=>h(N)),m=c?a.form||!!c.closest("form"):!0,g=LD(c),x=a.values[r],y=x===void 0?0:TL(x,a.min,a.max),w=Cne(r,a.values.length),S=g?.[o.size],k=S?Ene(S,y,o.direction):0;return b.useEffect(()=>{if(c)return a.thumbs.add(c),()=>{a.thumbs.delete(c)}},[c,a.thumbs]),l.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[o.startEdge]:`calc(${y}% + ${k}px)`},children:[l.jsx(q3.ItemSlot,{scope:t.__scopeSlider,children:l.jsx(nn.span,{role:"slider","aria-label":t["aria-label"]||w,"aria-valuemin":a.min,"aria-valuenow":x,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...i,ref:f,style:x===void 0?{display:"none"}:t.style,onFocus:Ze(t.onFocus,()=>{a.valueIndexToChangeRef.current=r})})}),m&&l.jsx(CL,{name:s??(a.name?a.name+(a.values.length>1?"[]":""):void 0),form:a.form,value:x},r)]})});NL.displayName=$3;var jne="RadioBubbleInput",CL=b.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=b.useRef(null),i=Dn(s,r),a=PD(e);return b.useEffect(()=>{const o=s.current;if(!o)return;const c=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==e&&f){const m=new Event("input",{bubbles:!0});f.call(o,e),o.dispatchEvent(m)}},[a,e]),l.jsx(nn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});CL.displayName=jne;function Nne(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function TL(t,e,n){const i=100/(n-e)*(t-e);return Hk(i,[0,100])}function Cne(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Tne(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function Ene(t,e,n){const r=t/2,i=x6([0,50],[0,r]);return(r-i(e)*n)*n}function _ne(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Mne(t,e){if(e>0){const n=_ne(t);return Math.min(...n)>=e}return!0}function x6(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function Ane(t){return(String(t).split(".")[1]||"").length}function Rne(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var EL=yL,Dne=OL,zne=jL,Pne=NL;const $0=b.forwardRef(({className:t,...e},n)=>l.jsxs(EL,{ref:n,className:ye("relative flex w-full touch-none select-none items-center",t),...e,children:[l.jsx(Dne,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:l.jsx(zne,{className:"absolute h-full bg-primary"})}),l.jsx(Pne,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background shadow transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));$0.displayName=EL.displayName;const zt=bK,Pt=wK,At=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(FD,{ref:r,className:ye("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,l.jsx(pK,{asChild:!0,children:l.jsx(Nu,{className:"h-4 w-4 opacity-50"})})]}));At.displayName=FD.displayName;const _L=b.forwardRef(({className:t,...e},n)=>l.jsx($D,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(Fm,{className:"h-4 w-4"})}));_L.displayName=$D.displayName;const ML=b.forwardRef(({className:t,...e},n)=>l.jsx(QD,{ref:n,className:ye("flex cursor-default items-center justify-center py-1",t),...e,children:l.jsx(Nu,{className:"h-4 w-4"})}));ML.displayName=QD.displayName;const Rt=b.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>l.jsx(gK,{children:l.jsxs(HD,{ref:s,className:ye("relative z-[100] max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-hidden rounded-md border border-border bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[l.jsx(_L,{}),l.jsx(xK,{className:ye("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(ML,{})]})}));Rt.displayName=HD.displayName;const Lne=b.forwardRef(({className:t,...e},n)=>l.jsx(VD,{ref:n,className:ye("px-2 py-1.5 text-sm font-semibold",t),...e}));Lne.displayName=VD.displayName;const ze=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(UD,{ref:r,className:ye("relative flex w-full cursor-default select-none items-center rounded-sm py-2 pl-2 pr-8 text-sm outline-none bg-white dark:bg-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 focus:bg-gray-100 dark:focus:bg-gray-800 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(vK,{children:l.jsx(so,{className:"h-4 w-4"})})}),l.jsx(yK,{children:e})]}));ze.displayName=UD.displayName;const Ine=b.forwardRef(({className:t,...e},n)=>l.jsx(WD,{ref:n,className:ye("-mx-1 my-1 h-px bg-muted",t),...e}));Ine.displayName=WD.displayName;function Bne(t){const e=qne(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,o=b.Children.toArray(i),c=o.find($ne);if(c){const h=c.props.children,f=o.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function qne(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=Hne(s),o=Qne(i,s.props);return s.type!==b.Fragment&&(o.ref=r?gc(r,a):a),b.cloneElement(s,o)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Fne=Symbol("radix.slottable");function $ne(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Fne}function Qne(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const c=i(...o);return s(...o),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function Hne(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Uv="Popover",[AL]=ua(Uv,[Rh]),Q0=Rh(),[Vne,Ec]=AL(Uv),RL=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:a=!1}=t,o=Q0(e),c=b.useRef(null),[h,f]=b.useState(!1),[m,g]=wo({prop:r,defaultProp:s??!1,onChange:i,caller:Uv});return l.jsx(_v,{...o,children:l.jsx(Vne,{scope:e,contentId:Ei(),triggerRef:c,open:m,onOpenChange:g,onOpenToggle:b.useCallback(()=>g(x=>!x),[g]),hasCustomAnchor:h,onCustomAnchorAdd:b.useCallback(()=>f(!0),[]),onCustomAnchorRemove:b.useCallback(()=>f(!1),[]),modal:a,children:n})})};RL.displayName=Uv;var DL="PopoverAnchor",Une=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ec(DL,n),i=Q0(n),{onCustomAnchorAdd:a,onCustomAnchorRemove:o}=s;return b.useEffect(()=>(a(),()=>o()),[a,o]),l.jsx(Mv,{...i,...r,ref:e})});Une.displayName=DL;var zL="PopoverTrigger",PL=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ec(zL,n),i=Q0(n),a=Dn(e,s.triggerRef),o=l.jsx(nn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":FL(s.open),...r,ref:a,onClick:Ze(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?o:l.jsx(Mv,{asChild:!0,...i,children:o})});PL.displayName=zL;var v6="PopoverPortal",[Wne,Gne]=AL(v6,{forceMount:void 0}),LL=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=Ec(v6,e);return l.jsx(Wne,{scope:e,forceMount:n,children:l.jsx(Ps,{present:n||i.open,children:l.jsx(Ev,{asChild:!0,container:s,children:r})})})};LL.displayName=v6;var xh="PopoverContent",IL=b.forwardRef((t,e)=>{const n=Gne(xh,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=Ec(xh,t.__scopePopover);return l.jsx(Ps,{present:r||i.open,children:i.modal?l.jsx(Yne,{...s,ref:e}):l.jsx(Kne,{...s,ref:e})})});IL.displayName=xh;var Xne=Bne("PopoverContent.RemoveScroll"),Yne=b.forwardRef((t,e)=>{const n=Ec(xh,t.__scopePopover),r=b.useRef(null),s=Dn(e,r),i=b.useRef(!1);return b.useEffect(()=>{const a=r.current;if(a)return GD(a)},[]),l.jsx(XD,{as:Xne,allowPinchZoom:!0,children:l.jsx(BL,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ze(t.onCloseAutoFocus,a=>{a.preventDefault(),i.current||n.triggerRef.current?.focus()}),onPointerDownOutside:Ze(t.onPointerDownOutside,a=>{const o=a.detail.originalEvent,c=o.button===0&&o.ctrlKey===!0,h=o.button===2||c;i.current=h},{checkForDefaultPrevented:!1}),onFocusOutside:Ze(t.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),Kne=b.forwardRef((t,e)=>{const n=Ec(xh,t.__scopePopover),r=b.useRef(!1),s=b.useRef(!1);return l.jsx(BL,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{t.onCloseAutoFocus?.(i),i.defaultPrevented||(r.current||n.triggerRef.current?.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{t.onInteractOutside?.(i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=i.target;n.triggerRef.current?.contains(a)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),BL=b.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:a,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:h,onInteractOutside:f,...m}=t,g=Ec(xh,n),x=Q0(n);return YD(),l.jsx(KD,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:l.jsx(Yk,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:f,onEscapeKeyDown:o,onPointerDownOutside:c,onFocusOutside:h,onDismiss:()=>g.onOpenChange(!1),children:l.jsx(Kk,{"data-state":FL(g.open),role:"dialog",id:g.contentId,...x,...m,ref:e,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),qL="PopoverClose",Zne=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Ec(qL,n);return l.jsx(nn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,()=>s.onOpenChange(!1))})});Zne.displayName=qL;var Jne="PopoverArrow",ere=b.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=Q0(n);return l.jsx(Zk,{...s,...r,ref:e})});ere.displayName=Jne;function FL(t){return t?"open":"closed"}var tre=RL,nre=PL,rre=LL,$L=IL;const uo=tre,ho=nre,ol=b.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>l.jsx(rre,{children:l.jsx($L,{ref:s,align:e,sideOffset:n,className:ye("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-popover-content-transform-origin]",t),...r})}));ol.displayName=$L.displayName;const _c="/api/webui/config";async function k9(){const e=await(await mt(`${_c}/bot`)).json();if(!e.success)throw new Error("获取配置数据失败");return e.config}async function Jd(){const e=await(await mt(`${_c}/model`)).json();if(!e.success)throw new Error("获取模型配置数据失败");return e.config}async function O9(t){const n=await(await mt(`${_c}/bot`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function sre(){const e=await(await mt(`${_c}/bot/raw`)).json();if(!e.success)throw new Error("获取配置源代码失败");return e.content}async function ire(t){const n=await(await mt(`${_c}/bot/raw`,{method:"POST",headers:Nt(),body:JSON.stringify({raw_content:t})})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function M1(t){const n=await(await mt(`${_c}/model`,{method:"POST",headers:Nt(),body:JSON.stringify(t)})).json();if(!n.success)throw new Error(n.message||"保存配置失败")}async function are(t,e){const r=await(await mt(`${_c}/bot/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}async function Q3(t,e){const r=await(await mt(`${_c}/model/section/${t}`,{method:"POST",headers:Nt(),body:JSON.stringify(e)})).json();if(!r.success)throw new Error(r.message||`保存配置节 ${t} 失败`)}const lre=Ih("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),il=b.forwardRef(({className:t,variant:e,...n},r)=>l.jsx("div",{ref:r,role:"alert",className:ye(lre({variant:e}),t),...n}));il.displayName="Alert";const ore=b.forwardRef(({className:t,...e},n)=>l.jsx("h5",{ref:n,className:ye("mb-1 font-medium leading-none tracking-tight",t),...e}));ore.displayName="AlertTitle";const al=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{ref:n,className:ye("text-sm [&_p]:leading-relaxed",t),...e}));al.displayName="AlertDescription";function y6({onRestartComplete:t,onRestartFailed:e}){const[n,r]=b.useState(0),[s,i]=b.useState("restarting"),[a,o]=b.useState(0),[c,h]=b.useState(0);b.useEffect(()=>{const g=setInterval(()=>{r(w=>w>=90?w:w+1)},200),x=setInterval(()=>{o(w=>w+1)},1e3),y=setTimeout(()=>{i("checking"),f()},3e3);return()=>{clearInterval(g),clearInterval(x),clearTimeout(y)}},[]);const f=()=>{const x=async()=>{try{if(h(w=>w+1),(await fetch("/api/webui/system/status",{method:"GET",headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(3e3)})).ok)r(100),i("success"),setTimeout(()=>{t?.()},1500);else throw new Error("Status check failed")}catch{c<60?setTimeout(x,2e3):(i("failed"),e?.())}};x()},m=g=>{const x=Math.floor(g/60),y=g%60;return`${x}:${y.toString().padStart(2,"0")}`};return l.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center",children:l.jsxs("div",{className:"max-w-md w-full mx-4 space-y-8",children:[l.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[s==="restarting"&&l.jsxs(l.Fragment,{children:[l.jsx(hh,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"正在重启麦麦"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"请稍候,麦麦正在重启中..."})]}),s==="checking"&&l.jsxs(l.Fragment,{children:[l.jsx(hh,{className:"h-16 w-16 text-primary animate-spin"}),l.jsx("h2",{className:"text-2xl font-bold",children:"检查服务状态"}),l.jsxs("p",{className:"text-muted-foreground text-center",children:["等待服务恢复... (尝试 ",c,"/60)"]})]}),s==="success"&&l.jsxs(l.Fragment,{children:[l.jsx(xc,{className:"h-16 w-16 text-green-500"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启成功"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"正在跳转到登录页面..."})]}),s==="failed"&&l.jsxs(l.Fragment,{children:[l.jsx(ju,{className:"h-16 w-16 text-destructive"}),l.jsx("h2",{className:"text-2xl font-bold",children:"重启超时"}),l.jsx("p",{className:"text-muted-foreground text-center",children:"服务未能在预期时间内恢复,请手动检查或刷新页面"})]})]}),s!=="failed"&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(F0,{value:n,className:"h-2"}),l.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[l.jsxs("span",{children:[n,"%"]}),l.jsxs("span",{children:["已用时: ",m(a)]})]})]}),l.jsx("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:l.jsxs("p",{className:"text-sm text-muted-foreground",children:[s==="restarting"&&"🔄 配置已保存,正在重启主程序...",s==="checking"&&"⏳ 正在等待服务恢复,请勿关闭页面...",s==="success"&&"✅ 配置已生效,服务运行正常",s==="failed"&&"⚠️ 如果长时间无响应,请尝试手动重启"]})}),l.jsx("div",{className:"bg-yellow-500/10 border border-yellow-500/50 rounded-lg p-4",children:l.jsxs("p",{className:"text-sm text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"⚠️ 重要提示:"})," 由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})}),s==="failed"&&l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{onClick:()=>window.location.reload(),className:"flex-1 px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90",children:"刷新页面"}),l.jsx("button",{onClick:()=>{i("checking"),h(0),f()},className:"flex-1 px-4 py-2 bg-secondary text-secondary-foreground rounded-md hover:bg-secondary/90",children:"重试检测"})]})]})})}let H3=[],QL=[];(()=>{let t="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,n=0;e>1;if(t=QL[r])e=r+1;else return!0;if(e==n)return!1}}function j9(t){return t>=127462&&t<=127487}const N9=8205;function ure(t,e,n=!0,r=!0){return(n?HL:dre)(t,e,r)}function HL(t,e,n){if(e==t.length)return e;e&&VL(t.charCodeAt(e))&&UL(t.charCodeAt(e-1))&&e--;let r=uw(t,e);for(e+=C9(r);e=0&&j9(uw(t,a));)i++,a-=2;if(i%2==0)break;e+=2}else break}return e}function dre(t,e,n){for(;e>0;){let r=HL(t,e-2,n);if(r=56320&&t<57344}function UL(t){return t>=55296&&t<56320}function C9(t){return t<65536?1:2}class cn{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){[e,n]=vh(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),e1.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=vh(this,e,n);let r=[];return this.decompose(e,n,r,0),e1.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new Nm(this),i=new Nm(e);for(let a=n,o=n;;){if(s.next(a),i.next(a),a=0,s.lineBreak!=i.lineBreak||s.done!=i.done||s.value!=i.value)return!1;if(o+=s.value.length,s.done||o>=r)return!0}}iter(e=1){return new Nm(this,e)}iterRange(e,n=this.length){return new WL(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new GL(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?cn.empty:e.length<=32?new Or(e):e1.from(Or.split(e,[]))}}class Or extends cn{constructor(e,n=hre(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.text[i],o=s+a.length;if((n?r:o)>=e)return new fre(s,o,r,a);s=o+1,r++}}decompose(e,n,r,s){let i=e<=0&&n>=this.length?this:new Or(T9(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let a=r.pop(),o=t1(i.text,a.text.slice(),0,i.length);if(o.length<=32)r.push(new Or(o,a.length+i.length));else{let c=o.length>>1;r.push(new Or(o.slice(0,c)),new Or(o.slice(c)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof Or))return super.replace(e,n,r);[e,n]=vh(this,e,n);let s=t1(this.text,t1(r.text,T9(this.text,0,e)),n),i=this.length+r.length-(n-e);return s.length<=32?new Or(s,i):e1.from(Or.split(s,[]),i)}sliceString(e,n=this.length,r=` +`){[e,n]=vh(this,e,n);let s="";for(let i=0,a=0;i<=n&&ae&&a&&(s+=r),ei&&(s+=o.slice(Math.max(0,e-i),n-i)),i=c+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let i of e)r.push(i),s+=i.length+1,r.length==32&&(n.push(new Or(r,s)),r=[],s=-1);return s>-1&&n.push(new Or(r,s)),n}}let e1=class Id extends cn{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let i=0;;i++){let a=this.children[i],o=s+a.length,c=r+a.lines-1;if((n?c:o)>=e)return a.lineInner(e,n,r,s);s=o+1,r=c+1}}decompose(e,n,r,s){for(let i=0,a=0;a<=n&&i=a){let h=s&((a<=e?1:0)|(c>=n?2:0));a>=e&&c<=n&&!h?r.push(o):o.decompose(e-a,n-a,r,h)}a=c+1}}replace(e,n,r){if([e,n]=vh(this,e,n),r.lines=i&&n<=o){let c=a.replace(e-i,n-i,r),h=this.lines-a.lines+c.lines;if(c.lines>4&&c.lines>h>>6){let f=this.children.slice();return f[s]=c,new Id(f,this.length-(n-e)+r.length)}return super.replace(i,o,c)}i=o+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=` +`){[e,n]=vh(this,e,n);let s="";for(let i=0,a=0;ie&&i&&(s+=r),ea&&(s+=o.sliceString(e-a,n-a,r)),a=c+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof Id))return 0;let r=0,[s,i,a,o]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,i+=n){if(s==a||i==o)return r;let c=this.children[s],h=e.children[i];if(c!=h)return r+c.scanIdentical(h,n);r+=c.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let x of e)r+=x.lines;if(r<32){let x=[];for(let y of e)y.flatten(x);return new Or(x,n)}let s=Math.max(32,r>>5),i=s<<1,a=s>>1,o=[],c=0,h=-1,f=[];function m(x){let y;if(x.lines>i&&x instanceof Id)for(let w of x.children)m(w);else x.lines>a&&(c>a||!c)?(g(),o.push(x)):x instanceof Or&&c&&(y=f[f.length-1])instanceof Or&&x.lines+y.lines<=32?(c+=x.lines,h+=x.length+1,f[f.length-1]=new Or(y.text.concat(x.text),y.length+1+x.length)):(c+x.lines>s&&g(),c+=x.lines,h+=x.length+1,f.push(x))}function g(){c!=0&&(o.push(f.length==1?f[0]:Id.from(f,h)),h=-1,c=f.length=0)}for(let x of e)m(x);return g(),o.length==1?o[0]:new Id(o,n)}};cn.empty=new Or([""],0);function hre(t){let e=-1;for(let n of t)e+=n.length+1;return e}function t1(t,e,n=0,r=1e9){for(let s=0,i=0,a=!0;i=n&&(c>r&&(o=o.slice(0,r-s)),s0?1:(e instanceof Or?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],i=this.offsets[r],a=i>>1,o=s instanceof Or?s.text.length:s.children.length;if(a==(n>0?o:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(s instanceof Or){let c=s.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,c.length>Math.max(0,e))return this.value=e==0?c:n>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=s.children[a+(n<0?-1:0)];e>c.length?(e-=c.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(c),this.offsets.push(n>0?1:(c instanceof Or?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class WL{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new Nm(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class GL{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(cn.prototype[Symbol.iterator]=function(){return this.iter()},Nm.prototype[Symbol.iterator]=WL.prototype[Symbol.iterator]=GL.prototype[Symbol.iterator]=function(){return this});class fre{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function vh(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function ms(t,e,n=!0,r=!0){return ure(t,e,n,r)}function mre(t){return t>=56320&&t<57344}function pre(t){return t>=55296&&t<56320}function Ks(t,e){let n=t.charCodeAt(e);if(!pre(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return mre(r)?(n-55296<<10)+(r-56320)+65536:n}function b6(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function Xa(t){return t<65536?1:2}const V3=/\r\n?|\n/;var fs=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(fs||(fs={}));class ll{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;ne)return i+(e-s);i+=o}else{if(r!=fs.Simple&&h>=e&&(r==fs.TrackDel&&se||r==fs.TrackBefore&&se))return null;if(h>e||h==e&&n<0&&!o)return e==s||n<0?i:i+c;i+=c}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return i}touchesRange(e,n=e){for(let r=0,s=0;r=0&&s<=n&&o>=e)return sn?"cover":!0;s=o}return!1}toString(){let e="";for(let n=0;n=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ll(e)}static create(e){return new ll(e)}}class Hr extends ll{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return U3(this,(n,r,s,i,a)=>e=e.replace(s,s+(r-n),a),!1),e}mapDesc(e,n=!1){return W3(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,i=0;s=0){n[s]=o,n[s+1]=a;let c=s>>1;for(;r.length0&&dc(r,n,i.text),i.forward(f),o+=f}let h=e[a++];for(;o>1].toJSON()))}return e}static of(e,n,r){let s=[],i=[],a=0,o=null;function c(f=!1){if(!f&&!s.length)return;ag||m<0||g>n)throw new RangeError(`Invalid change range ${m} to ${g} (in doc of length ${n})`);let y=x?typeof x=="string"?cn.of(x.split(r||V3)):x:cn.empty,w=y.length;if(m==g&&w==0)return;ma&&ys(s,m-a,-1),ys(s,g-m,w),dc(i,s,y),a=g}}return h(e),c(!o),o}static empty(e){return new Hr(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;so&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function dc(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r>1])),!(n||a==t.sections.length||t.sections[a+1]<0);)o=t.sections[a++],c=t.sections[a++];e(s,h,i,f,m),s=h,i=f}}}function W3(t,e,n,r=!1){let s=[],i=r?[]:null,a=new Vm(t),o=new Vm(e);for(let c=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let h=Math.min(a.len,o.len);ys(s,h,-1),a.forward(h),o.forward(h)}else if(o.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(o.len=0&&c=0){let h=0,f=a.len;for(;f;)if(o.ins==-1){let m=Math.min(f,o.len);h+=m,f-=m,o.forward(m)}else if(o.ins==0&&o.lenc||a.ins>=0&&a.len>c)&&(o||r.length>h),i.forward2(c),a.forward(c)}}}}class Vm{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return n>=e.length?cn.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?cn.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class mu{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new mu(r,s,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.range(this.anchor,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&(!n||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ae.range(e.anchor,e.head)}static create(e,n,r){return new mu(e,n,r)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;re.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ae(e.ranges.map(n=>mu.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;se?8:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((s,i)=>s.from-i.from),n=e.indexOf(r);for(let s=1;si.head?Ae.range(c,o):Ae.range(o,c))}}return new Ae(e,n)}}function YL(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let w6=0;class et{constructor(e,n,r,s,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=w6++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}get reader(){return this}static define(e={}){return new et(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:S6),!!e.static,e.enables)}of(e){return new n1([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new n1(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new n1(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function S6(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class n1{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=w6++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,i=this.id,a=e[i]>>1,o=this.type==2,c=!1,h=!1,f=[];for(let m of this.dependencies)m=="doc"?c=!0:m=="selection"?h=!0:(((n=e[m.id])!==null&&n!==void 0?n:1)&1)==0&&f.push(e[m.id]);return{create(m){return m.values[a]=r(m),1},update(m,g){if(c&&g.docChanged||h&&(g.docChanged||g.selection)||G3(m,f)){let x=r(m);if(o?!E9(x,m.values[a],s):!s(x,m.values[a]))return m.values[a]=x,1}return 0},reconfigure:(m,g)=>{let x,y=g.config.address[i];if(y!=null){let w=R1(g,y);if(this.dependencies.every(S=>S instanceof et?g.facet(S)===m.facet(S):S instanceof is?g.field(S,!1)==m.field(S,!1):!0)||(o?E9(x=r(m),w,s):s(x=r(m),w)))return m.values[a]=w,0}else x=r(m);return m.values[a]=x,1}}}}function E9(t,e,n){if(t.length!=e.length)return!1;for(let r=0;rt[c.id]),s=n.map(c=>c.type),i=r.filter(c=>!(c&1)),a=t[e.id]>>1;function o(c){let h=[];for(let f=0;fr===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Gg).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let i=r.values[n],a=this.updateF(i,s);return this.compareF(i,a)?0:(r.values[n]=a,1)},reconfigure:(r,s)=>{let i=r.facet(Gg),a=s.facet(Gg),o;return(o=i.find(c=>c.field==this))&&o!=a.find(c=>c.field==this)?(r.values[n]=o.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Gg.of({field:this,create:e})]}get extension(){return this}}const uu={lowest:4,low:3,default:2,high:1,highest:0};function Zf(t){return e=>new KL(e,t)}const Mc={highest:Zf(uu.highest),high:Zf(uu.high),default:Zf(uu.default),low:Zf(uu.low),lowest:Zf(uu.lowest)};class KL{constructor(e,n){this.inner=e,this.prec=n}}class Wv{of(e){return new X3(this,e)}reconfigure(e){return Wv.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class X3{constructor(e,n){this.compartment=e,this.inner=n}}class A1{constructor(e,n,r,s,i,a){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,n,r){let s=[],i=Object.create(null),a=new Map;for(let g of xre(e,n,a))g instanceof is?s.push(g):(i[g.facet.id]||(i[g.facet.id]=[])).push(g);let o=Object.create(null),c=[],h=[];for(let g of s)o[g.id]=h.length<<1,h.push(x=>g.slot(x));let f=r?.config.facets;for(let g in i){let x=i[g],y=x[0].facet,w=f&&f[g]||[];if(x.every(S=>S.type==0))if(o[y.id]=c.length<<1|1,S6(w,x))c.push(r.facet(y));else{let S=y.combine(x.map(k=>k.value));c.push(r&&y.compare(S,r.facet(y))?r.facet(y):S)}else{for(let S of x)S.type==0?(o[S.id]=c.length<<1|1,c.push(S.value)):(o[S.id]=h.length<<1,h.push(k=>S.dynamicSlot(k)));o[y.id]=h.length<<1,h.push(S=>gre(S,y,x))}}let m=h.map(g=>g(o));return new A1(e,a,m,o,c,i)}}function xre(t,e,n){let r=[[],[],[],[],[]],s=new Map;function i(a,o){let c=s.get(a);if(c!=null){if(c<=o)return;let h=r[c].indexOf(a);h>-1&&r[c].splice(h,1),a instanceof X3&&n.delete(a.compartment)}if(s.set(a,o),Array.isArray(a))for(let h of a)i(h,o);else if(a instanceof X3){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(a.compartment)||a.inner;n.set(a.compartment,h),i(h,o)}else if(a instanceof KL)i(a.inner,a.prec);else if(a instanceof is)r[o].push(a),a.provides&&i(a.provides,o);else if(a instanceof n1)r[o].push(a),a.facet.extensions&&i(a.facet.extensions,uu.default);else{let h=a.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(h,o)}}return i(t,uu.default),r.reduce((a,o)=>a.concat(o))}function Cm(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function R1(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const ZL=et.define(),Y3=et.define({combine:t=>t.some(e=>e),static:!0}),JL=et.define({combine:t=>t.length?t[0]:void 0,static:!0}),eI=et.define(),tI=et.define(),nI=et.define(),rI=et.define({combine:t=>t.length?t[0]:!1});class hl{constructor(e,n){this.type=e,this.value=n}static define(){return new vre}}class vre{of(e){return new hl(this,e)}}class yre{constructor(e){this.map=e}of(e){return new Mt(this,e)}}class Mt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new Mt(this.type,n)}is(e){return this.type==e}static define(e={}){return new yre(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let i=s.map(n);i&&r.push(i)}return r}}Mt.reconfigure=Mt.define();Mt.appendConfig=Mt.define();class Pr{constructor(e,n,r,s,i,a){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=i,this.scrollIntoView=a,this._doc=null,this._state=null,r&&YL(r,n.newLength),i.some(o=>o.type==Pr.time)||(this.annotations=i.concat(Pr.time.of(Date.now())))}static create(e,n,r,s,i,a){return new Pr(e,n,r,s,i,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(Pr.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}Pr.time=hl.define();Pr.userEvent=hl.define();Pr.addToHistory=hl.define();Pr.remote=hl.define();function bre(t,e){let n=[];for(let r=0,s=0;;){let i,a;if(r=t[r]))i=t[r++],a=t[r++];else if(s=0;s--){let i=r[s](t);i instanceof Pr?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof Pr?t=i[0]:t=iI(e,eh(i),!1)}return t}function Sre(t){let e=t.startState,n=e.facet(nI),r=t;for(let s=n.length-1;s>=0;s--){let i=n[s](t);i&&Object.keys(i).length&&(r=sI(r,K3(e,i,t.changes.newLength),!0))}return r==t?t:Pr.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const kre=[];function eh(t){return t==null?kre:Array.isArray(t)?t:[t]}var nr=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(nr||(nr={}));const Ore=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Z3;try{Z3=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function jre(t){if(Z3)return Z3.test(t);for(let e=0;e"€"&&(n.toUpperCase()!=n.toLowerCase()||Ore.test(n)))return!0}return!1}function Nre(t){return e=>{if(!/\S/.test(e))return nr.Space;if(jre(e))return nr.Word;for(let n=0;n-1)return nr.Word;return nr.Other}}class an{constructor(e,n,r,s,i,a){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let o=0;os.set(h,c)),n=null),s.set(o.value.compartment,o.value.extension)):o.is(Mt.reconfigure)?(n=null,r=o.value):o.is(Mt.appendConfig)&&(n=null,r=eh(r).concat(o.value));let i;n?i=e.startState.values.slice():(n=A1.resolve(r,s,this),i=new an(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(c,h)=>h.reconfigure(c,this),null).values);let a=e.startState.facet(Y3)?e.newSelection:e.newSelection.asSingle();new an(n,e.newDoc,a,i,(o,c)=>c.update(o,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),i=[r.range],a=eh(r.effects);for(let o=1;oa.spec.fromJSON(o,c)))}}return an.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=A1.resolve(e.extensions||[],new Map),r=e.doc instanceof cn?e.doc:cn.of((e.doc||"").split(n.staticFacet(an.lineSeparator)||V3)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return YL(s,r.length),n.staticFacet(Y3)||(s=s.asSingle()),new an(n,r,s,n.dynamicSlots.map(()=>null),(i,a)=>a.create(i),null)}get tabSize(){return this.facet(an.tabSize)}get lineBreak(){return this.facet(an.lineSeparator)||` +`}get readOnly(){return this.facet(rI)}phrase(e,...n){for(let r of this.facet(an.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let i=+(s||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let i of this.facet(ZL))for(let a of i(this,n,r))Object.prototype.hasOwnProperty.call(a,e)&&s.push(a[e]);return s}charCategorizer(e){return Nre(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-r,o=e-r;for(;a>0;){let c=ms(n,a,!1);if(i(n.slice(c,a))!=nr.Word)break;a=c}for(;ot.length?t[0]:4});an.lineSeparator=JL;an.readOnly=rI;an.phrases=et.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}});an.languageData=ZL;an.changeFilter=eI;an.transactionFilter=tI;an.transactionExtender=nI;Wv.reconfigure=Mt.define();function fl(t,e,n={}){let r={};for(let s of t)for(let i of Object.keys(s)){let a=s[i],o=r[i];if(o===void 0)r[i]=a;else if(!(o===a||a===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](o,a);else throw new Error("Config merge conflict for field "+i)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class Tu{eq(e){return this==e}range(e,n=e){return J3.create(e,n,this)}}Tu.prototype.startSide=Tu.prototype.endSide=0;Tu.prototype.point=!1;Tu.prototype.mapMode=fs.TrackDel;let J3=class aI{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new aI(e,n,r)}};function eS(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class k6{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,s=0){let i=r?this.to:this.from;for(let a=s,o=i.length;;){if(a==o)return a;let c=a+o>>1,h=i[c]-e||(r?this.value[c].endSide:this.value[c].startSide)-n;if(c==a)return h>=0?a:o;h>=0?o=c:a=c+1}}between(e,n,r,s){for(let i=this.findIndex(n,-1e9,!0),a=this.findIndex(r,1e9,!1,i);ix||g==x&&h.startSide>0&&h.endSide<=0)continue;(x-g||h.endSide-h.startSide)<0||(a<0&&(a=g),h.point&&(o=Math.max(o,x-g)),r.push(h),s.push(g-a),i.push(x-a))}return{mapped:r.length?new k6(s,i,r,o):null,pos:a}}}class bn{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new bn(e,n,r,s)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:i=this.length}=e,a=e.filter;if(n.length==0&&!a)return this;if(r&&(n=n.slice().sort(eS)),this.isEmpty)return n.length?bn.of(n):this;let o=new lI(this,null,-1).goto(0),c=0,h=[],f=new fo;for(;o.value||c=0){let m=n[c++];f.addInner(m.from,m.to,m.value)||h.push(m)}else o.rangeIndex==1&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||io.to||i=i&&e<=i+a.length&&a.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return Um.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Um.from(e).goto(n)}static compare(e,n,r,s,i=-1){let a=e.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),o=n.filter(m=>m.maxPoint>0||!m.isEmpty&&m.maxPoint>=i),c=_9(a,o,r),h=new Jf(a,c,i),f=new Jf(o,c,i);r.iterGaps((m,g,x)=>M9(h,m,f,g,x,s)),r.empty&&r.length==0&&M9(h,0,f,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let i=e.filter(f=>!f.isEmpty&&n.indexOf(f)<0),a=n.filter(f=>!f.isEmpty&&e.indexOf(f)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=_9(i,a),c=new Jf(i,o,0).goto(r),h=new Jf(a,o,0).goto(r);for(;;){if(c.to!=h.to||!tS(c.active,h.active)||c.point&&(!h.point||!c.point.eq(h.point)))return!1;if(c.to>s)return!0;c.next(),h.next()}}static spans(e,n,r,s,i=-1){let a=new Jf(e,null,i).goto(n),o=n,c=a.openStart;for(;;){let h=Math.min(a.to,r);if(a.point){let f=a.activeForPoint(a.to),m=a.pointFromo&&(s.span(o,h,a.active,c),c=a.openEnd(h));if(a.to>r)return c+(a.point&&a.to>r?1:0);o=a.to,a.next()}}static of(e,n=!1){let r=new fo;for(let s of e instanceof J3?[e]:n?Cre(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return bn.empty;let n=e[e.length-1];for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=bn.empty;s=s.nextLayer)n=new bn(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}bn.empty=new bn([],[],null,-1);function Cre(t){if(t.length>1)for(let e=t[0],n=1;n0)return t.slice().sort(eS);e=r}return t}bn.empty.nextLayer=bn.empty;class fo{finishChunk(e){this.chunks.push(new k6(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new fo)).add(e,n,r)}addInner(e,n,r){let s=e-this.lastTo||r.startSide-this.last.endSide;if(s<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(bn.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=bn.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function _9(t,e,n){let r=new Map;for(let i of t)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&s.push(new lI(a,n,r,i));return s.length==1?s[0]:new Um(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)dw(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)dw(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),dw(this.heap,0)}}}function dw(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class Jf{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Um.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Xg(this.active,e),Xg(this.activeTo,e),Xg(this.activeRank,e),this.minActive=A9(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:i}=this.cursor;for(;n0;)n++;Yg(this.active,n,r),Yg(this.activeTo,n,s),Yg(this.activeRank,n,i),e&&Yg(e,n,this.cursor.from),this.minActive=A9(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Xg(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from=0&&r[s]=0&&!(this.activeRank[r]e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function M9(t,e,n,r,s,i){t.goto(e),n.goto(r);let a=r+s,o=r,c=r-e;for(;;){let h=t.to+c-n.to,f=h||t.endSide-n.endSide,m=f<0?t.to+c:n.to,g=Math.min(m,a);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&tS(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(o,g,t.point,n.point):g>o&&!tS(t.active,n.active)&&i.compareRange(o,g,t.active,n.active),m>a)break;(h||t.openEnd!=n.openEnd)&&i.boundChange&&i.boundChange(m),o=m,f<=0&&t.next(),f>=0&&n.next()}}function tS(t,e){if(t.length!=e.length)return!1;for(let n=0;n=e;r--)t[r+1]=t[r];t[e]=n}function A9(t,e){let n=-1,r=1e9;for(let s=0;s=e)return s;if(s==t.length)break;i+=t.charCodeAt(s)==9?n-i%n:1,s=ms(t,s)}return r===!0?-1:t.length}const rS="ͼ",R9=typeof Symbol>"u"?"__"+rS:Symbol.for(rS),sS=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),D9=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class vc{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function i(a,o,c,h){let f=[],m=/^@(\w+)\b/.exec(a[0]),g=m&&m[1]=="keyframes";if(m&&o==null)return c.push(a[0]+";");for(let x in o){let y=o[x];if(/&/.test(x))i(x.split(/,\s*/).map(w=>a.map(S=>w.replace(/&/,S))).reduce((w,S)=>w.concat(S)),y,c);else if(y&&typeof y=="object"){if(!m)throw new RangeError("The value of a property ("+x+") should be a primitive value.");i(s(x),y,f,g)}else y!=null&&f.push(x.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+y+";")}(f.length||g)&&c.push((r&&!m&&!h?a.map(r):a).join(", ")+" {"+f.join(" ")+"}")}for(let a in e)i(s(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=D9[R9]||1;return D9[R9]=e+1,rS+e.toString(36)}static mount(e,n,r){let s=e[sS],i=r&&r.nonce;s?i&&s.setNonce(i):s=new Tre(e,i),s.mount(Array.isArray(n)?n:[n],e)}}let z9=new Map;class Tre{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let i=z9.get(r);if(i)return e[sS]=i;this.sheet=new s.CSSStyleSheet,z9.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[sS]=this}mount(e,n){let r=this.sheet,s=0,i=0;for(let a=0;a-1&&(this.modules.splice(c,1),i--,c=-1),c==-1){if(this.modules.splice(i++,0,o),r)for(let h=0;h",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ere=typeof navigator<"u"&&/Mac/.test(navigator.platform),_re=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var hs=0;hs<10;hs++)yc[48+hs]=yc[96+hs]=String(hs);for(var hs=1;hs<=24;hs++)yc[hs+111]="F"+hs;for(var hs=65;hs<=90;hs++)yc[hs]=String.fromCharCode(hs+32),Wm[hs]=String.fromCharCode(hs);for(var hw in yc)Wm.hasOwnProperty(hw)||(Wm[hw]=yc[hw]);function Mre(t){var e=Ere&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||_re&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wm:yc)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}function $n(){var t=arguments[0];typeof t=="string"&&(t=document.createElement(t));var e=1,n=arguments[1];if(n&&typeof n=="object"&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var s=n[r];typeof s=="string"?t.setAttribute(r,s):s!=null&&(t[r]=s)}e++}for(;e2);var Ye={mac:L9||/Mac/.test(_s.platform),windows:/Win/.test(_s.platform),linux:/Linux|X11/.test(_s.platform),ie:Gv,ie_version:cI?iS.documentMode||6:lS?+lS[1]:aS?+aS[1]:0,gecko:P9,gecko_version:P9?+(/Firefox\/(\d+)/.exec(_s.userAgent)||[0,0])[1]:0,chrome:!!fw,chrome_version:fw?+fw[1]:0,ios:L9,android:/Android\b/.test(_s.userAgent),webkit_version:Are?+(/\bAppleWebKit\/(\d+)/.exec(_s.userAgent)||[0,0])[1]:0,safari:oS,safari_version:oS?+(/\bVersion\/(\d+(\.\d+)?)/.exec(_s.userAgent)||[0,0])[1]:0,tabSize:iS.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Gm(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function cS(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function r1(t,e){if(!e.anchorNode)return!1;try{return cS(t,e.anchorNode)}catch{return!1}}function yh(t){return t.nodeType==3?_u(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Tm(t,e,n,r){return n?I9(t,e,n,r,-1)||I9(t,e,n,r,1):!1}function Eu(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function D1(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function I9(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:cl(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=Eu(t)+(s<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?cl(t):0}else return!1}}function cl(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function H0(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function Rre(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function uI(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function Dre(t,e,n,r,s,i,a,o){let c=t.ownerDocument,h=c.defaultView||window;for(let f=t,m=!1;f&&!m;)if(f.nodeType==1){let g,x=f==c.body,y=1,w=1;if(x)g=Rre(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(f).position)&&(m=!0),f.scrollHeight<=f.clientHeight&&f.scrollWidth<=f.clientWidth){f=f.assignedSlot||f.parentNode;continue}let N=f.getBoundingClientRect();({scaleX:y,scaleY:w}=uI(f,N)),g={left:N.left,right:N.left+f.clientWidth*y,top:N.top,bottom:N.top+f.clientHeight*w}}let S=0,k=0;if(s=="nearest")e.top0&&e.bottom>g.bottom+k&&(k=e.bottom-g.bottom+a)):e.bottom>g.bottom&&(k=e.bottom-g.bottom+a,n<0&&e.top-k0&&e.right>g.right+S&&(S=e.right-g.right+i)):e.right>g.right&&(S=e.right-g.right+i,n<0&&e.leftg.bottom||e.leftg.right)&&(e={left:Math.max(e.left,g.left),right:Math.min(e.right,g.right),top:Math.max(e.top,g.top),bottom:Math.min(e.bottom,g.bottom)}),f=f.assignedSlot||f.parentNode}else if(f.nodeType==11)f=f.host;else break}function zre(t){let e=t.ownerDocument,n,r;for(let s=t.parentNode;s&&!(s==e.body||n&&r);)if(s.nodeType==1)!r&&s.scrollHeight>s.clientHeight&&(r=s),!n&&s.scrollWidth>s.clientWidth&&(n=s),s=s.assignedSlot||s.parentNode;else if(s.nodeType==11)s=s.host;else break;return{x:n,y:r}}class Pre{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?cl(n):0),r,Math.min(e.focusOffset,r?cl(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}let lu=null;Ye.safari&&Ye.safari_version>=26&&(lu=!1);function dI(t){if(t.setActive)return t.setActive();if(lu)return t.focus(lu);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(lu==null?{get preventScroll(){return lu={preventScroll:!0},!0}}:void 0),!lu){lu=!1;for(let n=0;nMath.max(1,t.scrollHeight-t.clientHeight-4)}function mI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=cl(n)}else if(n.parentNode&&!D1(n))r=Eu(n),n=n.parentNode;else return null}}function pI(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&rn)return m.domBoundsAround(e,n,h);if(g>=e&&s==-1&&(s=c,i=h),h>n&&m.dom.parentNode==this.dom){a=c,o=f;break}f=g,h=g+m.breakAfter}return{from:i,to:o<0?r+this.length:o,startDOM:(s?this.children[s-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=O6){this.markDirty();for(let s=e;sthis.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}}function xI(t,e,n,r,s,i,a,o,c){let{children:h}=t,f=h.length?h[e]:null,m=i.length?i[i.length-1]:null,g=m?m.breakAfter:a;if(!(e==r&&f&&!a&&!g&&i.length<2&&f.merge(n,s,i.length?m:null,n==0,o,c))){if(r0&&(!a&&i.length&&f.merge(n,f.length,i[0],!1,o,0)?f.breakAfter=i.shift().breakAfter:(nBre||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new Ca(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Ss(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return qre(this.dom,e,n)}}class mo extends Bn{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let s of n)s.setParent(this)}setAttrs(e){if(hI(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,s,i,a){return r&&(!(r instanceof mo&&r.mark.eq(this.mark))||e&&i<=0||ne&&n.push(r=e&&(s=i),r=c,i++}let a=this.length-e;return this.length=e,s>-1&&(this.children.length=s,this.markDirty()),new mo(this.mark,n,a)}domAtPos(e){return yI(this,e)}coordsAt(e,n){return wI(this,e,n)}}function qre(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let s=e,i=e,a=0;e==0&&n<0||e==r&&n>=0?Ye.chrome||Ye.gecko||(e?(s--,a=1):i=0)?0:o.length-1];return Ye.safari&&!a&&c.width==0&&(c=Array.prototype.find.call(o,h=>h.width)||c),a?H0(c,a<0):c||null}class eo extends Bn{static create(e,n,r){return new eo(e,n,r)}constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}split(e){let n=eo.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable="false"))}getSide(){return this.side}merge(e,n,r,s,i,a){return r&&(!(r instanceof eo)||!this.widget.compare(r.widget)||e>0&&i<=0||n0)?Ss.before(this.dom):Ss.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let s=this.dom.getClientRects(),i=null;if(!s.length)return null;let a=this.side?this.side<0:e>0;for(let o=a?s.length-1:0;i=s[o],!(e>0?o==0:o==s.length-1||i.top0?Ss.before(this.dom):Ss.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return cn.empty}get isHidden(){return!0}}Ca.prototype.children=eo.prototype.children=bh.prototype.children=O6;function yI(t,e){let n=t.dom,{children:r}=t,s=0;for(let i=0;si&&e0;i--){let a=r[i-1];if(a.dom.parentNode==n)return a.domAtPos(a.length)}for(let i=s;i0&&e instanceof mo&&s.length&&(r=s[s.length-1])instanceof mo&&r.mark.eq(e.mark)?bI(r,e.children[0],n-1):(s.push(e),e.setParent(t)),t.length+=e.length}function wI(t,e,n){let r=null,s=-1,i=null,a=-1;function o(h,f){for(let m=0,g=0;m=f&&(x.children.length?o(x,f-g):(!i||i.isHidden&&(n>0||$re(i,x)))&&(y>f||g==y&&x.getSide()>0)?(i=x,a=f-g):(g-1?1:0)!=s.length-(n&&s.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(s.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function dS(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function Qre(t){let e=Object.create(null);for(let n=0;n0?3e8:-4e8:n>0?1e8:-1e8,new bc(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:i,end:a}=SI(e,n);r=(i?n?-3e8:-1:5e8)-1,s=(a?n?2e8:1:-6e8)+1}return new bc(e,r,s,n,e.widget||null,!0)}static line(e){return new U0(e)}static set(e,n=!1){return bn.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}ft.none=bn.empty;class V0 extends ft{constructor(e){let{start:n,end:r}=SI(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof V0&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&z1(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}V0.prototype.point=!1;class U0 extends ft{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof U0&&this.spec.class==e.spec.class&&z1(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}U0.prototype.mapMode=fs.TrackBefore;U0.prototype.point=!0;class bc extends ft{constructor(e,n,r,s,i,a){super(n,r,i,e),this.block=s,this.isReplace=a,this.mapMode=s?n<=0?fs.TrackBefore:fs.TrackAfter:fs.TrackDel}get type(){return this.startSide!=this.endSide?Rs.WidgetRange:this.startSide<=0?Rs.WidgetBefore:Rs.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof bc&&Hre(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}bc.prototype.point=!0;function SI(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function Hre(t,e){return t==e||!!(t&&e&&t.compare(e))}function s1(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Dr extends Bn{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,s,i,a){if(r){if(!(r instanceof Dr))return!1;this.dom||r.transferDOM(this)}return s&&this.setDeco(r?r.attrs:null),vI(this,e,n,r?r.children.slice():[],i,a),!0}split(e){let n=new Dr;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:s}=this.childPos(e);s&&(n.append(this.children[r].split(s),0),this.children[r].merge(s,this.children[r].length,null,!1,0,0),r++);for(let i=r;i0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){z1(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){bI(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=uS(n,this.attrs||{})),r&&(this.attrs=uS({class:r},this.attrs||{}))}domAtPos(e){return yI(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(hI(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(dS(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let s=this.dom.lastChild;for(;s&&Bn.get(s)instanceof mo;)s=s.lastChild;if(!s||!this.length||s.nodeName!="BR"&&((r=Bn.get(s))===null||r===void 0?void 0:r.isEditable)==!1&&(!Ye.ios||!this.children.some(i=>i instanceof Ca))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Ca)||/[^ -~]/.test(r.text))return null;let s=yh(r.dom);if(s.length!=1)return null;e+=s[0].width,n=s[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=wI(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:s}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-s.lineHeight)<2&&s.textHeight=n){if(i instanceof Dr)return i;if(a>n)break}s=a+i.breakAfter}return null}}class ao extends Bn{constructor(e,n,r){super(),this.widget=e,this.length=n,this.deco=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,s,i,a){return r&&(!(r instanceof ao)||!this.widget.compare(r.widget)||e>0&&i<=0||n0}}class hS extends ml{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}class Em{constructor(e,n,r,s){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=s,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof ao&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Dr),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(Kg(new bh(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof ao)&&this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:a,lineBreak:o,done:c}=this.cursor.next(this.skip);if(this.skip=0,c)throw new Error("Ran out of text content when drawing inline views");if(o){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=a,this.textOff=0}let s=Math.min(this.text.length-this.textOff,e),i=Math.min(s,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(Kg(new Ca(this.text.slice(this.textOff,this.textOff+i)),n),r),this.atCursorPos=!0,this.textOff+=i,e-=i,r=s<=i?0:n.length}}span(e,n,r,s){this.buildText(n-e,r,s),this.pos=n,this.openStart<0&&(this.openStart=s)}point(e,n,r,s,i,a){if(this.disallowBlockEffectsFor[a]&&r instanceof bc){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=n-e;if(r instanceof bc)if(r.block)r.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new ao(r.widget||wh.block,o,r));else{let c=eo.create(r.widget||wh.inline,o,o?0:r.startSide),h=this.atCursorPos&&!c.isEditable&&i<=s.length&&(e0),f=!c.isEditable&&(es.length||r.startSide<=0),m=this.getLine();this.pendingBuffer==2&&!h&&!c.isEditable&&(this.pendingBuffer=0),this.flushBuffer(s),h&&(m.append(Kg(new bh(1),s),i),i=s.length+Math.max(0,i-s.length)),m.append(Kg(c,s),i),this.atCursorPos=f,this.pendingBuffer=f?es.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=s.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,s,i){let a=new Em(e,n,r,i);return a.openEnd=bn.spans(s,n,r,a),a.openStart<0&&(a.openStart=a.openEnd),a.finish(a.openEnd),a}}function Kg(t,e){for(let n of e)t=new mo(n,[t],t.length);return t}class wh extends ml{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}wh.inline=new wh("span");wh.block=new wh("div");var Jn=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Jn||(Jn={}));const Mu=Jn.LTR,j6=Jn.RTL;function kI(t){let e=[];for(let n=0;n=n){if(o.level==r)return a;(i<0||(s!=0?s<0?o.fromn:e[i].level>o.level))&&(i=a)}}if(i<0)throw new RangeError("Index out of range");return i}}function jI(t,e){if(t.length!=e.length)return!1;for(let n=0;n=0;w-=3)if($a[w+1]==-x){let S=$a[w+2],k=S&2?s:S&4?S&1?i:s:0;k&&(Qn[m]=Qn[$a[w]]=k),o=w;break}}else{if($a.length==189)break;$a[o++]=m,$a[o++]=g,$a[o++]=c}else if((y=Qn[m])==2||y==1){let w=y==s;c=w?0:1;for(let S=o-3;S>=0;S-=3){let k=$a[S+2];if(k&2)break;if(w)$a[S+2]|=2;else{if(k&4)break;$a[S+2]|=4}}}}}function Yre(t,e,n,r){for(let s=0,i=r;s<=n.length;s++){let a=s?n[s-1].to:t,o=sc;)y==S&&(y=n[--w].from,S=w?n[w-1].to:t),Qn[--y]=x;c=f}else i=h,c++}}}function mS(t,e,n,r,s,i,a){let o=r%2?2:1;if(r%2==s%2)for(let c=e,h=0;cc&&a.push(new hc(c,w.from,x));let S=w.direction==Mu!=!(x%2);pS(t,S?r+1:r,s,w.inner,w.from,w.to,a),c=w.to}y=w.to}else{if(y==n||(f?Qn[y]!=o:Qn[y]==o))break;y++}g?mS(t,c,y,r+1,s,g,a):ce;){let f=!0,m=!1;if(!h||c>i[h-1].to){let w=Qn[c-1];w!=o&&(f=!1,m=w==16)}let g=!f&&o==1?[]:null,x=f?r:r+1,y=c;e:for(;;)if(h&&y==i[h-1].to){if(m)break e;let w=i[--h];if(!f)for(let S=w.from,k=h;;){if(S==e)break e;if(k&&i[k-1].to==S)S=i[--k].from;else{if(Qn[S-1]==o)break e;break}}if(g)g.push(w);else{w.toQn.length;)Qn[Qn.length]=256;let r=[],s=e==Mu?0:1;return pS(t,s,s,n,0,t.length,r),r}function NI(t){return[new hc(0,t,0)]}let CI="";function Zre(t,e,n,r,s){var i;let a=r.head-t.from,o=hc.find(e,a,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc),c=e[o],h=c.side(s,n);if(a==h){let g=o+=s?1:-1;if(g<0||g>=e.length)return null;c=e[o=g],a=c.side(!s,n),h=c.side(s,n)}let f=ms(t.text,a,c.forward(s,n));(fc.to)&&(f=h),CI=t.text.slice(Math.min(a,f),Math.max(a,f));let m=o==(s?e.length-1:0)?null:e[o+(s?1:-1)];return m&&f==h&&m.level+(s?0:1)t.some(e=>e)}),zI=et.define({combine:t=>t.some(e=>e)}),PI=et.define();class nh{constructor(e,n="nearest",r="nearest",s=5,i=5,a=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=i,this.isSnapshot=a}map(e){return e.empty?this:new nh(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new nh(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Zg=Mt.define({map:(t,e)=>t.map(e)}),LI=Mt.define();function Js(t,e,n){let r=t.facet(MI);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const Jl=et.define({combine:t=>t.length?t[0]:!0});let ese=0;const Ud=et.define({combine(t){return t.filter((e,n)=>{for(let r=0;r{let c=[];return a&&c.push(Xm.of(h=>{let f=h.plugin(o);return f?a(f):ft.none})),i&&c.push(i(o)),c})}static fromClass(e,n){return Nr.define((r,s)=>new e(r,s),n)}}class mw{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Js(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(n){Js(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Js(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const II=et.define(),T6=et.define(),Xm=et.define(),BI=et.define(),W0=et.define(),qI=et.define();function $9(t,e){let n=t.state.facet(qI);if(!n.length)return n;let r=n.map(i=>i instanceof Function?i(t):i),s=[];return bn.spans(r,e.from,e.to,{point(){},span(i,a,o,c){let h=i-e.from,f=a-e.from,m=s;for(let g=o.length-1;g>=0;g--,c--){let x=o[g].spec.bidiIsolate,y;if(x==null&&(x=Jre(e.text,h,f)),c>0&&m.length&&(y=m[m.length-1]).to==h&&y.direction==x)y.to=f,m=y.inner;else{let w={from:h,to:f,direction:x,inner:[]};m.push(w),m=w.inner}}}}),s}const FI=et.define();function E6(t){let e=0,n=0,r=0,s=0;for(let i of t.state.facet(FI)){let a=i(t);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(n=Math.max(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(s=Math.max(s,a.bottom)))}return{left:e,right:n,top:r,bottom:s}}const mm=et.define();class ra{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new ra(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toAf)break;i+=2}if(!c)return r;new ra(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),a=c.toA,o=c.toB}}}class P1{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Hr.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let s=[];this.changes.iterChangedRanges((i,a,o,c)=>s.push(new ra(i,a,o,c))),this.changedRanges=s}static create(e,n,r){return new P1(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}class Q9 extends Bn{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=ft.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Dr],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ra(0,0,0,e.state.doc.length)],0,null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:h,toA:f})=>fthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!lse(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let i=s>-1?nse(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:h,to:f}=this.hasComposition;r=new ra(h,f,e.changes.mapPos(h,-1),e.changes.mapPos(f,1)).addToSet(r.slice())}this.hasComposition=i?{from:i.range.fromB,to:i.range.toB}:null,(Ye.ie||Ye.chrome)&&!i&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,o=this.updateDeco(),c=ise(a,o,e.changes);return r=ra.extendWithRanges(r,c),!(this.flags&7)&&r.length==0?!1:(this.updateInner(r,e.startState.doc.length,i),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:s}=this.view;s.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=Ye.chrome||Ye.ios?{node:s.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,a),this.flags&=-8,a&&(a.written||s.selectionRange.focusNode!=a.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(a=>a.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?s[a]:null;if(!o)break;let{fromA:c,toA:h,fromB:f,toB:m}=o,g,x,y,w;if(r&&r.range.fromBf){let T=Em.build(this.view.state.doc,f,r.range.fromB,this.decorations,this.dynamicDecorationMap),_=Em.build(this.view.state.doc,r.range.toB,m,this.decorations,this.dynamicDecorationMap);x=T.breakAtStart,y=T.openStart,w=_.openEnd;let E=this.compositionView(r);_.breakAtStart?E.breakAfter=1:_.content.length&&E.merge(E.length,E.length,_.content[0],!1,_.openStart,0)&&(E.breakAfter=_.content[0].breakAfter,_.content.shift()),T.content.length&&E.merge(0,0,T.content[T.content.length-1],!0,0,T.openEnd)&&T.content.pop(),g=T.content.concat(E).concat(_.content)}else({content:g,breakAtStart:x,openStart:y,openEnd:w}=Em.build(this.view.state.doc,f,m,this.decorations,this.dynamicDecorationMap));let{i:S,off:k}=i.findPos(h,1),{i:N,off:C}=i.findPos(c,-1);xI(this,N,C,S,k,g,x,y,w)}r&&this.fixCompositionDOM(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(LI)&&(this.editContextFormatting=r.value)}compositionView(e){let n=new Ca(e.text.nodeValue);n.flags|=8;for(let{deco:s}of e.marks)n=new mo(s,[n],n.length);let r=new Dr;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,a)=>{a.flags|=8|(a.children.some(c=>c.flags&7)?1:0),this.markedForComposition.add(a);let o=Bn.get(i);o&&o!=a&&(o.dom=null),a.setDOM(i)},r=this.childPos(e.range.fromB,1),s=this.children[r.i];n(e.line,s);for(let i=e.marks.length-1;i>=-1;i--)r=s.childPos(r.off,1),s=s.children[r.i],n(i>=0?e.marks[i].node:e.text,s)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,s=r==this.dom,i=!s&&!(this.view.state.facet(Jl)||this.dom.tabIndex>-1)&&r1(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(s||n||i))return;let a=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,c=this.moveToLine(this.domAtPos(o.anchor)),h=o.empty?c:this.moveToLine(this.domAtPos(o.head));if(Ye.gecko&&o.empty&&!this.hasComposition&&tse(c)){let m=document.createTextNode("");this.view.observer.ignore(()=>c.node.insertBefore(m,c.node.childNodes[c.offset]||null)),c=h=new Ss(m,0),a=!0}let f=this.view.observer.selectionRange;(a||!f.focusNode||(!Tm(c.node,c.offset,f.anchorNode,f.anchorOffset)||!Tm(h.node,h.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,o))&&(this.view.observer.ignore(()=>{Ye.android&&Ye.chrome&&this.dom.contains(f.focusNode)&&ase(f.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let m=Gm(this.view.root);if(m)if(o.empty){if(Ye.gecko){let g=rse(c.node,c.offset);if(g&&g!=3){let x=(g==1?mI:pI)(c.node,c.offset);x&&(c=new Ss(x.node,x.offset))}}m.collapse(c.node,c.offset),o.bidiLevel!=null&&m.caretBidiLevel!==void 0&&(m.caretBidiLevel=o.bidiLevel)}else if(m.extend){m.collapse(c.node,c.offset);try{m.extend(h.node,h.offset)}catch{}}else{let g=document.createRange();o.anchor>o.head&&([c,h]=[h,c]),g.setEnd(h.node,h.offset),g.setStart(c.node,c.offset),m.removeAllRanges(),m.addRange(g)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,h)),this.impreciseAnchor=c.precise?null:new Ss(f.anchorNode,f.anchorOffset),this.impreciseHead=h.precise?null:new Ss(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Tm(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Gm(e.root),{anchorNode:s,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let a=Dr.find(this,n.head);if(!a)return;let o=a.posAtStart;if(n.head==o||n.head==o+a.length)return;let c=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!c||!h||c.bottom>h.top)return;let f=this.domAtPos(n.head+n.assoc);r.collapse(f.node,f.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let m=e.observer.selectionRange;e.docView.posFromDOM(m.anchorNode,m.anchorOffset)!=n.from&&r.collapse(s,i)}moveToLine(e){let n=this.dom,r;if(e.node!=n)return e;for(let s=e.offset;!r&&s=0;s--){let i=Bn.get(n.childNodes[s]);i instanceof Dr&&(r=i.domAtPos(i.length))}return r?new Ss(r.node,r.offset,!0):e}nearest(e){for(let n=e;n;){let r=Bn.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n=0;a--){let o=this.children[a],c=i-o.breakAfter,h=c-o.length;if(ce||o.covers(1))&&(!r||o instanceof Dr&&!(r instanceof Dr&&n>=0)))r=o,s=h;else if(r&&h==e&&c==e&&o instanceof ao&&Math.abs(n)<2){if(o.deco.startSide<0)break;a&&(r=null)}i=h}return r?r.coordsAt(e-s,n):null}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),s=this.children[n];if(!(s instanceof Dr))return null;for(;s.children.length;){let{i:o,off:c}=s.childPos(r,1);for(;;o++){if(o==s.children.length)return null;if((s=s.children[o]).length)break}r=c}if(!(s instanceof Ca))return null;let i=ms(s.text,r);if(i==r)return null;let a=_u(s.dom,r,i).getClientRects();for(let o=0;oMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,c=this.view.textDirection==Jn.LTR;for(let h=0,f=0;fs)break;if(h>=r){let x=m.dom.getBoundingClientRect();if(n.push(x.height),a){let y=m.dom.lastChild,w=y?yh(y):[];if(w.length){let S=w[w.length-1],k=c?S.right-x.left:x.right-S.left;k>o&&(o=k,this.minWidth=i,this.minWidthFrom=h,this.minWidthTo=g)}}}h=g+m.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Jn.RTL:Jn.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Dr){let a=i.measureTextSize();if(a)return a}let e=document.createElement("div"),n,r,s;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=yh(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,s=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:s}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new gI(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let i=s==n.viewports.length?null:n.viewports[s],a=i?i.from-1:this.length;if(a>r){let o=(n.lineBlockAt(a).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(ft.replace({widget:new hS(o),block:!0,inclusive:!0,isBlockGap:!0}).range(r,a))}if(!i)break;r=i.to+1}return ft.set(e)}updateDeco(){let e=1,n=this.view.state.facet(Xm).map(i=>(this.dynamicDecorationMap[e++]=typeof i=="function")?i(this.view):i),r=!1,s=this.view.state.facet(BI).map((i,a)=>{let o=typeof i=="function";return o&&(r=!0),o?i(this.view):i});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(bn.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];en.anchor?-1:1),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let i=E6(this.view),a={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom},{offsetWidth:o,offsetHeight:c}=this.view.scrollDOM;Dre(this.view.scrollDOM,a,n.heads instanceof eo||s.children.some(r);return r(this.children[n])}}function tse(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function $I(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=mI(n.focusNode,n.focusOffset),s=pI(n.focusNode,n.focusOffset),i=r||s;if(s&&r&&s.node!=r.node){let o=Bn.get(s.node);if(!o||o instanceof Ca&&o.text!=s.node.nodeValue)i=s;else if(t.docView.lastCompositionAfterCursor){let c=Bn.get(r.node);!c||c instanceof Ca&&c.text!=r.node.nodeValue||(i=s)}}if(t.docView.lastCompositionAfterCursor=i!=r,!i)return null;let a=e-i.offset;return{from:a,to:a+i.node.nodeValue.length,node:i.node}}function nse(t,e,n){let r=$I(t,n);if(!r)return null;let{node:s,from:i,to:a}=r,o=s.nodeValue;if(/[\n\r]/.test(o)||t.state.doc.sliceString(r.from,r.to)!=o)return null;let c=e.invertedDesc,h=new ra(c.mapPos(i),c.mapPos(a),i,a),f=[];for(let m=s.parentNode;;m=m.parentNode){let g=Bn.get(m);if(g instanceof mo)f.push({node:m,deco:g.mark});else{if(g instanceof Dr||m.nodeName=="DIV"&&m.parentNode==t.contentDOM)return{range:h,text:s,marks:f,line:m};if(m!=t.contentDOM)f.push({node:m,deco:new V0({inclusive:!0,attributes:Qre(m),tagName:m.tagName.toLowerCase()})});else return null}}}function rse(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e{re.from&&(n=!0)}),n}function ose(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),i=e-s.from;if(s.length==0)return Ae.cursor(e);i==0?n=1:i==s.length&&(n=-1);let a=i,o=i;n<0?a=ms(s.text,i,!1):o=ms(s.text,i);let c=r(s.text.slice(a,o));for(;a>0;){let h=ms(s.text,a,!1);if(r(s.text.slice(h,a))!=c)break;a=h}for(;ot?e.left-t:Math.max(0,t-e.right)}function use(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function pw(t,e){return t.tope.top+1}function H9(t,e){return et.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function xS(t,e,n){let r,s,i,a,o=!1,c,h,f,m;for(let y=t.firstChild;y;y=y.nextSibling){let w=yh(y);for(let S=0;SC||a==C&&i>N)&&(r=y,s=k,i=N,a=C,o=N?e0:Sk.bottom&&(!f||f.bottomk.top)&&(h=y,m=k):f&&pw(f,k)?f=V9(f,k.bottom):m&&pw(m,k)&&(m=H9(m,k.top))}}if(f&&f.bottom>=n?(r=c,s=f):m&&m.top<=n&&(r=h,s=m),!r)return{node:t,offset:0};let g=Math.max(s.left,Math.min(s.right,e));if(r.nodeType==3)return U9(r,g,n);if(o&&r.contentEditable!="false")return xS(r,g,n);let x=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(s.left+s.right)/2?1:0);return{node:t,offset:x}}function U9(t,e,n){let r=t.nodeValue.length,s=-1,i=1e9,a=0;for(let o=0;on?f.top-n:n-f.bottom)-1;if(f.left-1<=e&&f.right+1>=e&&m=(f.left+f.right)/2,x=g;if(Ye.chrome||Ye.gecko){let y=_u(t,o).getBoundingClientRect();Math.abs(y.left-f.right)<.1&&(x=!g)}if(m<=0)return{node:t,offset:o+(x?1:0)};s=o+(x?1:0),i=m}}}return{node:t,offset:s>-1?s:a>0?t.nodeValue.length:0}}function QI(t,e,n,r=-1){var s,i;let a=t.contentDOM.getBoundingClientRect(),o=a.top+t.viewState.paddingTop,c,{docHeight:h}=t.viewState,{x:f,y:m}=e,g=m-o;if(g<0)return 0;if(g>h)return t.state.doc.length;for(let T=t.viewState.heightOracle.textHeight/2,_=!1;c=t.elementAtHeight(g),c.type!=Rs.Text;)for(;g=r>0?c.bottom+T:c.top-T,!(g>=0&&g<=h);){if(_)return n?null:0;_=!0,r=-r}m=o+g;let x=c.from;if(xt.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:W9(t,a,c,f,m);let y=t.dom.ownerDocument,w=t.root.elementFromPoint?t.root:y,S=w.elementFromPoint(f,m);S&&!t.contentDOM.contains(S)&&(S=null),S||(f=Math.max(a.left+1,Math.min(a.right-1,f)),S=w.elementFromPoint(f,m),S&&!t.contentDOM.contains(S)&&(S=null));let k,N=-1;if(S&&((s=t.docView.nearest(S))===null||s===void 0?void 0:s.isEditable)!=!1){if(y.caretPositionFromPoint){let T=y.caretPositionFromPoint(f,m);T&&({offsetNode:k,offset:N}=T)}else if(y.caretRangeFromPoint){let T=y.caretRangeFromPoint(f,m);T&&({startContainer:k,startOffset:N}=T)}k&&(!t.contentDOM.contains(k)||Ye.safari&&dse(k,N,f)||Ye.chrome&&hse(k,N,f))&&(k=void 0),k&&(N=Math.min(cl(k),N))}if(!k||!t.docView.dom.contains(k)){let T=Dr.find(t.docView,x);if(!T)return g>c.top+c.height/2?c.to:c.from;({node:k,offset:N}=xS(T.dom,f,m))}let C=t.docView.nearest(k);if(!C)return null;if(C.isWidget&&((i=C.dom)===null||i===void 0?void 0:i.nodeType)==1){let T=C.dom.getBoundingClientRect();return e.yt.defaultLineHeight*1.5){let o=t.viewState.heightOracle.textHeight,c=Math.floor((s-n.top-(t.defaultLineHeight-o)*.5)/o);i+=c*t.viewState.heightOracle.lineLength}let a=t.state.sliceDoc(n.from,n.to);return n.from+nS(a,i,t.state.tabSize)}function HI(t,e,n){let r,s=t;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(;;){let i=s.nextSibling;if(i){if(i.nodeName=="BR")break;return!1}else{let a=s.parentNode;if(!a||a.nodeName=="DIV")break;s=a}}return _u(t,r-1,r).getBoundingClientRect().right>n}function dse(t,e,n){return HI(t,e,n)}function hse(t,e,n){if(e!=0)return HI(t,e,n);for(let s=t;;){let i=s.parentNode;if(!i||i.nodeType!=1||i.firstChild!=s)return!1;if(i.classList.contains("cm-line"))break;s=i}let r=t.nodeType==1?t.getBoundingClientRect():_u(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function vS(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let i of r.type){if(i.from>e)break;if(!(i.toe)return i;(!s||i.type==Rs.Text&&(s.type!=i.type||(n<0?i.frome)))&&(s=i)}}return s||r}return r}function fse(t,e,n,r){let s=vS(t,e.head,e.assoc||-1),i=!r||s.type!=Rs.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(i){let a=t.dom.getBoundingClientRect(),o=t.textDirectionAt(s.from),c=t.posAtCoords({x:n==(o==Jn.LTR)?a.right-1:a.left+1,y:(i.top+i.bottom)/2});if(c!=null)return Ae.cursor(c,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function G9(t,e,n,r){let s=t.state.doc.lineAt(e.head),i=t.bidiSpans(s),a=t.textDirectionAt(s.from);for(let o=e,c=null;;){let h=Zre(s,i,a,o,n),f=CI;if(!h){if(s.number==(n?t.state.doc.lines:1))return o;f=` +`,s=t.state.doc.line(s.number+(n?1:-1)),i=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(c){if(!c(f))return o}else{if(!r)return h;c=r(f)}o=h}}function mse(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return i=>{let a=r(i);return s==nr.Space&&(s=a),s==a}}function pse(t,e,n,r){let s=e.head,i=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let a=e.goalColumn,o,c=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||-1),f=t.documentTop;if(h)a==null&&(a=h.left-c.left),o=i<0?h.top:h.bottom;else{let x=t.viewState.lineBlockAt(s);a==null&&(a=Math.min(c.right-c.left,t.defaultCharacterWidth*(s-x.from))),o=(i<0?x.top:x.bottom)+f}let m=c.left+a,g=r??t.viewState.heightOracle.textHeight>>1;for(let x=0;;x+=10){let y=o+(g+x)*i,w=QI(t,{x:m,y},!1,i);if(yc.bottom||(i<0?ws)){let S=t.docView.coordsForChar(w),k=!S||y{if(e>i&&es(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,ri)&&!vse(a,n)&&this.lineBreak(),s=a}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),a=this.lineSeparator.length):(o=s.exec(n))&&(i=o.index,a=o[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);r=i+a}}readNode(e){if(e.cmIgnore)return;let n=Bn.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(xse(e,r.node,r.offset)?n:0))}}function xse(t,e,n){for(;;){if(!e||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let o=i||a?[]:wse(e),c=new gse(o,e.state);c.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=c.text,this.newSel=Sse(o,this.bounds.from)}else{let o=e.observer.selectionRange,c=i&&i.node==o.focusNode&&i.offset==o.focusOffset||!cS(e.contentDOM,o.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(o.focusNode,o.focusOffset),h=a&&a.node==o.anchorNode&&a.offset==o.anchorOffset||!cS(e.contentDOM,o.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(o.anchorNode,o.anchorOffset),f=e.viewport;if((Ye.ios||Ye.chrome)&&e.state.selection.main.empty&&c!=h&&(f.from>0||f.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(Ae.range(h,c)):this.newSel=Ae.single(h,c)}}}function UI(t,e){let n,{newSel:r}=e,s=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:a,to:o}=e.bounds,c=s.from,h=null;(i===8||Ye.android&&e.text.length=s.from&&n.to<=s.to&&(n.from!=s.from||n.to!=s.to)&&s.to-s.from-(n.to-n.from)<=4?n={from:s.from,to:s.to,insert:t.state.doc.slice(s.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,s.to))}:t.state.doc.lineAt(s.from).toDate.now()-50?n={from:s.from,to:s.to,insert:t.state.toText(t.inputState.insertingText)}:Ye.chrome&&n&&n.from==n.to&&n.from==s.head&&n.insert.toString()==` + `&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:s.from,to:s.to,insert:cn.of([" "])}),n)return _6(t,n,r,i);if(r&&!r.main.eq(s)){let a=!1,o="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(a=!0),o=t.inputState.lastSelectionOrigin,o=="select.pointer"&&(r=VI(t.state.facet(W0).map(c=>c(t)),r))),t.dispatch({selection:r,scrollIntoView:a,userEvent:o}),!0}else return!1}function _6(t,e,n,r=-1){if(Ye.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Ye.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&th(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.lengths.head)&&th(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&th(t.contentDOM,"Delete",46)))return!0;let i=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let a,o=()=>a||(a=bse(t,e,n));return t.state.facet(AI).some(c=>c(t,e.from,e.to,i,o))||t.dispatch(o()),!0}function bse(t,e,n){let r,s=t.state,i=s.selection.main,a=-1;if(e.from==e.to&&e.fromi.to){let c=e.fromm(t)),h,c);e.from==f&&(a=f)}if(a>-1)r={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=i.from&&e.to<=i.to&&e.to-e.from>=(i.to-i.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let c=i.frome.to?s.sliceDoc(e.to,i.to):"";r=s.replaceSelection(t.state.toText(c+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let c=s.changes(e),h=n&&n.main.to<=c.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=i.to+10&&e.to>=i.to-10){let f=t.state.sliceDoc(e.from,e.to),m,g=n&&$I(t,n.main.head);if(g){let y=e.insert.length-(e.to-e.from);m={from:g.from,to:g.to-y}}else m=t.state.doc.lineAt(i.head);let x=i.to-e.to;r=s.changeByRange(y=>{if(y.from==i.from&&y.to==i.to)return{changes:c,range:h||y.map(c)};let w=y.to-x,S=w-f.length;if(t.state.sliceDoc(S,w)!=f||w>=m.from&&S<=m.to)return{range:y};let k=s.changes({from:S,to:w,insert:e.insert}),N=y.to-i.to;return{changes:k,range:h?Ae.range(Math.max(0,h.anchor+N),Math.max(0,h.head+N)):y.map(k)}})}else r={changes:c,selection:h&&s.selection.replaceRange(h)}}let o="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,o+=".compose",t.inputState.compositionFirstChange&&(o+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:o,scrollIntoView:!0})}function WI(t,e,n,r){let s=Math.min(t.length,e.length),i=0;for(;i0&&o>0&&t.charCodeAt(a-1)==e.charCodeAt(o-1);)a--,o--;if(r=="end"){let c=Math.max(0,i-Math.min(a,o));n-=a+c-i}if(a=a?i-n:0;i-=c,o=i+(o-a),a=i}else if(o=o?i-n:0;i-=c,a=i+(a-o),o=i}return{from:i,toA:a,toB:o}}function wse(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new X9(n,r)),(s!=n||i!=r)&&e.push(new X9(s,i))),e}function Sse(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ae.single(n+e,r+e):null}class kse{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ye.safari&&e.contentDOM.addEventListener("input",()=>null),Ye.gecko&&Bse(e.contentDOM.ownerDocument)}handleEvent(e){!Mse(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=Ose(e),r=this.handlers,s=this.view.contentDOM;for(let i in n)if(i!="scroll"){let a=!n[i].handlers.length,o=r[i];o&&a!=!o.handlers.length&&(s.removeEventListener(i,this.handleEvent),o=null),o||s.addEventListener(i,this.handleEvent,{passive:a})}for(let i in r)i!="scroll"&&!n[i]&&s.removeEventListener(i,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&XI.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ye.android&&Ye.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let n;return Ye.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((n=GI.find(r=>r.keyCode==e.keyCode))&&!e.ctrlKey||jse.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=n||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let n=this.pendingIOSKey;return!n||n.key=="Enter"&&e&&e.from0?!0:Ye.safari&&!Ye.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Y9(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Js(n.state,s)}}}function Ose(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,i=s&&s.plugin.domEventHandlers,a=s&&s.plugin.domEventObservers;if(i)for(let o in i){let c=i[o];c&&n(o).handlers.push(Y9(r.value,c))}if(a)for(let o in a){let c=a[o];c&&n(o).observers.push(Y9(r.value,c))}}for(let r in Ta)n(r).handlers.push(Ta[r]);for(let r in la)n(r).observers.push(la[r]);return e}const GI=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],jse="dthko",XI=[16,17,18,20,91,92,224,225],Jg=6;function ex(t){return Math.max(0,t)*.7+8}function Nse(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class Cse{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=zre(e.contentDOM),this.atoms=e.state.facet(W0).map(a=>a(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(an.allowMultipleSelections)&&Tse(e,n),this.dragging=_se(e,n)&&ZI(n)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Nse(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let c=E6(this.view);e.clientX-c.left<=s+Jg?n=-ex(s-e.clientX):e.clientX+c.right>=a-Jg&&(n=ex(e.clientX-a)),e.clientY-c.top<=i+Jg?r=-ex(i-e.clientY):e.clientY+c.bottom>=o-Jg&&(r=ex(e.clientY-o)),this.setScrollSpeed(n,r)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=VI(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function Tse(t,e){let n=t.state.facet(TI);return n.length?n[0](e):Ye.mac?e.metaKey:e.ctrlKey}function Ese(t,e){let n=t.state.facet(EI);return n.length?n[0](e):Ye.mac?!e.altKey:!e.ctrlKey}function _se(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Gm(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let i=0;i=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function Mse(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Bn.get(n))&&r.ignoreEvent(e))return!1;return!0}const Ta=Object.create(null),la=Object.create(null),YI=Ye.ie&&Ye.ie_version<15||Ye.ios&&Ye.webkit_version<604;function Ase(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),KI(t,n.value)},50)}function Xv(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function KI(t,e){e=Xv(t.state,N6,e);let{state:n}=t,r,s=1,i=n.toText(e),a=i.lines==n.selection.ranges.length;if(yS!=null&&n.selection.ranges.every(c=>c.empty)&&yS==i.toString()){let c=-1;r=n.changeByRange(h=>{let f=n.doc.lineAt(h.from);if(f.from==c)return{range:h};c=f.from;let m=n.toText((a?i.line(s++).text:e)+n.lineBreak);return{changes:{from:f.from,insert:m},range:Ae.cursor(h.from+m.length)}})}else a?r=n.changeByRange(c=>{let h=i.line(s++);return{changes:{from:c.from,to:c.to,insert:h.text},range:Ae.cursor(c.from+h.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}la.scroll=t=>{t.inputState.lastScrollTop=t.scrollDOM.scrollTop,t.inputState.lastScrollLeft=t.scrollDOM.scrollLeft};Ta.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1);la.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};la.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Ta.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(_I))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=zse(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Cse(t,e,n,r)),r&&t.observer.ignore(()=>{dI(t.contentDOM);let i=t.root.activeElement;i&&!i.contains(t.contentDOM)&&i.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function K9(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return ose(t.state,e,n);{let s=Dr.find(t.docView,e),i=t.state.doc.lineAt(s?s.posAtEnd:e),a=s?s.posAtStart:i.from,o=s?s.posAtEnd:i.to;return oe>=n.top&&e<=n.bottom&&t>=n.left&&t<=n.right;function Rse(t,e,n,r){let s=Dr.find(t.docView,e);if(!s)return 1;let i=e-s.posAtStart;if(i==0)return 1;if(i==s.length)return-1;let a=s.coordsAt(i,-1);if(a&&Z9(n,r,a))return-1;let o=s.coordsAt(i,1);return o&&Z9(n,r,o)?1:a&&a.bottom>=r?-1:1}function J9(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:Rse(t,n,e.clientX,e.clientY)}}const Dse=Ye.ie&&Ye.ie_version<=11;let eT=null,tT=0,nT=0;function ZI(t){if(!Dse)return t.detail;let e=eT,n=nT;return eT=t,nT=Date.now(),tT=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(tT+1)%3:1}function zse(t,e){let n=J9(t,e),r=ZI(e),s=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),s=s.map(i.changes))},get(i,a,o){let c=J9(t,i),h,f=K9(t,c.pos,c.bias,r);if(n.pos!=c.pos&&!a){let m=K9(t,n.pos,n.bias,r),g=Math.min(m.from,f.from),x=Math.max(m.to,f.to);f=g1&&(h=Pse(s,c.pos))?h:o?s.addRange(f):Ae.create([f])}}}function Pse(t,e){for(let n=0;n=e)return Ae.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Ta.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.nearest(e.target);if(s&&s.isWidget){let i=s.posAtStart,a=i+s.length;(i>=n.to||a<=n.from)&&(n=Ae.range(i,a))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",Xv(t.state,C6,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1};Ta.dragend=t=>(t.inputState.draggedContent=null,!1);function rT(t,e,n,r){if(n=Xv(t.state,N6,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:i}=t.inputState,a=r&&i&&Ese(t,e)?{from:i.from,to:i.to}:null,o={from:s,insert:n},c=t.state.changes(a?[a,o]:o);t.focus(),t.dispatch({changes:c,selection:{anchor:c.mapPos(s,-1),head:c.mapPos(s,1)},userEvent:a?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Ta.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,i=()=>{++s==n.length&&rT(t,e,r.filter(a=>a!=null).join(t.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(o.result)||(r[a]=o.result),i()},o.readAsText(n[a])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return rT(t,e,r,!0),!0}return!1};Ta.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=YI?null:e.clipboardData;return n?(KI(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(Ase(t),!1)};function Lse(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function Ise(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:i}of t.selection.ranges){let a=t.doc.lineAt(i);a.number>s&&(e.push(a.text),n.push({from:a.from,to:Math.min(t.doc.length,a.to+1)})),s=a.number}r=!0}return{text:Xv(t,C6,e.join(t.lineBreak)),ranges:n,linewise:r}}let yS=null;Ta.copy=Ta.cut=(t,e)=>{let{text:n,ranges:r,linewise:s}=Ise(t.state);if(!n&&!s)return!1;yS=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let i=YI?null:e.clipboardData;return i?(i.clearData(),i.setData("text/plain",n),!0):(Lse(t,n),!1)};const JI=hl.define();function eB(t,e){let n=[];for(let r of t.facet(RI)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:JI.of(!0)}):null}function tB(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=eB(t.state,e);n?t.dispatch(n):t.update([])}},10)}la.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),tB(t)};la.blur=t=>{t.observer.clearSelectionRange(),tB(t)};la.compositionstart=la.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))};la.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Ye.chrome&&Ye.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))};la.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Ta.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let i=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),a=e.getTargetRanges();if(i&&a.length){let o=a[0],c=t.posAtDOM(o.startContainer,o.startOffset),h=t.posAtDOM(o.endContainer,o.endOffset);return _6(t,{from:c,to:h,insert:t.state.toText(i)},null),!0}}let s;if(Ye.chrome&&Ye.android&&(s=GI.find(i=>i.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let i=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>i+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Ye.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Ye.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>la.compositionend(t,e),20),!1};const sT=new Set;function Bse(t){sT.has(t)||(sT.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const iT=["pre-wrap","normal","pre-line","break-spaces"];let Sh=!1;function aT(){Sh=!1}class qse{constructor(e){this.lineWrapping=e,this.doc=cn.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return iT.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r-1,c=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=i,c){this.heightSamples={};for(let h=0;h0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>i1&&(Sh=!0),this.height=e)}replace(e,n,r){return Ds.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let i=this,a=r.doc;for(let o=s.length-1;o>=0;o--){let{fromA:c,toA:h,fromB:f,toB:m}=s[o],g=i.lineAt(c,Zn.ByPosNoHeight,r.setDoc(n),0,0),x=g.to>=h?g:i.lineAt(h,Zn.ByPosNoHeight,r,0,0);for(m+=x.to-h,h=x.to;o>0&&g.from<=s[o-1].toA;)c=s[o-1].fromA,f=s[o-1].fromB,o--,ci*2){let o=e[n-1];o.break?e.splice(--n,1,o.left,null,o.right):e.splice(--n,1,o.left,o.right),r+=1+o.break,s-=o.size}else if(i>s*2){let o=e[r];o.break?e.splice(r,1,o.left,null,o.right):e.splice(r,1,o.left,o.right),r+=2+o.break,i-=o.size}else break;else if(s=i&&a(this.blockAt(0,r,s,i))}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setHeight(s.heights[s.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ji extends nB{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,s){return new Ya(s,this.length,r,this.height,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof ji||s instanceof ds&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof ds?s=new ji(s.length,this.height):s.height=this.height,this.outdated||(s.outdated=!1),s):Ds.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setHeight(s.heights[s.index++]):(r||this.outdated)&&this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class ds extends Ds{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,i=s-r+1,a,o=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*i);a=c/i,this.length>i+1&&(o=(this.height-c)/(this.length-i-1))}else a=this.height/i;return{firstLine:r,lastLine:s,perLine:a,perChar:o}}blockAt(e,n,r,s){let{firstLine:i,lastLine:a,perLine:o,perChar:c}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e0){let i=r[r.length-1];i instanceof ds?r[r.length-1]=new ds(i.length+s):r.push(null,new ds(s-1))}if(e>0){let i=r[0];i instanceof ds?r[0]=new ds(e+i.length):r.unshift(new ds(e-1),null)}return Ds.of(r)}decomposeLeft(e,n){n.push(new ds(e-1),null)}decomposeRight(e,n){n.push(null,new ds(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let i=n+this.length;if(s&&s.from<=n+this.length&&s.more){let a=[],o=Math.max(n,s.from),c=-1;for(s.from>n&&a.push(new ds(s.from-n-1).updateHeight(e,n));o<=i&&s.more;){let f=e.doc.lineAt(o).length;a.length&&a.push(null);let m=s.heights[s.index++];c==-1?c=m:Math.abs(m-c)>=i1&&(c=-2);let g=new ji(f,m);g.outdated=!1,a.push(g),o+=f+1}o<=i&&a.push(null,new ds(i-o).updateHeight(e,o));let h=Ds.of(a);return(c<0||Math.abs(h.height-this.height)>=i1||Math.abs(c-this.heightMetrics(e,n).perLine)>=i1)&&(Sh=!0),L1(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class $se extends Ds{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let i=r+this.left.height;return eo))return h;let f=n==Zn.ByPosNoHeight?Zn.ByPosNoHeight:Zn.ByPos;return c?h.join(this.right.lineAt(o,f,r,a,o)):this.left.lineAt(o,f,r,s,i).join(h)}forEachLine(e,n,r,s,i,a){let o=s+this.left.height,c=i+this.left.length+this.break;if(this.break)e=c&&this.right.forEachLine(e,n,r,o,c,a);else{let h=this.lineAt(c,Zn.ByPos,r,s,i);e=e&&h.from<=n&&a(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,o,c,a)}}replace(e,n,r){let s=this.left.length+this.break;if(nthis.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let o of r)i.push(o);if(e>0&&lT(i,a-1),n=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e2*n.size||n.size>2*e.size?Ds.of(this.break?[e,null,n]:[e,n]):(this.left=L1(this.left,e),this.right=L1(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:i,right:a}=this,o=n+i.length+this.break,c=null;return s&&s.from<=n+i.length&&s.more?c=i=i.updateHeight(e,n,r,s):i.updateHeight(e,n,r),s&&s.from<=o+a.length&&s.more?c=a=a.updateHeight(e,o,r,s):a.updateHeight(e,o,r),c?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function lT(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof ds&&(r=t[e+1])instanceof ds&&t.splice(e-1,3,new ds(n.length+1+r.length))}const Qse=5;class M6{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof ji?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new ji(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e=Qse)&&this.addLineDeco(s,i,a)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenToe&&this.nodes.push(new ji(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new ds(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ji)return e;let n=new ji(0,-1);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof ji)&&!this.isCovered?this.nodes.push(new ji(0,-1)):(this.writtenTof.clientHeight||f.scrollWidth>f.clientWidth)&&m.overflow!="visible"){let g=f.getBoundingClientRect();i=Math.max(i,g.left),a=Math.min(a,g.right),o=Math.max(o,g.top),c=Math.min(h==t.parentNode?s.innerHeight:c,g.bottom)}h=m.position=="absolute"||m.position=="fixed"?f.offsetParent:f.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:i-n.left,right:Math.max(i,a)-n.left,top:o-(n.top+e),bottom:Math.max(o,c)-(n.top+e)}}function Wse(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left0&&e.top0}function Gse(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class xw{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;rtypeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new qse(n),this.stateDeco=e.facet(Xm).filter(r=>typeof r!="function"),this.heightMap=Ds.empty().applyChanges(this.stateDeco,cn.empty,this.heightOracle.setDoc(e.doc),[new ra(0,0,0,e.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=ft.set(this.lineGaps.map(r=>r.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:i,to:a})=>s>=i&&s<=a)){let{from:i,to:a}=this.lineBlockAt(s);e.push(new tx(i,a))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?cT:new A6(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(gm(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(Xm).filter(f=>typeof f!="function");let s=e.changedRanges,i=ra.extendWithRanges(s,Hse(r,this.stateDeco,e?e.changes:Hr.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);aT(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Sh)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.headc.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,n));let h=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(zI)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Jn.RTL:Jn.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),o=n.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let h=0,f=0;if(o.width&&o.height){let{scaleX:T,scaleY:_}=uI(n,o);(T>.005&&Math.abs(this.scaleX-T)>.005||_>.005&&Math.abs(this.scaleY-_)>.005)&&(this.scaleX=T,this.scaleY=_,h|=16,a=c=!0)}let m=(parseInt(r.paddingTop)||0)*this.scaleY,g=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=m||this.paddingBottom!=g)&&(this.paddingTop=m,this.paddingBottom=g,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let x=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=x&&(this.scrollAnchorHeight=-1,this.scrollTop=x),this.scrolledToBottom=fI(e.scrollDOM);let y=(this.printing?Gse:Use)(n,this.paddingTop),w=y.top-this.pixelViewport.top,S=y.bottom-this.pixelViewport.bottom;this.pixelViewport=y;let k=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(k!=this.inView&&(this.inView=k,k&&(c=!0)),!this.inView&&!this.scrollTarget&&!Wse(e.dom))return 0;let N=o.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),c){let T=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(T)&&(a=!0),a||s.lineWrapping&&Math.abs(N-this.contentDOMWidth)>s.charWidth){let{lineHeight:_,charWidth:E,textHeight:M}=e.docView.measureTextSize();a=_>0&&s.refresh(i,_,E,M,Math.max(5,N/E),T),a&&(e.docView.minWidth=0,h|=16)}w>0&&S>0?f=Math.max(w,S):w<0&&S<0&&(f=Math.min(w,S)),aT();for(let _ of this.viewports){let E=_.from==this.viewport.from?T:e.docView.measureVisibleLineHeights(_);this.heightMap=(a?Ds.empty().applyChanges(this.stateDeco,cn.empty,this.heightOracle,[new ra(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,a,new Fse(_.from,E))}Sh&&(h|=2)}let C=!this.viewportIsAppropriate(this.viewport,f)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return C&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(f,this.scrollTarget),h|=this.updateForViewport()),(h&2||C)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,c=new tx(s.lineAt(a-r*1e3,Zn.ByHeight,i,0,0).from,s.lineAt(o+(1-r)*1e3,Zn.ByHeight,i,0,0).to);if(n){let{head:h}=n.range;if(hc.to){let f=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),m=s.lineAt(h,Zn.ByPos,i,0,0),g;n.y=="center"?g=(m.top+m.bottom)/2-f/2:n.y=="start"||n.y=="nearest"&&h=o+Math.max(10,Math.min(r,250)))&&s>a-2*1e3&&i>1,a=s<<1;if(this.defaultTextDirection!=Jn.LTR&&!r)return[];let o=[],c=(f,m,g,x)=>{if(m-ff&&kk.from>=g.from&&k.to<=g.to&&Math.abs(k.from-f)k.fromN));if(!S){if(mC.from<=m&&C.to>=m)){let C=n.moveToLineBoundary(Ae.cursor(m),!1,!0).head;C>f&&(m=C)}let k=this.gapSize(g,f,m,x),N=r||k<2e6?k:2e6;S=new xw(f,m,k,N)}o.push(S)},h=f=>{if(f.length2e6)for(let E of e)E.from>=f.from&&E.fromf.from&&c(f.from,x,f,m),yn.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];bn.spans(n,this.viewport.from,this.viewport.to,{span(i,a){r.push({from:i,to:a})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let i=0;i=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||gm(this.heightMap.lineAt(e,Zn.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(n=>n.top<=e&&n.bottom>=e)||gm(this.heightMap.lineAt(this.scaler.fromDOM(e),Zn.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return gm(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let tx=class{constructor(e,n){this.from=e,this.to=n}};function Yse(t,e,n){let r=[],s=t,i=0;return bn.spans(n,t,e,{span(){},point(a,o){a>s&&(r.push({from:s,to:a}),i+=a-s),s=o}},20),s=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:i,to:a}=e[s],o=a-i;if(r<=o)return i+r;r-=o}}function rx(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function Kse(t,e){for(let n of t)if(e(n))return n}const cT={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};class A6{constructor(e,n,r){let s=0,i=0,a=0;this.viewports=r.map(({from:o,to:c})=>{let h=n.lineAt(o,Zn.ByPos,e,0,0).top,f=n.lineAt(c,Zn.ByPos,e,0,0).bottom;return s+=f-h,{from:o,to:c,top:h,bottom:f,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let o of this.viewports)o.domTop=a+(o.top-i)*this.scale,a=o.domBottom=o.domTop+(o.bottom-o.top),i=o.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let i=nn.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function gm(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ya(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>gm(s,e)):t._content)}const sx=et.define({combine:t=>t.join(" ")}),bS=et.define({combine:t=>t.indexOf(!0)>-1}),wS=vc.newName(),rB=vc.newName(),sB=vc.newName(),iB={"&light":"."+rB,"&dark":"."+sB};function SS(t,e,n){return new vc(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const Zse=SS("."+wS,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},iB),Jse={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},vw=Ye.ie&&Ye.ie_version<=11;class eie{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new Pre,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Ye.ie&&Ye.ie_version<=11||Ye.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ye.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ye.chrome&&Ye.chrome_version<126)&&(this.editContext=new nie(e),e.state.facet(Jl)&&(e.contentDOM.editContext=this.editContext.editContext)),vw&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(Jl)?r.root.activeElement!=this.dom:!r1(this.dom,s))return;let i=s.anchorNode&&r.docView.nearest(s.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Ye.ie&&Ye.ie_version<=11||Ye.android&&Ye.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Tm(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Gm(e.root);if(!n)return!1;let r=Ye.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&tie(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=r1(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&th(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,s=!1;for(let i of e){let a=this.readMutation(i);a&&(a.typeOver&&(s=!0),n==-1?{from:n,to:r}=a:(n=Math.min(a.from,n),r=Math.max(a.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&r1(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new yse(this.view,e,n,r);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=UI(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!n.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=uT(n,e.previousSibling||e.target.previousSibling,-1),s=uT(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Jl)!=e.state.facet(Jl)&&(e.view.contentDOM.editContext=e.state.facet(Jl)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function uT(t,e,n){for(;e;){let r=Bn.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function dT(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,i=e.endOffset,a=t.docView.domAtPos(t.state.selection.main.anchor);return Tm(a.node,a.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function tie(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return dT(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?dT(t,n):null}class nie{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=r=>{let s=e.state.selection.main,{anchor:i,head:a}=s,o=this.toEditorPos(r.updateRangeStart),c=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:o,drifted:!1});let h=c-o>r.text.length;o==this.from&&ithis.to&&(c=i);let f=WI(e.state.sliceDoc(o,c),r.text,(h?s.from:s.to)-o,h?"end":null);if(!f){let g=Ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));g.main.eq(s)||e.dispatch({selection:g,userEvent:"select"});return}let m={from:f.from+o,to:f.toA+o,insert:cn.of(r.text.slice(f.from,f.toB).split(` +`))};if((Ye.mac||Ye.android)&&m.from==a-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(m={from:o,to:c,insert:cn.of([r.text.replace("."," ")])}),this.pendingContextChange=m,!e.state.readOnly){let g=this.to-this.from+(m.to-m.from+m.insert.length);_6(e,m,Ae.single(this.toEditorPos(r.selectionStart,g),this.toEditorPos(r.selectionEnd,g)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),m.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],i=null;for(let a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a{let s=[];for(let i of r.getTextFormats()){let a=i.underlineStyle,o=i.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(o)){let c=this.toEditorPos(i.rangeStart),h=this.toEditorPos(i.rangeEnd);if(c{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let s=Gm(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((i,a,o,c,h)=>{if(r)return;let f=h.length-(a-i);if(s&&a>=s.to)if(s.from==i&&s.to==a&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=f,this.to+=f;return}else s=null,this.revertPending(e.state);if(i+=n,a+=n,a<=this.from)this.from+=f,this.to+=f;else if(ithis.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),h.toString()),this.to+=f}n+=f}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to1e4*3)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class We{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(i=>r(i,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||Lre(e.parent)||document,this.viewState=new oT(e.state||an.create(e)),e.scrollTo&&e.scrollTo.is(Zg)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Ud).map(s=>new mw(s));for(let s of this.plugins)s.update(this);this.observer=new eie(this),this.inputState=new kse(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Q9(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let n=e.length==1&&e[0]instanceof Pr?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,i=this.state;for(let g of e){if(g.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=g.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,o=0,c=null;e.some(g=>g.annotation(JI))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=eB(i,a),c||(o=1));let h=this.observer.delayedAndroidKey,f=null;if(h?(this.observer.clearDelayedAndroidKey(),f=this.observer.readChange(),(f&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(f=null)):this.observer.clear(),i.facet(an.phrases)!=this.state.facet(an.phrases))return this.setState(i);s=P1.create(this,i,e),s.flags|=o;let m=this.viewState.scrollTarget;try{this.updateState=2;for(let g of e){if(m&&(m=m.map(g.changes)),g.scrollIntoView){let{main:x}=g.state.selection;m=new nh(x.empty?x:Ae.cursor(x.head,x.head>x.anchor?-1:1))}for(let x of g.effects)x.is(Zg)&&(m=x.value.clip(this.state))}this.viewState.update(s,m),this.bidiCache=I1.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(mm)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(g=>g.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(sx)!=s.state.facet(sx)&&(this.viewState.mustMeasureContent=!0),(n||r||m||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let g of this.state.facet(gS))try{g(s)}catch(x){Js(this.state,x,"update listener")}(c||f)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),f&&!UI(this,f)&&h.force&&th(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new oT(e),this.plugins=e.facet(Ud).map(r=>new mw(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Q9(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(Ud),r=e.state.facet(Ud);if(n!=r){let s=[];for(let i of r){let a=n.indexOf(i);if(a<0)s.push(new mw(i));else{let o=this.plugins[a];o.mustUpdate=e,s.push(o)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,s=r.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(s-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(fI(r))i=-1,a=this.viewState.heightMap.height;else{let x=this.viewState.scrollAnchorAt(s);i=x.from,a=x.top}this.updateState=1;let c=this.viewState.measure(this);if(!c&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];c&4||([this.measureRequests,h]=[h,this.measureRequests]);let f=h.map(x=>{try{return x.read(this)}catch(y){return Js(this.state,y),hT}}),m=P1.create(this,this.state,[]),g=!1;m.flags|=c,n?n.flags|=c:n=m,this.updateState=2,m.empty||(this.updatePlugins(m),this.inputState.update(m),this.updateAttrs(),g=this.docView.update(m),g&&this.docViewUpdate());for(let x=0;x1||y<-1){s=s+y,r.scrollTop=s/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(gS))o(n)}get themeClasses(){return wS+" "+(this.state.facet(bS)?sB:rB)+" "+this.state.facet(sx)}updateAttrs(){let e=fT(this,II,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Jl)?"true":"false",class:"cm-content",style:`${Ye.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),fT(this,T6,n);let r=this.observer.ignore(()=>{let s=dS(this.contentDOM,this.contentAttrs,n),i=dS(this.dom,this.editorAttrs,e);return s||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(We.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(mm);let e=this.state.facet(We.cspNonce);vc.mount(this.root,this.styleModules.concat(Zse).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;nr.plugin==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return gw(this,e,G9(this,e,n,r))}moveByGroup(e,n){return gw(this,e,G9(this,e,n,r=>mse(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),i=r[n?r.length-1:0];return Ae.cursor(i.side(n,s)+e.from,i.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return fse(this,e,n,r)}moveVertically(e,n,r){return gw(this,e,pse(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),QI(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let s=this.state.doc.lineAt(e),i=this.bidiSpans(s),a=i[hc.find(i,e-s.from,-1,n)];return H0(r,a.dir==Jn.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(DI)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>rie)return NI(e.length);let n=this.textDirectionAt(e.from),r;for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||jI(i.isolates,r=$9(this,e))))return i.order;r||(r=$9(this,e));let s=Kre(e.text,n,r);return this.bidiCache.push(new I1(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ye.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{dI(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return Zg.of(new nh(typeof e=="number"?Ae.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return Zg.of(new nh(Ae.cursor(r.from),"start","start",r.top-e,n,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Nr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Nr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=vc.newName(),s=[sx.of(r),mm.of(SS(`.${r}`,e))];return n&&n.dark&&s.push(bS.of(!0)),s}static baseTheme(e){return Mc.lowest(mm.of(SS("."+wS,e,iB)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Bn.get(r)||Bn.get(e);return((n=s?.rootView)===null||n===void 0?void 0:n.view)||null}}We.styleModule=mm;We.inputHandler=AI;We.clipboardInputFilter=N6;We.clipboardOutputFilter=C6;We.scrollHandler=PI;We.focusChangeEffect=RI;We.perLineTextDirection=DI;We.exceptionSink=MI;We.updateListener=gS;We.editable=Jl;We.mouseSelectionStyle=_I;We.dragMovesSelection=EI;We.clickAddsSelectionRange=TI;We.decorations=Xm;We.outerDecorations=BI;We.atomicRanges=W0;We.bidiIsolatedRanges=qI;We.scrollMargins=FI;We.darkTheme=bS;We.cspNonce=et.define({combine:t=>t.length?t[0]:""});We.contentAttributes=T6;We.editorAttributes=II;We.lineWrapping=We.contentAttributes.of({class:"cm-lineWrapping"});We.announce=Mt.define();const rie=4096,hT={};class I1{constructor(e,n,r,s,i,a){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=i,this.order=a}static update(e,n){if(n.empty&&!e.some(i=>i.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Jn.LTR;for(let i=Math.max(0,e.length-10);i=0;s--){let i=r[s],a=typeof i=="function"?i(t):i;a&&uS(a,n)}return n}const sie=Ye.mac?"mac":Ye.windows?"win":Ye.linux?"linux":"key";function iie(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,i,a,o;for(let c=0;cr.concat(s),[]))),n}function lie(t,e,n){return lB(aB(t.state),e,t,n)}let cc=null;const oie=4e3;function cie(t,e=sie){let n=Object.create(null),r=Object.create(null),s=(a,o)=>{let c=r[a];if(c==null)r[a]=o;else if(c!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},i=(a,o,c,h,f)=>{var m,g;let x=n[a]||(n[a]=Object.create(null)),y=o.split(/ (?!$)/).map(k=>iie(k,e));for(let k=1;k{let T=cc={view:C,prefix:N,scope:a};return setTimeout(()=>{cc==T&&(cc=null)},oie),!0}]})}let w=y.join(" ");s(w,!1);let S=x[w]||(x[w]={preventDefault:!1,stopPropagation:!1,run:((g=(m=x._any)===null||m===void 0?void 0:m.run)===null||g===void 0?void 0:g.slice())||[]});c&&S.run.push(c),h&&(S.preventDefault=!0),f&&(S.stopPropagation=!0)};for(let a of t){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let h of o){let f=n[h]||(n[h]=Object.create(null));f._any||(f._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:m}=a;for(let g in f)f[g].run.push(x=>m(x,kS))}let c=a[e]||a.key;if(c)for(let h of o)i(h,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&i(h,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return n}let kS=null;function lB(t,e,n,r){kS=e;let s=Mre(e),i=Ks(s,0),a=Xa(i)==s.length&&s!=" ",o="",c=!1,h=!1,f=!1;cc&&cc.view==n&&cc.scope==r&&(o=cc.prefix+" ",XI.indexOf(e.keyCode)<0&&(h=!0,cc=null));let m=new Set,g=S=>{if(S){for(let k of S.run)if(!m.has(k)&&(m.add(k),k(n)))return S.stopPropagation&&(f=!0),!0;S.preventDefault&&(S.stopPropagation&&(f=!0),h=!0)}return!1},x=t[r],y,w;return x&&(g(x[o+ix(s,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ye.windows&&e.ctrlKey&&e.altKey)&&!(Ye.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(y=yc[e.keyCode])&&y!=s?(g(x[o+ix(y,e,!0)])||e.shiftKey&&(w=Wm[e.keyCode])!=s&&w!=y&&g(x[o+ix(w,e,!1)]))&&(c=!0):a&&e.shiftKey&&g(x[o+ix(s,e,!0)])&&(c=!0),!c&&g(x._any)&&(c=!0)),h&&(c=!0),c&&f&&e.stopPropagation(),kS=null,c}class X0{constructor(e,n,r,s,i){this.className=e,this.left=n,this.top=r,this.width=s,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let i=oB(e);return[new X0(n,s.left-i.left,s.top-i.top,null,s.bottom-s.top)]}else return uie(e,n,r)}}function oB(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Jn.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function pT(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let i=t.dom.getBoundingClientRect(),a=(s.top+s.bottom)/2,o=t.posAtCoords({x:i.left+1,y:a}),c=t.posAtCoords({x:i.right-1,y:a});return o==null||c==null?r:{from:Math.max(r.from,Math.min(o,c)),to:Math.min(r.to,Math.max(o,c))}}function uie(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),i=t.textDirection==Jn.LTR,a=t.contentDOM,o=a.getBoundingClientRect(),c=oB(t),h=a.querySelector(".cm-line"),f=h&&window.getComputedStyle(h),m=o.left+(f?parseInt(f.paddingLeft)+Math.min(0,parseInt(f.textIndent)):0),g=o.right-(f?parseInt(f.paddingRight):0),x=vS(t,r,1),y=vS(t,s,-1),w=x.type==Rs.Text?x:null,S=y.type==Rs.Text?y:null;if(w&&(t.lineWrapping||x.widgetLineBreaks)&&(w=pT(t,r,1,w)),S&&(t.lineWrapping||y.widgetLineBreaks)&&(S=pT(t,s,-1,S)),w&&S&&w.from==S.from&&w.to==S.to)return N(C(n.from,n.to,w));{let _=w?C(n.from,null,w):T(x,!1),E=S?C(null,n.to,S):T(y,!0),M=[];return(w||x).to<(S||y).from-(w&&S?1:0)||x.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2V&&z.from=P)break;R>H&&$(Math.max(X,H),_==null&&X<=V,Math.min(R,P),E==null&&R>=ee,J.dir)}if(H=W.to+1,H>=P)break}return I.length==0&&$(V,_==null,ee,E==null,t.textDirection),{top:q,bottom:L,horizontal:I}}function T(_,E){let M=o.top+(E?_.top:_.bottom);return{top:M,bottom:M,horizontal:[]}}}function die(t,e){return t.constructor==e.constructor&&t.eq(e)}class hie{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(a1)!=e.state.facet(a1)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(a1);for(;n!die(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Ye.safari&&Ye.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const a1=et.define();function cB(t){return[Nr.define(e=>new hie(e,t)),a1.of(t)]}const Ym=et.define({combine(t){return fl(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function fie(t={}){return[Ym.of(t),mie,pie,gie,zI.of(!0)]}function uB(t){return t.startState.facet(Ym)!=t.state.facet(Ym)}const mie=cB({above:!0,markers(t){let{state:e}=t,n=e.facet(Ym),r=[];for(let s of e.selection.ranges){let i=s==e.selection.main;if(s.empty||n.drawRangeCursor){let a=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=s.empty?s:Ae.cursor(s.head,s.head>s.anchor?-1:1);for(let c of X0.forRange(t,a,o))r.push(c)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=uB(t);return n&&gT(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){gT(e.state,t)},class:"cm-cursorLayer"});function gT(t,e){e.style.animationDuration=t.facet(Ym).cursorBlinkRate+"ms"}const pie=cB({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:X0.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||uB(t)},class:"cm-selectionLayer"}),gie=Mc.highest(We.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),dB=Mt.define({map(t,e){return t==null?null:e.mapPos(t)}}),xm=is.define({create(){return null},update(t,e){return t!=null&&(t=e.changes.mapPos(t)),e.effects.reduce((n,r)=>r.is(dB)?r.value:n,t)}}),xie=Nr.fromClass(class{constructor(t){this.view=t,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(t){var e;let n=t.state.field(xm);n==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(t.startState.field(xm)!=n||t.docChanged||t.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:t}=this,e=t.state.field(xm),n=e!=null&&t.coordsAtPos(e);if(!n)return null;let r=t.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+t.scrollDOM.scrollLeft*t.scaleX,top:n.top-r.top+t.scrollDOM.scrollTop*t.scaleY,height:n.bottom-n.top}}drawCursor(t){if(this.cursor){let{scaleX:e,scaleY:n}=this.view;t?(this.cursor.style.left=t.left/e+"px",this.cursor.style.top=t.top/n+"px",this.cursor.style.height=t.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(t){this.view.state.field(xm)!=t&&this.view.dispatch({effects:dB.of(t)})}},{eventObservers:{dragover(t){this.setDropPos(this.view.posAtCoords({x:t.clientX,y:t.clientY}))},dragleave(t){(t.target==this.view.contentDOM||!this.view.contentDOM.contains(t.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function vie(){return[xm,xie]}function xT(t,e,n,r,s){e.lastIndex=0;for(let i=t.iterRange(n,r),a=n,o;!i.next().done;a+=i.value.length)if(!i.lineBreak)for(;o=e.exec(i.value);)s(a+o.index,o)}function yie(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:s,to:i}of n)s=Math.max(t.state.doc.lineAt(s).from,s-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=s?r[r.length-1].to=i:r.push({from:s,to:i});return r}class bie{constructor(e){const{regexp:n,decoration:r,decorate:s,boundary:i,maxLength:a=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,s)this.addMatch=(o,c,h,f)=>s(f,h,h+o[0].length,o,c);else if(typeof r=="function")this.addMatch=(o,c,h,f)=>{let m=r(o,c,h);m&&f(h,h+o[0].length,m)};else if(r)this.addMatch=(o,c,h,f)=>f(h,h+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=a}createDeco(e){let n=new fo,r=n.add.bind(n);for(let{from:s,to:i}of yie(e,this.maxLength))xT(e.state.doc,this.regexp,s,i,(a,o)=>this.addMatch(o,e,a,r));return n.finish()}updateDeco(e,n){let r=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((i,a,o,c)=>{c>=e.view.viewport.from&&o<=e.view.viewport.to&&(r=Math.min(o,r),s=Math.max(c,s))}),e.viewportMoved||s-r>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,n.map(e.changes),r,s):n}updateRange(e,n,r,s){for(let i of e.visibleRanges){let a=Math.max(i.from,r),o=Math.min(i.to,s);if(o>=a){let c=e.state.doc.lineAt(a),h=c.toc.from;a--)if(this.boundary.test(c.text[a-1-c.from])){f=a;break}for(;og.push(k.range(w,S));if(c==h)for(this.regexp.lastIndex=f-c.from;(x=this.regexp.exec(c.text))&&x.indexthis.addMatch(S,e,w,y));n=n.update({filterFrom:f,filterTo:m,filter:(w,S)=>wm,add:g})}}return n}}const OS=/x/.unicode!=null?"gu":"g",wie=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,OS),Sie={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let yw=null;function kie(){var t;if(yw==null&&typeof document<"u"&&document.body){let e=document.body.style;yw=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return yw||!1}const l1=et.define({combine(t){let e=fl(t,{render:null,specialChars:wie,addSpecialChars:null});return(e.replaceTabs=!kie())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,OS)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,OS)),e}});function Oie(t={}){return[l1.of(t),jie()]}let vT=null;function jie(){return vT||(vT=Nr.fromClass(class{constructor(t){this.view=t,this.decorations=ft.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(l1)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new bie({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:s}=n.state,i=Ks(e[0],0);if(i==9){let a=s.lineAt(r),o=n.state.tabSize,c=Fh(a.text,o,r-a.from);return ft.replace({widget:new Eie((o-c%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[i]||(this.decorationCache[i]=ft.replace({widget:new Tie(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(l1);t.startState.facet(l1)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}const Nie="•";function Cie(t){return t>=32?Nie:t==10?"␤":String.fromCharCode(9216+t)}class Tie extends ml{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=Cie(this.code),r=e.state.phrase("Control character")+" "+(Sie[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,r,n);if(s)return s;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}}class Eie extends ml{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function _ie(){return Aie}const Mie=ft.line({class:"cm-activeLine"}),Aie=Nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(Mie.range(s.from)),e=s.from)}return ft.set(n)}},{decorations:t=>t.decorations});class Rie extends ml{constructor(e){super(),this.content=e}toDOM(e){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(e){let n=e.firstChild?yh(e.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(e.parentNode),s=H0(n[0],r.direction!="rtl"),i=parseInt(r.lineHeight);return s.bottom-s.top>i*1.5?{left:s.left,right:s.right,top:s.top,bottom:s.top+i}:s}ignoreEvent(){return!1}}function Die(t){let e=Nr.fromClass(class{constructor(n){this.view=n,this.placeholder=t?ft.set([ft.widget({widget:new Rie(t),side:1}).range(0)]):ft.none}get decorations(){return this.view.state.doc.length?ft.none:this.placeholder}},{decorations:n=>n.decorations});return typeof t=="string"?[e,We.contentAttributes.of({"aria-placeholder":t})]:e}const jS=2e3;function zie(t,e,n){let r=Math.min(e.line,n.line),s=Math.max(e.line,n.line),i=[];if(e.off>jS||n.off>jS||e.col<0||n.col<0){let a=Math.min(e.off,n.off),o=Math.max(e.off,n.off);for(let c=r;c<=s;c++){let h=t.doc.line(c);h.length<=o&&i.push(Ae.range(h.from+a,h.to+o))}}else{let a=Math.min(e.col,n.col),o=Math.max(e.col,n.col);for(let c=r;c<=s;c++){let h=t.doc.line(c),f=nS(h.text,a,t.tabSize,!0);if(f<0)i.push(Ae.cursor(h.to));else{let m=nS(h.text,o,t.tabSize);i.push(Ae.range(h.from+f,h.from+m))}}}return i}function Pie(t,e){let n=t.coordsAtPos(t.viewport.from);return n?Math.round(Math.abs((n.left-e)/t.defaultCharacterWidth)):-1}function yT(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1),r=t.state.doc.lineAt(n),s=n-r.from,i=s>jS?-1:s==r.length?Pie(t,e.clientX):Fh(r.text,t.state.tabSize,n-r.from);return{line:r.number,col:i,off:s}}function Lie(t,e){let n=yT(t,e),r=t.state.selection;return n?{update(s){if(s.docChanged){let i=s.changes.mapPos(s.startState.doc.line(n.line).from),a=s.state.doc.lineAt(i);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(s.changes)}},get(s,i,a){let o=yT(t,s);if(!o)return r;let c=zie(t.state,n,o);return c.length?a?Ae.create(c.concat(r.ranges)):Ae.create(c):r}}:null}function Iie(t){let e=(n=>n.altKey&&n.button==0);return We.mouseSelectionStyle.of((n,r)=>e(r)?Lie(n,r):null)}const Bie={Alt:[18,t=>!!t.altKey],Control:[17,t=>!!t.ctrlKey],Shift:[16,t=>!!t.shiftKey],Meta:[91,t=>!!t.metaKey]},qie={style:"cursor: crosshair"};function Fie(t={}){let[e,n]=Bie[t.key||"Alt"],r=Nr.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||n(s))},keyup(s){(s.keyCode==e||!n(s))&&this.set(!1)},mousemove(s){this.set(n(s))}}});return[r,We.contentAttributes.of(s=>{var i;return!((i=s.plugin(r))===null||i===void 0)&&i.isDown?qie:null})]}const ax="-10000px";class hB{constructor(e,n,r,s){this.facet=n,this.createTooltipView=r,this.removeTooltipView=s,this.input=e.state.facet(n),this.tooltips=this.input.filter(a=>a);let i=null;this.tooltipViews=this.tooltips.map(a=>i=r(a,i))}update(e,n){var r;let s=e.state.facet(this.facet),i=s.filter(c=>c);if(s===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],o=n?[]:null;for(let c=0;cn[h]=c),n.length=o.length),this.input=s,this.tooltips=i,this.tooltipViews=a,!0}}function $ie(t){let e=t.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const bw=et.define({combine:t=>{var e,n,r;return{position:Ye.ios?"absolute":((e=t.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((n=t.find(s=>s.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=t.find(s=>s.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||$ie}}}),bT=new WeakMap,R6=Nr.fromClass(class{constructor(t){this.view=t,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=t.state.facet(bw);this.position=e.position,this.parent=e.parent,this.classes=t.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new hB(t,D6,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),t.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let t of this.manager.tooltipViews)this.intersectionObserver.observe(t.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(t){t.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(t,this.above);e&&this.observeIntersection();let n=e||t.geometryChanged,r=t.state.facet(bw);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(t,e){let n=t.create(this.view),r=e?e.dom:null;if(n.dom.classList.add("cm-tooltip"),t.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",n.dom.appendChild(s)}return n.dom.style.position=this.position,n.dom.style.top=ax,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var t,e,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(t=r.destroy)===null||t===void 0||t.call(r);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let t=1,e=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:i}=this.manager.tooltipViews[0];if(Ye.safari){let a=i.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}else n=!!i.offsetParent&&i.offsetParent!=this.container.ownerDocument.body}if(n||this.position=="absolute")if(this.parent){let i=this.parent.getBoundingClientRect();i.width&&i.height&&(t=i.width/this.parent.offsetWidth,e=i.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:e}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),s=E6(this.view);return{visible:{left:r.left+s.left,top:r.top+s.top,right:r.right-s.right,bottom:r.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((i,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(i.pos):this.view.coordsAtPos(i.pos)}),size:this.manager.tooltipViews.map(({dom:i})=>i.getBoundingClientRect()),space:this.view.state.facet(bw).tooltipSpace(this.view),scaleX:t,scaleY:e,makeAbsolute:n}}writeMeasure(t){var e;if(t.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:s,scaleY:i}=t,a=[];for(let o=0;o=Math.min(n.bottom,r.bottom)||m.rightMath.min(n.right,r.right)+.1)){f.style.top=ax;continue}let x=c.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,y=x?7:0,w=g.right-g.left,S=(e=bT.get(h))!==null&&e!==void 0?e:g.bottom-g.top,k=h.offset||Hie,N=this.view.textDirection==Jn.LTR,C=g.width>r.right-r.left?N?r.left:r.right-g.width:N?Math.max(r.left,Math.min(m.left-(x?14:0)+k.x,r.right-w)):Math.min(Math.max(r.left,m.left-w+(x?14:0)-k.x),r.right-w),T=this.above[o];!c.strictSide&&(T?m.top-S-y-k.yr.bottom)&&T==r.bottom-m.bottom>m.top-r.top&&(T=this.above[o]=!T);let _=(T?m.top-r.top:r.bottom-m.bottom)-y;if(_C&&q.topE&&(E=T?q.top-S-2-y:q.bottom+y+2);if(this.position=="absolute"?(f.style.top=(E-t.parent.top)/i+"px",wT(f,(C-t.parent.left)/s)):(f.style.top=E/i+"px",wT(f,C/s)),x){let q=m.left+(N?k.x:-k.x)-(C+14-7);x.style.left=q/s+"px"}h.overlap!==!0&&a.push({left:C,top:E,right:M,bottom:E+S}),f.classList.toggle("cm-tooltip-above",T),f.classList.toggle("cm-tooltip-below",!T),h.positioned&&h.positioned(t.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let t of this.manager.tooltipViews)t.dom.style.top=ax}},{eventObservers:{scroll(){this.maybeMeasure()}}});function wT(t,e){let n=parseInt(t.style.left,10);(isNaN(n)||Math.abs(e-n)>1)&&(t.style.left=e+"px")}const Qie=We.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Hie={x:0,y:0},D6=et.define({enables:[R6,Qie]}),B1=et.define({combine:t=>t.reduce((e,n)=>e.concat(n),[])});class Yv{static create(e){return new Yv(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new hB(e,B1,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(e,n){let r=e.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(e){for(let n of this.manager.tooltipViews)n.mount&&n.mount(e);this.mounted=!0}positioned(e){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let n of this.manager.tooltipViews)(e=n.destroy)===null||e===void 0||e.call(n)}passProp(e){let n;for(let r of this.manager.tooltipViews){let s=r[e];if(s!==void 0){if(n===void 0)n=s;else if(n!==s)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const Vie=D6.compute([B1],t=>{let e=t.facet(B1);return e.length===0?null:{pos:Math.min(...e.map(n=>n.pos)),end:Math.max(...e.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:Yv.create,above:e[0].above,arrow:e.some(n=>n.arrow)}});class Uie{constructor(e,n,r,s,i){this.view=e,this.source=n,this.field=r,this.setHover=s,this.hoverTime=i,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;eo.bottom||n.xo.right+e.defaultCharacterWidth)return;let c=e.bidiSpans(e.state.doc.lineAt(s)).find(f=>f.from<=s&&f.to>=s),h=c&&c.dir==Jn.RTL?-1:1;i=n.x{this.pending==o&&(this.pending=null,c&&!(Array.isArray(c)&&!c.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(c)?c:[c])}))},c=>Js(e.state,c,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let e=this.view.plugin(R6),n=e?e.manager.tooltips.findIndex(r=>r.create==Yv.create):-1;return n>-1?e.manager.tooltipViews[n]:null}mousemove(e){var n,r;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:i}=this;if(s.length&&i&&!Wie(i.dom,e)||this.pending){let{pos:a}=s[0]||this.pending,o=(r=(n=s[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==o?this.view.posAtCoords(this.lastMove)!=a:!Gie(this.view,a,o,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(e.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let n=r=>{e.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const lx=4;function Wie(t,e){let{left:n,right:r,top:s,bottom:i}=t.getBoundingClientRect(),a;if(a=t.querySelector(".cm-tooltip-arrow")){let o=a.getBoundingClientRect();s=Math.min(o.top,s),i=Math.max(o.bottom,i)}return e.clientX>=n-lx&&e.clientX<=r+lx&&e.clientY>=s-lx&&e.clientY<=i+lx}function Gie(t,e,n,r,s,i){let a=t.scrollDOM.getBoundingClientRect(),o=t.documentTop+t.documentPadding.top+t.contentHeight;if(a.left>r||a.rights||Math.min(a.bottom,o)=e&&c<=n}function Xie(t,e={}){let n=Mt.define(),r=is.define({create(){return[]},update(s,i){if(s.length&&(e.hideOnChange&&(i.docChanged||i.selection)?s=[]:e.hideOn&&(s=s.filter(a=>!e.hideOn(i,a))),i.docChanged)){let a=[];for(let o of s){let c=i.changes.mapPos(o.pos,-1,fs.TrackDel);if(c!=null){let h=Object.assign(Object.create(null),o);h.pos=c,h.end!=null&&(h.end=i.changes.mapPos(h.end)),a.push(h)}}s=a}for(let a of i.effects)a.is(n)&&(s=a.value),a.is(Yie)&&(s=[]);return s},provide:s=>B1.from(s)});return{active:r,extension:[r,Nr.define(s=>new Uie(s,t,r,n,e.hoverTime||300)),Vie]}}function fB(t,e){let n=t.plugin(R6);if(!n)return null;let r=n.manager.tooltips.indexOf(e);return r<0?null:n.manager.tooltipViews[r]}const Yie=Mt.define(),ST=et.define({combine(t){let e,n;for(let r of t)e=e||r.topContainer,n=n||r.bottomContainer;return{topContainer:e,bottomContainer:n}}});function Km(t,e){let n=t.plugin(mB),r=n?n.specs.indexOf(e):-1;return r>-1?n.panels[r]:null}const mB=Nr.fromClass(class{constructor(t){this.input=t.state.facet(Zm),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(t));let e=t.state.facet(ST);this.top=new ox(t,!0,e.topContainer),this.bottom=new ox(t,!1,e.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(t){let e=t.state.facet(ST);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new ox(t.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new ox(t.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=t.state.facet(Zm);if(n!=this.input){let r=n.filter(c=>c),s=[],i=[],a=[],o=[];for(let c of r){let h=this.specs.indexOf(c),f;h<0?(f=c(t.view),o.push(f)):(f=this.panels[h],f.update&&f.update(t)),s.push(f),(f.top?i:a).push(f)}this.specs=r,this.panels=s,this.top.sync(i),this.bottom.sync(a);for(let c of o)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let r of this.panels)r.update&&r.update(t)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ox{constructor(e,n,r){this.view=e,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let n of this.panels)n.destroy&&e.indexOf(n)<0&&n.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let e=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;e!=n.dom;)e=kT(e);e=e.nextSibling}else this.dom.insertBefore(n.dom,e);for(;e;)e=kT(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function kT(t){let e=t.nextSibling;return t.remove(),e}const Zm=et.define({enables:mB});class po extends Tu{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}po.prototype.elementClass="";po.prototype.toDOM=void 0;po.prototype.mapMode=fs.TrackBefore;po.prototype.startSide=po.prototype.endSide=-1;po.prototype.point=!0;const o1=et.define(),Kie=et.define(),Zie={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>bn.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Mm=et.define();function Jie(t){return[pB(),Mm.of({...Zie,...t})]}const OT=et.define({combine:t=>t.some(e=>e)});function pB(t){return[eae]}const eae=Nr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=t.state.facet(Mm).map(e=>new NT(t,e)),this.fixed=!t.state.facet(OT);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),t.scrollDOM.insertBefore(this.dom,t.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(OT)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=bn.iter(this.view.state.facet(o1),this.view.viewport.from),r=[],s=this.gutters.map(i=>new tae(i,this.view.viewport,-this.view.documentPadding.top));for(let i of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(i.type)){let a=!0;for(let o of i.type)if(o.type==Rs.Text&&a){NS(n,r,o.from);for(let c of s)c.line(this.view,o,r);a=!1}else if(o.widget)for(let c of s)c.widget(this.view,o)}else if(i.type==Rs.Text){NS(n,r,i.from);for(let a of s)a.line(this.view,i,r)}else if(i.widget)for(let a of s)a.widget(this.view,i);for(let i of s)i.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Mm),n=t.state.facet(Mm),r=t.docChanged||t.heightChanged||t.viewportChanged||!bn.eq(t.startState.facet(o1),t.state.facet(o1),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let i of n){let a=e.indexOf(i);a<0?s.push(new NT(this.view,i)):(this.gutters[a].update(t),s.push(this.gutters[a]))}for(let i of this.gutters)i.dom.remove(),s.indexOf(i)<0&&i.destroy();for(let i of s)i.config.side=="after"?this.getDOMAfter().appendChild(i.dom):this.dom.appendChild(i.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>We.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Jn.LTR?{left:r,right:s}:{right:r,left:s}})});function jT(t){return Array.isArray(t)?t:[t]}function NS(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class tae{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=bn.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,i=(n.top-this.height)/e.scaleY,a=n.height/e.scaleY;if(this.i==s.elements.length){let o=new gB(e,a,i,r);s.elements.push(o),s.dom.appendChild(o.dom)}else s.elements[this.i].update(e,a,i,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];NS(this.cursor,s,n.from),r.length&&(s=s.concat(r));let i=this.gutter.config.lineMarker(e,n,s);i&&s.unshift(i);let a=this.gutter;s.length==0&&!a.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let i of e.state.facet(Kie)){let a=i(e,n.widget,n);a&&(s||(s=[])).push(a)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class NT{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let i=s.target,a;if(i!=this.dom&&this.dom.contains(i)){for(;i.parentNode!=this.dom;)i=i.parentNode;let c=i.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=s.clientY;let o=e.lineBlockAtHeight(a-e.documentTop);n.domEventHandlers[r](e,o,s)&&s.preventDefault()});this.markers=jT(n.markers(e)),n.initialSpacer&&(this.spacer=new gB(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=jT(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!bn.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class gB{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),nae(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let i=0,a=0;;){let o=a,c=ii(o,c,h)||a(o,c,h):a}return r}})}});class ww extends po{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Sw(t,e){return t.state.facet(Wd).formatNumber(e,t.state)}const iae=Mm.compute([Wd],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(rae)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new ww(Sw(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(sae)){let i=s(e,n,r);if(i)return i}return null},lineMarkerChange:e=>e.startState.facet(Wd)!=e.state.facet(Wd),initialSpacer(e){return new ww(Sw(e,CT(e.state.doc.lines)))},updateSpacer(e,n){let r=Sw(n.view,CT(n.view.state.doc.lines));return r==e.number?e:new ww(r)},domEventHandlers:t.facet(Wd).domEventHandlers,side:"before"}));function aae(t={}){return[Wd.of(t),pB(),iae]}function CT(t){let e=9;for(;e{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(lae.range(s)))}return bn.of(e)});function cae(){return oae}const xB=1024;let uae=0;class kw{constructor(e,n){this.from=e,this.to=n}}class Ht{constructor(e={}){this.id=uae++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=zs.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}Ht.closedBy=new Ht({deserialize:t=>t.split(" ")});Ht.openedBy=new Ht({deserialize:t=>t.split(" ")});Ht.group=new Ht({deserialize:t=>t.split(" ")});Ht.isolate=new Ht({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}});Ht.contextHash=new Ht({perNode:!0});Ht.lookAhead=new Ht({perNode:!0});Ht.mounted=new Ht({perNode:!0});class q1{constructor(e,n,r){this.tree=e,this.overlay=n,this.parser=r}static get(e){return e&&e.props&&e.props[Ht.mounted.id]}}const dae=Object.create(null);class zs{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):dae,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new zs(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(s)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(Ht.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(Ht.group),i=-1;i<(s?s.length:0);i++){let a=n[i<0?r.name:s[i]];if(a)return a}}}}zs.none=new zs("",Object.create(null),0,8);class Kv{constructor(e){this.types=e;for(let n=0;n0;for(let c=this.cursor(a|Ur.IncludeAnonymous);;){let h=!1;if(c.from<=i&&c.to>=s&&(!o&&c.type.isAnonymous||n(c)!==!1)){if(c.firstChild())continue;h=!0}for(;h&&r&&(o||!c.type.isAnonymous)&&r(c),!c.nextSibling();){if(!c.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:L6(zs.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new Hn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new Hn(zs.none,n,r,s)))}static build(e){return pae(e)}}Hn.empty=new Hn(zs.none,[],[],0);class z6{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new z6(this.buffer,this.index)}}class wc{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return zs.none}toString(){let e=[];for(let n=0;n0));c=a[c+3]);return o}slice(e,n,r){let s=this.buffer,i=new Uint16Array(n-e),a=0;for(let o=e,c=0;o=e&&ne;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Jm(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to0?o.length:-1;e!=h;e+=n){let f=o[e],m=c[e]+a.from;if(vB(s,r,m,m+f.length)){if(f instanceof wc){if(i&Ur.ExcludeBuffers)continue;let g=f.findChild(0,f.buffer.length,n,r-m,s);if(g>-1)return new Ja(new hae(a,f,e,m),null,g)}else if(i&Ur.IncludeAnonymous||!f.type.isAnonymous||P6(f)){let g;if(!(i&Ur.IgnoreMounts)&&(g=q1.get(f))&&!g.overlay)return new si(g.tree,m,e,a);let x=new si(f,m,e,a);return i&Ur.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(n<0?f.children.length-1:0,n,r,s)}}}if(i&Ur.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+n:e=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let s;if(!(r&Ur.IgnoreOverlays)&&(s=q1.get(this._tree))&&s.overlay){let i=e-this.from;for(let{from:a,to:o}of s.overlay)if((n>0?a<=i:a=i:o>i))return new si(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function ET(t,e,n,r){let s=t.cursor(),i=[];if(!s.firstChild())return i;if(n!=null){for(let a=!1;!a;)if(a=s.type.is(n),!s.nextSibling())return i}for(;;){if(r!=null&&s.type.is(r))return i;if(s.type.is(e)&&i.push(s.node),!s.nextSibling())return r==null?i:[]}}function CS(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class hae{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Ja extends yB{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new Ja(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ur.ExcludeBuffers)return null;let{buffer:s}=this.context,i=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new Ja(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ja(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Ja(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,i=r.buffer[this.index+3];if(i>s){let a=r.buffer[this.index+1];e.push(r.slice(s,i,a)),n.push(0)}return new Hn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function bB(t){if(!t.length)return null;let e=0,n=t[0];for(let i=1;in.from||a.to=e){let o=new si(a.tree,a.overlay[0].from+i.from,-1,i);(s||(s=[r])).push(Jm(o,e,n,!1))}}return s?bB(s):r}class TS{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof si)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof si?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,i=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ur.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ur.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ur.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:s}=this;if(s){if(e>0){if(this.index-1)for(let i=n+e,a=e<0?-1:r._tree.children.length;i!=a;i+=e){let o=r._tree.children[i];if(this.mode&Ur.IncludeAnonymous||o instanceof wc||!o.type.isAnonymous||P6(o))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to=0;){for(let a=e;a;a=a._parent)if(a.index==s){if(s==this.index)return a;n=a,r=i+1;break e}s=this.stack[--i]}for(let s=r;s=0;i--){if(i<0)return CS(this._tree,e,s);let a=r[n.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[s]&&e[s]!=a.name)return!1;s--}}return!0}}function P6(t){return t.children.some(e=>e instanceof wc||!e.type.isAnonymous||P6(e))}function pae(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=xB,reused:i=[],minRepeatType:a=r.types.length}=t,o=Array.isArray(n)?new z6(n,n.length):n,c=r.types,h=0,f=0;function m(_,E,M,q,L,I){let{id:$,start:V,end:ee,size:z}=o,H=f,P=h;if(z<0)if(o.next(),z==-1){let se=i[$];M.push(se),q.push(V-_);return}else if(z==-3){h=$;return}else if(z==-4){f=$;return}else throw new RangeError(`Unrecognized record size: ${z}`);let W=c[$],J,X,R=V-_;if(ee-V<=s&&(X=S(o.pos-E,L))){let se=new Uint16Array(X.size-X.skip),G=o.pos-X.size,F=se.length;for(;o.pos>G;)F=k(X.start,se,F);J=new wc(se,ee-X.start,r),R=X.start-_}else{let se=o.pos-z;o.next();let G=[],F=[],U=$>=a?$:-1,te=0,ne=ee;for(;o.pos>se;)U>=0&&o.id==U&&o.size>=0?(o.end<=ne-s&&(y(G,F,V,te,o.end,ne,U,H,P),te=G.length,ne=o.end),o.next()):I>2500?g(V,se,G,F):m(V,se,G,F,U,I+1);if(U>=0&&te>0&&te-1&&te>0){let Y=x(W,P);J=L6(W,G,F,0,G.length,0,ee-V,Y,Y)}else J=w(W,G,F,ee-V,H-ee,P)}M.push(J),q.push(R)}function g(_,E,M,q){let L=[],I=0,$=-1;for(;o.pos>E;){let{id:V,start:ee,end:z,size:H}=o;if(H>4)o.next();else{if($>-1&&ee<$)break;$<0&&($=z-s),L.push(V,ee,z),I++,o.next()}}if(I){let V=new Uint16Array(I*4),ee=L[L.length-2];for(let z=L.length-3,H=0;z>=0;z-=3)V[H++]=L[z],V[H++]=L[z+1]-ee,V[H++]=L[z+2]-ee,V[H++]=H;M.push(new wc(V,L[2]-ee,r)),q.push(ee-_)}}function x(_,E){return(M,q,L)=>{let I=0,$=M.length-1,V,ee;if($>=0&&(V=M[$])instanceof Hn){if(!$&&V.type==_&&V.length==L)return V;(ee=V.prop(Ht.lookAhead))&&(I=q[$]+V.length+ee)}return w(_,M,q,L,I,E)}}function y(_,E,M,q,L,I,$,V,ee){let z=[],H=[];for(;_.length>q;)z.push(_.pop()),H.push(E.pop()+M-L);_.push(w(r.types[$],z,H,I-L,V-I,ee)),E.push(L-M)}function w(_,E,M,q,L,I,$){if(I){let V=[Ht.contextHash,I];$=$?[V].concat($):[V]}if(L>25){let V=[Ht.lookAhead,L];$=$?[V].concat($):[V]}return new Hn(_,E,M,q,$)}function S(_,E){let M=o.fork(),q=0,L=0,I=0,$=M.end-s,V={size:0,start:0,skip:0};e:for(let ee=M.pos-_;M.pos>ee;){let z=M.size;if(M.id==E&&z>=0){V.size=q,V.start=L,V.skip=I,I+=4,q+=4,M.next();continue}let H=M.pos-z;if(z<0||H=a?4:0,W=M.start;for(M.next();M.pos>H;){if(M.size<0)if(M.size==-3)P+=4;else break e;else M.id>=a&&(P+=4);M.next()}L=W,q+=z,I+=P}return(E<0||q==_)&&(V.size=q,V.start=L,V.skip=I),V.size>4?V:void 0}function k(_,E,M){let{id:q,start:L,end:I,size:$}=o;if(o.next(),$>=0&&q4){let ee=o.pos-($-4);for(;o.pos>ee;)M=k(_,E,M)}E[--M]=V,E[--M]=I-_,E[--M]=L-_,E[--M]=q}else $==-3?h=q:$==-4&&(f=q);return M}let N=[],C=[];for(;o.pos>0;)m(t.start||0,t.bufferStart||0,N,C,-1,0);let T=(e=t.length)!==null&&e!==void 0?e:N.length?C[0]+N[0].length:0;return new Hn(c[t.topID],N.reverse(),C.reverse(),T)}const _T=new WeakMap;function c1(t,e){if(!t.isAnonymous||e instanceof wc||e.type!=t)return 1;let n=_T.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Hn)){n=1;break}n+=c1(t,r)}_T.set(e,n)}return n}function L6(t,e,n,r,s,i,a,o,c){let h=0;for(let y=r;y=f)break;E+=M}if(C==T+1){if(E>f){let M=y[T];x(M.children,M.positions,0,M.children.length,w[T]+N);continue}m.push(y[T])}else{let M=w[C-1]+y[C-1].length-_;m.push(L6(t,y,w,T,C,_,M,null,c))}g.push(_+N-i)}}return x(e,n,r,s,0),(o||c)(m,g,a)}class gae{constructor(){this.map=new WeakMap}setBuffer(e,n,r){let s=this.map.get(e);s||this.map.set(e,s=new Map),s.set(n,r)}getBuffer(e,n){let r=this.map.get(e);return r&&r.get(n)}set(e,n){e instanceof Ja?this.setBuffer(e.context.buffer,e.index,n):e instanceof si&&this.map.set(e.tree,n)}get(e){return e instanceof Ja?this.getBuffer(e.context.buffer,e.index):e instanceof si?this.map.get(e.tree):void 0}cursorSet(e,n){e.buffer?this.setBuffer(e.buffer.buffer,e.index,n):this.map.set(e.tree,n)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Su{constructor(e,n,r,s,i=!1,a=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(i?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Su(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&s.push(i);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],i=1,a=e.length?e[0]:null;for(let o=0,c=0,h=0;;o++){let f=o=r)for(;a&&a.from=g.from||m<=g.to||h){let x=Math.max(g.from,c)-h,y=Math.min(g.to,m)-h;g=x>=y?null:new Su(x,y,g.tree,g.offset+h,o>0,!!f)}if(g&&s.push(g),a.to>m)break;a=inew kw(s.from,s.to)):[new kw(0,0)]:[new kw(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let i=s.advance();if(i)return i}}};class xae{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new Ht({perNode:!0});let vae=0;class Gi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=vae++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof Gi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new Gi(r,[],null,[]);if(s.set.push(s),n)for(let i of n.set)s.set.push(i);return s}static defineModifier(e){let n=new F1(e);return r=>r.modified.indexOf(n)>-1?r:F1.get(r.base||r,r.modified.concat(n).sort((s,i)=>s.id-i.id))}}let yae=0;class F1{constructor(e){this.name=e,this.instances=[],this.id=yae++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(o=>o.base==e&&bae(n,o.modified));if(r)return r;let s=[],i=new Gi(e.name,s,e,n);for(let o of n)o.instances.push(i);let a=wae(n);for(let o of e.set)if(!o.modified.length)for(let c of a)s.push(F1.get(o,c));return i}}function bae(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function wae(t){let e=[[]];for(let n=0;nr.length-n.length)}function B6(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let i=[],a=2,o=s;for(let m=0;;){if(o=="..."&&m>0&&m+3==s.length){a=1;break}let g=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!g)throw new RangeError("Invalid path: "+s);if(i.push(g[0]=="*"?"":g[0][0]=='"'?JSON.parse(g[0]):g[0]),m+=g[0].length,m==s.length)break;let x=s[m++];if(m==s.length&&x=="!"){a=0;break}if(x!="/")throw new RangeError("Invalid path: "+s);o=s.slice(m)}let c=i.length-1,h=i[c];if(!h)throw new RangeError("Invalid path: "+s);let f=new e0(r,a,c>0?i.slice(0,c):null);e[h]=f.sort(e[h])}}return wB.add(e)}const wB=new Ht({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let i=new e0(s.tags,s.mode,s.context);n?n.next=i:r=i,n=i}return r}});class e0{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=s;for(let o of i)for(let c of o.set){let h=n[c.id];if(h){a=a?a+" "+h:h;break}}return a},scope:r}}function Sae(t,e){let n=null;for(let r of t){let s=r.style(e);s&&(n=n?n+" "+s:s)}return n}function kae(t,e,n,r=0,s=t.length){let i=new Oae(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,s,"",i.highlighters),i.flush(s)}class Oae{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,s,i){let{type:a,from:o,to:c}=e;if(o>=r||c<=n)return;a.isTop&&(i=this.highlighters.filter(x=>!x.scope||x.scope(a)));let h=s,f=jae(e)||e0.empty,m=Sae(i,f.tags);if(m&&(h&&(h+=" "),h+=m,f.mode==1&&(s+=(s?" ":"")+m)),this.startSpan(Math.max(n,o),h),f.opaque)return;let g=e.tree&&e.tree.prop(Ht.mounted);if(g&&g.overlay){let x=e.node.enter(g.overlay[0].from+o,1),y=this.highlighters.filter(S=>!S.scope||S.scope(g.tree.type)),w=e.firstChild();for(let S=0,k=o;;S++){let N=S=C||!e.nextSibling())););if(!N||C>r)break;k=N.to+o,k>n&&(this.highlightRange(x.cursor(),Math.max(n,N.from+o),Math.min(r,k),"",y),this.startSpan(Math.min(r,k),h))}w&&e.parent()}else if(e.firstChild()){g&&(s="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,s,i),this.startSpan(Math.min(r,e.to),h)}while(e.nextSibling());e.parent()}}}function jae(t){let e=t.type.prop(wB);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}const Ue=Gi.define,ux=Ue(),ic=Ue(),MT=Ue(ic),AT=Ue(ic),ac=Ue(),dx=Ue(ac),Ow=Ue(ac),Va=Ue(),ru=Ue(Va),Qa=Ue(),Ha=Ue(),ES=Ue(),em=Ue(ES),hx=Ue(),ve={comment:ux,lineComment:Ue(ux),blockComment:Ue(ux),docComment:Ue(ux),name:ic,variableName:Ue(ic),typeName:MT,tagName:Ue(MT),propertyName:AT,attributeName:Ue(AT),className:Ue(ic),labelName:Ue(ic),namespace:Ue(ic),macroName:Ue(ic),literal:ac,string:dx,docString:Ue(dx),character:Ue(dx),attributeValue:Ue(dx),number:Ow,integer:Ue(Ow),float:Ue(Ow),bool:Ue(ac),regexp:Ue(ac),escape:Ue(ac),color:Ue(ac),url:Ue(ac),keyword:Qa,self:Ue(Qa),null:Ue(Qa),atom:Ue(Qa),unit:Ue(Qa),modifier:Ue(Qa),operatorKeyword:Ue(Qa),controlKeyword:Ue(Qa),definitionKeyword:Ue(Qa),moduleKeyword:Ue(Qa),operator:Ha,derefOperator:Ue(Ha),arithmeticOperator:Ue(Ha),logicOperator:Ue(Ha),bitwiseOperator:Ue(Ha),compareOperator:Ue(Ha),updateOperator:Ue(Ha),definitionOperator:Ue(Ha),typeOperator:Ue(Ha),controlOperator:Ue(Ha),punctuation:ES,separator:Ue(ES),bracket:em,angleBracket:Ue(em),squareBracket:Ue(em),paren:Ue(em),brace:Ue(em),content:Va,heading:ru,heading1:Ue(ru),heading2:Ue(ru),heading3:Ue(ru),heading4:Ue(ru),heading5:Ue(ru),heading6:Ue(ru),contentSeparator:Ue(Va),list:Ue(Va),quote:Ue(Va),emphasis:Ue(Va),strong:Ue(Va),link:Ue(Va),monospace:Ue(Va),strikethrough:Ue(Va),inserted:Ue(),deleted:Ue(),changed:Ue(),invalid:Ue(),meta:hx,documentMeta:Ue(hx),annotation:Ue(hx),processingInstruction:Ue(hx),definition:Gi.defineModifier("definition"),constant:Gi.defineModifier("constant"),function:Gi.defineModifier("function"),standard:Gi.defineModifier("standard"),local:Gi.defineModifier("local"),special:Gi.defineModifier("special")};for(let t in ve){let e=ve[t];e instanceof Gi&&(e.name=t)}SB([{tag:ve.link,class:"tok-link"},{tag:ve.heading,class:"tok-heading"},{tag:ve.emphasis,class:"tok-emphasis"},{tag:ve.strong,class:"tok-strong"},{tag:ve.keyword,class:"tok-keyword"},{tag:ve.atom,class:"tok-atom"},{tag:ve.bool,class:"tok-bool"},{tag:ve.url,class:"tok-url"},{tag:ve.labelName,class:"tok-labelName"},{tag:ve.inserted,class:"tok-inserted"},{tag:ve.deleted,class:"tok-deleted"},{tag:ve.literal,class:"tok-literal"},{tag:ve.string,class:"tok-string"},{tag:ve.number,class:"tok-number"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],class:"tok-string2"},{tag:ve.variableName,class:"tok-variableName"},{tag:ve.local(ve.variableName),class:"tok-variableName tok-local"},{tag:ve.definition(ve.variableName),class:"tok-variableName tok-definition"},{tag:ve.special(ve.variableName),class:"tok-variableName2"},{tag:ve.definition(ve.propertyName),class:"tok-propertyName tok-definition"},{tag:ve.typeName,class:"tok-typeName"},{tag:ve.namespace,class:"tok-namespace"},{tag:ve.className,class:"tok-className"},{tag:ve.macroName,class:"tok-macroName"},{tag:ve.propertyName,class:"tok-propertyName"},{tag:ve.operator,class:"tok-operator"},{tag:ve.comment,class:"tok-comment"},{tag:ve.meta,class:"tok-meta"},{tag:ve.invalid,class:"tok-invalid"},{tag:ve.punctuation,class:"tok-punctuation"}]);var jw;const pu=new Ht;function kB(t){return et.define({combine:t?e=>e.concat(t):void 0})}const Nae=new Ht;class Ki{constructor(e,n,r=[],s=""){this.data=e,this.name=s,an.prototype.hasOwnProperty("tree")||Object.defineProperty(an.prototype,"tree",{get(){return ns(this)}}),this.parser=n,this.extension=[Sc.of(this),an.languageData.of((i,a,o)=>{let c=RT(i,a,o),h=c.type.prop(pu);if(!h)return[];let f=i.facet(h),m=c.type.prop(Nae);if(m){let g=c.resolve(a-c.from,o);for(let x of m)if(x.test(g,i)){let y=i.facet(x.facet);return x.type=="replace"?y:y.concat(f)}}return f})].concat(r)}isActiveAt(e,n,r=-1){return RT(e,n,r).type.prop(pu)==this.data}findRegions(e){let n=e.facet(Sc);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(i,a)=>{if(i.prop(pu)==this.data){r.push({from:a,to:a+i.length});return}let o=i.prop(Ht.mounted);if(o){if(o.tree.prop(pu)==this.data){if(o.overlay)for(let c of o.overlay)r.push({from:c.from+a,to:c.to+a});else r.push({from:a,to:a+i.length});return}else if(o.overlay){let c=r.length;if(s(o.tree,o.overlay[0].from+a),r.length>c)return}}for(let c=0;cr.isTop?n:void 0)]}),e.name)}configure(e,n){return new t0(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ns(t){let e=t.field(Ki.state,!1);return e?e.tree:Hn.empty}class Cae{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let tm=null;class kh{constructor(e,n,r=[],s,i,a,o,c){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new kh(e,n,[],Hn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new Cae(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Hn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Su.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=tm;tm=this;try{return e()}finally{tm=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=DT(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:i,viewport:a,skipped:o}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((h,f,m,g)=>c.push({fromA:h,toA:f,fromB:m,toB:g})),r=Su.applyChanges(r,c),s=Hn.empty,i=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){o=[];for(let h of this.skipped){let f=e.mapPos(h.from,1),m=e.mapPos(h.to,-1);fe.from&&(this.fragments=DT(this.fragments,s,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends I6{createParse(n,r,s){let i=s[0].from,a=s[s.length-1].to;return{parsedPos:i,advance(){let c=tm;if(c){for(let h of s)c.tempSkipped.push(h);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new Hn(zs.none,[],[],a-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return tm}}function DT(t,e,n){return Su.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class Oh{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Oh(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=kh.create(e.facet(Sc).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Oh(r)}}Ki.state=is.define({create:Oh.init,update(t,e){for(let n of e.effects)if(n.is(Ki.setState))return n.value;return e.startState.facet(Sc)!=e.state.facet(Sc)?Oh.init(e.state):t.apply(e)}});let OB=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(OB=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Nw=typeof navigator<"u"&&(!((jw=navigator.scheduling)===null||jw===void 0)&&jw.isInputPending)?()=>navigator.scheduling.isInputPending():null,Tae=Nr.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(Ki.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(Ki.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=OB(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnds+1e3,c=i.context.work(()=>Nw&&Nw()||Date.now()>a,s+(o?0:1e5));this.chunkBudget-=Date.now()-n,(c||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Ki.setState.of(new Oh(i.context))})),this.chunkBudget>0&&!(c&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Js(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Sc=et.define({combine(t){return t.length?t[0]:null},enables:t=>[Ki.state,Tae,We.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});class jB{constructor(e,n=[]){this.language=e,this.support=n,this.extension=[e,n]}}const Eae=et.define(),Y0=et.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Au(t){let e=t.facet(Y0);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function n0(t,e){let n="",r=t.tabSize,s=t.facet(Y0)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let i=0;i=e?_ae(t,n,e):null}class Zv{constructor(e,n={}){this.state=e,this.options=n,this.unit=Au(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:i}=this.options;return s!=null&&s>=r.from&&s<=r.to?i&&s==e?{text:"",from:e}:(n<0?s-1&&(i+=a-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return Fh(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let a=i(s);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Jv=new Ht;function _ae(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let i=[];for(let a=s;a&&!(a.fromr.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)i.push(a);for(let a=i.length-1;a>=0;a--)r={node:i[a],next:r}}return NB(r,t,n)}function NB(t,e,n){for(let r=t;r;r=r.next){let s=Aae(r.node);if(s)return s(F6.create(e,n,r))}return 0}function Mae(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function Aae(t){let e=t.type.prop(Jv);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(Ht.closedBy))){let s=t.lastChild,i=s&&r.indexOf(s.name)>-1;return a=>CB(a,!0,1,void 0,i&&!Mae(a)?s.from:void 0)}return t.parent==null?Rae:null}function Rae(){return 0}class F6 extends Zv{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new F6(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(Dae(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return NB(this.context.next,this.base,this.pos)}}function Dae(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function zae(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),a=s==null||s<=i.from?i.to:Math.min(i.to,s);for(let o=n.to;;){let c=e.childAfter(o);if(!c||c==r)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let h=/^ */.exec(i.text.slice(n.to-i.from))[0].length;return{from:n.from,to:n.to+h}}o=c.to}}function Cw({closing:t,align:e=!0,units:n=1}){return r=>CB(r,e,n,t)}function CB(t,e,n,r,s){let i=t.textAfter,a=i.match(/^\s*/)[0].length,o=r&&i.slice(a,a+r.length)==r||s==t.pos+a,c=e?zae(t):null;return c?o?t.column(c.from):t.column(c.to):t.baseIndent+(o?0:t.unit*n)}function zT({except:t,units:e=1}={}){return n=>{let r=t&&t.test(n.textAfter);return n.baseIndent+(r?0:e*n.unit)}}const Pae=200;function Lae(){return an.transactionFilter.of(t=>{if(!t.docChanged||!t.isUserEvent("input.type")&&!t.isUserEvent("input.complete"))return t;let e=t.startState.languageDataAt("indentOnInput",t.startState.selection.main.head);if(!e.length)return t;let n=t.newDoc,{head:r}=t.newSelection.main,s=n.lineAt(r);if(r>s.from+Pae)return t;let i=n.sliceString(s.from,r);if(!e.some(h=>h.test(i)))return t;let{state:a}=t,o=-1,c=[];for(let{head:h}of a.selection.ranges){let f=a.doc.lineAt(h);if(f.from==o)continue;o=f.from;let m=q6(a,f.from);if(m==null)continue;let g=/^\s*/.exec(f.text)[0],x=n0(a,m);g!=x&&c.push({from:f.from,to:f.from+g.length,insert:x})}return c.length?[t,{changes:c,sequential:!0}]:t})}const Iae=et.define(),$6=new Ht;function TB(t){let e=t.firstChild,n=t.lastChild;return e&&e.ton)continue;if(i&&o.from=e&&h.to>n&&(i=h)}}return i}function qae(t){let e=t.lastChild;return e&&e.to==t.to&&e.type.isError}function $1(t,e,n){for(let r of t.facet(Iae)){let s=r(t,e,n);if(s)return s}return Bae(t,e,n)}function EB(t,e){let n=e.mapPos(t.from,1),r=e.mapPos(t.to,-1);return n>=r?void 0:{from:n,to:r}}const ey=Mt.define({map:EB}),K0=Mt.define({map:EB});function _B(t){let e=[];for(let{head:n}of t.state.selection.ranges)e.some(r=>r.from<=n&&r.to>=n)||e.push(t.lineBlockAt(n));return e}const Ru=is.define({create(){return ft.none},update(t,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((n,r)=>t=PT(t,n,r)),t=t.map(e.changes);for(let n of e.effects)if(n.is(ey)&&!Fae(t,n.value.from,n.value.to)){let{preparePlaceholder:r}=e.state.facet(RB),s=r?ft.replace({widget:new Gae(r(e.state,n.value))}):LT;t=t.update({add:[s.range(n.value.from,n.value.to)]})}else n.is(K0)&&(t=t.update({filter:(r,s)=>n.value.from!=r||n.value.to!=s,filterFrom:n.value.from,filterTo:n.value.to}));return e.selection&&(t=PT(t,e.selection.main.head)),t},provide:t=>We.decorations.from(t),toJSON(t,e){let n=[];return t.between(0,e.doc.length,(r,s)=>{n.push(r,s)}),n},fromJSON(t){if(!Array.isArray(t)||t.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let n=0;n{se&&(r=!0)}),r?t.update({filterFrom:e,filterTo:n,filter:(s,i)=>s>=n||i<=e}):t}function Q1(t,e,n){var r;let s=null;return(r=t.field(Ru,!1))===null||r===void 0||r.between(e,n,(i,a)=>{(!s||s.from>i)&&(s={from:i,to:a})}),s}function Fae(t,e,n){let r=!1;return t.between(e,e,(s,i)=>{s==e&&i==n&&(r=!0)}),r}function MB(t,e){return t.field(Ru,!1)?e:e.concat(Mt.appendConfig.of(DB()))}const $ae=t=>{for(let e of _B(t)){let n=$1(t.state,e.from,e.to);if(n)return t.dispatch({effects:MB(t.state,[ey.of(n),AB(t,n)])}),!0}return!1},Qae=t=>{if(!t.state.field(Ru,!1))return!1;let e=[];for(let n of _B(t)){let r=Q1(t.state,n.from,n.to);r&&e.push(K0.of(r),AB(t,r,!1))}return e.length&&t.dispatch({effects:e}),e.length>0};function AB(t,e,n=!0){let r=t.state.doc.lineAt(e.from).number,s=t.state.doc.lineAt(e.to).number;return We.announce.of(`${t.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${t.state.phrase("to")} ${s}.`)}const Hae=t=>{let{state:e}=t,n=[];for(let r=0;r{let e=t.state.field(Ru,!1);if(!e||!e.size)return!1;let n=[];return e.between(0,t.state.doc.length,(r,s)=>{n.push(K0.of({from:r,to:s}))}),t.dispatch({effects:n}),!0},Uae=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:$ae},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:Qae},{key:"Ctrl-Alt-[",run:Hae},{key:"Ctrl-Alt-]",run:Vae}],Wae={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},RB=et.define({combine(t){return fl(t,Wae)}});function DB(t){return[Ru,Kae]}function zB(t,e){let{state:n}=t,r=n.facet(RB),s=a=>{let o=t.lineBlockAt(t.posAtDOM(a.target)),c=Q1(t.state,o.from,o.to);c&&t.dispatch({effects:K0.of(c)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(t,s,e);let i=document.createElement("span");return i.textContent=r.placeholderText,i.setAttribute("aria-label",n.phrase("folded code")),i.title=n.phrase("unfold"),i.className="cm-foldPlaceholder",i.onclick=s,i}const LT=ft.replace({widget:new class extends ml{toDOM(t){return zB(t,null)}}});class Gae extends ml{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return zB(e,this.value)}}const Xae={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class Tw extends po{constructor(e,n){super(),this.config=e,this.open=n}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=e.state.phrase(this.open?"Fold line":"Unfold line"),n}}function Yae(t={}){let e={...Xae,...t},n=new Tw(e,!0),r=new Tw(e,!1),s=Nr.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(Sc)!=a.state.facet(Sc)||a.startState.field(Ru,!1)!=a.state.field(Ru,!1)||ns(a.startState)!=ns(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let o=new fo;for(let c of a.viewportLineBlocks){let h=Q1(a.state,c.from,c.to)?r:$1(a.state,c.from,c.to)?n:null;h&&o.add(c.from,c.from,h)}return o.finish()}}),{domEventHandlers:i}=e;return[s,Jie({class:"cm-foldGutter",markers(a){var o;return((o=a.plugin(s))===null||o===void 0?void 0:o.markers)||bn.empty},initialSpacer(){return new Tw(e,!1)},domEventHandlers:{...i,click:(a,o,c)=>{if(i.click&&i.click(a,o,c))return!0;let h=Q1(a.state,o.from,o.to);if(h)return a.dispatch({effects:K0.of(h)}),!0;let f=$1(a.state,o.from,o.to);return f?(a.dispatch({effects:ey.of(f)}),!0):!1}}}),DB()]}const Kae=We.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Z0{constructor(e,n){this.specs=e;let r;function s(o){let c=vc.newName();return(r||(r=Object.create(null)))["."+c]=o,c}const i=typeof n.all=="string"?n.all:n.all?s(n.all):void 0,a=n.scope;this.scope=a instanceof Ki?o=>o.prop(pu)==a.data:a?o=>o==a:void 0,this.style=SB(e.map(o=>({tag:o.tag,class:o.class||s(Object.assign({},o,{tag:null}))})),{all:i}).style,this.module=r?new vc(r):null,this.themeType=n.themeType}static define(e,n){return new Z0(e,n||{})}}const _S=et.define(),PB=et.define({combine(t){return t.length?[t[0]]:null}});function Ew(t){let e=t.facet(_S);return e.length?e:t.facet(PB)}function LB(t,e){let n=[Jae],r;return t instanceof Z0&&(t.module&&n.push(We.styleModule.of(t.module)),r=t.themeType),e?.fallback?n.push(PB.of(t)):r?n.push(_S.computeN([We.darkTheme],s=>s.facet(We.darkTheme)==(r=="dark")?[t]:[])):n.push(_S.of(t)),n}class Zae{constructor(e){this.markCache=Object.create(null),this.tree=ns(e.state),this.decorations=this.buildDeco(e,Ew(e.state)),this.decoratedTo=e.viewport.to}update(e){let n=ns(e.state),r=Ew(e.state),s=r!=Ew(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);n.length=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(n!=this.tree||e.viewportChanged||s)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r),this.decoratedTo=i.to)}buildDeco(e,n){if(!n||!this.tree.length)return ft.none;let r=new fo;for(let{from:s,to:i}of e.visibleRanges)kae(this.tree,n,(a,o,c)=>{r.add(a,o,this.markCache[c]||(this.markCache[c]=ft.mark({class:c})))},s,i);return r.finish()}}const Jae=Mc.high(Nr.fromClass(Zae,{decorations:t=>t.decorations})),ele=Z0.define([{tag:ve.meta,color:"#404740"},{tag:ve.link,textDecoration:"underline"},{tag:ve.heading,textDecoration:"underline",fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strong,fontWeight:"bold"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.keyword,color:"#708"},{tag:[ve.atom,ve.bool,ve.url,ve.contentSeparator,ve.labelName],color:"#219"},{tag:[ve.literal,ve.inserted],color:"#164"},{tag:[ve.string,ve.deleted],color:"#a11"},{tag:[ve.regexp,ve.escape,ve.special(ve.string)],color:"#e40"},{tag:ve.definition(ve.variableName),color:"#00f"},{tag:ve.local(ve.variableName),color:"#30a"},{tag:[ve.typeName,ve.namespace],color:"#085"},{tag:ve.className,color:"#167"},{tag:[ve.special(ve.variableName),ve.macroName],color:"#256"},{tag:ve.definition(ve.propertyName),color:"#00c"},{tag:ve.comment,color:"#940"},{tag:ve.invalid,color:"#f00"}]),tle=We.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),IB=1e4,BB="()[]{}",qB=et.define({combine(t){return fl(t,{afterCursor:!0,brackets:BB,maxScanDistance:IB,renderMatch:sle})}}),nle=ft.mark({class:"cm-matchingBracket"}),rle=ft.mark({class:"cm-nonmatchingBracket"});function sle(t){let e=[],n=t.matched?nle:rle;return e.push(n.range(t.start.from,t.start.to)),t.end&&e.push(n.range(t.end.from,t.end.to)),e}const ile=is.define({create(){return ft.none},update(t,e){if(!e.docChanged&&!e.selection)return t;let n=[],r=e.state.facet(qB);for(let s of e.state.selection.ranges){if(!s.empty)continue;let i=el(e.state,s.head,-1,r)||s.head>0&&el(e.state,s.head-1,1,r)||r.afterCursor&&(el(e.state,s.head,1,r)||s.headWe.decorations.from(t)}),ale=[ile,tle];function lle(t={}){return[qB.of(t),ale]}const ole=new Ht;function MS(t,e,n){let r=t.prop(e<0?Ht.openedBy:Ht.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function AS(t){let e=t.type.prop(ole);return e?e(t.node):t}function el(t,e,n,r={}){let s=r.maxScanDistance||IB,i=r.brackets||BB,a=ns(t),o=a.resolveInner(e,n);for(let c=o;c;c=c.parent){let h=MS(c.type,n,i);if(h&&c.from0?e>=f.from&&ef.from&&e<=f.to))return cle(t,e,n,c,f,h,i)}}return ule(t,e,n,a,o.type,s,i)}function cle(t,e,n,r,s,i,a){let o=r.parent,c={from:s.from,to:s.to},h=0,f=o?.cursor();if(f&&(n<0?f.childBefore(r.from):f.childAfter(r.to)))do if(n<0?f.to<=r.from:f.from>=r.to){if(h==0&&i.indexOf(f.type.name)>-1&&f.from0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},f=t.doc.iterRange(e,n>0?t.doc.length:0),m=0;for(let g=0;!f.next().done&&g<=i;){let x=f.value;n<0&&(g+=x.length);let y=e+g*n;for(let w=n>0?0:x.length-1,S=n>0?x.length:-1;w!=S;w+=n){let k=a.indexOf(x[w]);if(!(k<0||r.resolveInner(y+w,1).type!=s))if(k%2==0==n>0)m++;else{if(m==1)return{start:h,end:{from:y+w,to:y+w+1},matched:k>>1==c>>1};m--}}n>0&&(g+=x.length)}return f.done?{start:h,matched:!1}:null}function IT(t,e,n,r=0,s=0){e==null&&(e=t.search(/[^\s\u00a0]/),e==-1&&(e=t.length));let i=s;for(let a=r;a=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.posn}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let n=this.string.indexOf(e,this.pos);if(n>-1)return this.pos=n,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPosr?a.toLowerCase():a,i=this.string.substr(this.pos,e.length);return s(i)==s(e)?(n!==!1&&(this.pos+=e.length),!0):null}else{let s=this.string.slice(this.pos).match(e);return s&&s.index>0?null:(s&&n!==!1&&(this.pos+=s[0].length),s)}}current(){return this.string.slice(this.start,this.pos)}}function dle(t){return{name:t.name||"",token:t.token,blankLine:t.blankLine||(()=>{}),startState:t.startState||(()=>!0),copyState:t.copyState||hle,indent:t.indent||(()=>null),languageData:t.languageData||{},tokenTable:t.tokenTable||V6,mergeTokens:t.mergeTokens!==!1}}function hle(t){if(typeof t!="object")return t;let e={};for(let n in t){let r=t[n];e[n]=r instanceof Array?r.slice():r}return e}const BT=new WeakMap;class Q6 extends Ki{constructor(e){let n=kB(e.languageData),r=dle(e),s,i=new class extends I6{createParse(a,o,c){return new mle(s,a,o,c)}};super(n,i,[],e.name),this.topNode=xle(n,this),s=this,this.streamParser=r,this.stateAfter=new Ht({perNode:!0}),this.tokenTable=e.tokenTable?new VB(r.tokenTable):gle}static define(e){return new Q6(e)}getIndent(e){let n,{overrideIndentation:r}=e.options;r&&(n=BT.get(e.state),n!=null&&n1e4)return null;for(;i=r&&n+e.length<=s&&e.prop(t.stateAfter);if(i)return{state:t.streamParser.copyState(i),pos:n+e.length};for(let a=e.children.length-1;a>=0;a--){let o=e.children[a],c=n+e.positions[a],h=o instanceof Hn&&c=e.length)return e;!s&&n==0&&e.type==t.topNode&&(s=!0);for(let i=e.children.length-1;i>=0;i--){let a=e.positions[i],o=e.children[i],c;if(an&&H6(t,i.tree,0-i.offset,n,o),h;if(c&&c.pos<=r&&(h=$B(t,i.tree,n+i.offset,c.pos+i.offset,!1)))return{state:c.state,tree:h}}return{state:t.streamParser.startState(s?Au(s):4),tree:Hn.empty}}let mle=class{constructor(e,n,r,s){this.lang=e,this.input=n,this.fragments=r,this.ranges=s,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=s[s.length-1].to;let i=kh.get(),a=s[0].from,{state:o,tree:c}=fle(e,r,a,this.to,i?.state);this.state=o,this.parsedPos=this.chunkStart=a+c.length;for(let h=0;hh.from<=i.viewport.from&&h.to>=i.viewport.from)&&(this.state=this.lang.streamParser.startState(Au(i.state)),i.skipUntilInView(this.parsedPos,i.viewport.from),this.parsedPos=i.viewport.from),this.moveRangeIndex()}advance(){let e=kh.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+512);for(e&&(r=Math.min(r,e.viewport.to));this.parsedPos=n?this.finish():e&&this.parsedPos>=e.viewport.to?(e.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(e){this.stoppedAt=e}lineAfter(e){let n=this.input.chunk(e);if(this.input.lineChunks)n==` `&&(n="");else{let r=n.indexOf(` -`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,l=this.lineAfter(a);n+=l,r=a+l.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let l=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-l}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new AB(n,e?e.state.tabSize:4,e?_u(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let l=DB(i.token,a,this.state);if(l&&(s=this.emitToken(this.lang.tokenTable.resolve(l),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const F6=Object.create(null),e0=[zs.none],eoe=new Uv(e0),RT=[],DT=Object.create(null),zB=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])zB[t]=LB(F6,e);class PB{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),zB)}resolve(e){return e?this.table[e]||(this.table[e]=LB(this.extra,e)):0}}const toe=new PB(F6);function Ow(t,e){RT.indexOf(t)>-1||(RT.push(t),console.warn(e))}function LB(t,e){let n=[];for(let l of e.split(" ")){let c=[];for(let h of l.split(".")){let f=t[h]||ve[h];f?typeof f=="function"?c.length?c=c.map(f):Ow(h,`Modifier ${h} used at start of tag`):c.length?Ow(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:Ow(h,`Unknown highlighting tag ${h}`)}for(let h of c)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(l=>l.id),i=DT[s];if(i)return i.id;let a=DT[s]=zs.define({id:e0.length,name:r,props:[z6({[r]:n})]});return e0.push(a),a.id}function noe(t,e){let n=zs.define({id:e0.length,name:"Document",props:[mu.add(()=>t),Gv.add(()=>r=>e.getIndent(r))],top:!0});return e0.push(n),n}Jn.RTL,Jn.LTR;const roe=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Q6(t.state,n.from);return r.line?soe(t):r.block?aoe(t):!1};function $6(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const soe=$6(coe,0),ioe=$6(IB,0),aoe=$6((t,e)=>IB(t,e,loe(e)),0);function Q6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const em=50;function ooe(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-em,r),a=t.sliceDoc(s,s+em),l=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,h=i.length-l;if(i.slice(h-e.length,h)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:s+c,margin:c&&1}};let f,m;s-r<=2*em?f=m=t.sliceDoc(r,s):(f=t.sliceDoc(r,r+em),m=t.sliceDoc(s-em,s));let g=/^\s*/.exec(f)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return f.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(f.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function loe(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function IB(t,e,n=e.selection.ranges){let r=n.map(i=>Q6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>ooe(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,l;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+h.length)==h?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:c,indent:h,empty:f,single:m}of r)(m||!f)&&i.push({from:l.from+h,insert:c+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:l,token:c}of r)if(l>=0){let h=a.from+l,f=h+c.length;a.text[f-a.from]==" "&&f++,i.push({from:h,to:f})}return{changes:i}}return null}const ES=lo.define(),uoe=lo.define(),doe=et.define(),BB=et.define({combine(t){return co(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),qB=rs.define({create(){return Za.empty},update(t,e){let n=e.state.facet(BB),r=e.annotation(ES);if(r){let c=Js.fromTransaction(e,r.selection),h=r.side,f=h==0?t.undone:t.done;return c?f=F1(f,f.length,n.minDepth,c):f=QB(f,e.startState.selection),new Za(h==0?r.rest:f,h==0?f:r.rest)}let s=e.annotation(uoe);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Dr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Js.fromTransaction(e),a=e.annotation(Dr.time),l=e.annotation(Dr.userEvent);return i?t=t.addChanges(i,a,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,l,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Za(t.done.map(Js.fromJSON),t.undone.map(Js.fromJSON))}});function hoe(t={}){return[qB,BB.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?FB:e.inputType=="historyRedo"?_S:null;return r?(e.preventDefault(),r(n)):!1}})]}function Yv(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(qB,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const FB=Yv(0,!1),_S=Yv(1,!1),foe=Yv(0,!0),moe=Yv(1,!0);class Js{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new Js(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Js(e.changes&&$r.fromJSON(e.changes),[],e.mapped&&no.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=Yi;for(let s of e.startState.facet(doe)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new Js(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Yi)}static selection(e){return new Js(void 0,Yi,void 0,void 0,e)}}function F1(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function poe(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,l)=>{for(let c=0;c=h&&a<=f&&(r=!0)}}),r}function goe(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function $B(t,e){return t.length?e.length?t.concat(e):t:e}const Yi=[],xoe=200;function QB(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-xoe));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),F1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Js.selection([e])]}function voe(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function jw(t,e){if(!t.length)return t;let n=t.length,r=Yi;for(;n;){let s=yoe(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[Js.selection(r)]:Yi}function yoe(t,e,n){let r=$B(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):Yi,n);if(!t.changes)return Js.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new Js(s,Et.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const boe=/^(input\.type|delete)($|\.)/;class Za{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Za(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,l=a[a.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||boe.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):Kv(n,e))}function ks(t){return t.textDirectionAt(t.state.selection.main.head)==Jn.LTR}const VB=t=>HB(t,!ks(t)),UB=t=>HB(t,ks(t));function WB(t,e){return Ma(t,n=>n.empty?t.moveByGroup(n,e):Kv(n,e))}const Soe=t=>WB(t,!ks(t)),koe=t=>WB(t,ks(t));function Ooe(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Zv(t,e,n){let r=es(t).resolveInner(e.head),s=n?Qt.closedBy:Qt.openedBy;for(let c=e.head;;){let h=n?r.childAfter(c):r.childBefore(c);if(!h)break;Ooe(t,h,s)?r=h:c=n?h.to:h.from}let i=r.type.prop(s),a,l;return i&&(a=n?Ka(t,r.from,1):Ka(t,r.to,-1))&&a.matched?l=n?a.end.to:a.end.from:l=n?r.to:r.from,Ae.cursor(l,n?-1:1)}const joe=t=>Ma(t,e=>Zv(t.state,e,!ks(t))),Noe=t=>Ma(t,e=>Zv(t.state,e,ks(t)));function GB(t,e){return Ma(t,n=>{if(!n.empty)return Kv(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const XB=t=>GB(t,!1),YB=t=>GB(t,!0);function KB(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):Kv(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),c=l.top+n.marginTop,h=l.bottom-n.marginBottom;a&&a.top>c&&a.bottomZB(t,!1),MS=t=>ZB(t,!0);function Mc(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ae.cursor(r.from+i))}return s}const Coe=t=>Ma(t,e=>Mc(t,e,!0)),Toe=t=>Ma(t,e=>Mc(t,e,!1)),Eoe=t=>Ma(t,e=>Mc(t,e,!ks(t))),_oe=t=>Ma(t,e=>Mc(t,e,ks(t))),Moe=t=>Ma(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),Aoe=t=>Ma(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function Roe(t,e,n){let r=!1,s=qh(t.selection,i=>{let a=Ka(t,i.head,-1)||Ka(t,i.head,1)||i.head>0&&Ka(t,i.head-1,1)||i.headRoe(t,e);function ca(t,e){let n=qh(t.state.selection,r=>{let s=e(r);return Ae.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(_a(t.state,n)),!0)}function JB(t,e){return ca(t,n=>t.moveByChar(n,e))}const eq=t=>JB(t,!ks(t)),tq=t=>JB(t,ks(t));function nq(t,e){return ca(t,n=>t.moveByGroup(n,e))}const zoe=t=>nq(t,!ks(t)),Poe=t=>nq(t,ks(t)),Loe=t=>ca(t,e=>Zv(t.state,e,!ks(t))),Ioe=t=>ca(t,e=>Zv(t.state,e,ks(t)));function rq(t,e){return ca(t,n=>t.moveVertically(n,e))}const sq=t=>rq(t,!1),iq=t=>rq(t,!0);function aq(t,e){return ca(t,n=>t.moveVertically(n,e,KB(t).height))}const PT=t=>aq(t,!1),LT=t=>aq(t,!0),Boe=t=>ca(t,e=>Mc(t,e,!0)),qoe=t=>ca(t,e=>Mc(t,e,!1)),Foe=t=>ca(t,e=>Mc(t,e,!ks(t))),$oe=t=>ca(t,e=>Mc(t,e,ks(t))),Qoe=t=>ca(t,e=>Ae.cursor(t.lineBlockAt(e.head).from)),Hoe=t=>ca(t,e=>Ae.cursor(t.lineBlockAt(e.head).to)),IT=({state:t,dispatch:e})=>(e(_a(t,{anchor:0})),!0),BT=({state:t,dispatch:e})=>(e(_a(t,{anchor:t.doc.length})),!0),qT=({state:t,dispatch:e})=>(e(_a(t,{anchor:t.selection.main.anchor,head:0})),!0),FT=({state:t,dispatch:e})=>(e(_a(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),Voe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),Uoe=({state:t,dispatch:e})=>{let n=Jv(t).map(({from:r,to:s})=>Ae.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},Woe=({state:t,dispatch:e})=>{let n=qh(t.selection,r=>{let s=es(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:l}=a;if((l.from=r.to||l.to>r.to&&l.from<=r.from)&&a.next)return Ae.range(l.to,l.from)}return r});return n.eq(t.selection)?!1:(e(_a(t,n)),!0)};function oq(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let l=i;;){let c=t.moveVertically(l,e);if(c.heada.to){s.some(h=>h.head==c.head)||s.push(c);break}else{if(c.head==l.head)break;l=c}}}return s.length==r.ranges.length?!1:(t.dispatch(_a(n,Ae.create(s,s.length-1))),!0)}const Goe=t=>oq(t,!1),Xoe=t=>oq(t,!0),Yoe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(_a(t,r)),!0):!1};function Y0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:l}=i;if(a==l){let c=e(i);ca&&(n="delete.forward",c=ux(t,c,!0)),a=Math.min(a,c),l=Math.max(l,c)}else a=ux(t,a,!1),l=ux(t,l,!0);return a==l?{range:i}:{changes:{from:a,to:l},range:Ae.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const lq=(t,e,n)=>Y0(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),l,c;if(n&&!e&&s>a.from&&slq(t,!1,!0),cq=t=>lq(t,!0,!1),uq=(t,e)=>Y0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let l=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=hs(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),f=a(h);if(l!=null&&f!=l)break;(h!=" "||r!=n.head)&&(l=f),r=c}return r}),dq=t=>uq(t,!1),Koe=t=>uq(t,!0),Zoe=t=>Y0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headY0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),ele=t=>Y0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:an.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},nle=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:hs(i.text,s-i.from,!1)+i.from,l=s==i.to?s+1:hs(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:l,insert:t.doc.slice(s,l).append(t.doc.slice(a,s))},range:Ae.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Jv(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function hq(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of Jv(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),l=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Ae.range(Math.min(t.doc.length,c.anchor+l),Math.min(t.doc.length,c.head+l)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Ae.range(c.anchor-l,c.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const rle=({state:t,dispatch:e})=>hq(t,e,!1),sle=({state:t,dispatch:e})=>hq(t,e,!0);function fq(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of Jv(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ile=({state:t,dispatch:e})=>fq(t,e,!1),ale=({state:t,dispatch:e})=>fq(t,e,!0),ole=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Jv(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),l=t.coordsAtPos(s.head,s.assoc||1);l&&(i=a.bottom+t.documentTop-l.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function lle(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=es(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Qt.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const $T=mq(!1),cle=mq(!0);function mq(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,l=e.doc.lineAt(i),c=!t&&i==a&&lle(e,i);t&&(i=a=(a<=l.to?l:e.doc.lineAt(a)).to);let h=new Wv(e,{simulateBreak:i,simulateDoubleBreak:!!c}),f=P6(h,i);for(f==null&&(f=Bh(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));al.from&&i{let s=[];for(let a=r.from;a<=r.to;){let l=t.doc.lineAt(a);l.number>n&&(r.empty||r.to>l.from)&&(e(l,s,r),n=l.number),a=l.to+1}let i=t.changes(s);return{changes:s,range:Ae.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const ule=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Wv(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=H6(t,(i,a,l)=>{let c=P6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let h=/^\s*/.exec(i.text)[0],f=Jm(t,c);(h!=f||l.fromt.readOnly?!1:(e(t.update(H6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(W0)})}),{userEvent:"input.indent"})),!0),gq=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(H6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Bh(s,t.tabSize),a=0,l=Jm(t,Math.max(0,i-_u(t)));for(;a(t.setTabFocusMode(),!0),hle=[{key:"Ctrl-b",run:VB,shift:eq,preventDefault:!0},{key:"Ctrl-f",run:UB,shift:tq},{key:"Ctrl-p",run:XB,shift:sq},{key:"Ctrl-n",run:YB,shift:iq},{key:"Ctrl-a",run:Moe,shift:Qoe},{key:"Ctrl-e",run:Aoe,shift:Hoe},{key:"Ctrl-d",run:cq},{key:"Ctrl-h",run:AS},{key:"Ctrl-k",run:Zoe},{key:"Ctrl-Alt-h",run:dq},{key:"Ctrl-o",run:tle},{key:"Ctrl-t",run:nle},{key:"Ctrl-v",run:MS}],fle=[{key:"ArrowLeft",run:VB,shift:eq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Soe,shift:zoe,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Eoe,shift:Foe,preventDefault:!0},{key:"ArrowRight",run:UB,shift:tq,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:koe,shift:Poe,preventDefault:!0},{mac:"Cmd-ArrowRight",run:_oe,shift:$oe,preventDefault:!0},{key:"ArrowUp",run:XB,shift:sq,preventDefault:!0},{mac:"Cmd-ArrowUp",run:IT,shift:qT},{mac:"Ctrl-ArrowUp",run:zT,shift:PT},{key:"ArrowDown",run:YB,shift:iq,preventDefault:!0},{mac:"Cmd-ArrowDown",run:BT,shift:FT},{mac:"Ctrl-ArrowDown",run:MS,shift:LT},{key:"PageUp",run:zT,shift:PT},{key:"PageDown",run:MS,shift:LT},{key:"Home",run:Toe,shift:qoe,preventDefault:!0},{key:"Mod-Home",run:IT,shift:qT},{key:"End",run:Coe,shift:Boe,preventDefault:!0},{key:"Mod-End",run:BT,shift:FT},{key:"Enter",run:$T,shift:$T},{key:"Mod-a",run:Voe},{key:"Backspace",run:AS,shift:AS,preventDefault:!0},{key:"Delete",run:cq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:dq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:Koe,preventDefault:!0},{mac:"Mod-Backspace",run:Joe,preventDefault:!0},{mac:"Mod-Delete",run:ele,preventDefault:!0}].concat(hle.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),mle=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:joe,shift:Loe},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Noe,shift:Ioe},{key:"Alt-ArrowUp",run:rle},{key:"Shift-Alt-ArrowUp",run:ile},{key:"Alt-ArrowDown",run:sle},{key:"Shift-Alt-ArrowDown",run:ale},{key:"Mod-Alt-ArrowUp",run:Goe},{key:"Mod-Alt-ArrowDown",run:Xoe},{key:"Escape",run:Yoe},{key:"Mod-Enter",run:cle},{key:"Alt-l",mac:"Ctrl-l",run:Uoe},{key:"Mod-i",run:Woe,preventDefault:!0},{key:"Mod-[",run:gq},{key:"Mod-]",run:pq},{key:"Mod-Alt-\\",run:ule},{key:"Shift-Mod-k",run:ole},{key:"Shift-Mod-\\",run:Doe},{key:"Mod-/",run:roe},{key:"Alt-A",run:ioe},{key:"Ctrl-m",mac:"Shift-Alt-m",run:dle}].concat(fle),ple={key:"Tab",run:pq,shift:gq},QT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class Oh{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?l=>i(QT(l)):QT,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ys(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=g6(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Ua(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let l=s.charCodeAt(i),c=this.match(l,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=$1(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let l=new nh(n,e.sliceString(n,r));return Nw.set(e,l),l}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=$1(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=nh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(vq.prototype[Symbol.iterator]=yq.prototype[Symbol.iterator]=function(){return this});function gle(t){try{return new RegExp(t,V6),!0}catch{return!1}}function $1(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function RS(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=$n("input",{class:"cm-textfield",name:"line",value:e}),r=$n("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:_m.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},$n("label",t.state.phrase("Go to line"),": ",n)," ",$n("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),$n("button",{name:"close",onclick:()=>{t.dispatch({effects:_m.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,l=a.doc.lineAt(a.selection.main.head),[,c,h,f,m]=i,g=f?+f.slice(1):0,x=h?+h:l.number;if(h&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+l.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else h&&c&&(x=x*(c=="-"?-1:1)+l.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Ae.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[_m.of(!1),We.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const _m=Et.define(),HT=rs.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(_m)&&(t=n.value);return t},provide:t=>Xm.from(t,e=>e?RS:null)}),xle=t=>{let e=Gm(t,RS);if(!e){let n=[_m.of(!0)];t.state.field(HT,!1)==null&&n.push(Et.appendConfig.of([HT,vle])),t.dispatch({effects:n}),e=Gm(t,RS)}return e&&e.dom.querySelector("input").select(),!0},vle=We.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),yle={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ble=et.define({combine(t){return co(t,yle,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function wle(t){return[Nle,jle]}const Sle=ft.mark({class:"cm-selectionMatch"}),kle=ft.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function VT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=rr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=rr.Word)}function Ole(t,e,n,r){return t(e.sliceDoc(n,n+1))==rr.Word&&t(e.sliceDoc(r-1,r))==rr.Word}const jle=jr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(ble),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ft.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return ft.none;let c=n.wordAt(s.head);if(!c)return ft.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c200)return ft.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(VT(a,n,s.from,s.to)&&Ole(a,n,s.from,s.to)))return ft.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ft.none}let l=[];for(let c of t.visibleRanges){let h=new Oh(n.doc,i,c.from,c.to);for(;!h.next().done;){let{from:f,to:m}=h.value;if((!a||VT(a,n,f,m))&&(s.empty&&f<=s.from&&m>=s.to?l.push(kle.range(f,m)):(f>=s.to||m<=s.from)&&l.push(Sle.range(f,m)),l.length>e.maxMatches))return ft.none}}return ft.set(l)}},{decorations:t=>t.decorations}),Nle=We.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Cle=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ae.create(n.ranges.map(s=>t.wordAt(s.head)||Ae.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Tle(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,l=new Oh(t.doc,e,r[r.length-1].to);;)if(l.next(),l.done){if(a)return null;l=new Oh(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==l.value.from))continue;if(i){let c=t.wordAt(l.value.from);if(!c||c.from!=l.value.from||c.to!=l.value.to)continue}return l.value}}const Ele=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return Cle({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=Tle(t,r);return s?(e(t.update({selection:t.selection.addRange(Ae.range(s.from,s.to),!1),effects:We.scrollIntoView(s.to)})),!0):!1},Fh=et.define({combine(t){return co(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Fle(e),scrollToMatch:e=>We.scrollIntoView(e)})}});class bq{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||gle(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` -`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Rle(this):new Mle(this)}getCursor(e,n=0,r){let s=e.doc?e:rn.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?Id(this,s,n,r):Ld(this,s,n,r)}}class wq{constructor(e){this.spec=e}}function Ld(t,e,n,r){return new Oh(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?_le(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function _le(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Ld(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function Id(t,e,n,r){return new vq(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Ale(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function Q1(t,e){return t.slice(hs(t,e,!1),e)}function H1(t,e){return t.slice(e,hs(t,e))}function Ale(t){return(e,n,r)=>!r[0].length||(t(Q1(r.input,r.index))!=rr.Word||t(H1(r.input,r.index))!=rr.Word)&&(t(H1(r.input,r.index+r[0].length))!=rr.Word||t(Q1(r.input,r.index+r[0].length))!=rr.Word)}class Rle extends wq{nextMatch(e,n,r){let s=Id(this.spec,e,r,e.doc.length).next();return s.done&&(s=Id(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=Id(this.spec,e,i,r),l=null;for(;!a.next().done;)l=a.value;if(l&&(i==n||l.from>i+10))return l;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Id(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const t0=Et.define(),U6=Et.define(),hc=rs.define({create(t){return new Cw(DS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(t0)?t=new Cw(n.value.create(),t.panel):n.is(U6)&&(t=new Cw(t.query,n.value?W6:null));return t},provide:t=>Xm.from(t,e=>e.panel)});class Cw{constructor(e,n){this.query=e,this.panel=n}}const Dle=ft.mark({class:"cm-searchMatch"}),zle=ft.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ple=jr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(hc))}update(t){let e=t.state.field(hc);(e!=t.startState.field(hc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ft.none;let{view:n}=this,r=new dl;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)c=i[++s].to;t.highlight(n.state,l,c,(h,f)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==f);r.add(h,f,m?zle:Dle)})}return r.finish()}},{decorations:t=>t.decorations});function K0(t){return e=>{let n=e.state.field(hc,!1);return n&&n.query.spec.valid?t(e,n):Oq(e)}}const V1=K0((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ae.single(r.from,r.to),i=t.state.facet(Fh);return t.dispatch({selection:s,effects:[G6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),kq(t),!0}),U1=K0((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ae.single(s.from,s.to),a=t.state.facet(Fh);return t.dispatch({selection:i,effects:[G6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),kq(t),!0}),Lle=K0((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ae.create(n.map(r=>Ae.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Ile=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let l=new Oh(t.doc,t.sliceDoc(r,s));!l.next().done;){if(i.length>1e3)return!1;l.value.from==r&&(a=i.length),i.push(Ae.range(l.value.from,l.value.to))}return e(t.update({selection:Ae.create(i,a),userEvent:"select.search.matches"})),!0},UT=K0((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,l=[],c,h,f=[];a.from==r&&a.to==s&&(h=n.toText(e.getReplacement(a)),l.push({from:a.from,to:a.to,insert:h}),a=e.nextMatch(n,a.from,a.to),f.push(We.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(l);return a&&(c=Ae.single(a.from,a.to).map(m),f.push(G6(t,a)),f.push(n.facet(Fh).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:f,userEvent:"input.replace"}),!0}),Ble=K0((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:We.announce.of(r),userEvent:"input.replace.all"}),!0});function W6(t){return t.state.facet(Fh).createPanel(t)}function DS(t,e){var n,r,s,i,a;let l=t.selection.main,c=l.empty||l.to>l.from+100?"":t.sliceDoc(l.from,l.to);if(e&&!c)return e;let h=t.facet(Fh);return new bq({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:h.wholeWord})}function Sq(t){let e=Gm(t,W6);return e&&e.dom.querySelector("[main-field]")}function kq(t){let e=Sq(t);e&&e==t.root.activeElement&&e.select()}const Oq=t=>{let e=t.state.field(hc,!1);if(e&&e.panel){let n=Sq(t);if(n&&n!=t.root.activeElement){let r=DS(t.state,e.query.spec);r.valid&&t.dispatch({effects:t0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[U6.of(!0),e?t0.of(DS(t.state,e.query.spec)):Et.appendConfig.of(Qle)]});return!0},jq=t=>{let e=t.state.field(hc,!1);if(!e||!e.panel)return!1;let n=Gm(t,W6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:U6.of(!1)}),!0},qle=[{key:"Mod-f",run:Oq,scope:"editor search-panel"},{key:"F3",run:V1,shift:U1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:V1,shift:U1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:jq,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ile},{key:"Mod-Alt-g",run:xle},{key:"Mod-d",run:Ele,preventDefault:!0}];class Fle{constructor(e){this.view=e;let n=this.query=e.state.field(hc).query.spec;this.commit=this.commit.bind(this),this.searchField=$n("input",{value:n.search,placeholder:bi(e,"Find"),"aria-label":bi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$n("input",{value:n.replace,placeholder:bi(e,"Replace"),"aria-label":bi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$n("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=$n("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=$n("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return $n("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=$n("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>V1(e),[bi(e,"next")]),r("prev",()=>U1(e),[bi(e,"previous")]),r("select",()=>Lle(e),[bi(e,"all")]),$n("label",null,[this.caseField,bi(e,"match case")]),$n("label",null,[this.reField,bi(e,"regexp")]),$n("label",null,[this.wordField,bi(e,"by word")]),...e.state.readOnly?[]:[$n("br"),this.replaceField,r("replace",()=>UT(e),[bi(e,"replace")]),r("replaceAll",()=>Ble(e),[bi(e,"replace all")])],$n("button",{name:"close",onclick:()=>jq(e),"aria-label":bi(e,"close"),type:"button"},["×"])])}commit(){let e=new bq({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:t0.of(e)}))}keydown(e){Use(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?U1:V1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),UT(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(t0)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Fh).top}}function bi(t,e){return t.state.phrase(e)}const dx=30,hx=/[\s\.,:;?!]/;function G6(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-dx),a=Math.min(s,n+dx),l=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;cl.length-dx;c--)if(!hx.test(l[c-1])&&hx.test(l[c])){l=l.slice(0,c);break}}return We.announce.of(`${t.state.phrase("current match")}. ${l} ${t.state.phrase("on line")} ${r.number}.`)}const $le=We.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Qle=[hc,_c.low(Ple),$le];class Nq{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=es(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(Tq(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function WT(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Hle(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Hle(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function Vle(t,e){return n=>{for(let r=es(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let GT=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function Su(t){return t.selection.main.from}function Tq(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const X6=lo.define();function Ule(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(l=>{if(l!=s&&n!=r&&t.sliceDoc(l.from+i,l.from+a)!=t.sliceDoc(n,r))return{range:l};let c=t.toText(e);return{changes:{from:l.from+i,to:r==s.from?l.to:l.from+a,insert:c},range:Ae.cursor(l.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const XT=new WeakMap;function Wle(t){if(!Array.isArray(t))return t;let e=XT.get(t);return e||XT.set(t,e=Cq(t)),e}const W1=Et.define(),n0=Et.define();class Gle{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&_<=57||_>=97&&_<=122?2:_>=65&&_<=90?1:0:(E=g6(_))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!N||M==1&&S||T==0&&M!=0)&&(n[m]==_||r[m]==_&&(g=!0)?a[m++]=N:a.length&&(k=!1)),T=M,N+=Ua(_)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let l=a+(this.astral?Ua(Ys(r,a)):1);i&&s[i-1]==a?s[i-1]=l:(s[i++]=a,s[i++]=l)}return this.ret(e-r.length,s)}}class Xle{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Yle,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>YT(e(r),n(r)),optionClass:(e,n)=>r=>YT(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function YT(t,e){return t?e?t+" "+e:t:e}function Yle(t,e,n,r,s,i){let a=t.textDirection==Jn.RTL,l=a,c=!1,h="top",f,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(l&&g=w||N>e.top?f=n.bottom-e.top:(h="bottom",f=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${f/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":l?"left":"right")}}function Kle(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let l=n.displayLabel||n.label,c=0;for(let h=0;hc&&a.appendChild(document.createTextNode(l.slice(c,f)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(l.slice(f,m))),g.className="cm-completionMatchedText",c=m}return cn.position-r.position).map(n=>n.render)}function Tw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class Zle{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,l=e.state.facet(Jr);this.optionContent=Kle(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Tw(i.length,a,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:h}=e.state.field(n).open;for(let f=c.target,m;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(m=/-(\d+)$/.exec(f.id))&&+m[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(Jr).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:n0.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:l}=r.open;(!s.open||s.open.options!=i)&&(this.range=Tw(i.length,a,e.state.facet(Jr).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),l!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Tw(n.options.length,n.selected,this.view.state.facet(Jr).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>Zs(this.view.state,l,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&ece(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const f=s.appendChild(document.createElement("li"));f.id=n+"-"+a,f.setAttribute("role","option");let m=this.optionClass(l);m&&(f.className=m);for(let g of this.optionContent){let x=g(l,this.view.state,this.view,c);x&&f.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew Zle(n,t,e)}function ece(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function KT(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function tce(t,e){let n=[],r=null,s=null,i=f=>{n.push(f);let{section:m}=f.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(Jr);for(let f of t)if(f.hasResult()){let m=f.result.getMatch;if(f.result.filter===!1)for(let g of f.result.options)i(new GT(g,f.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(f.from,f.to),x,y=a.filterStrict?new Xle(g):new Gle(g);for(let w of f.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new GT(w,f.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:N}=w.section;s||(s=Object.create(null)),s[N]=Math.max(k,s[N]||-1e9)}}}}if(r){let f=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||h(m.completion,g.completion))){let m=f.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?l.push(f):KT(f.completion)>KT(c)&&(l[l.length-1]=f),c=f.completion}return l}class Ud{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Ud(this.options,ZT(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(h=>h.isPending))return s.setDisabled();let l=tce(e,n);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let c=n.facet(Jr).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let h=s.options[s.selected].completion;for(let f=0;ff.hasResult()?Math.min(h,f.from):h,1e8),create:oce,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Ud(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Ud(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class G1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new G1(ice,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(Jr),i=(r.override||n.languageDataAt("autocomplete",Su(n)).map(Wle)).map(c=>(this.active.find(f=>f.source==c)||new Ki(c,this.active.some(f=>f.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,h)=>c==this.active[h])&&(i=this.active);let a=this.open,l=e.effects.some(c=>c.is(Y6));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!nce(i,this.active)||l?a=Ud.build(i,n,this.id,a,r,l):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new Ki(c.source,0):c));for(let c of e.effects)c.is(_q)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new G1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?rce:sce}}function nce(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const ice=[];function Eq(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(X6);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ki{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Eq(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Ki(s.source,0)),r&4&&s.state==0&&(s=new Ki(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(W1))s=new Ki(s.source,1,i.value);else if(i.is(n0))s=new Ki(s.source,0);else if(i.is(Y6))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Su(e.state))}}class rh extends Ki{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),l=Su(e.state);if(l>a||!s||n&2&&(Su(e.startState)==this.from||ln.map(e))}}),_q=Et.define(),Ks=rs.define({create(){return G1.start()},update(t,e){return t.update(e)},provide:t=>[_6.from(t,e=>e.tooltip),We.contentAttributes.from(t,e=>e.attrs)]});function K6(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Ks).active.find(s=>s.source==e.source);return r instanceof rh?(typeof n=="string"?t.dispatch({...Ule(t.state,n,r.from,r.to),annotations:X6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const oce=Jle(Ks,K6);function fx(t,e="option"){return n=>{let r=n.state.field(Ks,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return l<0?l=e=="page"?0:a-1:l>=a&&(l=e=="page"?a-1:0),n.dispatch({effects:_q.of(l)}),!0}}const lce=t=>{let e=t.state.field(Ks,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Ks,!1)?(t.dispatch({effects:W1.of(!0)}),!0):!1,cce=t=>{let e=t.state.field(Ks,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:n0.of(null)}),!0)};class uce{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const dce=50,hce=1e3,fce=jr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Ks).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Ks),n=t.state.facet(Jr);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Ks)==e)return;let r=t.transactions.some(i=>{let a=Eq(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;idce&&Date.now()-a.time>hce){for(let l of a.context.abortListeners)try{l()}catch(c){Zs(this.view.state,c)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(W1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Ks);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Jr).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=Su(e),r=new Nq(e,n,t.explicit,this.view),s=new uce(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:n0.of(null)}),Zs(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Jr).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(Jr),r=this.view.state.field(Ks);for(let s=0;sl.source==i.active.source);if(a&&a.isPending)if(i.done==null){let l=new Ki(i.active.source,0);for(let c of i.updates)l=l.update(c,n);l.isPending||e.push(l)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:Y6.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Ks,!1);if(e&&e.tooltip&&this.view.state.facet(Jr).closeOnBlur){let n=e.open&&sB(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:n0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:W1.of(!1)}),20),this.composing=0}}}),mce=typeof navigator=="object"&&/Win/.test(navigator.platform),pce=_c.highest(We.domEventHandlers({keydown(t,e){let n=e.state.field(Ks,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(mce&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&K6(e,r),!1}})),Mq=We.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class gce{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class Z6{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,ds.TrackDel),r=e.mapPos(this.to,1,ds.TrackDel);return n==null||r==null?null:new Z6(this.field,n,r)}}class J6{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let c of this.lines){if(r.length){let h=a,f=/^\t*/.exec(c)[0].length;for(let m=0;mnew Z6(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:l}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let l=i[1]?+i[1]:null,c=i[2]||i[3]||"",h=-1,f=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=h&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new gce(h,r.length,i.index,i.index+f.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(l,c,h)=>{for(let f of s)f.line==r.length&&f.from>h&&(f.from--,f.to--);return c}),r.push(a)}return new J6(r,s)}}let xce=ft.widget({widget:new class extends uo{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),vce=ft.mark({class:"cm-snippetField"});class $h{constructor(e,n){this.ranges=e,this.active=n,this.deco=ft.set(e.map(r=>(r.from==r.to?xce:vce).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new $h(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const Z0=Et.define({map(t,e){return t&&t.map(e)}}),yce=Et.define(),r0=rs.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(Z0))return n.value;if(n.is(yce)&&t)return new $h(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>We.decorations.from(t,e=>e?e.deco:ft.none)});function eO(t,e){return Ae.create(t.filter(n=>n.field==e).map(n=>Ae.range(n.from,n.to)))}function bce(t){let e=J6.parse(t);return(n,r,s,i)=>{let{text:a,ranges:l}=e.instantiate(n.state,s),{main:c}=n.state.selection,h={changes:{from:s,to:i==c.from?c.to:i,insert:an.of(a)},scrollIntoView:!0,annotations:r?[X6.of(r),Dr.userEvent.of("input.complete")]:void 0};if(l.length&&(h.selection=eO(l,0)),l.some(f=>f.field>0)){let f=new $h(l,0),m=h.effects=[Z0.of(f)];n.state.field(r0,!1)===void 0&&m.push(Et.appendConfig.of([r0,jce,Nce,Mq]))}n.dispatch(n.state.update(h))}}function Aq(t){return({state:e,dispatch:n})=>{let r=e.field(r0,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:eO(r.ranges,s),effects:Z0.of(i?null:new $h(r.ranges,s)),scrollIntoView:!0})),!0}}const wce=({state:t,dispatch:e})=>t.field(r0,!1)?(e(t.update({effects:Z0.of(null)})),!0):!1,Sce=Aq(1),kce=Aq(-1),Oce=[{key:"Tab",run:Sce,shift:kce},{key:"Escape",run:wce}],JT=et.define({combine(t){return t.length?t[0]:Oce}}),jce=_c.highest(V0.compute([JT],t=>t.facet(JT)));function qo(t,e){return{...e,apply:bce(t)}}const Nce=We.domEventHandlers({mousedown(t,e){let n=e.state.field(r0,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:eO(n.ranges,s.field),effects:Z0.of(n.ranges.some(i=>i.field>s.field)?new $h(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),s0={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},pu=Et.define({map(t,e){let n=e.mapPos(t,-1,ds.TrackAfter);return n??void 0}}),tO=new class extends Nu{};tO.startSide=1;tO.endSide=-1;const Rq=rs.define({create(){return ln.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(pu)&&(t=t.update({add:[tO.range(n.value,n.value+1)]}));return t}});function Cce(){return[Ece,Rq]}const _w="()[]{}<>«»»«[]{}";function Dq(t){for(let e=0;e<_w.length;e+=2)if(_w.charCodeAt(e)==t)return _w.charAt(e+1);return g6(t<128?t:t+1)}function zq(t,e){return t.languageDataAt("closeBrackets",e)[0]||s0}const Tce=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Ece=We.inputHandler.of((t,e,n,r)=>{if((Tce?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Ua(Ys(r,0))==1||e!=s.from||n!=s.to)return!1;let i=Ace(t.state,r);return i?(t.dispatch(i),!0):!1}),_ce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=zq(t,t.selection.main.head).brackets||s0.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let l=Rce(t.doc,a.head);for(let c of r)if(c==l&&ey(t.doc,a.head)==Dq(Ys(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Ae.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Mce=[{key:"Backspace",run:_ce}];function Ace(t,e){let n=zq(t,t.selection.main.head),r=n.brackets||s0.brackets;for(let s of r){let i=Dq(Ys(s,0));if(e==s)return i==s?Pce(t,s,r.indexOf(s+s+s)>-1,n):Dce(t,s,i,n.before||s0.before);if(e==i&&Pq(t,t.selection.main.from))return zce(t,s,i)}return null}function Pq(t,e){let n=!1;return t.field(Rq).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function ey(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Ua(Ys(n,0)))}function Rce(t,e){let n=t.sliceString(e-2,e);return Ua(Ys(n,0))==n.length?n:n.slice(1)}function Dce(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:pu.of(a.to+e.length),range:Ae.range(a.anchor+e.length,a.head+e.length)};let l=ey(t.doc,a.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:a.head},effects:pu.of(a.head+e.length),range:Ae.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function zce(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&ey(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ae.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Pce(t,e,n,r){let s=r.stringPrefixes||s0.stringPrefixes,i=null,a=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:pu.of(l.to+e.length),range:Ae.range(l.anchor+e.length,l.head+e.length)};let c=l.head,h=ey(t.doc,c),f;if(h==e){if(eE(t,c))return{changes:{insert:e+e,from:c},effects:pu.of(c+e.length),range:Ae.cursor(c+e.length)};if(Pq(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Ae.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(f=tE(t,c-2*e.length,s))>-1&&eE(t,f))return{changes:{insert:e+e+e+e,from:c},effects:pu.of(c+e.length),range:Ae.cursor(c+e.length)};if(t.charCategorizer(c)(h)!=rr.Word&&tE(t,c,s)>-1&&!Lce(t,c,e,s))return{changes:{insert:e+e,from:c},effects:pu.of(c+e.length),range:Ae.cursor(c+e.length)}}return{range:i=l}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function eE(t,e){let n=es(t).resolveInner(e+1);return n.parent&&n.from==e}function Lce(t,e,n,r){let s=es(t).resolveInner(e,-1),i=r.reduce((a,l)=>Math.max(a,l.length),0);for(let a=0;a<5;a++){let l=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=l.indexOf(n);if(!c||c>-1&&r.indexOf(l.slice(0,c))>-1){let f=s.firstChild;for(;f&&f.from==s.from&&f.to-f.from>n.length+c;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function tE(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=rr.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=rr.Word)return i}return-1}function Ice(t={}){return[pce,Ks,Jr.of(t),fce,Bce,Mq]}const Lq=[{key:"Ctrl-Space",run:Ew},{mac:"Alt-`",run:Ew},{mac:"Alt-i",run:Ew},{key:"Escape",run:cce},{key:"ArrowDown",run:fx(!0)},{key:"ArrowUp",run:fx(!1)},{key:"PageDown",run:fx(!0,"page")},{key:"PageUp",run:fx(!1,"page")},{key:"Enter",run:lce}],Bce=_c.highest(V0.computeN([Jr],t=>t.facet(Jr).defaultKeymap?[Lq]:[]));class nE{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class uu{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(i0).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new dl,l=[],c=0,h=r.doc.iter(),f=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!l.length)break;let w,S;if(l.length)w=c,S=l.reduce((C,T)=>Math.min(C,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,l.push(y),x++}for(;xC.from||C.to==w))l.push(C),x++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,m);let k=!1;if(l.some(C=>C.from==w&&(C.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let C=w-(f+h.value.length);C>0&&(h.next(C),f=w);for(let T=w;;){if(T>=S){k=!0;break}if(!h.lineBreak&&f+h.value.length>T)break;T=f+h.value.length,f+=h.value.length,h.next()}}let N=Zce(l);if(k)a.add(w,w,ft.widget({widget:new Gce(N),diagnostics:l.slice()}));else{let C=l.reduce((T,_)=>_.markClass?T+" "+_.markClass:T,"");a.add(w,S,ft.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:l.slice(),inclusiveEnd:l.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let C=0;C{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new nE(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new nE(r.from,i,r.diagnostic)}}),r}function qce(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(i0).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(Iq))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function Fce(t,e){return t.field(Ci,!1)?e:e.concat(Et.appendConfig.of(Jce))}const Iq=Et.define(),nO=Et.define(),Bq=Et.define(),Ci=rs.define({create(){return new uu(ft.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=jh(n,t.selected.diagnostic,i)||jh(n,null,i)}!n.size&&s&&e.state.facet(i0).autoPanel&&(s=null),t=new uu(n,s,r)}for(let n of e.effects)if(n.is(Iq)){let r=e.state.facet(i0).autoPanel?n.value.length?a0.open:null:t.panel;t=uu.init(n.value,r,e.state)}else n.is(nO)?t=new uu(t.diagnostics,n.value?a0.open:null,t.selected):n.is(Bq)&&(t=new uu(t.diagnostics,t.panel,n.value));return t},provide:t=>[Xm.from(t,e=>e.panel),We.decorations.from(t,e=>e.diagnostics)]}),$ce=ft.mark({class:"cm-lintRange cm-lintRange-active"});function Qce(t,e,n){let{diagnostics:r}=t.state.field(Ci),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,h,{spec:f})=>{if(e>=c&&e<=h&&(c==h||(e>c||n>0)&&(eFq(t,n,!1)))}const Vce=t=>{let e=t.state.field(Ci,!1);(!e||!e.panel)&&t.dispatch({effects:Fce(t.state,[nO.of(!0)])});let n=Gm(t,a0.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},rE=t=>{let e=t.state.field(Ci,!1);return!e||!e.panel?!1:(t.dispatch({effects:nO.of(!1)}),!0)},Uce=t=>{let e=t.state.field(Ci,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},Wce=[{key:"Mod-Shift-m",run:Vce,preventDefault:!0},{key:"F8",run:Uce}],i0=et.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...co(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:sE,tooltipFilter:sE,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function sE(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function qq(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Fq(t,e,n){var r;let s=n?qq(e.actions):[];return $n("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},$n("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let l=!1,c=x=>{if(x.preventDefault(),l)return;l=!0;let y=jh(t.state.field(Ci).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:h}=i,f=s[a]?h.indexOf(s[a]):-1,m=f<0?h:[h.slice(0,f),$n("u",h.slice(f,f+1)),h.slice(f+1)],g=i.markClass?" "+i.markClass:"";return $n("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${h}${f<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&$n("div",{class:"cm-diagnosticSource"},e.source))}class Gce extends uo{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return $n("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class iE{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Fq(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class a0{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)rE(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=qq(i.actions);for(let l=0;l{for(let i=0;irE(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ci).selected;if(!e)return-1;for(let n=0;n{for(let f of h.diagnostics){if(a.has(f))continue;a.add(f);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:c})=>{let h=c.height/this.list.offsetHeight;l.topc.bottom&&(this.list.scrollTop+=(l.bottom-c.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ci),r=jh(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Bq.of(r)})}static open(e){return new a0(e)}}function Xce(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function mx(t){return Xce(``,'width="6" height="3"')}const Yce=We.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:mx("#d11")},".cm-lintRange-warning":{backgroundImage:mx("orange")},".cm-lintRange-info":{backgroundImage:mx("#999")},".cm-lintRange-hint":{backgroundImage:mx("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function Kce(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function Zce(t){let e="hint",n=1;for(let r of t){let s=Kce(r.severity);s>n&&(n=s,e=r.severity)}return e}const Jce=[Ci,We.decorations.compute([Ci],t=>{let{selected:e,panel:n}=t.field(Ci);return!e||!n||e.from==e.to?ft.none:ft.set([$ce.range(e.from,e.to)])}),Die(Qce,{hideOn:qce}),Yce];var aE=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Mce)),e.defaultKeymap!==!1&&(r=r.concat(mle)),e.searchKeymap!==!1&&(r=r.concat(qle)),e.historyKeymap!==!1&&(r=r.concat(woe)),e.foldKeymap!==!1&&(r=r.concat(Mae)),e.completionKeymap!==!1&&(r=r.concat(Lq)),e.lintKeymap!==!1&&(r=r.concat(Wce));var s=[];return e.lineNumbers!==!1&&s.push(Vie()),e.highlightActiveLineGutter!==!1&&s.push(Gie()),e.highlightSpecialChars!==!1&&s.push(cie()),e.history!==!1&&s.push(hoe()),e.foldGutter!==!1&&s.push(zae()),e.drawSelection!==!1&&s.push(Zse()),e.dropCursor!==!1&&s.push(rie()),e.allowMultipleSelections!==!1&&s.push(rn.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(Sae()),e.syntaxHighlighting!==!1&&s.push(TB(Bae,{fallback:!0})),e.bracketMatching!==!1&&s.push(Uae()),e.closeBrackets!==!1&&s.push(Cce()),e.autocompletion!==!1&&s.push(Ice()),e.rectangularSelection!==!1&&s.push(kie()),n!==!1&&s.push(Nie()),e.highlightActiveLine!==!1&&s.push(pie()),e.highlightSelectionMatches!==!1&&s.push(wle()),e.tabSize&&typeof e.tabSize=="number"&&s.push(W0.of(" ".repeat(e.tabSize))),s.concat([V0.of(r.flat())]).filter(Boolean)};const eue="#e5c07b",oE="#e06c75",tue="#56b6c2",nue="#ffffff",o1="#abb2bf",zS="#7d8799",rue="#61afef",sue="#98c379",lE="#d19a66",iue="#c678dd",aue="#21252b",cE="#2c313a",uE="#282c34",Mw="#353a42",oue="#3E4451",dE="#528bff",lue=We.theme({"&":{color:o1,backgroundColor:uE},".cm-content":{caretColor:dE},".cm-cursor, .cm-dropCursor":{borderLeftColor:dE},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:oue},".cm-panels":{backgroundColor:aue,color:o1},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:uE,color:zS,border:"none"},".cm-activeLineGutter":{backgroundColor:cE},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Mw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Mw,borderBottomColor:Mw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:cE,color:o1}}},{dark:!0}),cue=X0.define([{tag:ve.keyword,color:iue},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:oE},{tag:[ve.function(ve.variableName),ve.labelName],color:rue},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:lE},{tag:[ve.definition(ve.name),ve.separator],color:o1},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:eue},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:tue},{tag:[ve.meta,ve.comment],color:zS},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:zS,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:oE},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:lE},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:sue},{tag:ve.invalid,color:nue}]),$q=[lue,TB(cue)];var uue=We.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),due=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:l=!0}=e,c=[];switch(n&&c.unshift(V0.of([ple])),l&&(typeof l=="boolean"?c.unshift(aE()):c.unshift(aE(l))),a&&c.unshift(yie(a)),i){case"light":c.push(uue);break;case"dark":c.push($q);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(We.editable.of(!1)),s&&c.push(rn.readOnly.of(!0)),[...c]},hue=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class fue{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class hE{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Aw=null,mue=()=>typeof window>"u"?new hE:(Aw||(Aw=new hE),Aw),fE=lo.define(),pue=200,gue=[];function xue(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:l=gue,autoFocus:c,theme:h="light",height:f=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:_,initialState:E}=t,[M,q]=b.useState(),[L,I]=b.useState(),[$,V]=b.useState(),ee=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],H=We.theme({"&":{height:f,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),P=We.updateListener.of(X=>{if(X.docChanged&&typeof r=="function"&&!X.transactions.some(G=>G.annotation(fE))){ee.current?ee.current.reset():(ee.current=new fue(()=>{if(z.current){var G=z.current;z.current=null,G()}ee.current=null},pue),mue().add(ee.current));var R=X.state.doc,se=R.toString();r(se,X)}s&&s(hue(X))}),W=due({theme:h,editable:k,readOnly:N,placeholder:S,indentWithTab:C,basicSetup:T}),J=[P,H,...W];return a&&typeof a=="function"&&J.push(We.updateListener.of(a)),J=J.concat(l),b.useLayoutEffect(()=>{if(M&&!$){var X={doc:e,selection:n,extensions:J},R=E?rn.fromJSON(E.json,X,E.fields):rn.create(X);if(V(R),!L){var se=new We({state:R,parent:M,root:_});I(se),i&&i(se,R)}}return()=>{L&&(V(void 0),I(void 0))}},[M,$]),b.useEffect(()=>{t.container&&q(t.container)},[t.container]),b.useEffect(()=>()=>{L&&(L.destroy(),I(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[L]),b.useEffect(()=>{c&&L&&L.focus()},[c,L]),b.useEffect(()=>{L&&L.dispatch({effects:Et.reconfigure.of(J)})},[h,l,f,m,g,x,y,w,S,k,N,C,T,r,a]),b.useEffect(()=>{if(e!==void 0){var X=L?L.state.doc.toString():"";if(L&&e!==X){var R=ee.current&&!ee.current.isDone,se=()=>{L&&e!==L.state.doc.toString()&&L.dispatch({changes:{from:0,to:L.state.doc.toString().length,insert:e||""},annotations:[fE.of(!0)]})};R?z.current=se:se()}}},[e,L]),{state:$,setState:V,view:L,setView:I,container:M,setContainer:q}}var vue=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Qq=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:h,autoFocus:f,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,root:M,initialState:q}=t,L=oY(t,vue),I=b.useRef(null),{state:$,view:V,container:ee,setContainer:z}=xue({root:M,value:r,autoFocus:f,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,selection:s,onChange:a,onStatistics:l,onCreateEditor:c,onUpdate:h,extensions:i,initialState:q});b.useImperativeHandle(e,()=>({editor:I.current,state:$,view:V}),[I,ee,$,V]);var H=b.useCallback(W=>{I.current=W,z(W)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var P=typeof m=="string"?"cm-theme-"+m:"cm-theme";return o.jsx("div",lY({ref:H,className:""+P+(n?" "+n:"")},L))});Qq.displayName="CodeMirror";var mE={};class X1{constructor(e,n,r,s,i,a,l,c,h,f=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=l,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new X1(e,[],n,r,r,0,[],0,s?new pE(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[l-4]==0&&a.buffer[l-1]>-1){if(n==r)return;if(a.buffer[l-2]>=n){a.buffer[l-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let l=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){l=!0;break}if(l)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new X1(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new yue(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;ic&1&&l==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let l=(a>>19)-i;if(l>1){let c=a&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return l<<19|65536|c}}else{let l=r(a,i+1);if(l!=null)return l}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class pE{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class yue{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class Y1{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new Y1(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Y1(this.stack,this.pos,this.index)}}function px(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,l=!0),i+=c,l)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class l1{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const gE=new l1;class bue{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=gE,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&rl.to&&(this.chunk2=this.chunk2.slice(0,l.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=gE,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class sh{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;wue(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}sh.prototype.contextual=sh.prototype.fallback=sh.prototype.extend=!1;sh.prototype.fallback=sh.prototype.extend=!1;class ty{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function wue(t,e,n,r,s,i){let a=0,l=1<0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||Sue(y,e.token.value,s,i))){e.acceptToken(y);break}}let f=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[h+g*3-3]==65535){a=t[h+g*3-1];continue e}for(;m>1,y=h+x+(x<<1),w=t[y],S=t[y+1]||65536;if(f=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function xE(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function Sue(t,e,n,r){let s=xE(n,r,e);return s<0||xE(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class kue{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?vE(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?vE(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof Hn){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class Oue{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new l1)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,c=0;for(let h=0;hm.end+25&&(c=Math.max(m.lookAhead,c)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!f.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new l1,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new l1,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new kue(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(l);else{if(this.advanceStack(l,r,e))continue;{s||(s=[],i=[]),s.push(l);let c=this.tokens.getMainToken(l);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&Tue(s);if(a)return wi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw wi&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return wi&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((l,c)=>c.score-l.score);r.length>a;)r.pop();r.some(l=>l.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(Qt.contextHash)||0)==f))return e.useNode(m,g),wi&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof Hn)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof Hn&&m.positions[0]==0)m=x;else break}}let l=i.stateSlot(e.state,4);if(l>0)return e.reduce(l),wi&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;hs?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return yE(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(l.deadEnd&&(i||(i=!0,l.restart(),wi&&console.log(f+this.stackID(l)+" (restarted)"),this.advanceFully(l,r))))continue;let m=l.split(),g=f;for(let x=0;x<10&&m.forceReduce()&&(wi&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)wi&&(g=this.stackID(m)+" -> ");for(let x of l.recoverByInsert(c))wi&&console.log(f+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>l.pos?(h==l.pos&&(h++,c=0),l.recoverByDelete(c,h),wi&&console.log(f+this.stackID(l)+` (via recover-delete ${this.parser.getName(c)})`),yE(l,r)):(!s||s.scoret;class Cue{constructor(e){this.start=e.start,this.shift=e.shift||Dw,this.reduce=e.reduce||Dw,this.reuse=e.reuse||Dw,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class o0 extends D6{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let l=0;le.topRules[l][1]),s=[];for(let l=0;l=0)i(f,c,l[h++]);else{let m=l[h+-f];for(let g=-f;g>0;g--)i(l[h++],c,m);h++}}}this.nodeSet=new Uv(n.map((l,c)=>zs.define({name:c>=this.minRepeatTerm?void 0:l,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=lB;let a=px(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;ltypeof l=="number"?new sh(a,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new jue(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],l=a&1,c=s[i++];if(l&&r)return c;for(let h=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Go(this.data,i+2);else break;s=n(Go(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Go(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(o0.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(l=>l.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=bE(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const Eue=1,Hq=194,Vq=195,_ue=196,wE=197,Mue=198,Aue=199,Rue=200,Due=2,Uq=3,SE=201,zue=24,Pue=25,Lue=49,Iue=50,Bue=55,que=56,Fue=57,$ue=59,Que=60,Hue=61,Vue=62,Uue=63,Wue=65,Gue=238,Xue=71,Yue=241,Kue=242,Zue=243,Jue=244,ede=245,tde=246,nde=247,rde=248,Wq=72,sde=249,ide=250,ade=251,ode=252,lde=253,cde=254,ude=255,dde=256,hde=73,fde=77,mde=263,pde=112,gde=130,xde=151,vde=152,yde=155,Au=10,l0=13,rO=32,ny=9,sO=35,bde=40,wde=46,PS=123,kE=125,Gq=39,Xq=34,OE=92,Sde=111,kde=120,Ode=78,jde=117,Nde=85,Cde=new Set([Pue,Lue,Iue,mde,Wue,gde,que,Fue,Gue,Vue,Uue,Wq,hde,fde,Que,Hue,xde,vde,yde,pde]);function zw(t){return t==Au||t==l0}function Pw(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const Tde=new ty((t,e)=>{let n;if(t.next<0)t.acceptToken(Aue);else if(e.context.flags&c1)zw(t.next)&&t.acceptToken(Mue,1);else if(((n=t.peek(-1))<0||zw(n))&&e.canShift(wE)){let r=0;for(;t.next==rO||t.next==ny;)t.advance(),r++;(t.next==Au||t.next==l0||t.next==sO)&&t.acceptToken(wE,-r)}else zw(t.next)&&t.acceptToken(_ue,1)},{contextual:!0}),Ede=new ty((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==Au||r==l0){let s=0,i=0;for(;;){if(t.next==rO)s++;else if(t.next==ny)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=Au&&t.next!=l0&&t.next!=sO&&(s[t,e|Yq])),Ade=new Cue({start:_de,reduce(t,e,n,r){return t.flags&c1&&Cde.has(e)||(e==Xue||e==Wq)&&t.flags&Yq?t.parent:t},shift(t,e,n,r){return e==Hq?new u1(t,Mde(r.read(r.pos,n.pos)),0):e==Vq?t.parent:e==zue||e==Bue||e==$ue||e==Uq?new u1(t,0,c1):jE.has(e)?new u1(t,0,jE.get(e)|t.flags&c1):t},hash(t){return t.hash}}),Rde=new ty(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==rO||n==ny)){n!=bde&&n!=wde&&n!=Au&&n!=l0&&n!=sO&&t.acceptToken(Eue);return}}}),Dde=new ty((t,e)=>{let{flags:n}=e.context,r=n&Ho?Xq:Gq,s=(n&Vo)>0,i=!(n&Uo),a=(n&Wo)>0,l=t.pos;for(;!(t.next<0);)if(a&&t.next==PS)if(t.peek(1)==PS)t.advance(2);else{if(t.pos==l){t.acceptToken(Uq,1);return}break}else if(i&&t.next==OE){if(t.pos==l){t.advance();let c=t.next;c>=0&&(t.advance(),zde(t,c)),t.acceptToken(Due);return}break}else if(t.next==OE&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==l){t.acceptToken(SE,s?3:1);return}break}else if(t.next==Au){if(s)t.advance();else if(t.pos==l){t.acceptToken(SE);return}break}else t.advance();t.pos>l&&t.acceptToken(Rue)});function zde(t,e){if(e==Sde)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==kde)for(let n=0;n<2&&Pw(t.next);n++)t.advance();else if(e==jde)for(let n=0;n<4&&Pw(t.next);n++)t.advance();else if(e==Nde)for(let n=0;n<8&&Pw(t.next);n++)t.advance();else if(e==Ode&&t.next==PS){for(t.advance();t.next>=0&&t.next!=kE&&t.next!=Gq&&t.next!=Xq&&t.next!=Au;)t.advance();t.next==kE&&t.advance()}}const Pde=z6({'async "*" "**" FormatConversion FormatSpec':ve.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":ve.controlKeyword,"in not and or is del":ve.operatorKeyword,"from def class global nonlocal lambda":ve.definitionKeyword,import:ve.moduleKeyword,"with as print":ve.keyword,Boolean:ve.bool,None:ve.null,VariableName:ve.variableName,"CallExpression/VariableName":ve.function(ve.variableName),"FunctionDefinition/VariableName":ve.function(ve.definition(ve.variableName)),"ClassDefinition/VariableName":ve.definition(ve.className),PropertyName:ve.propertyName,"CallExpression/MemberExpression/PropertyName":ve.function(ve.propertyName),Comment:ve.lineComment,Number:ve.number,String:ve.string,FormatString:ve.special(ve.string),Escape:ve.escape,UpdateOp:ve.updateOperator,"ArithOp!":ve.arithmeticOperator,BitOp:ve.bitwiseOperator,CompareOp:ve.compareOperator,AssignOp:ve.definitionOperator,Ellipsis:ve.punctuation,At:ve.meta,"( )":ve.paren,"[ ]":ve.squareBracket,"{ }":ve.brace,".":ve.derefOperator,", ;":ve.separator}),Lde={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Ide=o0.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Rde,Ede,Tde,Dde,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Lde[t]||-1}],tokenPrec:7668}),NE=new tae,Kq=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function gx(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const Bde={FunctionDefinition:gx("function"),ClassDefinition:gx("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:gx("variable"),AsPattern:gx("variable"),__proto__:null};function Zq(t,e){let n=NE.get(e);if(n)return n;let r=[],s=!0;function i(a,l){let c=t.sliceString(a.from,a.to);r.push({label:c,type:l})}return e.cursor(Hr.IncludeAnonymous).iterate(a=>{if(a.name){let l=Bde[a.name];if(l&&l(a,i,s)||!s&&Kq.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let l of Zq(t,a.node))r.push(l);return!1}}),NE.set(e,r),r}const CE=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Jq=["String","FormatString","Comment","PropertyName"];function qde(t){let e=es(t.state).resolveInner(t.pos,-1);if(Jq.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&CE.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)Kq.has(s.name)&&(r=r.concat(Zq(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:CE}}const Fde=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),$de=[qo("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),qo("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),qo("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),qo("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),qo(`if \${}: +`);r>-1&&(n=n.slice(0,r))}return e+n.length<=this.to?n:n.slice(0,this.to-e)}nextLine(){let e=this.parsedPos,n=this.lineAfter(e),r=e+n.length;for(let s=this.rangeIndex;;){let i=this.ranges[s].to;if(i>=r||(n=n.slice(0,i-(r-n.length)),s++,s==this.ranges.length))break;let a=this.ranges[s].from,o=this.lineAfter(a);n+=o,r=a+o.length}return{line:n,end:r}}skipGapsTo(e,n,r){for(;;){let s=this.ranges[this.rangeIndex].to,i=e+n;if(r>0?s>i:s>=i)break;let a=this.ranges[++this.rangeIndex].from;n+=a-s}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to1){s=this.skipGapsTo(n,s,1),n+=s;let o=this.chunk.length;s=this.skipGapsTo(r,s,-1),r+=s,i+=this.chunk.length-o}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&i==4&&a>=0&&this.chunk[a]==e&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(e,n,r,i),s}parseLine(e){let{line:n,end:r}=this.nextLine(),s=0,{streamParser:i}=this.lang,a=new FB(n,e?e.state.tabSize:4,e?Au(e.state):2);if(a.eol())i.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=QB(i.token,a,this.state);if(o&&(s=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+a.start,this.parsedPos+a.pos,s)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPose.start)return s}throw new Error("Stream parser failed to advance stream.")}const V6=Object.create(null),r0=[zs.none],ple=new Kv(r0),qT=[],FT=Object.create(null),HB=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])HB[t]=UB(V6,e);class VB{constructor(e){this.extra=e,this.table=Object.assign(Object.create(null),HB)}resolve(e){return e?this.table[e]||(this.table[e]=UB(this.extra,e)):0}}const gle=new VB(V6);function _w(t,e){qT.indexOf(t)>-1||(qT.push(t),console.warn(e))}function UB(t,e){let n=[];for(let o of e.split(" ")){let c=[];for(let h of o.split(".")){let f=t[h]||ve[h];f?typeof f=="function"?c.length?c=c.map(f):_w(h,`Modifier ${h} used at start of tag`):c.length?_w(h,`Tag ${h} used as modifier`):c=Array.isArray(f)?f:[f]:_w(h,`Unknown highlighting tag ${h}`)}for(let h of c)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(o=>o.id),i=FT[s];if(i)return i.id;let a=FT[s]=zs.define({id:r0.length,name:r,props:[B6({[r]:n})]});return r0.push(a),a.id}function xle(t,e){let n=zs.define({id:r0.length,name:"Document",props:[pu.add(()=>t),Jv.add(()=>r=>e.getIndent(r))],top:!0});return r0.push(n),n}Jn.RTL,Jn.LTR;const vle=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=W6(t.state,n.from);return r.line?yle(t):r.block?wle(t):!1};function U6(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const yle=U6(Ole,0),ble=U6(WB,0),wle=U6((t,e)=>WB(t,e,kle(e)),0);function W6(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const nm=50;function Sle(t,{open:e,close:n},r,s){let i=t.sliceDoc(r-nm,r),a=t.sliceDoc(s,s+nm),o=/\s*$/.exec(i)[0].length,c=/^\s*/.exec(a)[0].length,h=i.length-o;if(i.slice(h-e.length,h)==e&&a.slice(c,c+n.length)==n)return{open:{pos:r-o,margin:o&&1},close:{pos:s+c,margin:c&&1}};let f,m;s-r<=2*nm?f=m=t.sliceDoc(r,s):(f=t.sliceDoc(r,r+nm),m=t.sliceDoc(s-nm,s));let g=/^\s*/.exec(f)[0].length,x=/\s*$/.exec(m)[0].length,y=m.length-x-n.length;return f.slice(g,g+e.length)==e&&m.slice(y,y+n.length)==n?{open:{pos:r+g+e.length,margin:/\s/.test(f.charAt(g+e.length))?1:0},close:{pos:s-x-n.length,margin:/\s/.test(m.charAt(y-1))?1:0}}:null}function kle(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function WB(t,e,n=e.selection.ranges){let r=n.map(i=>W6(e,i.from).block);if(!r.every(i=>i))return null;let s=n.map((i,a)=>Sle(e,r[a],i.from,i.to));if(t!=2&&!s.every(i=>i))return{changes:e.changes(n.map((i,a)=>s[a]?[]:[{from:i.from,insert:r[a].open+" "},{from:i.to,insert:" "+r[a].close}]))};if(t!=1&&s.some(i=>i)){let i=[];for(let a=0,o;as&&(i==a||a>m.from)){s=m.from;let g=/^\s*/.exec(m.text)[0].length,x=g==m.length,y=m.text.slice(g,g+h.length)==h?g:-1;gi.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:o,token:c,indent:h,empty:f,single:m}of r)(m||!f)&&i.push({from:o.from+h,insert:c+" "});let a=e.changes(i);return{changes:a,selection:e.selection.map(a,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:a,comment:o,token:c}of r)if(o>=0){let h=a.from+o,f=h+c.length;a.text[f-a.from]==" "&&f++,i.push({from:h,to:f})}return{changes:i}}return null}const RS=hl.define(),jle=hl.define(),Nle=et.define(),GB=et.define({combine(t){return fl(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),XB=is.define({create(){return tl.empty},update(t,e){let n=e.state.facet(GB),r=e.annotation(RS);if(r){let c=ei.fromTransaction(e,r.selection),h=r.side,f=h==0?t.undone:t.done;return c?f=H1(f,f.length,n.minDepth,c):f=ZB(f,e.startState.selection),new tl(h==0?r.rest:f,h==0?f:r.rest)}let s=e.annotation(jle);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(Pr.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=ei.fromTransaction(e),a=e.annotation(Pr.time),o=e.annotation(Pr.userEvent);return i?t=t.addChanges(i,a,o,n,e):e.selection&&(t=t.addSelection(e.startState.selection,a,o,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new tl(t.done.map(ei.fromJSON),t.undone.map(ei.fromJSON))}});function Cle(t={}){return[XB,GB.of(t),We.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?YB:e.inputType=="historyRedo"?DS:null;return r?(e.preventDefault(),r(n)):!1}})]}function ty(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(XB,!1);if(!s)return!1;let i=s.pop(t,n,e);return i?(r(i),!0):!1}}const YB=ty(0,!1),DS=ty(1,!1),Tle=ty(0,!0),Ele=ty(1,!0);class ei{constructor(e,n,r,s,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=i}setSelAfter(e){return new ei(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ei(e.changes&&Hr.fromJSON(e.changes),[],e.mapped&&ll.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=Zi;for(let s of e.startState.facet(Nle)){let i=s(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new ei(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,Zi)}static selection(e){return new ei(void 0,Zi,void 0,void 0,e)}}function H1(t,e,n,r){let s=e+1>n+20?e-n-1:0,i=t.slice(s,e);return i.push(r),i}function _le(t,e){let n=[],r=!1;return t.iterChangedRanges((s,i)=>n.push(s,i)),e.iterChangedRanges((s,i,a,o)=>{for(let c=0;c=h&&a<=f&&(r=!0)}}),r}function Mle(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function KB(t,e){return t.length?e.length?t.concat(e):t:e}const Zi=[],Ale=200;function ZB(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Ale));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),H1(t,t.length-1,1e9,n.setSelAfter(r)))}else return[ei.selection([e])]}function Rle(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Mw(t,e){if(!t.length)return t;let n=t.length,r=Zi;for(;n;){let s=Dle(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let i=t.slice(0,n);return i[n-1]=s,i}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[ei.selection(r)]:Zi}function Dle(t,e,n){let r=KB(t.selectionsAfter.length?t.selectionsAfter.map(o=>o.map(e)):Zi,n);if(!t.changes)return ei.selection(r);let s=t.changes.map(e),i=e.mapDesc(t.changes,!0),a=t.mapped?t.mapped.composeDesc(i):i;return new ei(s,Mt.mapEffects(t.effects,e),a,t.startSelection.map(i),r)}const zle=/^(input\.type|delete)($|\.)/;class tl{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new tl(this.done,this.undone):this}addChanges(e,n,r,s,i){let a=this.done,o=a[a.length-1];return o&&o.changes&&!o.changes.empty&&e.changes&&(!r||zle.test(r))&&(!o.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?t.moveByChar(n,e):ny(n,e))}function Os(t){return t.textDirectionAt(t.state.selection.main.head)==Jn.LTR}const eq=t=>JB(t,!Os(t)),tq=t=>JB(t,Os(t));function nq(t,e){return Da(t,n=>n.empty?t.moveByGroup(n,e):ny(n,e))}const Lle=t=>nq(t,!Os(t)),Ile=t=>nq(t,Os(t));function Ble(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function ry(t,e,n){let r=ns(t).resolveInner(e.head),s=n?Ht.closedBy:Ht.openedBy;for(let c=e.head;;){let h=n?r.childAfter(c):r.childBefore(c);if(!h)break;Ble(t,h,s)?r=h:c=n?h.to:h.from}let i=r.type.prop(s),a,o;return i&&(a=n?el(t,r.from,1):el(t,r.to,-1))&&a.matched?o=n?a.end.to:a.end.from:o=n?r.to:r.from,Ae.cursor(o,n?-1:1)}const qle=t=>Da(t,e=>ry(t.state,e,!Os(t))),Fle=t=>Da(t,e=>ry(t.state,e,Os(t)));function rq(t,e){return Da(t,n=>{if(!n.empty)return ny(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const sq=t=>rq(t,!1),iq=t=>rq(t,!0);function aq(t){let e=t.scrollDOM.clientHeighta.empty?t.moveVertically(a,e,n.height):ny(a,e));if(s.eq(r.selection))return!1;let i;if(n.selfScroll){let a=t.coordsAtPos(r.selection.main.head),o=t.scrollDOM.getBoundingClientRect(),c=o.top+n.marginTop,h=o.bottom-n.marginBottom;a&&a.top>c&&a.bottomlq(t,!1),zS=t=>lq(t,!0);function Ac(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(s=Ae.cursor(r.from+i))}return s}const $le=t=>Da(t,e=>Ac(t,e,!0)),Qle=t=>Da(t,e=>Ac(t,e,!1)),Hle=t=>Da(t,e=>Ac(t,e,!Os(t))),Vle=t=>Da(t,e=>Ac(t,e,Os(t))),Ule=t=>Da(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),Wle=t=>Da(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function Gle(t,e,n){let r=!1,s=$h(t.selection,i=>{let a=el(t,i.head,-1)||el(t,i.head,1)||i.head>0&&el(t,i.head-1,1)||i.headGle(t,e);function ha(t,e){let n=$h(t.state.selection,r=>{let s=e(r);return Ae.range(r.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Ra(t.state,n)),!0)}function oq(t,e){return ha(t,n=>t.moveByChar(n,e))}const cq=t=>oq(t,!Os(t)),uq=t=>oq(t,Os(t));function dq(t,e){return ha(t,n=>t.moveByGroup(n,e))}const Yle=t=>dq(t,!Os(t)),Kle=t=>dq(t,Os(t)),Zle=t=>ha(t,e=>ry(t.state,e,!Os(t))),Jle=t=>ha(t,e=>ry(t.state,e,Os(t)));function hq(t,e){return ha(t,n=>t.moveVertically(n,e))}const fq=t=>hq(t,!1),mq=t=>hq(t,!0);function pq(t,e){return ha(t,n=>t.moveVertically(n,e,aq(t).height))}const QT=t=>pq(t,!1),HT=t=>pq(t,!0),eoe=t=>ha(t,e=>Ac(t,e,!0)),toe=t=>ha(t,e=>Ac(t,e,!1)),noe=t=>ha(t,e=>Ac(t,e,!Os(t))),roe=t=>ha(t,e=>Ac(t,e,Os(t))),soe=t=>ha(t,e=>Ae.cursor(t.lineBlockAt(e.head).from)),ioe=t=>ha(t,e=>Ae.cursor(t.lineBlockAt(e.head).to)),VT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:0})),!0),UT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:t.doc.length})),!0),WT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:t.selection.main.anchor,head:0})),!0),GT=({state:t,dispatch:e})=>(e(Ra(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),aoe=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),loe=({state:t,dispatch:e})=>{let n=sy(t).map(({from:r,to:s})=>Ae.range(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},ooe=({state:t,dispatch:e})=>{let n=$h(t.selection,r=>{let s=ns(t),i=s.resolveStack(r.from,1);if(r.empty){let a=s.resolveStack(r.from,-1);a.node.from>=i.node.from&&a.node.to<=i.node.to&&(i=a)}for(let a=i;a;a=a.next){let{node:o}=a;if((o.from=r.to||o.to>r.to&&o.from<=r.from)&&a.next)return Ae.range(o.to,o.from)}return r});return n.eq(t.selection)?!1:(e(Ra(t,n)),!0)};function gq(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let i of n.selection.ranges){let a=n.doc.lineAt(i.head);if(e?a.to0)for(let o=i;;){let c=t.moveVertically(o,e);if(c.heada.to){s.some(h=>h.head==c.head)||s.push(c);break}else{if(c.head==o.head)break;o=c}}}return s.length==r.ranges.length?!1:(t.dispatch(Ra(n,Ae.create(s,s.length-1))),!0)}const coe=t=>gq(t,!1),uoe=t=>gq(t,!0),doe=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(Ra(t,r)),!0):!1};function J0(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let c=e(i);ca&&(n="delete.forward",c=fx(t,c,!0)),a=Math.min(a,c),o=Math.max(o,c)}else a=fx(t,a,!1),o=fx(t,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:Ae.cursor(a,as(t)))r.between(e,e,(s,i)=>{se&&(e=n?i:s)});return e}const xq=(t,e,n)=>J0(t,r=>{let s=r.from,{state:i}=t,a=i.doc.lineAt(s),o,c;if(n&&!e&&s>a.from&&sxq(t,!1,!0),vq=t=>xq(t,!0,!1),yq=(t,e)=>J0(t,n=>{let r=n.head,{state:s}=t,i=s.doc.lineAt(r),a=s.charCategorizer(r);for(let o=null;;){if(r==(e?i.to:i.from)){r==n.head&&i.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let c=ms(i.text,r-i.from,e)+i.from,h=i.text.slice(Math.min(r,c)-i.from,Math.max(r,c)-i.from),f=a(h);if(o!=null&&f!=o)break;(h!=" "||r!=n.head)&&(o=f),r=c}return r}),bq=t=>yq(t,!1),hoe=t=>yq(t,!0),foe=t=>J0(t,e=>{let n=t.lineBlockAt(e.head).to;return e.headJ0(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),poe=t=>J0(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:cn.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},xoe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,i=t.doc.lineAt(s),a=s==i.from?s-1:ms(i.text,s-i.from,!1)+i.from,o=s==i.to?s+1:ms(i.text,s-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:t.doc.slice(s,o).append(t.doc.slice(a,s))},range:Ae.cursor(o)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function sy(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=s.number){let a=e[e.length-1];a.to=i.to,a.ranges.push(r)}else e.push({from:s.from,to:i.to,ranges:[r]});n=i.number+1}return e}function wq(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let i of sy(t)){if(n?i.to==t.doc.length:i.from==0)continue;let a=t.doc.lineAt(n?i.to+1:i.from-1),o=a.length+1;if(n){r.push({from:i.to,to:a.to},{from:i.from,insert:a.text+t.lineBreak});for(let c of i.ranges)s.push(Ae.range(Math.min(t.doc.length,c.anchor+o),Math.min(t.doc.length,c.head+o)))}else{r.push({from:a.from,to:i.from},{from:i.to,insert:t.lineBreak+a.text});for(let c of i.ranges)s.push(Ae.range(c.anchor-o,c.head-o))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const voe=({state:t,dispatch:e})=>wq(t,e,!1),yoe=({state:t,dispatch:e})=>wq(t,e,!0);function Sq(t,e,n){if(t.readOnly)return!1;let r=[];for(let s of sy(t))n?r.push({from:s.from,insert:t.doc.slice(s.from,s.to)+t.lineBreak}):r.push({from:s.to,insert:t.lineBreak+t.doc.slice(s.from,s.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const boe=({state:t,dispatch:e})=>Sq(t,e,!1),woe=({state:t,dispatch:e})=>Sq(t,e,!0),Soe=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(sy(e).map(({from:s,to:i})=>(s>0?s--:i{let i;if(t.lineWrapping){let a=t.lineBlockAt(s.head),o=t.coordsAtPos(s.head,s.assoc||1);o&&(i=a.bottom+t.documentTop-o.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,i)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function koe(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ns(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),i;return r&&s&&r.to<=e&&s.from>=e&&(i=r.type.prop(Ht.closedBy))&&i.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const XT=kq(!1),Ooe=kq(!0);function kq(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:i,to:a}=s,o=e.doc.lineAt(i),c=!t&&i==a&&koe(e,i);t&&(i=a=(a<=o.to?o:e.doc.lineAt(a)).to);let h=new Zv(e,{simulateBreak:i,simulateDoubleBreak:!!c}),f=q6(h,i);for(f==null&&(f=Fh(/^\s*/.exec(e.doc.lineAt(i).text)[0],e.tabSize));ao.from&&i{let s=[];for(let a=r.from;a<=r.to;){let o=t.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(e(o,s,r),n=o.number),a=o.to+1}let i=t.changes(s);return{changes:s,range:Ae.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}const joe=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Zv(t,{overrideIndentation:i=>{let a=n[i];return a??-1}}),s=G6(t,(i,a,o)=>{let c=q6(r,i.from);if(c==null)return;/\S/.test(i.text)||(c=0);let h=/^\s*/.exec(i.text)[0],f=n0(t,c);(h!=f||o.fromt.readOnly?!1:(e(t.update(G6(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Y0)})}),{userEvent:"input.indent"})),!0),jq=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(G6(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let i=Fh(s,t.tabSize),a=0,o=n0(t,Math.max(0,i-Au(t)));for(;a(t.setTabFocusMode(),!0),Coe=[{key:"Ctrl-b",run:eq,shift:cq,preventDefault:!0},{key:"Ctrl-f",run:tq,shift:uq},{key:"Ctrl-p",run:sq,shift:fq},{key:"Ctrl-n",run:iq,shift:mq},{key:"Ctrl-a",run:Ule,shift:soe},{key:"Ctrl-e",run:Wle,shift:ioe},{key:"Ctrl-d",run:vq},{key:"Ctrl-h",run:PS},{key:"Ctrl-k",run:foe},{key:"Ctrl-Alt-h",run:bq},{key:"Ctrl-o",run:goe},{key:"Ctrl-t",run:xoe},{key:"Ctrl-v",run:zS}],Toe=[{key:"ArrowLeft",run:eq,shift:cq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Lle,shift:Yle,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Hle,shift:noe,preventDefault:!0},{key:"ArrowRight",run:tq,shift:uq,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Ile,shift:Kle,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Vle,shift:roe,preventDefault:!0},{key:"ArrowUp",run:sq,shift:fq,preventDefault:!0},{mac:"Cmd-ArrowUp",run:VT,shift:WT},{mac:"Ctrl-ArrowUp",run:$T,shift:QT},{key:"ArrowDown",run:iq,shift:mq,preventDefault:!0},{mac:"Cmd-ArrowDown",run:UT,shift:GT},{mac:"Ctrl-ArrowDown",run:zS,shift:HT},{key:"PageUp",run:$T,shift:QT},{key:"PageDown",run:zS,shift:HT},{key:"Home",run:Qle,shift:toe,preventDefault:!0},{key:"Mod-Home",run:VT,shift:WT},{key:"End",run:$le,shift:eoe,preventDefault:!0},{key:"Mod-End",run:UT,shift:GT},{key:"Enter",run:XT,shift:XT},{key:"Mod-a",run:aoe},{key:"Backspace",run:PS,shift:PS,preventDefault:!0},{key:"Delete",run:vq,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:bq,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:hoe,preventDefault:!0},{mac:"Mod-Backspace",run:moe,preventDefault:!0},{mac:"Mod-Delete",run:poe,preventDefault:!0}].concat(Coe.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Eoe=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:qle,shift:Zle},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Fle,shift:Jle},{key:"Alt-ArrowUp",run:voe},{key:"Shift-Alt-ArrowUp",run:boe},{key:"Alt-ArrowDown",run:yoe},{key:"Shift-Alt-ArrowDown",run:woe},{key:"Mod-Alt-ArrowUp",run:coe},{key:"Mod-Alt-ArrowDown",run:uoe},{key:"Escape",run:doe},{key:"Mod-Enter",run:Ooe},{key:"Alt-l",mac:"Ctrl-l",run:loe},{key:"Mod-i",run:ooe,preventDefault:!0},{key:"Mod-[",run:jq},{key:"Mod-]",run:Oq},{key:"Mod-Alt-\\",run:joe},{key:"Shift-Mod-k",run:Soe},{key:"Shift-Mod-\\",run:Xle},{key:"Mod-/",run:vle},{key:"Alt-A",run:ble},{key:"Ctrl-m",mac:"Shift-Alt-m",run:Noe}].concat(Toe),_oe={key:"Tab",run:Oq,shift:jq},YT=typeof String.prototype.normalize=="function"?t=>t.normalize("NFKD"):t=>t;class jh{constructor(e,n,r=0,s=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(r,s),this.bufferStart=r,this.normalize=i?o=>i(YT(o)):YT,this.query=this.normalize(n)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return Ks(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let n=b6(e),r=this.bufferStart+this.bufferPos;this.bufferPos+=Xa(e);let s=this.normalize(n);if(s.length)for(let i=0,a=r;;i++){let o=s.charCodeAt(i),c=this.match(o,a,this.bufferPos+this.bufferStart);if(i==s.length-1){if(c)return this.value=c,this;break}a==r&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let n=this.matchPos<=this.to&&this.re.exec(this.curLine);if(n){let r=this.curLineStart+n.index,s=r+n[0].length;if(this.matchPos=V1(this.text,s+(r==s?1:0)),r==this.curLineStart+this.curLine.length&&this.nextLine(),(rthis.value.to)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||s.to<=n){let o=new rh(n,e.sliceString(n,r));return Aw.set(e,o),o}if(s.from==n&&s.to==r)return s;let{text:i,from:a}=s;return a>n&&(i=e.sliceString(n,a)+i,a=n),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,n=this.re.exec(this.flat.text);if(n&&!n[0]&&n.index==e&&(this.re.lastIndex=e+1,n=this.re.exec(this.flat.text)),n){let r=this.flat.from+n.index,s=r+n[0].length;if((this.flat.to>=this.to||n.index+n[0].length<=this.flat.text.length-10)&&(!this.test||this.test(r,s,n)))return this.value={from:r,to:s,match:n},this.matchPos=V1(this.text,s+(r==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=rh.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(Cq.prototype[Symbol.iterator]=Tq.prototype[Symbol.iterator]=function(){return this});function Moe(t){try{return new RegExp(t,X6),!0}catch{return!1}}function V1(t,e){if(e>=t.length)return e;let n=t.lineAt(e),r;for(;e=56320&&r<57344;)e++;return e}function LS(t){let e=String(t.state.doc.lineAt(t.state.selection.main.head).number),n=$n("input",{class:"cm-textfield",name:"line",value:e}),r=$n("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),t.dispatch({effects:Am.of(!1)}),t.focus()):i.keyCode==13&&(i.preventDefault(),s())},onsubmit:i=>{i.preventDefault(),s()}},$n("label",t.state.phrase("Go to line"),": ",n)," ",$n("button",{class:"cm-button",type:"submit"},t.state.phrase("go")),$n("button",{name:"close",onclick:()=>{t.dispatch({effects:Am.of(!1)}),t.focus()},"aria-label":t.state.phrase("close"),type:"button"},["×"]));function s(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.value);if(!i)return;let{state:a}=t,o=a.doc.lineAt(a.selection.main.head),[,c,h,f,m]=i,g=f?+f.slice(1):0,x=h?+h:o.number;if(h&&m){let S=x/100;c&&(S=S*(c=="-"?-1:1)+o.number/a.doc.lines),x=Math.round(a.doc.lines*S)}else h&&c&&(x=x*(c=="-"?-1:1)+o.number);let y=a.doc.line(Math.max(1,Math.min(a.doc.lines,x))),w=Ae.cursor(y.from+Math.max(0,Math.min(g,y.length)));t.dispatch({effects:[Am.of(!1),We.scrollIntoView(w.from,{y:"center"})],selection:w}),t.focus()}return{dom:r}}const Am=Mt.define(),KT=is.define({create(){return!0},update(t,e){for(let n of e.effects)n.is(Am)&&(t=n.value);return t},provide:t=>Zm.from(t,e=>e?LS:null)}),Aoe=t=>{let e=Km(t,LS);if(!e){let n=[Am.of(!0)];t.state.field(KT,!1)==null&&n.push(Mt.appendConfig.of([KT,Roe])),t.dispatch({effects:n}),e=Km(t,LS)}return e&&e.dom.querySelector("input").select(),!0},Roe=We.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Doe={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},zoe=et.define({combine(t){return fl(t,Doe,{highlightWordAroundCursor:(e,n)=>e||n,minSelectionLength:Math.min,maxMatches:Math.min})}});function Poe(t){return[Foe,qoe]}const Loe=ft.mark({class:"cm-selectionMatch"}),Ioe=ft.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function ZT(t,e,n,r){return(n==0||t(e.sliceDoc(n-1,n))!=nr.Word)&&(r==e.doc.length||t(e.sliceDoc(r,r+1))!=nr.Word)}function Boe(t,e,n,r){return t(e.sliceDoc(n,n+1))==nr.Word&&t(e.sliceDoc(r-1,r))==nr.Word}const qoe=Nr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(zoe),{state:n}=t,r=n.selection;if(r.ranges.length>1)return ft.none;let s=r.main,i,a=null;if(s.empty){if(!e.highlightWordAroundCursor)return ft.none;let c=n.wordAt(s.head);if(!c)return ft.none;a=n.charCategorizer(s.head),i=n.sliceDoc(c.from,c.to)}else{let c=s.to-s.from;if(c200)return ft.none;if(e.wholeWords){if(i=n.sliceDoc(s.from,s.to),a=n.charCategorizer(s.head),!(ZT(a,n,s.from,s.to)&&Boe(a,n,s.from,s.to)))return ft.none}else if(i=n.sliceDoc(s.from,s.to),!i)return ft.none}let o=[];for(let c of t.visibleRanges){let h=new jh(n.doc,i,c.from,c.to);for(;!h.next().done;){let{from:f,to:m}=h.value;if((!a||ZT(a,n,f,m))&&(s.empty&&f<=s.from&&m>=s.to?o.push(Ioe.range(f,m)):(f>=s.to||m<=s.from)&&o.push(Loe.range(f,m)),o.length>e.maxMatches))return ft.none}}return ft.set(o)}},{decorations:t=>t.decorations}),Foe=We.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),$oe=({state:t,dispatch:e})=>{let{selection:n}=t,r=Ae.create(n.ranges.map(s=>t.wordAt(s.head)||Ae.cursor(s.head)),n.mainIndex);return r.eq(n)?!1:(e(t.update({selection:r})),!0)};function Qoe(t,e){let{main:n,ranges:r}=t.selection,s=t.wordAt(n.head),i=s&&s.from==n.from&&s.to==n.to;for(let a=!1,o=new jh(t.doc,e,r[r.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new jh(t.doc,e,0,Math.max(0,r[r.length-1].from-1)),a=!0}else{if(a&&r.some(c=>c.from==o.value.from))continue;if(i){let c=t.wordAt(o.value.from);if(!c||c.from!=o.value.from||c.to!=o.value.to)continue}return o.value}}const Hoe=({state:t,dispatch:e})=>{let{ranges:n}=t.selection;if(n.some(i=>i.from===i.to))return $oe({state:t,dispatch:e});let r=t.sliceDoc(n[0].from,n[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=r))return!1;let s=Qoe(t,r);return s?(e(t.update({selection:t.selection.addRange(Ae.range(s.from,s.to),!1),effects:We.scrollIntoView(s.to)})),!0):!1},Qh=et.define({combine(t){return fl(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new nce(e),scrollToMatch:e=>We.scrollIntoView(e)})}});class Eq{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Moe(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(n,r)=>r=="n"?` +`:r=="r"?"\r":r=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Goe(this):new Uoe(this)}getCursor(e,n=0,r){let s=e.doc?e:an.create({doc:e});return r==null&&(r=s.doc.length),this.regexp?qd(this,s,n,r):Bd(this,s,n,r)}}class _q{constructor(e){this.spec=e}}function Bd(t,e,n,r){return new jh(e.doc,t.unquoted,n,r,t.caseSensitive?void 0:s=>s.toLowerCase(),t.wholeWord?Voe(e.doc,e.charCategorizer(e.selection.main.head)):void 0)}function Voe(t,e){return(n,r,s,i)=>((i>n||i+s.length=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=Bd(this.spec,e,Math.max(0,n-this.spec.unquoted.length),Math.min(r+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}function qd(t,e,n,r){return new Cq(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:t.wholeWord?Woe(e.charCategorizer(e.selection.main.head)):void 0},n,r)}function U1(t,e){return t.slice(ms(t,e,!1),e)}function W1(t,e){return t.slice(e,ms(t,e))}function Woe(t){return(e,n,r)=>!r[0].length||(t(U1(r.input,r.index))!=nr.Word||t(W1(r.input,r.index))!=nr.Word)&&(t(W1(r.input,r.index+r[0].length))!=nr.Word||t(U1(r.input,r.index+r[0].length))!=nr.Word)}class Goe extends _q{nextMatch(e,n,r){let s=qd(this.spec,e,r,e.doc.length).next();return s.done&&(s=qd(this.spec,e,0,n).next()),s.done?null:s.value}prevMatchInRange(e,n,r){for(let s=1;;s++){let i=Math.max(n,r-s*1e4),a=qd(this.spec,e,i,r),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==n||o.from>i+10))return o;if(i==n)return null}}prevMatch(e,n,r){return this.prevMatchInRange(e,0,n)||this.prevMatchInRange(e,r,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(n,r)=>{if(r=="&")return e.match[0];if(r=="$")return"$";for(let s=r.length;s>0;s--){let i=+r.slice(0,s);if(i>0&&i=n)return null;s.push(r.value)}return s}highlight(e,n,r,s){let i=qd(this.spec,e,Math.max(0,n-250),Math.min(r+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}}const s0=Mt.define(),Y6=Mt.define(),mc=is.define({create(t){return new Rw(IS(t).create(),null)},update(t,e){for(let n of e.effects)n.is(s0)?t=new Rw(n.value.create(),t.panel):n.is(Y6)&&(t=new Rw(t.query,n.value?K6:null));return t},provide:t=>Zm.from(t,e=>e.panel)});class Rw{constructor(e,n){this.query=e,this.panel=n}}const Xoe=ft.mark({class:"cm-searchMatch"}),Yoe=ft.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Koe=Nr.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(mc))}update(t){let e=t.state.field(mc);(e!=t.startState.field(mc)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return ft.none;let{view:n}=this,r=new fo;for(let s=0,i=n.visibleRanges,a=i.length;si[s+1].from-500;)c=i[++s].to;t.highlight(n.state,o,c,(h,f)=>{let m=n.state.selection.ranges.some(g=>g.from==h&&g.to==f);r.add(h,f,m?Yoe:Xoe)})}return r.finish()}},{decorations:t=>t.decorations});function ep(t){return e=>{let n=e.state.field(mc,!1);return n&&n.query.spec.valid?t(e,n):Rq(e)}}const G1=ep((t,{query:e})=>{let{to:n}=t.state.selection.main,r=e.nextMatch(t.state,n,n);if(!r)return!1;let s=Ae.single(r.from,r.to),i=t.state.facet(Qh);return t.dispatch({selection:s,effects:[Z6(t,r),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),Aq(t),!0}),X1=ep((t,{query:e})=>{let{state:n}=t,{from:r}=n.selection.main,s=e.prevMatch(n,r,r);if(!s)return!1;let i=Ae.single(s.from,s.to),a=t.state.facet(Qh);return t.dispatch({selection:i,effects:[Z6(t,s),a.scrollToMatch(i.main,t)],userEvent:"select.search"}),Aq(t),!0}),Zoe=ep((t,{query:e})=>{let n=e.matchAll(t.state,1e3);return!n||!n.length?!1:(t.dispatch({selection:Ae.create(n.map(r=>Ae.range(r.from,r.to))),userEvent:"select.search.matches"}),!0)}),Joe=({state:t,dispatch:e})=>{let n=t.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:s}=n.main,i=[],a=0;for(let o=new jh(t.doc,t.sliceDoc(r,s));!o.next().done;){if(i.length>1e3)return!1;o.value.from==r&&(a=i.length),i.push(Ae.range(o.value.from,o.value.to))}return e(t.update({selection:Ae.create(i,a),userEvent:"select.search.matches"})),!0},JT=ep((t,{query:e})=>{let{state:n}=t,{from:r,to:s}=n.selection.main;if(n.readOnly)return!1;let i=e.nextMatch(n,r,r);if(!i)return!1;let a=i,o=[],c,h,f=[];a.from==r&&a.to==s&&(h=n.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:h}),a=e.nextMatch(n,a.from,a.to),f.push(We.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+".")));let m=t.state.changes(o);return a&&(c=Ae.single(a.from,a.to).map(m),f.push(Z6(t,a)),f.push(n.facet(Qh).scrollToMatch(c.main,t))),t.dispatch({changes:m,selection:c,effects:f,userEvent:"input.replace"}),!0}),ece=ep((t,{query:e})=>{if(t.state.readOnly)return!1;let n=e.matchAll(t.state,1e9).map(s=>{let{from:i,to:a}=s;return{from:i,to:a,insert:e.getReplacement(s)}});if(!n.length)return!1;let r=t.state.phrase("replaced $ matches",n.length)+".";return t.dispatch({changes:n,effects:We.announce.of(r),userEvent:"input.replace.all"}),!0});function K6(t){return t.state.facet(Qh).createPanel(t)}function IS(t,e){var n,r,s,i,a;let o=t.selection.main,c=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!c)return e;let h=t.facet(Qh);return new Eq({search:((n=e?.literal)!==null&&n!==void 0?n:h.literal)?c:c.replace(/\n/g,"\\n"),caseSensitive:(r=e?.caseSensitive)!==null&&r!==void 0?r:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:h.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:h.wholeWord})}function Mq(t){let e=Km(t,K6);return e&&e.dom.querySelector("[main-field]")}function Aq(t){let e=Mq(t);e&&e==t.root.activeElement&&e.select()}const Rq=t=>{let e=t.state.field(mc,!1);if(e&&e.panel){let n=Mq(t);if(n&&n!=t.root.activeElement){let r=IS(t.state,e.query.spec);r.valid&&t.dispatch({effects:s0.of(r)}),n.focus(),n.select()}}else t.dispatch({effects:[Y6.of(!0),e?s0.of(IS(t.state,e.query.spec)):Mt.appendConfig.of(sce)]});return!0},Dq=t=>{let e=t.state.field(mc,!1);if(!e||!e.panel)return!1;let n=Km(t,K6);return n&&n.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Y6.of(!1)}),!0},tce=[{key:"Mod-f",run:Rq,scope:"editor search-panel"},{key:"F3",run:G1,shift:X1,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:G1,shift:X1,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Dq,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Joe},{key:"Mod-Alt-g",run:Aoe},{key:"Mod-d",run:Hoe,preventDefault:!0}];class nce{constructor(e){this.view=e;let n=this.query=e.state.field(mc).query.spec;this.commit=this.commit.bind(this),this.searchField=$n("input",{value:n.search,placeholder:wi(e,"Find"),"aria-label":wi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$n("input",{value:n.replace,placeholder:wi(e,"Replace"),"aria-label":wi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$n("input",{type:"checkbox",name:"case",form:"",checked:n.caseSensitive,onchange:this.commit}),this.reField=$n("input",{type:"checkbox",name:"re",form:"",checked:n.regexp,onchange:this.commit}),this.wordField=$n("input",{type:"checkbox",name:"word",form:"",checked:n.wholeWord,onchange:this.commit});function r(s,i,a){return $n("button",{class:"cm-button",name:s,onclick:i,type:"button"},a)}this.dom=$n("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,r("next",()=>G1(e),[wi(e,"next")]),r("prev",()=>X1(e),[wi(e,"previous")]),r("select",()=>Zoe(e),[wi(e,"all")]),$n("label",null,[this.caseField,wi(e,"match case")]),$n("label",null,[this.reField,wi(e,"regexp")]),$n("label",null,[this.wordField,wi(e,"by word")]),...e.state.readOnly?[]:[$n("br"),this.replaceField,r("replace",()=>JT(e),[wi(e,"replace")]),r("replaceAll",()=>ece(e),[wi(e,"replace all")])],$n("button",{name:"close",onclick:()=>Dq(e),"aria-label":wi(e,"close"),type:"button"},["×"])])}commit(){let e=new Eq({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:s0.of(e)}))}keydown(e){lie(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?X1:G1)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),JT(this.view))}update(e){for(let n of e.transactions)for(let r of n.effects)r.is(s0)&&!r.value.eq(this.query)&&this.setQuery(r.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Qh).top}}function wi(t,e){return t.state.phrase(e)}const mx=30,px=/[\s\.,:;?!]/;function Z6(t,{from:e,to:n}){let r=t.state.doc.lineAt(e),s=t.state.doc.lineAt(n).to,i=Math.max(r.from,e-mx),a=Math.min(s,n+mx),o=t.state.sliceDoc(i,a);if(i!=r.from){for(let c=0;co.length-mx;c--)if(!px.test(o[c-1])&&px.test(o[c])){o=o.slice(0,c);break}}return We.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${r.number}.`)}const rce=We.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),sce=[mc,Mc.low(Koe),rce];class zq{constructor(e,n,r,s){this.state=e,this.pos=n,this.explicit=r,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let n=ns(this.state).resolveInner(this.pos,-1);for(;n&&e.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(e){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),s=n.text.slice(r-n.from,this.pos-n.from),i=s.search(Lq(e,!1));return i<0?null:{from:r+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,n,r){e=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function eE(t){let e=Object.keys(t).join(""),n=/\w/.test(e);return n&&(e=e.replace(/\w/g,"")),`[${n?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ice(t){let e=Object.create(null),n=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[n,r]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:ice(e);return s=>{let i=s.matchBefore(r);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:n}:null}}function ace(t,e){return n=>{for(let r=ns(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(t.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return e(n)}}let tE=class{constructor(e,n,r,s){this.completion=e,this.source=n,this.match=r,this.score=s}};function ku(t){return t.selection.main.from}function Lq(t,e){var n;let{source:r}=t,s=e&&r[0]!="^",i=r[r.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${r})${i?"$":""}`,(n=t.flags)!==null&&n!==void 0?n:t.ignoreCase?"i":"")}const J6=hl.define();function lce(t,e,n,r){let{main:s}=t.selection,i=n-s.from,a=r-s.from;return{...t.changeByRange(o=>{if(o!=s&&n!=r&&t.sliceDoc(o.from+i,o.from+a)!=t.sliceDoc(n,r))return{range:o};let c=t.toText(e);return{changes:{from:o.from+i,to:r==s.from?o.to:o.from+a,insert:c},range:Ae.cursor(o.from+i+c.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const nE=new WeakMap;function oce(t){if(!Array.isArray(t))return t;let e=nE.get(t);return e||nE.set(t,e=Pq(t)),e}const Y1=Mt.define(),i0=Mt.define();class cce{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n=48&&_<=57||_>=97&&_<=122?2:_>=65&&_<=90?1:0:(E=b6(_))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!N||M==1&&S||T==0&&M!=0)&&(n[m]==_||r[m]==_&&(g=!0)?a[m++]=N:a.length&&(k=!1)),T=M,N+=Xa(_)}return m==c&&a[0]==0&&k?this.result(-100+(g?-200:0),a,e):x==c&&y==0?this.ret(-200-e.length+(w==e.length?0:-100),[0,w]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):x==c?this.ret(-900-e.length,[y,w]):m==c?this.result(-100+(g?-200:0)+-700+(k?0:-1100),a,e):n.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,n,r){let s=[],i=0;for(let a of n){let o=a+(this.astral?Xa(Ks(r,a)):1);i&&s[i-1]==a?s[i-1]=o:(s[i++]=a,s[i++]=o)}return this.ret(e-r.length,s)}}class uce{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:dce,filterStrict:!1,compareCompletions:(e,n)=>e.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,n)=>e&&n,closeOnBlur:(e,n)=>e&&n,icons:(e,n)=>e&&n,tooltipClass:(e,n)=>r=>rE(e(r),n(r)),optionClass:(e,n)=>r=>rE(e(r),n(r)),addToOptions:(e,n)=>e.concat(n),filterStrict:(e,n)=>e||n})}});function rE(t,e){return t?e?t+" "+e:t:e}function dce(t,e,n,r,s,i){let a=t.textDirection==Jn.RTL,o=a,c=!1,h="top",f,m,g=e.left-s.left,x=s.right-e.right,y=r.right-r.left,w=r.bottom-r.top;if(o&&g=w||N>e.top?f=n.bottom-e.top:(h="bottom",f=e.bottom-n.top)}let S=(e.bottom-e.top)/i.offsetHeight,k=(e.right-e.left)/i.offsetWidth;return{style:`${h}: ${f/S}px; max-width: ${m/k}px`,class:"cm-completionInfo-"+(c?a?"left-narrow":"right-narrow":o?"left":"right")}}function hce(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),r.setAttribute("aria-hidden","true"),r},position:20}),e.push({render(n,r,s,i){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,c=0;for(let h=0;hc&&a.appendChild(document.createTextNode(o.slice(c,f)));let g=a.appendChild(document.createElement("span"));g.appendChild(document.createTextNode(o.slice(f,m))),g.className="cm-completionMatchedText",c=m}return cn.position-r.position).map(n=>n.render)}function Dw(t,e,n){if(t<=n)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/n);return{from:s*n,to:(s+1)*n}}let r=Math.floor((t-e)/n);return{from:t-(r+1)*n,to:t-r*n}}class fce{constructor(e,n,r){this.view=e,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:c=>this.placeInfo(c),key:this},this.space=null,this.currentClass="";let s=e.state.field(n),{options:i,selected:a}=s.open,o=e.state.facet(es);this.optionContent=hce(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Dw(i.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",c=>{let{options:h}=e.state.field(n).open;for(let f=c.target,m;f&&f!=this.dom;f=f.parentNode)if(f.nodeName=="LI"&&(m=/-(\d+)$/.exec(f.id))&&+m[1]{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(es).closeOnBlur&&c.relatedTarget!=e.contentDOM&&e.dispatch({effects:i0.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var n;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),r!=s){let{options:i,selected:a,disabled:o}=r.open;(!s.open||s.open.options!=i)&&(this.range=Dw(i.length,a,e.state.facet(es).maxRenderedOptions),this.showOptions(i,r.id)),this.updateSel(),o!=((n=s.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let n=this.tooltipClass(e);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),n=e.open;(n.selected>-1&&n.selected=this.range.to)&&(this.range=Dw(n.options.length,n.selected,this.view.state.facet(es).maxRenderedOptions),this.showOptions(n.options,e.id));let r=this.updateSelectedOption(n.selected);if(r){this.destroyInfo();let{completion:s}=n.options[n.selected],{info:i}=s;if(!i)return;let a=typeof i=="string"?document.createTextNode(i):i(s);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,s)}).catch(o=>Js(this.view.state,o,"completion info")):(this.addInfoPane(a,s),r.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",r.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)r.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;r.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let n=null;for(let r=this.list.firstChild,s=this.range.from;r;r=r.nextSibling,s++)r.nodeName!="LI"||!r.id?s--:s==e?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&(r.removeAttribute("aria-selected"),r.removeAttribute("aria-describedby"));return n&&pce(this.list,n),n}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let a=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return s.top>Math.min(i.bottom,n.bottom)-10||s.bottom{a.target==s&&a.preventDefault()});let i=null;for(let a=r.from;ar.from||r.from==0))if(i=g,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let x=s.appendChild(document.createElement("completion-section"));x.textContent=g}}const f=s.appendChild(document.createElement("li"));f.id=n+"-"+a,f.setAttribute("role","option");let m=this.optionClass(o);m&&(f.className=m);for(let g of this.optionContent){let x=g(o,this.view.state,this.view,c);x&&f.appendChild(x)}}return r.from&&s.classList.add("cm-completionListIncompleteTop"),r.tonew fce(n,t,e)}function pce(t,e){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),s=n.height/t.offsetHeight;r.topn.bottom&&(t.scrollTop+=(r.bottom-n.bottom)/s)}function sE(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function gce(t,e){let n=[],r=null,s=null,i=f=>{n.push(f);let{section:m}=f.completion;if(m){r||(r=[]);let g=typeof m=="string"?m:m.name;r.some(x=>x.name==g)||r.push(typeof m=="string"?{name:g}:m)}},a=e.facet(es);for(let f of t)if(f.hasResult()){let m=f.result.getMatch;if(f.result.filter===!1)for(let g of f.result.options)i(new tE(g,f.source,m?m(g):[],1e9-n.length));else{let g=e.sliceDoc(f.from,f.to),x,y=a.filterStrict?new uce(g):new cce(g);for(let w of f.result.options)if(x=y.match(w.label)){let S=w.displayLabel?m?m(w,x.matched):[]:x.matched,k=x.score+(w.boost||0);if(i(new tE(w,f.source,S,k)),typeof w.section=="object"&&w.section.rank==="dynamic"){let{name:N}=w.section;s||(s=Object.create(null)),s[N]=Math.max(k,s[N]||-1e9)}}}}if(r){let f=Object.create(null),m=0,g=(x,y)=>(x.rank==="dynamic"&&y.rank==="dynamic"?s[y.name]-s[x.name]:0)||(typeof x.rank=="number"?x.rank:1e9)-(typeof y.rank=="number"?y.rank:1e9)||(x.nameg.score-m.score||h(m.completion,g.completion))){let m=f.completion;!c||c.label!=m.label||c.detail!=m.detail||c.type!=null&&m.type!=null&&c.type!=m.type||c.apply!=m.apply||c.boost!=m.boost?o.push(f):sE(f.completion)>sE(c)&&(o[o.length-1]=f),c=f.completion}return o}class Gd{constructor(e,n,r,s,i,a){this.options=e,this.attrs=n,this.tooltip=r,this.timestamp=s,this.selected=i,this.disabled=a}setSelected(e,n){return e==this.selected||e>=this.options.length?this:new Gd(this.options,iE(n,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,n,r,s,i,a){if(s&&!a&&e.some(h=>h.isPending))return s.setDisabled();let o=gce(e,n);if(!o.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let c=n.facet(es).selectOnOpen?0:-1;if(s&&s.selected!=c&&s.selected!=-1){let h=s.options[s.selected].completion;for(let f=0;ff.hasResult()?Math.min(h,f.from):h,1e8),create:Sce,above:i.aboveCursor},s?s.timestamp:Date.now(),c,!1)}map(e){return new Gd(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Gd(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class K1{constructor(e,n,r){this.active=e,this.id=n,this.open=r}static start(){return new K1(bce,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:n}=e,r=n.facet(es),i=(r.override||n.languageDataAt("autocomplete",ku(n)).map(oce)).map(c=>(this.active.find(f=>f.source==c)||new Ji(c,this.active.some(f=>f.state!=0)?1:0)).update(e,r));i.length==this.active.length&&i.every((c,h)=>c==this.active[h])&&(i=this.active);let a=this.open,o=e.effects.some(c=>c.is(eO));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||i.some(c=>c.hasResult()&&e.changes.touchesRange(c.from,c.to))||!xce(i,this.active)||o?a=Gd.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(c=>c.isPending)&&(a=null),!a&&i.every(c=>!c.isPending)&&i.some(c=>c.hasResult())&&(i=i.map(c=>c.hasResult()?new Ji(c.source,0):c));for(let c of e.effects)c.is(Bq)&&(a=a&&a.setSelected(c.value,this.id));return i==this.active&&a==this.open?this:new K1(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?vce:yce}}function xce(t,e){if(t==e)return!0;for(let n=0,r=0;;){for(;n-1&&(n["aria-activedescendant"]=t+"-"+e),n}const bce=[];function Iq(t,e){if(t.isUserEvent("input.complete")){let r=t.annotation(J6);if(r&&e.activateOnCompletion(r))return 12}let n=t.isUserEvent("input.type");return n&&e.activateOnTyping?5:n?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}class Ji{constructor(e,n,r=!1){this.source=e,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(e,n){let r=Iq(e,n),s=this;(r&8||r&16&&this.touches(e))&&(s=new Ji(s.source,0)),r&4&&s.state==0&&(s=new Ji(this.source,1)),s=s.updateFor(e,r);for(let i of e.effects)if(i.is(Y1))s=new Ji(s.source,1,i.value);else if(i.is(i0))s=new Ji(s.source,0);else if(i.is(eO))for(let a of i.value)a.source==s.source&&(s=a);return s}updateFor(e,n){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(ku(e.state))}}class sh extends Ji{constructor(e,n,r,s,i,a){super(e,3,n),this.limit=r,this.result=s,this.from=i,this.to=a}hasResult(){return!0}updateFor(e,n){var r;if(!(n&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=ku(e.state);if(o>a||!s||n&2&&(ku(e.startState)==this.from||on.map(e))}}),Bq=Mt.define(),Zs=is.define({create(){return K1.start()},update(t,e){return t.update(e)},provide:t=>[D6.from(t,e=>e.tooltip),We.contentAttributes.from(t,e=>e.attrs)]});function tO(t,e){const n=e.completion.apply||e.completion.label;let r=t.state.field(Zs).active.find(s=>s.source==e.source);return r instanceof sh?(typeof n=="string"?t.dispatch({...lce(t.state,n,r.from,r.to),annotations:J6.of(e.completion)}):n(t,e.completion,r.from,r.to),!0):!1}const Sce=mce(Zs,tO);function gx(t,e="option"){return n=>{let r=n.state.field(Zs,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp-1?r.open.selected+s*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),n.dispatch({effects:Bq.of(o)}),!0}}const kce=t=>{let e=t.state.field(Zs,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(Zs,!1)?(t.dispatch({effects:Y1.of(!0)}),!0):!1,Oce=t=>{let e=t.state.field(Zs,!1);return!e||!e.active.some(n=>n.state!=0)?!1:(t.dispatch({effects:i0.of(null)}),!0)};class jce{constructor(e,n){this.active=e,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const Nce=50,Cce=1e3,Tce=Nr.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(Zs).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(Zs),n=t.state.facet(es);if(!t.selectionSet&&!t.docChanged&&t.startState.field(Zs)==e)return;let r=t.transactions.some(i=>{let a=Iq(i,n);return a&8||(i.selection||i.docChanged)&&!(a&3)});for(let i=0;iNce&&Date.now()-a.time>Cce){for(let o of a.context.abortListeners)try{o()}catch(c){Js(this.view.state,c)}a.context.abortListeners=null,this.running.splice(i--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(a=>a.is(Y1)))&&(this.pendingStart=!0);let s=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(a=>a.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(Zs);for(let n of e.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(es).updateSyncTime))}startQuery(t){let{state:e}=this.view,n=ku(e),r=new zq(e,n,t.explicit,this.view),s=new jce(t,r);this.running.push(s),Promise.resolve(t.source(r)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:i0.of(null)}),Js(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(es).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],n=this.view.state.facet(es),r=this.view.state.field(Zs);for(let s=0;so.source==i.active.source);if(a&&a.isPending)if(i.done==null){let o=new Ji(i.active.source,0);for(let c of i.updates)o=o.update(c,n);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:eO.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(Zs,!1);if(e&&e.tooltip&&this.view.state.facet(es).closeOnBlur){let n=e.open&&fB(this.view,e.open.tooltip);(!n||!n.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:i0.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Y1.of(!1)}),20),this.composing=0}}}),Ece=typeof navigator=="object"&&/Win/.test(navigator.platform),_ce=Mc.highest(We.domEventHandlers({keydown(t,e){let n=e.state.field(Zs,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||t.key.length>1||t.ctrlKey&&!(Ece&&t.altKey)||t.metaKey)return!1;let r=n.open.options[n.open.selected],s=n.active.find(a=>a.source==r.source),i=r.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&tO(e,r),!1}})),qq=We.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Mce{constructor(e,n,r,s){this.field=e,this.line=n,this.from=r,this.to=s}}class nO{constructor(e,n,r){this.field=e,this.from=n,this.to=r}map(e){let n=e.mapPos(this.from,-1,fs.TrackDel),r=e.mapPos(this.to,1,fs.TrackDel);return n==null||r==null?null:new nO(this.field,n,r)}}class rO{constructor(e,n){this.lines=e,this.fieldPositions=n}instantiate(e,n){let r=[],s=[n],i=e.doc.lineAt(n),a=/^\s*/.exec(i.text)[0];for(let c of this.lines){if(r.length){let h=a,f=/^\t*/.exec(c)[0].length;for(let m=0;mnew nO(c.field,s[c.line]+c.from,s[c.line]+c.to));return{text:r,ranges:o}}static parse(e){let n=[],r=[],s=[],i;for(let a of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=i[1]?+i[1]:null,c=i[2]||i[3]||"",h=-1,f=c.replace(/\\[{}]/g,m=>m[1]);for(let m=0;m=h&&g.field++}for(let m of s)if(m.line==r.length&&m.from>i.index){let g=i[2]?3+(i[1]||"").length:2;m.from-=g,m.to-=g}s.push(new Mce(h,r.length,i.index,i.index+f.length)),a=a.slice(0,i.index)+c+a.slice(i.index+i[0].length)}a=a.replace(/\\([{}])/g,(o,c,h)=>{for(let f of s)f.line==r.length&&f.from>h&&(f.from--,f.to--);return c}),r.push(a)}return new rO(r,s)}}let Ace=ft.widget({widget:new class extends ml{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),Rce=ft.mark({class:"cm-snippetField"});class Hh{constructor(e,n){this.ranges=e,this.active=n,this.deco=ft.set(e.map(r=>(r.from==r.to?Ace:Rce).range(r.from,r.to)),!0)}map(e){let n=[];for(let r of this.ranges){let s=r.map(e);if(!s)return null;n.push(s)}return new Hh(n,this.active)}selectionInsideField(e){return e.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const tp=Mt.define({map(t,e){return t&&t.map(e)}}),Dce=Mt.define(),a0=is.define({create(){return null},update(t,e){for(let n of e.effects){if(n.is(tp))return n.value;if(n.is(Dce)&&t)return new Hh(t.ranges,n.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>We.decorations.from(t,e=>e?e.deco:ft.none)});function sO(t,e){return Ae.create(t.filter(n=>n.field==e).map(n=>Ae.range(n.from,n.to)))}function zce(t){let e=rO.parse(t);return(n,r,s,i)=>{let{text:a,ranges:o}=e.instantiate(n.state,s),{main:c}=n.state.selection,h={changes:{from:s,to:i==c.from?c.to:i,insert:cn.of(a)},scrollIntoView:!0,annotations:r?[J6.of(r),Pr.userEvent.of("input.complete")]:void 0};if(o.length&&(h.selection=sO(o,0)),o.some(f=>f.field>0)){let f=new Hh(o,0),m=h.effects=[tp.of(f)];n.state.field(a0,!1)===void 0&&m.push(Mt.appendConfig.of([a0,qce,Fce,qq]))}n.dispatch(n.state.update(h))}}function Fq(t){return({state:e,dispatch:n})=>{let r=e.field(a0,!1);if(!r||t<0&&r.active==0)return!1;let s=r.active+t,i=t>0&&!r.ranges.some(a=>a.field==s+t);return n(e.update({selection:sO(r.ranges,s),effects:tp.of(i?null:new Hh(r.ranges,s)),scrollIntoView:!0})),!0}}const Pce=({state:t,dispatch:e})=>t.field(a0,!1)?(e(t.update({effects:tp.of(null)})),!0):!1,Lce=Fq(1),Ice=Fq(-1),Bce=[{key:"Tab",run:Lce,shift:Ice},{key:"Escape",run:Pce}],aE=et.define({combine(t){return t.length?t[0]:Bce}}),qce=Mc.highest(G0.compute([aE],t=>t.facet(aE)));function Ql(t,e){return{...e,apply:zce(t)}}const Fce=We.domEventHandlers({mousedown(t,e){let n=e.state.field(a0,!1),r;if(!n||(r=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=n.ranges.find(i=>i.from<=r&&i.to>=r);return!s||s.field==n.active?!1:(e.dispatch({selection:sO(n.ranges,s.field),effects:tp.of(n.ranges.some(i=>i.field>s.field)?new Hh(n.ranges,s.field):null),scrollIntoView:!0}),!0)}}),l0={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},gu=Mt.define({map(t,e){let n=e.mapPos(t,-1,fs.TrackAfter);return n??void 0}}),iO=new class extends Tu{};iO.startSide=1;iO.endSide=-1;const $q=is.define({create(){return bn.empty},update(t,e){if(t=t.map(e.changes),e.selection){let n=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of e.effects)n.is(gu)&&(t=t.update({add:[iO.range(n.value,n.value+1)]}));return t}});function $ce(){return[Hce,$q]}const Pw="()[]{}<>«»»«[]{}";function Qq(t){for(let e=0;e{if((Qce?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(r.length>2||r.length==2&&Xa(Ks(r,0))==1||e!=s.from||n!=s.to)return!1;let i=Wce(t.state,r);return i?(t.dispatch(i),!0):!1}),Vce=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let r=Hq(t,t.selection.main.head).brackets||l0.brackets,s=null,i=t.changeByRange(a=>{if(a.empty){let o=Gce(t.doc,a.head);for(let c of r)if(c==o&&iy(t.doc,a.head)==Qq(Ks(c,0)))return{changes:{from:a.head-c.length,to:a.head+c.length},range:Ae.cursor(a.head-c.length)}}return{range:s=a}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Uce=[{key:"Backspace",run:Vce}];function Wce(t,e){let n=Hq(t,t.selection.main.head),r=n.brackets||l0.brackets;for(let s of r){let i=Qq(Ks(s,0));if(e==s)return i==s?Kce(t,s,r.indexOf(s+s+s)>-1,n):Xce(t,s,i,n.before||l0.before);if(e==i&&Vq(t,t.selection.main.from))return Yce(t,s,i)}return null}function Vq(t,e){let n=!1;return t.field($q).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function iy(t,e){let n=t.sliceString(e,e+2);return n.slice(0,Xa(Ks(n,0)))}function Gce(t,e){let n=t.sliceString(e-2,e);return Xa(Ks(n,0))==n.length?n:n.slice(1)}function Xce(t,e,n,r){let s=null,i=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:n,from:a.to}],effects:gu.of(a.to+e.length),range:Ae.range(a.anchor+e.length,a.head+e.length)};let o=iy(t.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:e+n,from:a.head},effects:gu.of(a.head+e.length),range:Ae.cursor(a.head+e.length)}:{range:s=a}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Yce(t,e,n){let r=null,s=t.changeByRange(i=>i.empty&&iy(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:Ae.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Kce(t,e,n,r){let s=r.stringPrefixes||l0.stringPrefixes,i=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:gu.of(o.to+e.length),range:Ae.range(o.anchor+e.length,o.head+e.length)};let c=o.head,h=iy(t.doc,c),f;if(h==e){if(lE(t,c))return{changes:{insert:e+e,from:c},effects:gu.of(c+e.length),range:Ae.cursor(c+e.length)};if(Vq(t,c)){let g=n&&t.sliceDoc(c,c+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:c,to:c+g.length,insert:g},range:Ae.cursor(c+g.length)}}}else{if(n&&t.sliceDoc(c-2*e.length,c)==e+e&&(f=oE(t,c-2*e.length,s))>-1&&lE(t,f))return{changes:{insert:e+e+e+e,from:c},effects:gu.of(c+e.length),range:Ae.cursor(c+e.length)};if(t.charCategorizer(c)(h)!=nr.Word&&oE(t,c,s)>-1&&!Zce(t,c,e,s))return{changes:{insert:e+e,from:c},effects:gu.of(c+e.length),range:Ae.cursor(c+e.length)}}return{range:i=o}});return i?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function lE(t,e){let n=ns(t).resolveInner(e+1);return n.parent&&n.from==e}function Zce(t,e,n,r){let s=ns(t).resolveInner(e,-1),i=r.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(s.from,Math.min(s.to,s.from+n.length+i)),c=o.indexOf(n);if(!c||c>-1&&r.indexOf(o.slice(0,c))>-1){let f=s.firstChild;for(;f&&f.from==s.from&&f.to-f.from>n.length+c;){if(t.sliceDoc(f.to-n.length,f.to)==n)return!1;f=f.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function oE(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=nr.Word)return e;for(let s of n){let i=e-s.length;if(t.sliceDoc(i,e)==s&&r(t.sliceDoc(i-1,i))!=nr.Word)return i}return-1}function Jce(t={}){return[_ce,Zs,es.of(t),Tce,eue,qq]}const Uq=[{key:"Ctrl-Space",run:zw},{mac:"Alt-`",run:zw},{mac:"Alt-i",run:zw},{key:"Escape",run:Oce},{key:"ArrowDown",run:gx(!0)},{key:"ArrowUp",run:gx(!1)},{key:"PageDown",run:gx(!0,"page")},{key:"PageUp",run:gx(!1,"page")},{key:"Enter",run:kce}],eue=Mc.highest(G0.computeN([es],t=>t.facet(es).defaultKeymap?[Uq]:[]));class cE{constructor(e,n,r){this.from=e,this.to=n,this.diagnostic=r}}class du{constructor(e,n,r){this.diagnostics=e,this.panel=n,this.selected=r}static init(e,n,r){let s=r.facet(o0).markerFilter;s&&(e=s(e,r));let i=e.slice().sort((x,y)=>x.from-y.from||x.to-y.to),a=new fo,o=[],c=0,h=r.doc.iter(),f=0,m=r.doc.length;for(let x=0;;){let y=x==i.length?null:i[x];if(!y&&!o.length)break;let w,S;if(o.length)w=c,S=o.reduce((C,T)=>Math.min(C,T.to),y&&y.from>w?y.from:1e8);else{if(w=y.from,w>m)break;S=y.to,o.push(y),x++}for(;xC.from||C.to==w))o.push(C),x++,S=Math.min(C.to,S);else{S=Math.min(C.from,S);break}}S=Math.min(S,m);let k=!1;if(o.some(C=>C.from==w&&(C.to==S||S==m))&&(k=w==S,!k&&S-w<10)){let C=w-(f+h.value.length);C>0&&(h.next(C),f=w);for(let T=w;;){if(T>=S){k=!0;break}if(!h.lineBreak&&f+h.value.length>T)break;T=f+h.value.length,f+=h.value.length,h.next()}}let N=fue(o);if(k)a.add(w,w,ft.widget({widget:new cue(N),diagnostics:o.slice()}));else{let C=o.reduce((T,_)=>_.markClass?T+" "+_.markClass:T,"");a.add(w,S,ft.mark({class:"cm-lintRange cm-lintRange-"+N+C,diagnostics:o.slice(),inclusiveEnd:o.some(T=>T.to>S)}))}if(c=S,c==m)break;for(let C=0;C{if(!(e&&a.diagnostics.indexOf(e)<0))if(!r)r=new cE(s,i,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(r.diagnostic)<0)return!1;r=new cE(r.from,i,r.diagnostic)}}),r}function tue(t,e){let n=e.pos,r=e.end||n,s=t.state.facet(o0).hideOn(t,n,r);if(s!=null)return s;let i=t.startState.doc.lineAt(e.pos);return!!(t.effects.some(a=>a.is(Wq))||t.changes.touchesRange(i.from,Math.max(i.to,r)))}function nue(t,e){return t.field(Ti,!1)?e:e.concat(Mt.appendConfig.of(mue))}const Wq=Mt.define(),aO=Mt.define(),Gq=Mt.define(),Ti=is.define({create(){return new du(ft.none,null,null)},update(t,e){if(e.docChanged&&t.diagnostics.size){let n=t.diagnostics.map(e.changes),r=null,s=t.panel;if(t.selected){let i=e.changes.mapPos(t.selected.from,1);r=Nh(n,t.selected.diagnostic,i)||Nh(n,null,i)}!n.size&&s&&e.state.facet(o0).autoPanel&&(s=null),t=new du(n,s,r)}for(let n of e.effects)if(n.is(Wq)){let r=e.state.facet(o0).autoPanel?n.value.length?c0.open:null:t.panel;t=du.init(n.value,r,e.state)}else n.is(aO)?t=new du(t.diagnostics,n.value?c0.open:null,t.selected):n.is(Gq)&&(t=new du(t.diagnostics,t.panel,n.value));return t},provide:t=>[Zm.from(t,e=>e.panel),We.decorations.from(t,e=>e.diagnostics)]}),rue=ft.mark({class:"cm-lintRange cm-lintRange-active"});function sue(t,e,n){let{diagnostics:r}=t.state.field(Ti),s,i=-1,a=-1;r.between(e-(n<0?1:0),e+(n>0?1:0),(c,h,{spec:f})=>{if(e>=c&&e<=h&&(c==h||(e>c||n>0)&&(eYq(t,n,!1)))}const aue=t=>{let e=t.state.field(Ti,!1);(!e||!e.panel)&&t.dispatch({effects:nue(t.state,[aO.of(!0)])});let n=Km(t,c0.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},uE=t=>{let e=t.state.field(Ti,!1);return!e||!e.panel?!1:(t.dispatch({effects:aO.of(!1)}),!0)},lue=t=>{let e=t.state.field(Ti,!1);if(!e)return!1;let n=t.state.selection.main,r=e.diagnostics.iter(n.to+1);return!r.value&&(r=e.diagnostics.iter(0),!r.value||r.from==n.from&&r.to==n.to)?!1:(t.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),!0)},oue=[{key:"Mod-Shift-m",run:aue,preventDefault:!0},{key:"F8",run:lue}],o0=et.define({combine(t){return{sources:t.map(e=>e.source).filter(e=>e!=null),...fl(t.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:dE,tooltipFilter:dE,needsRefresh:(e,n)=>e?n?r=>e(r)||n(r):e:n,hideOn:(e,n)=>e?n?(r,s,i)=>e(r,s,i)||n(r,s,i):e:n,autoPanel:(e,n)=>e||n})}}});function dE(t,e){return t?e?(n,r)=>e(t(n,r),r):t:e}function Xq(t){let e=[];if(t)e:for(let{name:n}of t){for(let r=0;ri.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function Yq(t,e,n){var r;let s=n?Xq(e.actions):[];return $n("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},$n("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(t):e.message),(r=e.actions)===null||r===void 0?void 0:r.map((i,a)=>{let o=!1,c=x=>{if(x.preventDefault(),o)return;o=!0;let y=Nh(t.state.field(Ti).diagnostics,e);y&&i.apply(t,y.from,y.to)},{name:h}=i,f=s[a]?h.indexOf(s[a]):-1,m=f<0?h:[h.slice(0,f),$n("u",h.slice(f,f+1)),h.slice(f+1)],g=i.markClass?" "+i.markClass:"";return $n("button",{type:"button",class:"cm-diagnosticAction"+g,onclick:c,onmousedown:c,"aria-label":` Action: ${h}${f<0?"":` (access key "${s[a]})"`}.`},m)}),e.source&&$n("div",{class:"cm-diagnosticSource"},e.source))}class cue extends ml{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return $n("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class hE{constructor(e,n){this.diagnostic=n,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=Yq(e,n,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class c0{constructor(e){this.view=e,this.items=[];let n=s=>{if(s.keyCode==27)uE(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:i}=this.items[this.selectedIndex],a=Xq(i.actions);for(let o=0;o{for(let i=0;iuE(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Ti).selected;if(!e)return-1;for(let n=0;n{for(let f of h.diagnostics){if(a.has(f))continue;a.add(f);let m=-1,g;for(let x=r;xr&&(this.items.splice(r,m-r),s=!0)),n&&g.diagnostic==n.diagnostic?g.dom.hasAttribute("aria-selected")||(g.dom.setAttribute("aria-selected","true"),i=g):g.dom.hasAttribute("aria-selected")&&g.dom.removeAttribute("aria-selected"),r++}});r({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:o,panel:c})=>{let h=c.height/this.list.offsetHeight;o.topc.bottom&&(this.list.scrollTop+=(o.bottom-c.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function n(){let r=e;e=r.nextSibling,r.remove()}for(let r of this.items)if(r.dom.parentNode==this.list){for(;e!=r.dom;)n();e=r.dom.nextSibling}else this.list.insertBefore(r.dom,e);for(;e;)n()}moveSelection(e){if(this.selectedIndex<0)return;let n=this.view.state.field(Ti),r=Nh(n.diagnostics,this.items[e].diagnostic);r&&this.view.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Gq.of(r)})}static open(e){return new c0(e)}}function uue(t,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(t)}')`}function xx(t){return uue(``,'width="6" height="3"')}const due=We.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:xx("#d11")},".cm-lintRange-warning":{backgroundImage:xx("orange")},".cm-lintRange-info":{backgroundImage:xx("#999")},".cm-lintRange-hint":{backgroundImage:xx("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}});function hue(t){return t=="error"?4:t=="warning"?3:t=="info"?2:1}function fue(t){let e="hint",n=1;for(let r of t){let s=hue(r.severity);s>n&&(n=s,e=r.severity)}return e}const mue=[Ti,We.decorations.compute([Ti],t=>{let{selected:e,panel:n}=t.field(Ti);return!e||!n||e.from==e.to?ft.none:ft.set([rue.range(e.from,e.to)])}),Xie(sue,{hideOn:tue}),due];var fE=function(e){e===void 0&&(e={});var{crosshairCursor:n=!1}=e,r=[];e.closeBracketsKeymap!==!1&&(r=r.concat(Uce)),e.defaultKeymap!==!1&&(r=r.concat(Eoe)),e.searchKeymap!==!1&&(r=r.concat(tce)),e.historyKeymap!==!1&&(r=r.concat(Ple)),e.foldKeymap!==!1&&(r=r.concat(Uae)),e.completionKeymap!==!1&&(r=r.concat(Uq)),e.lintKeymap!==!1&&(r=r.concat(oue));var s=[];return e.lineNumbers!==!1&&s.push(aae()),e.highlightActiveLineGutter!==!1&&s.push(cae()),e.highlightSpecialChars!==!1&&s.push(Oie()),e.history!==!1&&s.push(Cle()),e.foldGutter!==!1&&s.push(Yae()),e.drawSelection!==!1&&s.push(fie()),e.dropCursor!==!1&&s.push(vie()),e.allowMultipleSelections!==!1&&s.push(an.allowMultipleSelections.of(!0)),e.indentOnInput!==!1&&s.push(Lae()),e.syntaxHighlighting!==!1&&s.push(LB(ele,{fallback:!0})),e.bracketMatching!==!1&&s.push(lle()),e.closeBrackets!==!1&&s.push($ce()),e.autocompletion!==!1&&s.push(Jce()),e.rectangularSelection!==!1&&s.push(Iie()),n!==!1&&s.push(Fie()),e.highlightActiveLine!==!1&&s.push(_ie()),e.highlightSelectionMatches!==!1&&s.push(Poe()),e.tabSize&&typeof e.tabSize=="number"&&s.push(Y0.of(" ".repeat(e.tabSize))),s.concat([G0.of(r.flat())]).filter(Boolean)};const pue="#e5c07b",mE="#e06c75",gue="#56b6c2",xue="#ffffff",u1="#abb2bf",BS="#7d8799",vue="#61afef",yue="#98c379",pE="#d19a66",bue="#c678dd",wue="#21252b",gE="#2c313a",xE="#282c34",Lw="#353a42",Sue="#3E4451",vE="#528bff",kue=We.theme({"&":{color:u1,backgroundColor:xE},".cm-content":{caretColor:vE},".cm-cursor, .cm-dropCursor":{borderLeftColor:vE},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Sue},".cm-panels":{backgroundColor:wue,color:u1},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847"},".cm-gutters":{backgroundColor:xE,color:BS,border:"none"},".cm-activeLineGutter":{backgroundColor:gE},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Lw},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Lw,borderBottomColor:Lw},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:gE,color:u1}}},{dark:!0}),Oue=Z0.define([{tag:ve.keyword,color:bue},{tag:[ve.name,ve.deleted,ve.character,ve.propertyName,ve.macroName],color:mE},{tag:[ve.function(ve.variableName),ve.labelName],color:vue},{tag:[ve.color,ve.constant(ve.name),ve.standard(ve.name)],color:pE},{tag:[ve.definition(ve.name),ve.separator],color:u1},{tag:[ve.typeName,ve.className,ve.number,ve.changed,ve.annotation,ve.modifier,ve.self,ve.namespace],color:pue},{tag:[ve.operator,ve.operatorKeyword,ve.url,ve.escape,ve.regexp,ve.link,ve.special(ve.string)],color:gue},{tag:[ve.meta,ve.comment],color:BS},{tag:ve.strong,fontWeight:"bold"},{tag:ve.emphasis,fontStyle:"italic"},{tag:ve.strikethrough,textDecoration:"line-through"},{tag:ve.link,color:BS,textDecoration:"underline"},{tag:ve.heading,fontWeight:"bold",color:mE},{tag:[ve.atom,ve.bool,ve.special(ve.variableName)],color:pE},{tag:[ve.processingInstruction,ve.string,ve.inserted],color:yue},{tag:ve.invalid,color:xue}]),Kq=[kue,LB(Oue)];var jue=We.theme({"&":{backgroundColor:"#fff"}},{dark:!1}),Nue=function(e){e===void 0&&(e={});var{indentWithTab:n=!0,editable:r=!0,readOnly:s=!1,theme:i="light",placeholder:a="",basicSetup:o=!0}=e,c=[];switch(n&&c.unshift(G0.of([_oe])),o&&(typeof o=="boolean"?c.unshift(fE()):c.unshift(fE(o))),a&&c.unshift(Die(a)),i){case"light":c.push(jue);break;case"dark":c.push(Kq);break;case"none":break;default:c.push(i);break}return r===!1&&c.push(We.editable.of(!1)),s&&c.push(an.readOnly.of(!0)),[...c]},Cue=t=>({line:t.state.doc.lineAt(t.state.selection.main.from),lineCount:t.state.doc.lines,lineBreak:t.state.lineBreak,length:t.state.doc.length,readOnly:t.state.readOnly,tabSize:t.state.tabSize,selection:t.state.selection,selectionAsSingle:t.state.selection.asSingle().main,ranges:t.state.selection.ranges,selectionCode:t.state.sliceDoc(t.state.selection.main.from,t.state.selection.main.to),selections:t.state.selection.ranges.map(e=>t.state.sliceDoc(e.from,e.to)),selectedText:t.state.selection.ranges.some(e=>!e.empty)});class Tue{constructor(e,n){this.timeLeftMS=void 0,this.timeoutMS=void 0,this.isCancelled=!1,this.isTimeExhausted=!1,this.callbacks=[],this.timeLeftMS=n,this.timeoutMS=n,this.callbacks.push(e)}tick(){if(!this.isCancelled&&!this.isTimeExhausted&&(this.timeLeftMS--,this.timeLeftMS<=0)){this.isTimeExhausted=!0;var e=this.callbacks.slice();this.callbacks.length=0,e.forEach(n=>{try{n()}catch(r){console.error("TimeoutLatch callback error:",r)}})}}cancel(){this.isCancelled=!0,this.callbacks.length=0}reset(){this.timeLeftMS=this.timeoutMS,this.isCancelled=!1,this.isTimeExhausted=!1}get isDone(){return this.isCancelled||this.isTimeExhausted}}class yE{constructor(){this.interval=null,this.latches=new Set}add(e){this.latches.add(e),this.start()}remove(e){this.latches.delete(e),this.latches.size===0&&this.stop()}start(){this.interval===null&&(this.interval=setInterval(()=>{this.latches.forEach(e=>{e.tick(),e.isDone&&this.remove(e)})},1))}stop(){this.interval!==null&&(clearInterval(this.interval),this.interval=null)}}var Iw=null,Eue=()=>typeof window>"u"?new yE:(Iw||(Iw=new yE),Iw),bE=hl.define(),_ue=200,Mue=[];function Aue(t){var{value:e,selection:n,onChange:r,onStatistics:s,onCreateEditor:i,onUpdate:a,extensions:o=Mue,autoFocus:c,theme:h="light",height:f=null,minHeight:m=null,maxHeight:g=null,width:x=null,minWidth:y=null,maxWidth:w=null,placeholder:S="",editable:k=!0,readOnly:N=!1,indentWithTab:C=!0,basicSetup:T=!0,root:_,initialState:E}=t,[M,q]=b.useState(),[L,I]=b.useState(),[$,V]=b.useState(),ee=b.useState(()=>({current:null}))[0],z=b.useState(()=>({current:null}))[0],H=We.theme({"&":{height:f,minHeight:m,maxHeight:g,width:x,minWidth:y,maxWidth:w},"& .cm-scroller":{height:"100% !important"}}),P=We.updateListener.of(X=>{if(X.docChanged&&typeof r=="function"&&!X.transactions.some(G=>G.annotation(bE))){ee.current?ee.current.reset():(ee.current=new Tue(()=>{if(z.current){var G=z.current;z.current=null,G()}ee.current=null},_ue),Eue().add(ee.current));var R=X.state.doc,se=R.toString();r(se,X)}s&&s(Cue(X))}),W=Nue({theme:h,editable:k,readOnly:N,placeholder:S,indentWithTab:C,basicSetup:T}),J=[P,H,...W];return a&&typeof a=="function"&&J.push(We.updateListener.of(a)),J=J.concat(o),b.useLayoutEffect(()=>{if(M&&!$){var X={doc:e,selection:n,extensions:J},R=E?an.fromJSON(E.json,X,E.fields):an.create(X);if(V(R),!L){var se=new We({state:R,parent:M,root:_});I(se),i&&i(se,R)}}return()=>{L&&(V(void 0),I(void 0))}},[M,$]),b.useEffect(()=>{t.container&&q(t.container)},[t.container]),b.useEffect(()=>()=>{L&&(L.destroy(),I(void 0)),ee.current&&(ee.current.cancel(),ee.current=null)},[L]),b.useEffect(()=>{c&&L&&L.focus()},[c,L]),b.useEffect(()=>{L&&L.dispatch({effects:Mt.reconfigure.of(J)})},[h,o,f,m,g,x,y,w,S,k,N,C,T,r,a]),b.useEffect(()=>{if(e!==void 0){var X=L?L.state.doc.toString():"";if(L&&e!==X){var R=ee.current&&!ee.current.isDone,se=()=>{L&&e!==L.state.doc.toString()&&L.dispatch({changes:{from:0,to:L.state.doc.toString().length,insert:e||""},annotations:[bE.of(!0)]})};R?z.current=se:se()}}},[e,L]),{state:$,setState:V,view:L,setView:I,container:M,setContainer:q}}var Rue=["className","value","selection","extensions","onChange","onStatistics","onCreateEditor","onUpdate","autoFocus","theme","height","minHeight","maxHeight","width","minWidth","maxWidth","basicSetup","placeholder","indentWithTab","editable","readOnly","root","initialState"],Zq=b.forwardRef((t,e)=>{var{className:n,value:r="",selection:s,extensions:i=[],onChange:a,onStatistics:o,onCreateEditor:c,onUpdate:h,autoFocus:f,theme:m="light",height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,root:M,initialState:q}=t,L=SY(t,Rue),I=b.useRef(null),{state:$,view:V,container:ee,setContainer:z}=Aue({root:M,value:r,autoFocus:f,theme:m,height:g,minHeight:x,maxHeight:y,width:w,minWidth:S,maxWidth:k,basicSetup:N,placeholder:C,indentWithTab:T,editable:_,readOnly:E,selection:s,onChange:a,onStatistics:o,onCreateEditor:c,onUpdate:h,extensions:i,initialState:q});b.useImperativeHandle(e,()=>({editor:I.current,state:$,view:V}),[I,ee,$,V]);var H=b.useCallback(W=>{I.current=W,z(W)},[z]);if(typeof r!="string")throw new Error("value must be typeof string but got "+typeof r);var P=typeof m=="string"?"cm-theme-"+m:"cm-theme";return l.jsx("div",kY({ref:H,className:""+P+(n?" "+n:"")},L))});Zq.displayName="CodeMirror";var wE={};class Z1{constructor(e,n,r,s,i,a,o,c,h,f=0,m){this.p=e,this.stack=n,this.state=r,this.reducePos=s,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=c,this.curContext=h,this.lookAhead=f,this.parent=m}toString(){return`[${this.stack.filter((e,n)=>n%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,n,r=0){let s=e.parser.context;return new Z1(e,[],n,r,r,0,[],0,s?new SE(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,n){this.stack.push(this.state,n,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var n;let r=e>>19,s=e&65535,{parser:i}=this.p,a=this.reducePos=2e3&&!(!((n=this.p.parser.nodeSet.types[s])===null||n===void 0)&&n.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=f):this.p.lastBigReductionSizec;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,n,r,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&a.buffer[o-4]==0&&a.buffer[o-1]>-1){if(n==r)return;if(a.buffer[o-2]>=n){a.buffer[o-2]=r;return}}}if(!i||this.pos==r)this.buffer.push(e,n,r,s);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let c=a;c>0&&this.buffer[c-2]>r;c-=4)if(this.buffer[c-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>r;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,s>4&&(s-=4)}this.buffer[a]=e,this.buffer[a+1]=n,this.buffer[a+2]=r,this.buffer[a+3]=s}}shift(e,n,r,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:a}=this.p;(s>this.pos||n<=a.maxNode)&&(this.pos=s,a.stateFlag(i,1)||(this.reducePos=s)),this.pushState(i,r),this.shiftContext(n,r),n<=a.maxNode&&this.buffer.push(n,r,s,4)}else this.pos=s,this.shiftContext(n,r),n<=this.p.parser.maxNode&&this.buffer.push(n,r,s,4)}apply(e,n,r,s){e&65536?this.reduce(e):this.shift(e,n,r,s)}useNode(e,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(n,s),this.buffer.push(r,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,n=e.buffer.length;for(;n>0&&e.buffer[n-2]>e.reducePos;)n-=4;let r=e.buffer.slice(n),s=e.bufferBase+n;for(;e&&s==e.bufferBase;)e=e.parent;return new Z1(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,n){let r=e<=this.p.parser.maxNode;r&&this.storeNode(e,this.pos,n,4),this.storeNode(0,this.pos,n,r?8:4),this.pos=this.reducePos=n,this.score-=190}canShift(e){for(let n=new Due(this);;){let r=this.p.parser.stateSlot(n.state,4)||this.p.parser.hasAction(n.state,e);if(r==0)return!1;if((r&65536)==0)return!0;n.reduce(r)}}recoverByInsert(e){if(this.stack.length>=300)return[];let n=this.p.parser.nextStates(this.state);if(n.length>8||this.stack.length>=120){let s=[];for(let i=0,a;ic&1&&o==a)||s.push(n[i],a)}n=s}let r=[];for(let s=0;s>19,s=n&65535,i=this.stack.length-r*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;n=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(n),!0}findForcedReduction(){let{parser:e}=this.p,n=[],r=(s,i)=>{if(!n.includes(s))return n.push(s),e.allActions(s,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-i;if(o>1){let c=a&65535,h=this.stack.length-o*3;if(h>=0&&e.getGoto(this.stack[h],c,!1)>=0)return o<<19|65536|c}}else{let o=r(a,i+1);if(o!=null)return o}})};return r(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let n=0;nthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class SE{constructor(e,n){this.tracker=e,this.context=n,this.hash=e.strict?e.hash(n):0}}class Due{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let n=e&65535,r=e>>19;r==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(r-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],n,!0);this.state=s}}class J1{constructor(e,n,r){this.stack=e,this.pos=n,this.index=r,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,n=e.bufferBase+e.buffer.length){return new J1(e,n,n-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new J1(this.stack,this.pos,this.index)}}function vx(t,e=Uint16Array){if(typeof t!="string")return t;let n=null;for(let r=0,s=0;r=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,o=!0),i+=c,o)break;i*=46}n?n[s++]=i:n=new e(i)}return n}class d1{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const kE=new d1;class zue{constructor(e,n){this.input=e,this.ranges=n,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=kE,this.rangeIndex=0,this.pos=this.chunkPos=n[0].from,this.range=n[0],this.end=n[n.length-1].to,this.readNext()}resolveOffset(e,n){let r=this.range,s=this.rangeIndex,i=this.pos+e;for(;ir.to:i>=r.to;){if(s==this.ranges.length-1)return null;let a=this.ranges[++s];i+=a.from-r.to,r=a}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,n.from);return this.end}peek(e){let n=this.chunkOff+e,r,s;if(n>=0&&n=this.chunk2Pos&&ro.to&&(this.chunk2=this.chunk2.slice(0,o.to-r)),s=this.chunk2.charCodeAt(0)}}return r>=this.token.lookAhead&&(this.token.lookAhead=r+1),s}acceptToken(e,n=0){let r=n?this.resolveOffset(n,-1):this.pos;if(r==null||r=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,n){if(n?(this.token=n,n.start=e,n.lookAhead=e+1,n.value=n.extended=-1):this.token=kE,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&n<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,n-this.chunkPos);if(e>=this.chunk2Pos&&n<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,n-this.chunk2Pos);if(e>=this.range.from&&n<=this.range.to)return this.input.read(e,n);let r="";for(let s of this.ranges){if(s.from>=n)break;s.to>e&&(r+=this.input.read(Math.max(s.from,e),Math.min(s.to,n)))}return r}}class ih{constructor(e,n){this.data=e,this.id=n}token(e,n){let{parser:r}=n.p;Pue(this.data,e,n,this.id,r.data,r.tokenPrecTable)}}ih.prototype.contextual=ih.prototype.fallback=ih.prototype.extend=!1;ih.prototype.fallback=ih.prototype.extend=!1;class ay{constructor(e,n={}){this.token=e,this.contextual=!!n.contextual,this.fallback=!!n.fallback,this.extend=!!n.extend}}function Pue(t,e,n,r,s,i){let a=0,o=1<0){let y=t[x];if(c.allows(y)&&(e.token.value==-1||e.token.value==y||Lue(y,e.token.value,s,i))){e.acceptToken(y);break}}let f=e.next,m=0,g=t[a+2];if(e.next<0&&g>m&&t[h+g*3-3]==65535){a=t[h+g*3-1];continue e}for(;m>1,y=h+x+(x<<1),w=t[y],S=t[y+1]||65536;if(f=S)m=x+1;else{a=t[y+2],e.advance();continue e}}break}}function OE(t,e,n){for(let r=e,s;(s=t[r])!=65535;r++)if(s==n)return r-e;return-1}function Lue(t,e,n,r){let s=OE(n,r,e);return s<0||OE(n,r,t)e)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,e-25)):Math.min(t.length,Math.max(r.from+1,e+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:t.length}}class Iue{constructor(e,n){this.fragments=e,this.nodeSet=n,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?jE(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?jE(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof Hn){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[n]++,this.nextStart=a+i.length}}}class Bue{constructor(e,n){this.stream=n,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(r=>new d1)}getActions(e){let n=0,r=null,{parser:s}=e.p,{tokenizers:i}=s,a=s.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,c=0;for(let h=0;hm.end+25&&(c=Math.max(m.lookAhead,c)),m.value!=0)){let g=n;if(m.extended>-1&&(n=this.addActions(e,m.extended,m.end,n)),n=this.addActions(e,m.value,m.end,n),!f.extend&&(r=m,n>g))break}}for(;this.actions.length>n;)this.actions.pop();return c&&e.setLookAhead(c),!r&&e.pos==this.stream.end&&(r=new d1,r.value=e.p.parser.eofTerm,r.start=r.end=e.pos,n=this.addActions(e,r.value,r.end,n)),this.mainToken=r,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let n=new d1,{pos:r,p:s}=e;return n.start=r,n.end=Math.min(r+1,s.stream.end),n.value=r==s.stream.end?s.parser.eofTerm:0,n}updateCachedToken(e,n,r){let s=this.stream.clipPos(r.pos);if(n.token(this.stream.reset(s,e),r),e.value>-1){let{parser:i}=r.p;for(let a=0;a=0&&r.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,n,r,s){for(let i=0;ie.bufferLength*4?new Iue(r,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,n=this.minStackPos,r=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;an)r.push(o);else{if(this.advanceStack(o,r,e))continue;{s||(s=[],i=[]),s.push(o);let c=this.tokens.getMainToken(o);i.push(c.value,c.end)}}break}}if(!r.length){let a=s&&Que(s);if(a)return Si&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Si&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+n);this.recovering||(this.recovering=5)}if(this.recovering&&s){let a=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,r);if(a)return Si&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(r.length>a)for(r.sort((o,c)=>c.score-o.score);r.length>a;)r.pop();r.some(o=>o.reducePos>n)&&this.recovering--}else if(r.length>1){e:for(let a=0;a500&&h.buffer.length>500)if((o.score-h.score||o.buffer.length-h.buffer.length)>0)r.splice(c--,1);else{r.splice(a--,1);continue e}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let a=1;a ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,f=h?e.curContext.hash:0;for(let m=this.fragments.nodeAt(s);m;){let g=this.parser.nodeSet.types[m.type.id]==m.type?i.getGoto(e.state,m.type.id):-1;if(g>-1&&m.length&&(!h||(m.prop(Ht.contextHash)||0)==f))return e.useNode(m,g),Si&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(m.type.id)})`),!0;if(!(m instanceof Hn)||m.children.length==0||m.positions[0]>0)break;let x=m.children[0];if(x instanceof Hn&&m.positions[0]==0)m=x;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),Si&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let h=0;hs?n.push(y):r.push(y)}return!1}advanceFully(e,n){let r=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>r)return NE(e,n),!0}}runRecovery(e,n,r){let s=null,i=!1;for(let a=0;a ":"";if(o.deadEnd&&(i||(i=!0,o.restart(),Si&&console.log(f+this.stackID(o)+" (restarted)"),this.advanceFully(o,r))))continue;let m=o.split(),g=f;for(let x=0;x<10&&m.forceReduce()&&(Si&&console.log(g+this.stackID(m)+" (via force-reduce)"),!this.advanceFully(m,r));x++)Si&&(g=this.stackID(m)+" -> ");for(let x of o.recoverByInsert(c))Si&&console.log(f+this.stackID(x)+" (via recover-insert)"),this.advanceFully(x,r);this.stream.end>o.pos?(h==o.pos&&(h++,c=0),o.recoverByDelete(c,h),Si&&console.log(f+this.stackID(o)+` (via recover-delete ${this.parser.getName(c)})`),NE(o,r)):(!s||s.scoret;class $ue{constructor(e){this.start=e.start,this.shift=e.shift||qw,this.reduce=e.reduce||qw,this.reuse=e.reuse||qw,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class u0 extends I6{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let n=e.nodeNames.split(" ");this.minRepeatTerm=n.length;for(let o=0;oe.topRules[o][1]),s=[];for(let o=0;o=0)i(f,c,o[h++]);else{let m=o[h+-f];for(let g=-f;g>0;g--)i(o[h++],c,m);h++}}}this.nodeSet=new Kv(n.map((o,c)=>zs.define({name:c>=this.minRepeatTerm?void 0:o,id:c,props:s[c],top:r.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=xB;let a=vx(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new ih(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,n,r){let s=new que(this,e,n,r);for(let i of this.wrappers)s=i(s,e,n,r);return s}getGoto(e,n,r=!1){let s=this.goto;if(n>=s[0])return-1;for(let i=s[n+1];;){let a=s[i++],o=a&1,c=s[i++];if(o&&r)return c;for(let h=i+(a>>1);i0}validAction(e,n){return!!this.allActions(e,r=>r==n?!0:null)}allActions(e,n){let r=this.stateSlot(e,4),s=r?n(r):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Kl(this.data,i+2);else break;s=n(Kl(this.data,i+1))}return s}nextStates(e){let n=[];for(let r=this.stateSlot(e,1);;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=Kl(this.data,r+2);else break;if((this.data[r+2]&1)==0){let s=this.data[r+1];n.some((i,a)=>a&1&&i==s)||n.push(this.data[r],s)}}return n}configure(e){let n=Object.assign(Object.create(u0.prototype),this);if(e.props&&(n.nodeSet=this.nodeSet.extend(...e.props)),e.top){let r=this.topRules[e.top];if(!r)throw new RangeError(`Invalid top rule name ${e.top}`);n.top=r}return e.tokenizers&&(n.tokenizers=this.tokenizers.map(r=>{let s=e.tokenizers.find(i=>i.from==r);return s?s.to:r})),e.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((r,s)=>{let i=e.specializers.find(o=>o.from==r.external);if(!i)return r;let a=Object.assign(Object.assign({},r),{external:i.to});return n.specializers[s]=CE(a),a})),e.contextTracker&&(n.context=e.contextTracker),e.dialect&&(n.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(n.strict=e.strict),e.wrap&&(n.wrappers=n.wrappers.concat(e.wrap)),e.bufferLength!=null&&(n.bufferLength=e.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let n=this.dynamicPrecedences;return n==null?0:n[e]||0}parseDialect(e){let n=Object.keys(this.dialects),r=n.map(()=>!1);if(e)for(let i of e.split(" ")){let a=n.indexOf(i);a>=0&&(r[a]=!0)}let s=null;for(let i=0;ir)&&n.p.parser.stateFlag(n.state,2)&&(!e||e.scoret.external(n,r)<<1|e}return t.get}const Hue=1,Jq=194,eF=195,Vue=196,TE=197,Uue=198,Wue=199,Gue=200,Xue=2,tF=3,EE=201,Yue=24,Kue=25,Zue=49,Jue=50,ede=55,tde=56,nde=57,rde=59,sde=60,ide=61,ade=62,lde=63,ode=65,cde=238,ude=71,dde=241,hde=242,fde=243,mde=244,pde=245,gde=246,xde=247,vde=248,nF=72,yde=249,bde=250,wde=251,Sde=252,kde=253,Ode=254,jde=255,Nde=256,Cde=73,Tde=77,Ede=263,_de=112,Mde=130,Ade=151,Rde=152,Dde=155,Du=10,d0=13,lO=32,ly=9,oO=35,zde=40,Pde=46,qS=123,_E=125,rF=39,sF=34,ME=92,Lde=111,Ide=120,Bde=78,qde=117,Fde=85,$de=new Set([Kue,Zue,Jue,Ede,ode,Mde,tde,nde,cde,ade,lde,nF,Cde,Tde,sde,ide,Ade,Rde,Dde,_de]);function Fw(t){return t==Du||t==d0}function $w(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}const Qde=new ay((t,e)=>{let n;if(t.next<0)t.acceptToken(Wue);else if(e.context.flags&h1)Fw(t.next)&&t.acceptToken(Uue,1);else if(((n=t.peek(-1))<0||Fw(n))&&e.canShift(TE)){let r=0;for(;t.next==lO||t.next==ly;)t.advance(),r++;(t.next==Du||t.next==d0||t.next==oO)&&t.acceptToken(TE,-r)}else Fw(t.next)&&t.acceptToken(Vue,1)},{contextual:!0}),Hde=new ay((t,e)=>{let n=e.context;if(n.flags)return;let r=t.peek(-1);if(r==Du||r==d0){let s=0,i=0;for(;;){if(t.next==lO)s++;else if(t.next==ly)s+=8-s%8;else break;t.advance(),i++}s!=n.indent&&t.next!=Du&&t.next!=d0&&t.next!=oO&&(s[t,e|iF])),Wde=new $ue({start:Vde,reduce(t,e,n,r){return t.flags&h1&&$de.has(e)||(e==ude||e==nF)&&t.flags&iF?t.parent:t},shift(t,e,n,r){return e==Jq?new f1(t,Ude(r.read(r.pos,n.pos)),0):e==eF?t.parent:e==Yue||e==ede||e==rde||e==tF?new f1(t,0,h1):AE.has(e)?new f1(t,0,AE.get(e)|t.flags&h1):t},hash(t){return t.hash}}),Gde=new ay(t=>{for(let e=0;e<5;e++){if(t.next!="print".charCodeAt(e))return;t.advance()}if(!/\w/.test(String.fromCharCode(t.next)))for(let e=0;;e++){let n=t.peek(e);if(!(n==lO||n==ly)){n!=zde&&n!=Pde&&n!=Du&&n!=d0&&n!=oO&&t.acceptToken(Hue);return}}}),Xde=new ay((t,e)=>{let{flags:n}=e.context,r=n&Wl?sF:rF,s=(n&Gl)>0,i=!(n&Xl),a=(n&Yl)>0,o=t.pos;for(;!(t.next<0);)if(a&&t.next==qS)if(t.peek(1)==qS)t.advance(2);else{if(t.pos==o){t.acceptToken(tF,1);return}break}else if(i&&t.next==ME){if(t.pos==o){t.advance();let c=t.next;c>=0&&(t.advance(),Yde(t,c)),t.acceptToken(Xue);return}break}else if(t.next==ME&&!i&&t.peek(1)>-1)t.advance(2);else if(t.next==r&&(!s||t.peek(1)==r&&t.peek(2)==r)){if(t.pos==o){t.acceptToken(EE,s?3:1);return}break}else if(t.next==Du){if(s)t.advance();else if(t.pos==o){t.acceptToken(EE);return}break}else t.advance();t.pos>o&&t.acceptToken(Gue)});function Yde(t,e){if(e==Lde)for(let n=0;n<2&&t.next>=48&&t.next<=55;n++)t.advance();else if(e==Ide)for(let n=0;n<2&&$w(t.next);n++)t.advance();else if(e==qde)for(let n=0;n<4&&$w(t.next);n++)t.advance();else if(e==Fde)for(let n=0;n<8&&$w(t.next);n++)t.advance();else if(e==Bde&&t.next==qS){for(t.advance();t.next>=0&&t.next!=_E&&t.next!=rF&&t.next!=sF&&t.next!=Du;)t.advance();t.next==_E&&t.advance()}}const Kde=B6({'async "*" "**" FormatConversion FormatSpec':ve.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":ve.controlKeyword,"in not and or is del":ve.operatorKeyword,"from def class global nonlocal lambda":ve.definitionKeyword,import:ve.moduleKeyword,"with as print":ve.keyword,Boolean:ve.bool,None:ve.null,VariableName:ve.variableName,"CallExpression/VariableName":ve.function(ve.variableName),"FunctionDefinition/VariableName":ve.function(ve.definition(ve.variableName)),"ClassDefinition/VariableName":ve.definition(ve.className),PropertyName:ve.propertyName,"CallExpression/MemberExpression/PropertyName":ve.function(ve.propertyName),Comment:ve.lineComment,Number:ve.number,String:ve.string,FormatString:ve.special(ve.string),Escape:ve.escape,UpdateOp:ve.updateOperator,"ArithOp!":ve.arithmeticOperator,BitOp:ve.bitwiseOperator,CompareOp:ve.compareOperator,AssignOp:ve.definitionOperator,Ellipsis:ve.punctuation,At:ve.meta,"( )":ve.paren,"[ ]":ve.squareBracket,"{ }":ve.brace,".":ve.derefOperator,", ;":ve.separator}),Zde={__proto__:null,await:44,or:54,and:56,in:60,not:62,is:64,if:70,else:72,lambda:76,yield:94,from:96,async:102,for:104,None:162,True:164,False:164,del:178,pass:182,break:186,continue:190,return:194,raise:202,import:206,as:208,global:212,nonlocal:214,assert:218,type:223,elif:236,while:240,try:246,except:248,finally:250,with:254,def:258,class:268,match:279,case:285},Jde=u0.deserialize({version:14,states:"##jO`QeOOP$}OSOOO&WQtO'#HUOOQS'#Co'#CoOOQS'#Cp'#CpO'vQdO'#CnO*UQtO'#HTOOQS'#HU'#HUOOQS'#DU'#DUOOQS'#HT'#HTO*rQdO'#D_O+VQdO'#DfO+gQdO'#DjO+zOWO'#DuO,VOWO'#DvO.[QtO'#GuOOQS'#Gu'#GuO'vQdO'#GtO0ZQtO'#GtOOQS'#Eb'#EbO0rQdO'#EcOOQS'#Gs'#GsO0|QdO'#GrOOQV'#Gr'#GrO1XQdO'#FYOOQS'#G^'#G^O1^QdO'#FXOOQV'#IS'#ISOOQV'#Gq'#GqOOQV'#Fq'#FqQ`QeOOO'vQdO'#CqO1lQdO'#C}O1sQdO'#DRO2RQdO'#HYO2cQtO'#EVO'vQdO'#EWOOQS'#EY'#EYOOQS'#E['#E[OOQS'#E^'#E^O2wQdO'#E`O3_QdO'#EdO3rQdO'#EfO3zQtO'#EfO1XQdO'#EiO0rQdO'#ElO1XQdO'#EnO0rQdO'#EtO0rQdO'#EwO4VQdO'#EyO4^QdO'#FOO4iQdO'#EzO0rQdO'#FOO1XQdO'#FQO1XQdO'#FVO4nQdO'#F[P4uOdO'#GpPOOO)CBd)CBdOOQS'#Ce'#CeOOQS'#Cf'#CfOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Cl'#ClO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO'vQdO,59OO5TQdO'#DoOOQS,5:Y,5:YO5hQdO'#HdOOQS,5:],5:]O5uQ!fO,5:]O5zQtO,59YO1lQdO,59bO1lQdO,59bO1lQdO,59bO8jQdO,59bO8oQdO,59bO8vQdO,59jO8}QdO'#HTO:TQdO'#HSOOQS'#HS'#HSOOQS'#D['#D[O:lQdO,59aO'vQdO,59aO:zQdO,59aOOQS,59y,59yO;PQdO,5:RO'vQdO,5:ROOQS,5:Q,5:QO;_QdO,5:QO;dQdO,5:XO'vQdO,5:XO'vQdO,5:VOOQS,5:U,5:UO;uQdO,5:UO;zQdO,5:WOOOW'#Fy'#FyOOOOQS'#Ds'#DsOOQS1G/w1G/wOOQS1G.|1G.|O!/[QtO1G.|O!/cQtO1G.|O1lQdO1G.|O!0OQdO1G/UOOQS'#DZ'#DZO0rQdO,59tOOQS1G.{1G.{O!0VQdO1G/eO!0gQdO1G/eO!0oQdO1G/fO'vQdO'#H[O!0tQdO'#H[O!0yQtO1G.{O!1ZQdO,59iO!2aQdO,5=zO!2qQdO,5=zO!2yQdO1G/mO!3OQtO1G/mOOQS1G/l1G/lO!3`QdO,5=uO!4VQdO,5=uO0rQdO1G/qO!4tQdO1G/sO!4yQtO1G/sO!5ZQtO1G/qOOQS1G/p1G/pOOQS1G/r1G/rOOOW-E9w-E9wOOQS1G/{1G/{O!5kQdO'#HxO0rQdO'#HxO!5|QdO,5>cOOOW-E9x-E9xOOQS1G/|1G/|OOQS-E9{-E9{O!6[Q#xO1G2zO!6{QtO1G2zO'vQdO,5kOOQS1G1`1G1`O!8RQdO1G1`OOQS'#DV'#DVO0rQdO,5=qOOQS,5=q,5=qO!8WQdO'#FrO!8cQdO,59oO!8kQdO1G/XO!8uQtO,5=uOOQS1G3`1G3`OOQS,5:m,5:mO!9fQdO'#GtOOQS,5jO!;ZQdO,5>jO1XQdO,5>jO!;lQdO,5>iOOQS-E:R-E:RO!;qQdO1G0lO!;|QdO1G0lO!lO!lO!hO!=VQdO,5>hO!=hQdO'#EpO0rQdO1G0tO!=sQdO1G0tO!=xQgO1G0zO!AvQgO1G0}O!EqQdO,5>oO!E{QdO,5>oO!FTQtO,5>oO0rQdO1G1PO!F_QdO1G1PO4iQdO1G1UO!!vQdO1G1WOOQV,5;a,5;aO!FdQfO,5;aO!FiQgO1G1QO!JjQdO'#GZO4iQdO1G1QO4iQdO1G1QO!JzQdO,5>pO!KXQdO,5>pO1XQdO,5>pOOQV1G1U1G1UO!KaQdO'#FSO!KrQ!fO1G1WO!KzQdO1G1WOOQV1G1]1G1]O4iQdO1G1]O!LPQdO1G1]O!LXQdO'#F^OOQV1G1b1G1bO!#ZQtO1G1bPOOO1G2v1G2vP!L^OSO1G2vOOQS,5=},5=}OOQS'#Dp'#DpO0rQdO,5=}O!LfQdO,5=|O!LyQdO,5=|OOQS1G/u1G/uO!MRQdO,5>PO!McQdO,5>PO!MkQdO,5>PO!NOQdO,5>PO!N`QdO,5>POOQS1G3j1G3jOOQS7+$h7+$hO!8kQdO7+$pO#!RQdO1G.|O#!YQdO1G.|OOQS1G/`1G/`OOQS,5<`,5<`O'vQdO,5<`OOQS7+%P7+%PO#!aQdO7+%POOQS-E9r-E9rOOQS7+%Q7+%QO#!qQdO,5=vO'vQdO,5=vOOQS7+$g7+$gO#!vQdO7+%PO##OQdO7+%QO##TQdO1G3fOOQS7+%X7+%XO##eQdO1G3fO##mQdO7+%XOOQS,5<_,5<_O'vQdO,5<_O##rQdO1G3aOOQS-E9q-E9qO#$iQdO7+%]OOQS7+%_7+%_O#$wQdO1G3aO#%fQdO7+%_O#%kQdO1G3gO#%{QdO1G3gO#&TQdO7+%]O#&YQdO,5>dO#&sQdO,5>dO#&sQdO,5>dOOQS'#Dx'#DxO#'UO&jO'#DzO#'aO`O'#HyOOOW1G3}1G3}O#'fQdO1G3}O#'nQdO1G3}O#'yQ#xO7+(fO#(jQtO1G2UP#)TQdO'#GOOOQS,5nQdO,5sQdO1G4OOOQS-E9y-E9yO#?^QdO1G4OO<[QdO'#H{OOOO'#D{'#D{OOOO'#F|'#F|O#?oO&jO,5:fOOOW,5>e,5>eOOOW7+)i7+)iO#?zQdO7+)iO#@SQdO1G2zO#@mQdO1G2zP'vQdO'#FuO0rQdO<mO#BQQdO,5>mOOQS1G0v1G0vOOQS<rO#KgQdO,5>rO#KrQdO,5>rO#K}QdO,5>qO#L`QdO,5>qOOQS1G1Y1G1YOOQS,5;p,5;pOOQV<VAN>VO$ oQdO<cAN>cO0rQdO1G1|O$!PQtO1G1|P$!ZQdO'#FvOOQS1G2R1G2RP$!hQdO'#F{O$!uQdO7+)jO$#`QdO,5>gOOOO-E9z-E9zOOOW<tO$4{QdO,5>tO1XQdO,5vO$)nQdO,5>vOOQS1G1p1G1pOOQS,5<[,5<[OOQU7+'P7+'PO$+zQdO1G/iO$)nQdO,5wO$8zQdO,5>wOOQS1G1s1G1sOOQS7+'S7+'SP$)nQdO'#GdO$9SQdO1G4bO$9^QdO1G4bO$9fQdO1G4bOOQS7+%T7+%TO$9tQdO1G1tO$:SQtO'#FaO$:ZQdO,5<}OOQS,5<},5<}O$:iQdO1G4cOOQS-E:a-E:aO$)nQdO,5<|O$:pQdO,5<|O$:uQdO7+)|OOQS-E:`-E:`O$;PQdO7+)|O$)nQdO,5S~O%cOS%^OSSOS%]PQ~OPdOVaOfoOhYOopOs!POvqO!PrO!Q{O!T!SO!U!RO!XZO!][O!h`O!r`O!s`O!t`O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#l!QO#o!TO#s!UO#u!VO#z!WO#}hO$P!XO%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~O%]!YO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%j![O%k!]O%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aO~Ok%xXl%xXm%xXn%xXo%xXp%xXs%xXz%xX{%xX!x%xX#g%xX%[%xX%_%xX%z%xXg%xX!T%xX!U%xX%{%xX!W%xX![%xX!Q%xX#[%xXt%xX!m%xX~P%SOfoOhYO!XZO!][O!h`O!r`O!s`O!t`O%oRO%pRO%tSO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O~Oz%wX{%wX#g%wX%[%wX%_%wX%z%wX~Ok!pOl!qOm!oOn!oOo!rOp!sOs!tO!x%wX~P)pOV!zOg!|Oo0cOv0qO!PrO~P'vOV#OOo0cOv0qO!W#PO~P'vOV#SOa#TOo0cOv0qO![#UO~P'vOQ#XO%`#XO%a#ZO~OQ#^OR#[O%`#^O%a#`O~OV%iX_%iXa%iXh%iXk%iXl%iXm%iXn%iXo%iXp%iXs%iXz%iX!X%iX!f%iX%j%iX%k%iX%l%iX%m%iX%n%iX%o%iX%p%iX%q%iX%r%iX%s%iXg%iX!T%iX!U%iX~O&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O&c^O&d^O&e^O&f^O&g^O&h^O&i^O&j^O{%iX!x%iX#g%iX%[%iX%_%iX%z%iX%{%iX!W%iX![%iX!Q%iX#[%iXt%iX!m%iX~P,eOz#dO{%hX!x%hX#g%hX%[%hX%_%hX%z%hX~Oo0cOv0qO~P'vO#g#gO%[#iO%_#iO~O%uWO~O!T#nO#u!VO#z!WO#}hO~OopO~P'vOV#sOa#tO%uWO{wP~OV#xOo0cOv0qO!Q#yO~P'vO{#{O!x$QO%z#|O#g!yX%[!yX%_!yX~OV#xOo0cOv0qO#g#SX%[#SX%_#SX~P'vOo0cOv0qO#g#WX%[#WX%_#WX~P'vOh$WO%uWO~O!f$YO!r$YO%uWO~OV$eO~P'vO!U$gO#s$hO#u$iO~O{$jO~OV$qO~P'vOS$sO%[$rO%_$rO%c$tO~OV$}Oa$}Og%POo0cOv0qO~P'vOo0cOv0qO{%SO~P'vO&Y%UO~Oa!bOh!iO!X!kO!f!mOVba_bakbalbambanbaobapbasbazba{ba!xba#gba%[ba%_ba%jba%kba%lba%mba%nba%oba%pba%qba%rba%sba%zbagba!Tba!Uba%{ba!Wba![ba!Qba#[batba!mba~On%ZO~Oo%ZO~P'vOo0cO~P'vOk0eOl0fOm0dOn0dOo0mOp0nOs0rOg%wX!T%wX!U%wX%{%wX!W%wX![%wX!Q%wX#[%wX!m%wX~P)pO%{%]Og%vXz%vX!T%vX!U%vX!W%vX{%vX~Og%_Oz%`O!T%dO!U%cO~Og%_O~Oz%gO!T%dO!U%cO!W&SX~O!W%kO~Oz%lO{%nO!T%dO!U%cO![%}X~O![%rO~O![%sO~OQ#XO%`#XO%a%uO~OV%wOo0cOv0qO!PrO~P'vOQ#^OR#[O%`#^O%a%zO~OV!qa_!qaa!qah!qak!qal!qam!qan!qao!qap!qas!qaz!qa{!qa!X!qa!f!qa!x!qa#g!qa%[!qa%_!qa%j!qa%k!qa%l!qa%m!qa%n!qa%o!qa%p!qa%q!qa%r!qa%s!qa%z!qag!qa!T!qa!U!qa%{!qa!W!qa![!qa!Q!qa#[!qat!qa!m!qa~P#yOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P%SOV&OOopOvqO{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~P'vOz%|O{%ha!x%ha#g%ha%[%ha%_%ha%z%ha~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO#g$zX%[$zX%_$zX~P'vO#g#gO%[&TO%_&TO~O!f&UOh&sX%[&sXz&sX#[&sX#g&sX%_&sX#Z&sXg&sX~Oh!iO%[&WO~Okealeameaneaoeapeaseazea{ea!xea#gea%[ea%_ea%zeagea!Tea!Uea%{ea!Wea![ea!Qea#[eatea!mea~P%SOsqazqa{qa#gqa%[qa%_qa%zqa~Ok!pOl!qOm!oOn!oOo!rOp!sO!xqa~PEcO%z&YOz%yX{%yX~O%uWOz%yX{%yX~Oz&]O{wX~O{&_O~Oz%lO#g%}X%[%}X%_%}Xg%}X{%}X![%}X!m%}X%z%}X~OV0lOo0cOv0qO!PrO~P'vO%z#|O#gUa%[Ua%_Ua~Oz&hO#g&PX%[&PX%_&PXn&PX~P%SOz&kO!Q&jO#g#Wa%[#Wa%_#Wa~Oz&lO#[&nO#g&rX%[&rX%_&rXg&rX~O!f$YO!r$YO#Z&qO%uWO~O#Z&qO~Oz&sO#g&tX%[&tX%_&tX~Oz&uO#g&pX%[&pX%_&pX{&pX~O!X&wO%z&xO~Oz&|On&wX~P%SOn'PO~OPdOVaOopOvqO!PrO!Q{O!{tO!}uO#PvO#RwO#TxO#XyO#ZzO#^|O#_|O#a}O#c!OO%['UO~P'vOt'YO#p'WO#q'XOP#naV#naf#nah#nao#nas#nav#na!P#na!Q#na!T#na!U#na!X#na!]#na!h#na!r#na!s#na!t#na!{#na!}#na#P#na#R#na#T#na#X#na#Z#na#^#na#_#na#a#na#c#na#l#na#o#na#s#na#u#na#z#na#}#na$P#na%X#na%o#na%p#na%t#na%u#na&Z#na&[#na&]#na&^#na&_#na&`#na&a#na&b#na&c#na&d#na&e#na&f#na&g#na&h#na&i#na&j#na%Z#na%_#na~Oz'ZO#[']O{&xX~Oh'_O!X&wO~Oh!iO{$jO!X&wO~O{'eO~P%SO%['hO%_'hO~OS'iO%['hO%_'hO~OV!aO_!aOa!bOh!iO!X!kO!f!mO%l!^O%m!_O%n!_O%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%k!]O~P!#uO%kWi~P!#uOV!aO_!aOa!bOh!iO!X!kO!f!mO%o!`O%p!`O%q!aO%r!aO%s!aOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~O%m!_O%n!_O~P!&pO%mWi%nWi~P!&pOa!bOh!iO!X!kO!f!mOkWilWimWinWioWipWisWizWi{Wi!xWi#gWi%[Wi%_Wi%jWi%kWi%lWi%mWi%nWi%oWi%pWi%zWigWi!TWi!UWi%{Wi!WWi![Wi!QWi#[WitWi!mWi~OV!aO_!aO%q!aO%r!aO%s!aO~P!)nOVWi_Wi%qWi%rWi%sWi~P!)nO!T%dO!U%cOg&VXz&VX~O%z'kO%{'kO~P,eOz'mOg&UX~Og'oO~Oz'pO{'rO!W&XX~Oo0cOv0qOz'pO{'sO!W&XX~P'vO!W'uO~Om!oOn!oOo!rOp!sOkjisjizji{ji!xji#gji%[ji%_ji%zji~Ol!qO~P!.aOlji~P!.aOk0eOl0fOm0dOn0dOo0mOp0nO~Ot'wO~P!/jOV'|Og'}Oo0cOv0qO~P'vOg'}Oz(OO~Og(QO~O!U(SO~Og(TOz(OO!T%dO!U%cO~P%SOk0eOl0fOm0dOn0dOo0mOp0nOgqa!Tqa!Uqa%{qa!Wqa![qa!Qqa#[qatqa!mqa~PEcOV'|Oo0cOv0qO!W&Sa~P'vOz(WO!W&Sa~O!W(XO~Oz(WO!T%dO!U%cO!W&Sa~P%SOV(]Oo0cOv0qO![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~P'vOz(^O![%}a#g%}a%[%}a%_%}ag%}a{%}a!m%}a%z%}a~O![(aO~Oz(^O!T%dO!U%cO![%}a~P%SOz(dO!T%dO!U%cO![&Ta~P%SOz(gO{&lX![&lX!m&lX%z&lX~O{(kO![(mO!m(nO%z(jO~OV&OOopOvqO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~P'vOz(pO{%hi!x%hi#g%hi%[%hi%_%hi%z%hi~O!f&UOh&sa%[&saz&sa#[&sa#g&sa%_&sa#Z&sag&sa~O%[(uO~OV#sOa#tO%uWO~Oz&]O{wa~OopOvqO~P'vOz(^O#g%}a%[%}a%_%}ag%}a{%}a![%}a!m%}a%z%}a~P%SOz(zO#g%hX%[%hX%_%hX%z%hX~O%z#|O#gUi%[Ui%_Ui~O#g&Pa%[&Pa%_&Pan&Pa~P'vOz(}O#g&Pa%[&Pa%_&Pan&Pa~O%uWO#g&ra%[&ra%_&rag&ra~Oz)SO#g&ra%[&ra%_&rag&ra~Og)VO~OV)WOh$WO%uWO~O#Z)XO~O%uWO#g&ta%[&ta%_&ta~Oz)ZO#g&ta%[&ta%_&ta~Oo0cOv0qO#g&pa%[&pa%_&pa{&pa~P'vOz)^O#g&pa%[&pa%_&pa{&pa~OV)`Oa)`O%uWO~O%z)eO~Ot)hO#j)gOP#hiV#hif#hih#hio#his#hiv#hi!P#hi!Q#hi!T#hi!U#hi!X#hi!]#hi!h#hi!r#hi!s#hi!t#hi!{#hi!}#hi#P#hi#R#hi#T#hi#X#hi#Z#hi#^#hi#_#hi#a#hi#c#hi#l#hi#o#hi#s#hi#u#hi#z#hi#}#hi$P#hi%X#hi%o#hi%p#hi%t#hi%u#hi&Z#hi&[#hi&]#hi&^#hi&_#hi&`#hi&a#hi&b#hi&c#hi&d#hi&e#hi&f#hi&g#hi&h#hi&i#hi&j#hi%Z#hi%_#hi~Ot)iOP#kiV#kif#kih#kio#kis#kiv#ki!P#ki!Q#ki!T#ki!U#ki!X#ki!]#ki!h#ki!r#ki!s#ki!t#ki!{#ki!}#ki#P#ki#R#ki#T#ki#X#ki#Z#ki#^#ki#_#ki#a#ki#c#ki#l#ki#o#ki#s#ki#u#ki#z#ki#}#ki$P#ki%X#ki%o#ki%p#ki%t#ki%u#ki&Z#ki&[#ki&]#ki&^#ki&_#ki&`#ki&a#ki&b#ki&c#ki&d#ki&e#ki&f#ki&g#ki&h#ki&i#ki&j#ki%Z#ki%_#ki~OV)kOn&wa~P'vOz)lOn&wa~Oz)lOn&wa~P%SOn)pO~O%Y)tO~Ot)wO#p'WO#q)vOP#niV#nif#nih#nio#nis#niv#ni!P#ni!Q#ni!T#ni!U#ni!X#ni!]#ni!h#ni!r#ni!s#ni!t#ni!{#ni!}#ni#P#ni#R#ni#T#ni#X#ni#Z#ni#^#ni#_#ni#a#ni#c#ni#l#ni#o#ni#s#ni#u#ni#z#ni#}#ni$P#ni%X#ni%o#ni%p#ni%t#ni%u#ni&Z#ni&[#ni&]#ni&^#ni&_#ni&`#ni&a#ni&b#ni&c#ni&d#ni&e#ni&f#ni&g#ni&h#ni&i#ni&j#ni%Z#ni%_#ni~OV)zOo0cOv0qO{$jO~P'vOo0cOv0qO{&xa~P'vOz*OO{&xa~OV*SOa*TOg*WO%q*UO%uWO~O{$jO&{*YO~Oh'_O~Oh!iO{$jO~O%[*_O~O%[*aO%_*aO~OV$}Oa$}Oo0cOv0qOg&Ua~P'vOz*dOg&Ua~Oo0cOv0qO{*gO!W&Xa~P'vOz*hO!W&Xa~Oo0cOv0qOz*hO{*kO!W&Xa~P'vOo0cOv0qOz*hO!W&Xa~P'vOz*hO{*kO!W&Xa~Om0dOn0dOo0mOp0nOgjikjisjizji!Tji!Uji%{ji!Wji{ji![ji#gji%[ji%_ji!Qji#[jitji!mji%zji~Ol0fO~P!NkOlji~P!NkOV'|Og*pOo0cOv0qO~P'vOn*rO~Og*pOz*tO~Og*uO~OV'|Oo0cOv0qO!W&Si~P'vOz*vO!W&Si~O!W*wO~OV(]Oo0cOv0qO![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~P'vOz*zO!T%dO!U%cO![&Ti~Oz*}O![%}i#g%}i%[%}i%_%}ig%}i{%}i!m%}i%z%}i~O![+OO~Oa+QOo0cOv0qO![&Ti~P'vOz*zO![&Ti~O![+SO~OV+UOo0cOv0qO{&la![&la!m&la%z&la~P'vOz+VO{&la![&la!m&la%z&la~O!]+YO&n+[O![!nX~O![+^O~O{(kO![+_O~O{(kO![+_O!m+`O~OV&OOopOvqO{%hq!x%hq#g%hq%[%hq%_%hq%z%hq~P'vOz$ri{$ri!x$ri#g$ri%[$ri%_$ri%z$ri~P%SOV&OOopOvqO~P'vOV&OOo0cOv0qO#g%ha%[%ha%_%ha%z%ha~P'vOz+aO#g%ha%[%ha%_%ha%z%ha~Oz$ia#g$ia%[$ia%_$ian$ia~P%SO#g&Pi%[&Pi%_&Pin&Pi~P'vOz+dO#g#Wq%[#Wq%_#Wq~O#[+eOz$va#g$va%[$va%_$vag$va~O%uWO#g&ri%[&ri%_&rig&ri~Oz+gO#g&ri%[&ri%_&rig&ri~OV+iOh$WO%uWO~O%uWO#g&ti%[&ti%_&ti~Oo0cOv0qO#g&pi%[&pi%_&pi{&pi~P'vO{#{Oz#eX!W#eX~Oz+mO!W&uX~O!W+oO~Ot+rO#j)gOP#hqV#hqf#hqh#hqo#hqs#hqv#hq!P#hq!Q#hq!T#hq!U#hq!X#hq!]#hq!h#hq!r#hq!s#hq!t#hq!{#hq!}#hq#P#hq#R#hq#T#hq#X#hq#Z#hq#^#hq#_#hq#a#hq#c#hq#l#hq#o#hq#s#hq#u#hq#z#hq#}#hq$P#hq%X#hq%o#hq%p#hq%t#hq%u#hq&Z#hq&[#hq&]#hq&^#hq&_#hq&`#hq&a#hq&b#hq&c#hq&d#hq&e#hq&f#hq&g#hq&h#hq&i#hq&j#hq%Z#hq%_#hq~On$|az$|a~P%SOV)kOn&wi~P'vOz+yOn&wi~Oz,TO{$jO#[,TO~O#q,VOP#nqV#nqf#nqh#nqo#nqs#nqv#nq!P#nq!Q#nq!T#nq!U#nq!X#nq!]#nq!h#nq!r#nq!s#nq!t#nq!{#nq!}#nq#P#nq#R#nq#T#nq#X#nq#Z#nq#^#nq#_#nq#a#nq#c#nq#l#nq#o#nq#s#nq#u#nq#z#nq#}#nq$P#nq%X#nq%o#nq%p#nq%t#nq%u#nq&Z#nq&[#nq&]#nq&^#nq&_#nq&`#nq&a#nq&b#nq&c#nq&d#nq&e#nq&f#nq&g#nq&h#nq&i#nq&j#nq%Z#nq%_#nq~O#[,WOz%Oa{%Oa~Oo0cOv0qO{&xi~P'vOz,YO{&xi~O{#{O%z,[Og&zXz&zX~O%uWOg&zXz&zX~Oz,`Og&yX~Og,bO~O%Y,eO~O!T%dO!U%cOg&Viz&Vi~OV$}Oa$}Oo0cOv0qOg&Ui~P'vO{,hOz$la!W$la~Oo0cOv0qO{,iOz$la!W$la~P'vOo0cOv0qO{*gO!W&Xi~P'vOz,lO!W&Xi~Oo0cOv0qOz,lO!W&Xi~P'vOz,lO{,oO!W&Xi~Og$hiz$hi!W$hi~P%SOV'|Oo0cOv0qO~P'vOn,qO~OV'|Og,rOo0cOv0qO~P'vOV'|Oo0cOv0qO!W&Sq~P'vOz$gi![$gi#g$gi%[$gi%_$gig$gi{$gi!m$gi%z$gi~P%SOV(]Oo0cOv0qO~P'vOa+QOo0cOv0qO![&Tq~P'vOz,sO![&Tq~O![,tO~OV(]Oo0cOv0qO![%}q#g%}q%[%}q%_%}qg%}q{%}q!m%}q%z%}q~P'vO{,uO~OV+UOo0cOv0qO{&li![&li!m&li%z&li~P'vOz,zO{&li![&li!m&li%z&li~O!]+YO&n+[O![!na~O{(kO![,}O~OV&OOo0cOv0qO#g%hi%[%hi%_%hi%z%hi~P'vOz-OO#g%hi%[%hi%_%hi%z%hi~O%uWO#g&rq%[&rq%_&rqg&rq~Oz-RO#g&rq%[&rq%_&rqg&rq~OV)`Oa)`O%uWO!W&ua~Oz-TO!W&ua~On$|iz$|i~P%SOV)kO~P'vOV)kOn&wq~P'vOt-XOP#myV#myf#myh#myo#mys#myv#my!P#my!Q#my!T#my!U#my!X#my!]#my!h#my!r#my!s#my!t#my!{#my!}#my#P#my#R#my#T#my#X#my#Z#my#^#my#_#my#a#my#c#my#l#my#o#my#s#my#u#my#z#my#}#my$P#my%X#my%o#my%p#my%t#my%u#my&Z#my&[#my&]#my&^#my&_#my&`#my&a#my&b#my&c#my&d#my&e#my&f#my&g#my&h#my&i#my&j#my%Z#my%_#my~O%Z-]O%_-]O~P`O#q-^OP#nyV#nyf#nyh#nyo#nys#nyv#ny!P#ny!Q#ny!T#ny!U#ny!X#ny!]#ny!h#ny!r#ny!s#ny!t#ny!{#ny!}#ny#P#ny#R#ny#T#ny#X#ny#Z#ny#^#ny#_#ny#a#ny#c#ny#l#ny#o#ny#s#ny#u#ny#z#ny#}#ny$P#ny%X#ny%o#ny%p#ny%t#ny%u#ny&Z#ny&[#ny&]#ny&^#ny&_#ny&`#ny&a#ny&b#ny&c#ny&d#ny&e#ny&f#ny&g#ny&h#ny&i#ny&j#ny%Z#ny%_#ny~Oz-aO{$jO#[-aO~Oo0cOv0qO{&xq~P'vOz-dO{&xq~O%z,[Og&zaz&za~O{#{Og&zaz&za~OV*SOa*TO%q*UO%uWOg&ya~Oz-hOg&ya~O$S-lO~OV$}Oa$}Oo0cOv0qO~P'vOo0cOv0qO{-mOz$li!W$li~P'vOo0cOv0qOz$li!W$li~P'vO{-mOz$li!W$li~Oo0cOv0qO{*gO~P'vOo0cOv0qO{*gO!W&Xq~P'vOz-pO!W&Xq~Oo0cOv0qOz-pO!W&Xq~P'vOs-sO!T%dO!U%cOg&Oq!W&Oq![&Oqz&Oq~P!/jOa+QOo0cOv0qO![&Ty~P'vOz$ji![$ji~P%SOa+QOo0cOv0qO~P'vOV+UOo0cOv0qO~P'vOV+UOo0cOv0qO{&lq![&lq!m&lq%z&lq~P'vO{(kO![-xO!m-yO%z-wO~OV&OOo0cOv0qO#g%hq%[%hq%_%hq%z%hq~P'vO%uWO#g&ry%[&ry%_&ryg&ry~OV)`Oa)`O%uWO!W&ui~Ot-}OP#m!RV#m!Rf#m!Rh#m!Ro#m!Rs#m!Rv#m!R!P#m!R!Q#m!R!T#m!R!U#m!R!X#m!R!]#m!R!h#m!R!r#m!R!s#m!R!t#m!R!{#m!R!}#m!R#P#m!R#R#m!R#T#m!R#X#m!R#Z#m!R#^#m!R#_#m!R#a#m!R#c#m!R#l#m!R#o#m!R#s#m!R#u#m!R#z#m!R#}#m!R$P#m!R%X#m!R%o#m!R%p#m!R%t#m!R%u#m!R&Z#m!R&[#m!R&]#m!R&^#m!R&_#m!R&`#m!R&a#m!R&b#m!R&c#m!R&d#m!R&e#m!R&f#m!R&g#m!R&h#m!R&i#m!R&j#m!R%Z#m!R%_#m!R~Oo0cOv0qO{&xy~P'vOV*SOa*TO%q*UO%uWOg&yi~O$S-lO%Z.VO%_.VO~OV.aOh._O!X.^O!].`O!h.YO!s.[O!t.[O%p.XO%uWO&Z]O&[]O&]]O&^]O&_]O&`]O&a]O&b]O~Oo0cOv0qOz$lq!W$lq~P'vO{.fOz$lq!W$lq~Oo0cOv0qO{*gO!W&Xy~P'vOz.gO!W&Xy~Oo0cOv.kO~P'vOs-sO!T%dO!U%cOg&Oy!W&Oy![&Oyz&Oy~P!/jO{(kO![.nO~O{(kO![.nO!m.oO~OV*SOa*TO%q*UO%uWO~Oh.tO!f.rOz$TX#[$TX%j$TXg$TX~Os$TX{$TX!W$TX![$TX~P$-bO%o.vO%p.vOs$UXz$UX{$UX#[$UX%j$UX!W$UXg$UX![$UX~O!h.xO~Oz.|O#[/OO%j.yOs&|X{&|X!W&|Xg&|X~Oa/RO~P$)zOh.tOs&}Xz&}X{&}X#[&}X%j&}X!W&}Xg&}X![&}X~Os/VO{$jO~Oo0cOv0qOz$ly!W$ly~P'vOo0cOv0qO{*gO!W&X!R~P'vOz/ZO!W&X!R~Og&RXs&RX!T&RX!U&RX!W&RX![&RXz&RX~P!/jOs-sO!T%dO!U%cOg&Qa!W&Qa![&Qaz&Qa~O{(kO![/^O~O!f.rOh$[as$[az$[a{$[a#[$[a%j$[a!W$[ag$[a![$[a~O!h/eO~O%o.vO%p.vOs$Uaz$Ua{$Ua#[$Ua%j$Ua!W$Uag$Ua![$Ua~O%j.yOs$Yaz$Ya{$Ya#[$Ya!W$Yag$Ya![$Ya~Os&|a{&|a!W&|ag&|a~P$)nOz/jOs&|a{&|a!W&|ag&|a~O!W/mO~Og/mO~O{/oO~O![/pO~Oo0cOv0qO{*gO!W&X!Z~P'vO{/sO~O%z/tO~P$-bOz/uO#[/OO%j.yOg'PX~Oz/uOg'PX~Og/wO~O!h/xO~O#[/OOs%Saz%Sa{%Sa%j%Sa!W%Sag%Sa![%Sa~O#[/OO%j.yOs%Waz%Wa{%Wa!W%Wag%Wa~Os&|i{&|i!W&|ig&|i~P$)nOz/zO#[/OO%j.yO!['Oa~Og'Pa~P$)nOz0SOg'Pa~Oa0UO!['Oi~P$)zOz0WO!['Oi~Oz0WO#[/OO%j.yO!['Oi~O#[/OO%j.yOg$biz$bi~O%z0ZO~P$-bO#[/OO%j.yOg%Vaz%Va~Og'Pi~P$)nO{0^O~Oa0UO!['Oq~P$)zOz0`O!['Oq~O#[/OO%j.yOz%Ui![%Ui~Oa0UO~P$)zOa0UO!['Oy~P$)zO#[/OO%j.yOg$ciz$ci~O#[/OO%j.yOz%Uq![%Uq~Oz+aO#g%ha%[%ha%_%ha%z%ha~P%SOV&OOo0cOv0qO~P'vOn0hO~Oo0hO~P'vO{0iO~Ot0jO~P!/jO&]&Z&j&h&i&g&f&d&e&c&b&`&a&_&^&[%u~",goto:"!=j'QPPPPPP'RP'Z*s+[+t,_,y-fP.SP'Z.r.r'ZPPP'Z2[PPPPPP2[5PPP5PP7b7k=sPP=v>h>kPP'Z'ZPP>zPP'Z'ZPP'Z'Z'Z'Z'Z?O?w'ZP?zP@QDXGuGyPG|HWH['ZPPPH_Hk'RP'R'RP'RP'RP'RP'RP'R'R'RP'RPP'RPP'RP'RPHqH}IVPI^IdPI^PI^I^PPPI^PKrPK{LVL]KrPI^LfPI^PLmLsPLwM]MzNeLwLwNkNxLwLwLwLw! ^! d! g! l! o! y!!P!!]!!o!!u!#P!#V!#s!#y!$P!$Z!$a!$g!$y!%T!%Z!%a!%k!%q!%w!%}!&T!&Z!&e!&k!&u!&{!'U!'[!'k!'s!'}!(UPPPPPPPPPPP!([!(_!(e!(n!(x!)TPPPPPPPPPPPP!-u!/Z!3^!6oPP!6w!7W!7a!8Y!8P!8c!8i!8l!8o!8r!8z!9jPPPPPPPPPPPPPPPPP!9m!9q!9wP!:]!:a!:m!:v!;S!;j!;m!;p!;v!;|!_![!]Do!]!^Es!^!_FZ!_!`Gk!`!aHX!a!b%T!b!cIf!c!dJU!d!eK^!e!hJU!h!i!#f!i!tJU!t!u!,|!u!wJU!w!x!.t!x!}JU!}#O!0S#O#P&o#P#Q!0j#Q#R!1Q#R#SJU#S#T%T#T#UJU#U#VK^#V#YJU#Y#Z!#f#Z#fJU#f#g!,|#g#iJU#i#j!.t#j#oJU#o#p!1n#p#q!1s#q#r!2a#r#s!2f#s$g%T$g;'SJU;'S;=`KW<%lOJU`%YT&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T`%lP;=`<%l%To%v]&n`%c_OX%TXY%oY[%T[]%o]p%Tpq%oq#O%T#O#P&o#P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To&tX&n`OY%TYZ%oZ]%T]^%o^#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc'f[&n`O!_%T!_!`([!`#T%T#T#U(r#U#f%T#f#g(r#g#h(r#h#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(cTmR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc(yT!mR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk)aV&n`&[ZOr%Trs)vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk){V&n`Or%Trs*bs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk*iT&n`&^ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To+PZS_&n`OY*xYZ%TZ]*x]^%T^#o*x#o#p+r#p#q*x#q#r+r#r;'S*x;'S;=`,^<%lO*x_+wTS_OY+rZ]+r^;'S+r;'S;=`,W<%lO+r_,ZP;=`<%l+ro,aP;=`<%l*xj,kV%rQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-XT!xY&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj-oV%lQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.]V&n`&ZZOw%Twx.rx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk.wV&n`Ow%Twx/^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/eT&n`&]ZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk/{ThZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc0cTgR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk0yXVZ&n`Oz%Tz{1f{!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk1mVaR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk2ZV%oZ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc2wTzR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To3_W%pZ&n`O!_%T!_!`-Q!`!a3w!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Td4OT&{S&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk4fX!fQ&n`O!O%T!O!P5R!P!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5WV&n`O!O%T!O!P5m!P#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk5tT!rZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti6[a!hX&n`O!Q%T!Q![6T![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S6T#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti7fZ&n`O{%T{|8X|}%T}!O8X!O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8^V&n`O!Q%T!Q![8s![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti8z]!hX&n`O!Q%T!Q![8s![!l%T!l!m9s!m#R%T#R#S8s#S#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti9zT!hX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk:bX%qR&n`O!P%T!P!Q:}!Q!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj;UV%sQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti;ro!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!d%T!d!e?q!e!g%T!g!h7a!h!l%T!l!m9s!m!q%T!q!rA]!r!z%T!z!{Bq!{#R%T#R#S>_#S#U%T#U#V?q#V#X%T#X#Y7a#Y#^%T#^#_9s#_#c%T#c#dA]#d#l%T#l#mBq#m#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti=xV&n`O!Q%T!Q![6T![#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti>fc!hX&n`O!O%T!O!P=s!P!Q%T!Q![>_![!g%T!g!h7a!h!l%T!l!m9s!m#R%T#R#S>_#S#X%T#X#Y7a#Y#^%T#^#_9s#_#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti?vY&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Ti@mY!hX&n`O!Q%T!Q!R@f!R!S@f!S#R%T#R#S@f#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiAbX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBUX!hX&n`O!Q%T!Q!YA}!Y#R%T#R#SA}#S#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiBv]&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TiCv]!hX&n`O!Q%T!Q![Co![!c%T!c!iCo!i#R%T#R#SCo#S#T%T#T#ZCo#Z#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToDvV{_&n`O!_%T!_!`E]!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TcEdT%{R&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkEzT#gZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkFbXmR&n`O!^%T!^!_F}!_!`([!`!a([!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjGUV%mQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkGrV%zZ&n`O!_%T!_!`([!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkH`WmR&n`O!_%T!_!`([!`!aHx!a#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TjIPV%nQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkIoV_Q#}P&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%ToJ_]&n`&YS%uZO!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoKZP;=`<%lJUoKge&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!tJU!t!uLx!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#gLx#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUoMRa&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUkN_V&n`&`ZOr%TrsNts#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%TkNyV&n`Or%Trs! `s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! gT&n`&bZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk! }V&n`&_ZOw%Twx!!dx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!!iV&n`Ow%Twx!#Ox#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!#VT&n`&aZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!#oe&n`&YS%uZOr%Trs!%Qsw%Twx!&px!Q%T!Q![JU![!c%T!c!tJU!t!u!(`!u!}JU!}#R%T#R#SJU#S#T%T#T#fJU#f#g!(`#g#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!%XV&n`&dZOr%Trs!%ns#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!%sV&n`Or%Trs!&Ys#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&aT&n`&fZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!&wV&n`&cZOw%Twx!'^x#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!'cV&n`Ow%Twx!'xx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!(PT&n`&eZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!(ia&n`&YS%uZOr%Trs!)nsw%Twx!+^x!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!)uV&n`&hZOr%Trs!*[s#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*aV&n`Or%Trs!*vs#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!*}T&n`&jZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!+eV&n`&gZOw%Twx!+zx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,PV&n`Ow%Twx!,fx#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tk!,mT&n`&iZO#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%To!-Vi&n`&YS%uZOr%TrsNWsw%Twx! vx!Q%T!Q![JU![!c%T!c!dJU!d!eLx!e!hJU!h!i!(`!i!}JU!}#R%T#R#SJU#S#T%T#T#UJU#U#VLx#V#YJU#Y#Z!(`#Z#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUo!.}a&n`&YS%uZOr%Trs)Ysw%Twx.Ux!Q%T!Q![JU![!c%T!c!}JU!}#R%T#R#SJU#S#T%T#T#oJU#p#q%T#r$g%T$g;'SJU;'S;=`KW<%lOJUk!0ZT!XZ&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tc!0qT!WR&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%Tj!1XV%kQ&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!1sO!]~k!1zV%jR&n`O!_%T!_!`-Q!`#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T~!2fO![~i!2mT%tX&n`O#o%T#p#q%T#r;'S%T;'S;=`%i<%lO%T",tokenizers:[Gde,Hde,Qde,Xde,0,1,2,3,4],topRules:{Script:[0,5]},specialized:[{term:221,get:t=>Zde[t]||-1}],tokenPrec:7668}),RE=new gae,aF=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function yx(t){return(e,n,r)=>{if(r)return!1;let s=e.node.getChild("VariableName");return s&&n(s,t),!0}}const ehe={FunctionDefinition:yx("function"),ClassDefinition:yx("class"),ForStatement(t,e,n){if(n){for(let r=t.node.firstChild;r;r=r.nextSibling)if(r.name=="VariableName")e(r,"variable");else if(r.name=="in")break}},ImportStatement(t,e){var n,r;let{node:s}=t,i=((n=s.firstChild)===null||n===void 0?void 0:n.name)=="from";for(let a=s.getChild("import");a;a=a.nextSibling)a.name=="VariableName"&&((r=a.nextSibling)===null||r===void 0?void 0:r.name)!="as"&&e(a,i?"variable":"namespace")},AssignStatement(t,e){for(let n=t.node.firstChild;n;n=n.nextSibling)if(n.name=="VariableName")e(n,"variable");else if(n.name==":"||n.name=="AssignOp")break},ParamList(t,e){for(let n=null,r=t.node.firstChild;r;r=r.nextSibling)r.name=="VariableName"&&(!n||!/\*|AssignOp/.test(n.name))&&e(r,"variable"),n=r},CapturePattern:yx("variable"),AsPattern:yx("variable"),__proto__:null};function lF(t,e){let n=RE.get(e);if(n)return n;let r=[],s=!0;function i(a,o){let c=t.sliceString(a.from,a.to);r.push({label:c,type:o})}return e.cursor(Ur.IncludeAnonymous).iterate(a=>{if(a.name){let o=ehe[a.name];if(o&&o(a,i,s)||!s&&aF.has(a.name))return!1;s=!1}else if(a.to-a.from>8192){for(let o of lF(t,a.node))r.push(o);return!1}}),RE.set(e,r),r}const DE=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,oF=["String","FormatString","Comment","PropertyName"];function the(t){let e=ns(t.state).resolveInner(t.pos,-1);if(oF.indexOf(e.name)>-1)return null;let n=e.name=="VariableName"||e.to-e.from<20&&DE.test(t.state.sliceDoc(e.from,e.to));if(!n&&!t.explicit)return null;let r=[];for(let s=e;s;s=s.parent)aF.has(s.name)&&(r=r.concat(lF(t.state.doc,s)));return{options:r,from:n?e.from:t.pos,validFor:DE}}const nhe=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map(t=>({label:t,type:"constant"})).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map(t=>({label:t,type:"type"}))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map(t=>({label:t,type:"class"}))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map(t=>({label:t,type:"function"}))),rhe=[Ql("def ${name}(${params}):\n ${}",{label:"def",detail:"function",type:"keyword"}),Ql("for ${name} in ${collection}:\n ${}",{label:"for",detail:"loop",type:"keyword"}),Ql("while ${}:\n ${}",{label:"while",detail:"loop",type:"keyword"}),Ql("try:\n ${}\nexcept ${error}:\n ${}",{label:"try",detail:"/ except block",type:"keyword"}),Ql(`if \${}: -`,{label:"if",detail:"block",type:"keyword"}),qo("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),qo("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),qo("import ${module}",{label:"import",detail:"statement",type:"keyword"}),qo("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Qde=Vle(Jq,Cq(Fde.concat($de)));function Lw(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function Iw(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const Bw=Zm.define({name:"python",parser:Ide.configure({props:[Gv.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&Lw(t)||t.node;return(e=Iw(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=Lw(t);return(e=Iw(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":ww({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":ww({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":ww({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=Lw(t);return(e=n&&Iw(t,n))!==null&&e!==void 0?e:t.continue()}}),I6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":yB,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function Hde(){return new gB(Bw,[Bw.data.of({autocomplete:qde}),Bw.data.of({autocomplete:Qde})])}const Vde=z6({String:ve.string,Number:ve.number,"True False":ve.bool,PropertyName:ve.propertyName,Null:ve.null,", :":ve.separator,"[ ]":ve.squareBracket,"{ }":ve.brace}),Ude=o0.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[Vde],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),Wde=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=Gde(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function Gde(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const Xde=Zm.define({name:"json",parser:Ude.configure({props:[Gv.add({Object:TT({except:/^\s*\}/}),Array:TT({except:/^\s*\]/})}),I6.add({"Object Array":yB})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function Yde(){return new gB(Xde)}const Kde={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},Zde={python:[Hde()],json:[Yde(),Wde()],toml:[B6.define(Kde)],text:[]};function Jde({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:l,theme:c="dark",className:h=""}){const[f,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!f)return o.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...Zde[n]||[],We.lineWrapping];return r&&g.push(We.editable.of(!1)),o.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:o.jsx(Qq,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?$q:void 0,extensions:g,onChange:e,placeholder:l,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function ehe(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:N}=Wr(),[C,T]=b.useState(null),[_,E]=b.useState(null),[M,q]=b.useState(null),[L,I]=b.useState(null),[$,V]=b.useState(null),[ee,z]=b.useState(null),[H,P]=b.useState(null),[W,J]=b.useState(null),[X,R]=b.useState(null),[se,G]=b.useState(null),[F,U]=b.useState(null),[te,ne]=b.useState(null),[Y,ae]=b.useState(null),[re,oe]=b.useState(null),[_e,Ge]=b.useState(null),[tt,Xe]=b.useState(null),[je,Qe]=b.useState(null),[He,$e]=b.useState(null),bt=b.useRef(null),ot=b.useRef(!0),on=b.useRef({}),Tn=b.useCallback(async()=>{try{const ie=await Qne();w(ie),k(!1)}catch(ie){N({variant:"destructive",title:"加载失败",description:ie instanceof Error?ie.message:"加载源代码失败"})}},[N]),Nn=b.useCallback(async()=>{try{e(!0);const ie=await g9();on.current=ie,T(ie.bot),E(ie.personality);const xe=ie.chat;xe.talk_value_rules||(xe.talk_value_rules=[]),q(xe),I(ie.expression),V(ie.emoji),z(ie.memory),P(ie.tool),J(ie.mood),R(ie.voice),G(ie.lpmm_knowledge),U(ie.keyword_reaction),ne(ie.response_post_process),ae(ie.chinese_typo),oe(ie.response_splitter),Ge(ie.log),Xe(ie.debug),Qe(ie.maim_message),$e(ie.telemetry),l(!1),ot.current=!1,await Tn()}catch(ie){console.error("加载配置失败:",ie),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[N,Tn]);b.useEffect(()=>{Nn()},[Nn]);const Rt=b.useCallback(async(ie,xe)=>{if(!ot.current)try{i(!0),await Vne(ie,xe),l(!1)}catch(Je){console.error(`自动保存 ${ie} 失败:`,Je),l(!0)}finally{i(!1)}},[]),xt=b.useCallback((ie,xe)=>{ot.current||(l(!0),bt.current&&clearTimeout(bt.current),bt.current=setTimeout(()=>{Rt(ie,xe)},2e3))},[Rt]);b.useEffect(()=>{C&&!ot.current&&xt("bot",C)},[C,xt]),b.useEffect(()=>{_&&!ot.current&&xt("personality",_)},[_,xt]),b.useEffect(()=>{M&&!ot.current&&xt("chat",M)},[M,xt]),b.useEffect(()=>{L&&!ot.current&&xt("expression",L)},[L,xt]),b.useEffect(()=>{$&&!ot.current&&xt("emoji",$)},[$,xt]),b.useEffect(()=>{ee&&!ot.current&&xt("memory",ee)},[ee,xt]),b.useEffect(()=>{H&&!ot.current&&xt("tool",H)},[H,xt]),b.useEffect(()=>{W&&!ot.current&&xt("mood",W)},[W,xt]),b.useEffect(()=>{X&&!ot.current&&xt("voice",X)},[X,xt]),b.useEffect(()=>{se&&!ot.current&&xt("lpmm_knowledge",se)},[se,xt]),b.useEffect(()=>{F&&!ot.current&&xt("keyword_reaction",F)},[F,xt]),b.useEffect(()=>{te&&!ot.current&&xt("response_post_process",te)},[te,xt]),b.useEffect(()=>{Y&&!ot.current&&xt("chinese_typo",Y)},[Y,xt]),b.useEffect(()=>{re&&!ot.current&&xt("response_splitter",re)},[re,xt]),b.useEffect(()=>{_e&&!ot.current&&xt("log",_e)},[_e,xt]),b.useEffect(()=>{tt&&!ot.current&&xt("debug",tt)},[tt,xt]),b.useEffect(()=>{je&&!ot.current&&xt("maim_message",je)},[je,xt]),b.useEffect(()=>{He&&!ot.current&&xt("telemetry",He)},[He,xt]);const Te=async()=>{try{r(!0),await Hne(y),l(!1),k(!1),N({title:"保存成功",description:"配置已保存"}),await Nn()}catch(ie){k(!0),N({variant:"destructive",title:"保存失败",description:ie instanceof Error?ie.message:"保存配置失败"})}finally{r(!1)}},Re=async ie=>{if(a){N({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(ie),ie==="source")await Tn();else try{const xe=await g9();on.current=xe,T(xe.bot),E(xe.personality);const Je=xe.chat;Je.talk_value_rules||(Je.talk_value_rules=[]),q(Je),I(xe.expression),V(xe.emoji),z(xe.memory),P(xe.tool),J(xe.mood),R(xe.voice),G(xe.lpmm_knowledge),U(xe.keyword_reaction),ne(xe.response_post_process),ae(xe.chinese_typo),oe(xe.response_splitter),Ge(xe.log),Xe(xe.debug),Qe(xe.maim_message),$e(xe.telemetry),l(!1)}catch(xe){console.error("加载配置失败:",xe),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},qe=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...on.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await x9(ie),l(!1),N({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ie){console.error("保存配置失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),Bv().catch(()=>{}),m(!0)}catch(ie){console.error("重启失败:",ie),m(!1),N({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},wt=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...on.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await x9(ie),l(!1),N({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(xe=>setTimeout(xe,500)),await rt()}catch(ie){console.error("保存失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},jt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ne=()=>{m(!1),h(!1),N({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?o.jsx(kn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[o.jsx(ll,{value:g,onValueChange:ie=>Re(ie),className:"w-auto",children:o.jsxs(ro,{className:"h-9",children:[o.jsxs(Jt,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(kK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),o.jsxs(Jt,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[o.jsx(OK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),o.jsxs(me,{onClick:g==="visual"?qe:Te,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Yk,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重启麦麦?"}),o.jsxs(fn,{className:"space-y-3",children:[o.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(nl,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(wa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(rl,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})]})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:a?wt:rt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:[o.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&o.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),o.jsx(Jde,{value:y,onChange:ie=>{w(ie),l(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&o.jsx(o.Fragment,{children:o.jsxs(ll,{defaultValue:"bot",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(ro,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[o.jsx(Jt,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),o.jsx(Jt,{value:"personality",className:"flex-shrink-0",children:"人格"}),o.jsx(Jt,{value:"chat",className:"flex-shrink-0",children:"聊天"}),o.jsx(Jt,{value:"expression",className:"flex-shrink-0",children:"表达"}),o.jsx(Jt,{value:"features",className:"flex-shrink-0",children:"功能"}),o.jsx(Jt,{value:"processing",className:"flex-shrink-0",children:"处理"}),o.jsx(Jt,{value:"mood",className:"flex-shrink-0",children:"情绪"}),o.jsx(Jt,{value:"voice",className:"flex-shrink-0",children:"语音"}),o.jsx(Jt,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),o.jsx(Jt,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),o.jsx(Pn,{value:"bot",className:"space-y-4",children:C&&o.jsx(the,{config:C,onChange:T})}),o.jsx(Pn,{value:"personality",className:"space-y-4",children:_&&o.jsx(nhe,{config:_,onChange:E})}),o.jsx(Pn,{value:"chat",className:"space-y-4",children:M&&o.jsx(rhe,{config:M,onChange:q})}),o.jsx(Pn,{value:"expression",className:"space-y-4",children:L&&o.jsx(she,{config:L,onChange:I})}),o.jsx(Pn,{value:"features",className:"space-y-4",children:$&&ee&&H&&o.jsx(ihe,{emojiConfig:$,memoryConfig:ee,toolConfig:H,onEmojiChange:V,onMemoryChange:z,onToolChange:P})}),o.jsx(Pn,{value:"processing",className:"space-y-4",children:F&&te&&Y&&re&&o.jsx(ahe,{keywordReactionConfig:F,responsePostProcessConfig:te,chineseTypoConfig:Y,responseSplitterConfig:re,onKeywordReactionChange:U,onResponsePostProcessChange:ne,onChineseTypoChange:ae,onResponseSplitterChange:oe})}),o.jsx(Pn,{value:"mood",className:"space-y-4",children:W&&o.jsx(ohe,{config:W,onChange:J})}),o.jsx(Pn,{value:"voice",className:"space-y-4",children:X&&o.jsx(lhe,{config:X,onChange:R})}),o.jsx(Pn,{value:"lpmm",className:"space-y-4",children:se&&o.jsx(che,{config:se,onChange:G})}),o.jsxs(Pn,{value:"other",className:"space-y-4",children:[_e&&o.jsx(uhe,{config:_e,onChange:Ge}),tt&&o.jsx(dhe,{config:tt,onChange:Xe}),je&&o.jsx(hhe,{config:je,onChange:Qe}),He&&o.jsx(fhe,{config:He,onChange:$e})]})]})}),f&&o.jsx(p6,{onRestartComplete:jt,onRestartFailed:Ne})]})})}function the({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((h,f)=>f!==c)})},s=(c,h)=>{const f=[...t.platforms];f[c]=h,e({...t,platforms:f})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((h,f)=>f!==c)})},l=(c,h)=>{const f=[...t.alias_names];f[c]=h,e({...t,alias_names:f})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"platform",children:"平台"}),o.jsx(Pe,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"qq_account",children:"QQ账号"}),o.jsx(Pe,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"nickname",children:"昵称"}),o.jsx(Pe,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"其他平台账号"}),o.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,h)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:c,onChange:f=>s(h,f.target.value),placeholder:"wx:114514"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"别名"}),o.jsxs(me,{onClick:i,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加"]})]}),o.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,h)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{value:c,onChange:f=>l(h,f.target.value),placeholder:"小麦"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>a(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function nhe({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,l)=>l!==i)})},s=(i,a)=>{const l=[...t.states];l[i]=a,e({...t,states:l})};return o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"personality",children:"人格特质"}),o.jsx(nr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"reply_style",children:"表达风格"}),o.jsx(nr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"interest",children:"兴趣"}),o.jsx(nr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"plan_style",children:"说话规则与行为风格"}),o.jsx(nr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"visual_style",children:"识图规则"}),o.jsx(nr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"private_plan_style",children:"私聊规则"}),o.jsx(nr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"状态列表(人格多样性)"}),o.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),o.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(nr,{value:i,onChange:l=>s(a,l.target.value),placeholder:"描述一个人格状态",rows:2}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsx(fn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"state_probability",children:"状态替换概率"}),o.jsx(Pe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function rhe({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=l=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,h)=>h!==l)})},s=(l,c,h)=>{const f=[...t.talk_value_rules];f[l]={...f[l],[c]:h},e({...t,talk_value_rules:f})},i=({value:l,onChange:c})=>{const[h,f]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const N=l.split("-");if(N.length===2){const[C,T]=N,[_,E]=C.split(":"),[M,q]=T.split(":");_&&f(_.padStart(2,"0")),E&&g(E.padStart(2,"0")),M&&y(M.padStart(2,"0")),q&&S(q.padStart(2,"0"))}},[l]);const k=(N,C,T,_)=>{const E=`${N}:${C}-${T}:${_}`;c(E)};return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[o.jsx(Gd,{className:"h-4 w-4 mr-2"}),l||"选择时间段"]})}),o.jsx(so,{className:"w-80",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"小时"}),o.jsxs(Dt,{value:h,onValueChange:N=>{f(N),k(N,m,x,w)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:24},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"分钟"}),o.jsxs(Dt,{value:m,onValueChange:N=>{g(N),k(h,N,x,w)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:60},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),o.jsxs("div",{children:[o.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"小时"}),o.jsxs(Dt,{value:x,onValueChange:N=>{y(N),k(h,m,N,w)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:24},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-xs",children:"分钟"}),o.jsxs(Dt,{value:w,onValueChange:N=>{S(N),k(h,m,x,N)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:Array.from({length:60},(N,C)=>C).map(N=>o.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})},a=({rule:l})=>{const c=`{ target = "${l.target}", time = "${l.time}", value = ${l.value.toFixed(1)} }`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),o.jsx(Pe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:l=>e({...t,talk_value:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:l=>e({...t,mentioned_bot_reply:l})}),o.jsx(de,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_context_size",children:"上下文长度"}),o.jsx(Pe,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:l=>e({...t,max_context_size:parseInt(l.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"planner_smooth",children:"规划器平滑"}),o.jsx(Pe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:l=>e({...t,planner_smooth:parseFloat(l.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:l=>e({...t,enable_talk_value_rules:l})}),o.jsx(de,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:l=>e({...t,include_planner_reasoning:l})}),o.jsx(de,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&o.jsxs("div",{className:"border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),o.jsxs(me,{onClick:n,size:"sm",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?o.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((l,c)=>o.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(a,{rule:l}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{variant:"ghost",size:"sm",children:o.jsx(sn,{className:"h-4 w-4 text-destructive"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Dt,{value:l.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"global",children:"全局配置"}),o.jsx(ze,{value:"specific",children:"详细配置"})]})]})]}),l.target!==""&&(()=>{const h=l.target.split(":"),f=h[0]||"qq",m=h[1]||"",g=h[2]||"group";return o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Dt,{value:f,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"qq",children:"QQ"}),o.jsx(ze,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(Pe,{value:m,onChange:x=>{s(c,"target",`${f}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Dt,{value:g,onValueChange:x=>{s(c,"target",`${f}:${m}:${x}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"group",children:"群组(group)"}),o.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",l.target||"(未设置)"]})]})})(),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"时间段 (Time)"}),o.jsx(i,{value:l.time,onChange:h=>s(c,"time",h)}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),o.jsx(Pe,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0",max:"1",value:l.value,onChange:h=>{const f=parseFloat(h.target.value);isNaN(f)||s(c,"value",Math.max(0,Math.min(1,f)))},className:"w-20 h-8 text-xs"})]}),o.jsx(B0,{value:[l.value],onValueChange:h=>s(c,"value",h[0]),min:0,max:1,step:.01,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (完全沉默)"}),o.jsx("span",{children:"0.5"}),o.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:o.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),o.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[o.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),o.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),o.jsxs("li",{children:["• ",o.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function she({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=g=>{e({...t,learning_list:t.learning_list.filter((x,y)=>y!==g)})},s=(g,x,y)=>{const w=[...t.learning_list];w[g][x]=y,e({...t,learning_list:w})},i=({rule:g})=>{const x=`["${g[0]}", "${g[1]}", "${g[2]}", "${g[3]}"]`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-96",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:x}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=({member:g,groupIndex:x,memberIndex:y,availableChatIds:w})=>{const S=w.includes(g)||g==="*",[k,N]=b.useState(!S);return o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 flex gap-2",children:k?o.jsxs(o.Fragment,{children:[o.jsx(Pe,{value:g,onChange:C=>m(x,y,C.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),w.length>0&&o.jsx(me,{size:"sm",variant:"outline",onClick:()=>N(!1),title:"切换到下拉选择",children:"下拉"})]}):o.jsxs(o.Fragment,{children:[o.jsxs(Dt,{value:g,onValueChange:C=>m(x,y,C),children:[o.jsx(Mt,{className:"flex-1",children:o.jsx(zt,{placeholder:"选择聊天流"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"*",children:"* (全局共享)"}),w.map((C,T)=>o.jsx(ze,{value:C,children:C},T))]})]}),o.jsx(me,{size:"sm",variant:"outline",onClick:()=>N(!0),title:"切换到手动输入",children:"输入"})]})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除组成员 "',g||"(空)",'" 吗?此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>f(x,y),children:"删除"})]})]})]})]})},l=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},c=g=>{e({...t,expression_groups:t.expression_groups.filter((x,y)=>y!==g)})},h=g=>{const x=[...t.expression_groups];x[g]=[...x[g],""],e({...t,expression_groups:x})},f=(g,x)=>{const y=[...t.expression_groups];y[g]=y[g].filter((w,S)=>S!==x),e({...t,expression_groups:y})},m=(g,x,y)=>{const w=[...t.expression_groups];w[g][x]=y,e({...t,expression_groups:w})};return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),o.jsxs(me,{onClick:n,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((g,x)=>{const y=t.learning_list.some((T,_)=>_!==x&&T[0]===""),w=g[0]==="",S=g[0].split(":"),k=S[0]||"qq",N=S[1]||"",C=S[2]||"group";return o.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["规则 ",x+1," ",w&&"(全局配置)"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(i,{rule:g}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除学习规则 ",x+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r(x),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),o.jsxs(Dt,{value:w?"global":"specific",onValueChange:T=>{T==="global"?s(x,0,""):s(x,0,"qq::group")},disabled:y&&!w,children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"global",children:"全局配置"}),o.jsx(ze,{value:"specific",disabled:y&&!w,children:"详细配置"})]})]}),y&&!w&&o.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!w&&o.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"平台"}),o.jsxs(Dt,{value:k,onValueChange:T=>{s(x,0,`${T}:${N}:${C}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"qq",children:"QQ"}),o.jsx(ze,{value:"wx",children:"微信"})]})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),o.jsx(Pe,{value:N,onChange:T=>{s(x,0,`${k}:${T.target.value}:${C}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"类型"}),o.jsxs(Dt,{value:C,onValueChange:T=>{s(x,0,`${k}:${N}:${T}`)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"group",children:"群组(group)"}),o.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),o.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",g[0]||"(未设置)"]})]}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs font-medium",children:"使用学到的表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),o.jsx(Tt,{checked:g[1]==="enable",onCheckedChange:T=>s(x,1,T?"enable":"disable")})]})}),o.jsx("div",{className:"grid gap-2",children:o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-xs font-medium",children:"学习表达"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),o.jsx(Tt,{checked:g[2]==="enable",onCheckedChange:T=>s(x,2,T?"enable":"disable")})]})}),o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{className:"text-xs font-medium",children:"学习强度"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"5",value:g[3],onChange:T=>{const _=parseFloat(T.target.value);isNaN(_)||s(x,3,Math.max(0,Math.min(5,_)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),o.jsx(B0,{value:[parseFloat(g[3])||1],onValueChange:T=>s(x,3,T[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),o.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[o.jsx("span",{children:"0 (不学习)"}),o.jsx("span",{children:"2.5"}),o.jsx("span",{children:"5.0 (快速学习)"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},x)}),t.learning_list.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),o.jsxs(me,{onClick:l,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),o.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((g,x)=>{const y=t.learning_list.map(w=>w[0]).filter(w=>w!=="");return o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",x+1,g.length===1&&g[0]==="*"&&"(全局共享)"]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(me,{onClick:()=>h(x),size:"sm",variant:"outline",children:o.jsx(ms,{className:"h-4 w-4"})}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除共享组 ",x+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>c(x),children:"删除"})]})]})]})]})]}),o.jsx("div",{className:"space-y-2",children:g.map((w,S)=>o.jsx(a,{member:w,groupIndex:x,memberIndex:S,availableChatIds:y},S))}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},x)}),t.expression_groups.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function ihe({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),o.jsx(de,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),o.jsx(Pe,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),o.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),o.jsx(Pe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_reg_num",children:"最大注册数量"}),o.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),o.jsx(Pe,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),o.jsx(de,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),o.jsx(de,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),o.jsx(de,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&o.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[o.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),o.jsx(Pe,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function ahe({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:l}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=T=>{s({...t,regex_rules:t.regex_rules.filter((_,E)=>E!==T)})},f=(T,_,E)=>{const M=[...t.regex_rules];_==="regex"&&typeof E=="string"?M[T]={...M[T],regex:[E]}:_==="reaction"&&typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,regex_rules:M})},m=({regex:T,reaction:_,onRegexChange:E,onReactionChange:M})=>{const[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState({}),[J,X]=b.useState(""),R=b.useRef(null),[se,G]=b.useState("build"),F=Y=>Y.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),U=(Y,ae=0)=>{const re=R.current;if(!re)return;const oe=re.selectionStart||0,_e=re.selectionEnd||0,Ge=T.substring(0,oe)+Y+T.substring(_e);E(Ge),setTimeout(()=>{const tt=oe+Y.length+ae;re.setSelectionRange(tt,tt),re.focus()},0)};b.useEffect(()=>{if(!T||!I){ee(null),W({}),X(_),H("");return}try{const Y=F(T),ae=new RegExp(Y,"g"),re=I.match(ae);ee(re),H("");const _e=new RegExp(Y).exec(I);if(_e&&_e.groups){W(_e.groups);let Ge=_;Object.entries(_e.groups).forEach(([tt,Xe])=>{Ge=Ge.replace(new RegExp(`\\[${tt}\\]`,"g"),Xe||"")}),X(Ge)}else W({}),X(_)}catch(Y){H(Y.message),ee(null),W({}),X(_)}},[T,I,_]);const te=()=>{if(!I||!V||V.length===0)return o.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const Y=F(T),ae=new RegExp(Y,"g");let re=0;const oe=[];let _e;for(;(_e=ae.exec(I))!==null;)_e.index>re&&oe.push(o.jsx("span",{children:I.substring(re,_e.index)},`text-${re}`)),oe.push(o.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:_e[0]},`match-${_e.index}`)),re=_e.index+_e[0].length;return re)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return o.jsxs(zr,{open:q,onOpenChange:L,children:[o.jsx(h6,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(S1,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"正则表达式编辑器"}),o.jsx(ps,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),o.jsx(kn,{className:"max-h-[calc(90vh-120px)]",children:o.jsxs(ll,{value:se,onValueChange:Y=>G(Y),className:"w-full",children:[o.jsxs(ro,{className:"grid w-full grid-cols-2",children:[o.jsx(Jt,{value:"build",children:"🔧 构建器"}),o.jsx(Jt,{value:"test",children:"🧪 测试器"})]}),o.jsxs(Pn,{value:"build",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"正则表达式"}),o.jsx(Pe,{ref:R,value:T,onChange:Y=>E(Y.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"Reaction 内容"}),o.jsx(nr,{value:_,onChange:Y=>M(Y.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),o.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(Y=>o.jsxs("div",{className:"space-y-2",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:Y.category}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:Y.items.map(ae=>o.jsx(me,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>U(ae.pattern,ae.moveCursor||0),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("div",{className:"flex items-center gap-2 w-full",children:[o.jsx("span",{className:"text-xs font-medium",children:ae.label}),o.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ae.pattern})]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ae.desc})]})},ae.label))})]},Y.category)),o.jsxs("div",{className:"space-y-2 border-t pt-4",children:[o.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),o.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),o.jsx(me,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:o.jsxs("div",{className:"flex flex-col items-start w-full",children:[o.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),o.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),o.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),o.jsxs("li",{children:["命名捕获组格式:",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),o.jsxs("li",{children:["在 reaction 中使用 ",o.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),o.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),o.jsxs(Pn,{value:"test",className:"space-y-4 mt-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"当前正则表达式"}),o.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),o.jsx(nr,{id:"test-text",value:I,onChange:Y=>$(Y.target.value),placeholder:`在此输入要测试的文本... -例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&o.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[o.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),o.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&I&&o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),o.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),o.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"匹配高亮"}),o.jsx(kn,{className:"h-40 rounded-md bg-muted p-3",children:o.jsx("div",{className:"text-sm break-words",children:te()})})]}),Object.keys(P).length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"命名捕获组"}),o.jsx(kn,{className:"h-32 rounded-md border p-3",children:o.jsx("div",{className:"space-y-2",children:Object.entries(P).map(([Y,ae])=>o.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[o.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",Y,"]"]}),o.jsx("span",{className:"text-muted-foreground",children:"="}),o.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ae})]},Y))})})]}),Object.keys(P).length>0&&_&&o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{className:"text-sm font-medium",children:"Reaction 替换预览"}),o.jsx(kn,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:o.jsx("div",{className:"text-sm break-words",children:J})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),o.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[o.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),o.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[o.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),o.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),o.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),o.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((_,E)=>E!==T)})},y=(T,_,E)=>{const M=[...t.keyword_rules];typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,keyword_rules:M})},w=T=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:[..._[T].keywords||[],""]},s({...t,keyword_rules:_})},S=(T,_)=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:(E[T].keywords||[]).filter((M,q)=>q!==_)},s({...t,keyword_rules:E})},k=(T,_,E)=>{const M=[...t.keyword_rules],q=[...M[T].keywords||[]];q[_]=E,M[T]={...M[T],keywords:q},s({...t,keyword_rules:M})},N=({rule:T})=>{const _=`{ regex = [${(T.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${T.reaction}" }`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(kn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs break-all",children:_})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:T})=>{const _=`[[keyword_reaction.keyword_rules]] +`,{label:"if",detail:"block",type:"keyword"}),Ql("if ${}:\n ${}\nelse:\n ${}",{label:"if",detail:"/ else block",type:"keyword"}),Ql("class ${name}:\n def __init__(self, ${params}):\n ${}",{label:"class",detail:"definition",type:"keyword"}),Ql("import ${module}",{label:"import",detail:"statement",type:"keyword"}),Ql("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],she=ace(oF,Pq(nhe.concat(rhe)));function Qw(t){let{node:e,pos:n}=t,r=t.lineIndent(n,-1),s=null;for(;;){let i=e.childBefore(n);if(i)if(i.name=="Comment")n=i.from;else if(i.name=="Body"||i.name=="MatchBody")t.baseIndentFor(i)+t.unit<=r&&(s=i),e=i;else if(i.name=="MatchClause")e=i;else if(i.type.is("Statement"))e=i;else break;else break}return s}function Hw(t,e){let n=t.baseIndentFor(e),r=t.lineAt(t.pos,-1),s=r.from+r.text.length;return/^\s*($|#)/.test(r.text)&&t.node.ton?null:n+t.unit}const Vw=t0.define({name:"python",parser:Jde.configure({props:[Jv.add({Body:t=>{var e;let n=/^\s*(#|$)/.test(t.textAfter)&&Qw(t)||t.node;return(e=Hw(t,n))!==null&&e!==void 0?e:t.continue()},MatchBody:t=>{var e;let n=Qw(t);return(e=Hw(t,n||t.node))!==null&&e!==void 0?e:t.continue()},IfStatement:t=>/^\s*(else:|elif )/.test(t.textAfter)?t.baseIndent:t.continue(),"ForStatement WhileStatement":t=>/^\s*else:/.test(t.textAfter)?t.baseIndent:t.continue(),TryStatement:t=>/^\s*(except[ :]|finally:|else:)/.test(t.textAfter)?t.baseIndent:t.continue(),MatchStatement:t=>/^\s*case /.test(t.textAfter)?t.baseIndent+t.unit:t.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":Cw({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":Cw({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":Cw({closing:"]"}),MemberExpression:t=>t.baseIndent+t.unit,"String FormatString":()=>null,Script:t=>{var e;let n=Qw(t);return(e=n&&Hw(t,n))!==null&&e!==void 0?e:t.continue()}}),$6.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":TB,Body:(t,e)=>({from:t.from+1,to:t.to-(t.to==e.doc.length?0:1)}),"String FormatString":(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:|case\s+[^:]*:?)$/}});function ihe(){return new jB(Vw,[Vw.data.of({autocomplete:the}),Vw.data.of({autocomplete:she})])}const ahe=B6({String:ve.string,Number:ve.number,"True False":ve.bool,PropertyName:ve.propertyName,Null:ve.null,", :":ve.separator,"[ ]":ve.squareBracket,"{ }":ve.brace}),lhe=u0.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[ahe],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),ohe=()=>t=>{try{JSON.parse(t.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const n=che(e,t.state.doc);return[{from:n,message:e.message,severity:"error",to:n}]}return[]};function che(t,e){let n;return(n=t.message.match(/at position (\d+)/))?Math.min(+n[1],e.length):(n=t.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+n[1]).from+ +n[2]-1,e.length):0}const uhe=t0.define({name:"json",parser:lhe.configure({props:[Jv.add({Object:zT({except:/^\s*\}/}),Array:zT({except:/^\s*\]/})}),$6.add({"Object Array":TB})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function dhe(){return new jB(uhe)}const hhe={name:"toml",startState:function(){return{inString:!1,stringType:"",lhs:!0,inArray:0}},token:function(t,e){let n;if(!e.inString&&(n=t.match(/^('''|"""|'|")/))&&(e.stringType=n[0],e.inString=!0),t.sol()&&!e.inString&&e.inArray===0&&(e.lhs=!0),e.inString){for(;e.inString;)if(t.match(e.stringType))e.inString=!1;else if(t.peek()==="\\")t.next(),t.next();else{if(t.eol())break;t.match(/^.[^\\\"\']*/)}return e.lhs?"property":"string"}else{if(e.inArray&&t.peek()==="]")return t.next(),e.inArray--,"bracket";if(e.lhs&&t.peek()==="["&&t.skipTo("]"))return t.next(),t.peek()==="]"&&t.next(),"atom";if(t.peek()==="#")return t.skipToEnd(),"comment";if(t.eatSpace())return null;if(e.lhs&&t.eatWhile(function(r){return r!="="&&r!=" "}))return"property";if(e.lhs&&t.peek()==="=")return t.next(),e.lhs=!1,null;if(!e.lhs&&t.match(/^\d\d\d\d[\d\-\:\.T]*Z/))return"atom";if(!e.lhs&&(t.match("true")||t.match("false")))return"atom";if(!e.lhs&&t.peek()==="[")return e.inArray++,t.next(),"bracket";if(!e.lhs&&t.match(/^\-?\d+(?:\.\d+)?/))return"number";t.eatSpace()||t.next()}return null},languageData:{commentTokens:{line:"#"}}},fhe={python:[ihe()],json:[dhe(),ohe()],toml:[Q6.define(hhe)],text:[]};function mhe({value:t,onChange:e,language:n="text",readOnly:r=!1,height:s="400px",minHeight:i,maxHeight:a,placeholder:o,theme:c="dark",className:h=""}){const[f,m]=b.useState(!1);if(b.useEffect(()=>{m(!0)},[]),!f)return l.jsx("div",{className:`rounded-md border bg-muted animate-pulse ${h}`,style:{height:s,minHeight:i,maxHeight:a}});const g=[...fhe[n]||[],We.lineWrapping];return r&&g.push(We.editable.of(!1)),l.jsx("div",{className:`rounded-md overflow-hidden border ${h}`,children:l.jsx(Zq,{value:t,height:s,minHeight:i,maxHeight:a,theme:c==="dark"?Kq:void 0,extensions:g,onChange:e,placeholder:o,basicSetup:{lineNumbers:!0,highlightActiveLineGutter:!0,highlightSpecialChars:!0,history:!0,foldGutter:!0,drawSelection:!0,dropCursor:!0,allowMultipleSelections:!0,indentOnInput:!0,syntaxHighlighting:!0,bracketMatching:!0,closeBrackets:!0,autocompletion:!0,rectangularSelection:!0,crosshairCursor:!0,highlightActiveLine:!0,highlightSelectionMatches:!0,closeBracketsKeymap:!0,defaultKeymap:!0,searchKeymap:!0,historyKeymap:!0,foldKeymap:!0,completionKeymap:!0,lintKeymap:!0}})})}function phe(){const[t,e]=b.useState(!0),[n,r]=b.useState(!1),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState("visual"),[y,w]=b.useState(""),[S,k]=b.useState(!1),{toast:N}=Gr(),[C,T]=b.useState(null),[_,E]=b.useState(null),[M,q]=b.useState(null),[L,I]=b.useState(null),[$,V]=b.useState(null),[ee,z]=b.useState(null),[H,P]=b.useState(null),[W,J]=b.useState(null),[X,R]=b.useState(null),[se,G]=b.useState(null),[F,U]=b.useState(null),[te,ne]=b.useState(null),[Y,ae]=b.useState(null),[re,le]=b.useState(null),[_e,Ge]=b.useState(null),[tt,Xe]=b.useState(null),[je,Qe]=b.useState(null),[He,$e]=b.useState(null),bt=b.useRef(null),lt=b.useRef(!0),xn=b.useRef({}),_n=b.useCallback(async()=>{try{const ie=await sre();w(ie),k(!1)}catch(ie){N({variant:"destructive",title:"加载失败",description:ie instanceof Error?ie.message:"加载源代码失败"})}},[N]),Cn=b.useCallback(async()=>{try{e(!0);const ie=await k9();xn.current=ie,T(ie.bot),E(ie.personality);const xe=ie.chat;xe.talk_value_rules||(xe.talk_value_rules=[]),q(xe),I(ie.expression),V(ie.emoji),z(ie.memory),P(ie.tool),J(ie.mood),R(ie.voice),G(ie.lpmm_knowledge),U(ie.keyword_reaction),ne(ie.response_post_process),ae(ie.chinese_typo),le(ie.response_splitter),Ge(ie.log),Xe(ie.debug),Qe(ie.maim_message),$e(ie.telemetry),o(!1),lt.current=!1,await _n()}catch(ie){console.error("加载配置失败:",ie),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}finally{e(!1)}},[N,_n]);b.useEffect(()=>{Cn()},[Cn]);const Dt=b.useCallback(async(ie,xe)=>{if(!lt.current)try{i(!0),await are(ie,xe),o(!1)}catch(Je){console.error(`自动保存 ${ie} 失败:`,Je),o(!0)}finally{i(!1)}},[]),xt=b.useCallback((ie,xe)=>{lt.current||(o(!0),bt.current&&clearTimeout(bt.current),bt.current=setTimeout(()=>{Dt(ie,xe)},2e3))},[Dt]);b.useEffect(()=>{C&&!lt.current&&xt("bot",C)},[C,xt]),b.useEffect(()=>{_&&!lt.current&&xt("personality",_)},[_,xt]),b.useEffect(()=>{M&&!lt.current&&xt("chat",M)},[M,xt]),b.useEffect(()=>{L&&!lt.current&&xt("expression",L)},[L,xt]),b.useEffect(()=>{$&&!lt.current&&xt("emoji",$)},[$,xt]),b.useEffect(()=>{ee&&!lt.current&&xt("memory",ee)},[ee,xt]),b.useEffect(()=>{H&&!lt.current&&xt("tool",H)},[H,xt]),b.useEffect(()=>{W&&!lt.current&&xt("mood",W)},[W,xt]),b.useEffect(()=>{X&&!lt.current&&xt("voice",X)},[X,xt]),b.useEffect(()=>{se&&!lt.current&&xt("lpmm_knowledge",se)},[se,xt]),b.useEffect(()=>{F&&!lt.current&&xt("keyword_reaction",F)},[F,xt]),b.useEffect(()=>{te&&!lt.current&&xt("response_post_process",te)},[te,xt]),b.useEffect(()=>{Y&&!lt.current&&xt("chinese_typo",Y)},[Y,xt]),b.useEffect(()=>{re&&!lt.current&&xt("response_splitter",re)},[re,xt]),b.useEffect(()=>{_e&&!lt.current&&xt("log",_e)},[_e,xt]),b.useEffect(()=>{tt&&!lt.current&&xt("debug",tt)},[tt,xt]),b.useEffect(()=>{je&&!lt.current&&xt("maim_message",je)},[je,xt]),b.useEffect(()=>{He&&!lt.current&&xt("telemetry",He)},[He,xt]);const Te=async()=>{try{r(!0),await ire(y),o(!1),k(!1),N({title:"保存成功",description:"配置已保存"}),await Cn()}catch(ie){k(!0),N({variant:"destructive",title:"保存失败",description:ie instanceof Error?ie.message:"保存配置失败"})}finally{r(!1)}},Re=async ie=>{if(a){N({variant:"destructive",title:"切换失败",description:"请先保存当前更改"});return}if(x(ie),ie==="source")await _n();else try{const xe=await k9();xn.current=xe,T(xe.bot),E(xe.personality);const Je=xe.chat;Je.talk_value_rules||(Je.talk_value_rules=[]),q(Je),I(xe.expression),V(xe.emoji),z(xe.memory),P(xe.tool),J(xe.mood),R(xe.voice),G(xe.lpmm_knowledge),U(xe.keyword_reaction),ne(xe.response_post_process),ae(xe.chinese_typo),le(xe.response_splitter),Ge(xe.log),Xe(xe.debug),Qe(xe.maim_message),$e(xe.telemetry),o(!1)}catch(xe){console.error("加载配置失败:",xe),N({title:"加载失败",description:"无法加载配置文件",variant:"destructive"})}},qe=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...xn.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await O9(ie),o(!1),N({title:"保存成功",description:"麦麦主程序配置已保存"})}catch(ie){console.error("保存配置失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},rt=async()=>{try{h(!0),Hv().catch(()=>{}),m(!0)}catch(ie){console.error("重启失败:",ie),m(!1),N({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),h(!1)}},wt=async()=>{try{r(!0),bt.current&&clearTimeout(bt.current);const ie={...xn.current,bot:C,personality:_,chat:M,expression:L,emoji:$,memory:ee,tool:H,mood:W,voice:X,lpmm_knowledge:se,keyword_reaction:F,response_post_process:te,chinese_typo:Y,response_splitter:re,log:_e,debug:tt,maim_message:je,telemetry:He};await O9(ie),o(!1),N({title:"保存成功",description:"配置已保存,即将重启麦麦..."}),await new Promise(xe=>setTimeout(xe,500)),await rt()}catch(ie){console.error("保存失败:",ie),N({title:"保存失败",description:ie.message,variant:"destructive"})}finally{r(!1)}},jt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Ne=()=>{m(!1),h(!1),N({title:"重启失败",description:"服务器未能在预期时间内恢复,请手动检查",variant:"destructive"})};return t?l.jsx(on,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦主程序配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的核心功能和行为设置"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto items-center",children:[l.jsx(na,{value:g,onValueChange:ie=>Re(ie),className:"w-auto",children:l.jsxs(_i,{className:"h-9",children:[l.jsxs(Et,{value:"visual",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(LK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"可视化"]}),l.jsxs(Et,{value:"source",className:"text-xs sm:text-sm px-2 sm:px-3",children:[l.jsx(IK,{className:"h-3 w-3 sm:h-4 sm:w-4 mr-1"}),"源代码"]})]})}),l.jsxs(fe,{onClick:g==="visual"?qe:Te,disabled:n||s||!a||c,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),n?"保存中...":s?"自动保存中...":a?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{disabled:n||s||c,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(e6,{className:"mr-2 h-4 w-4"}),c?"重启中...":a?"保存并重启":"重启麦麦"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重启麦麦?"}),l.jsx(mn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:a?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(il,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(al,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Av,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Ir,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(na,{defaultValue:"windows",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsx(Et,{value:"windows",children:"Windows"}),l.jsx(Et,{value:"macos",children:"macOS"}),l.jsx(Et,{value:"linux",children:"Linux"})]}),l.jsxs(Kt,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(Kt,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(Kt,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(ts,{children:l.jsx(g6,{asChild:!0,children:l.jsx(fe,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:a?wt:rt,children:a?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),g==="source"&&l.jsxs("div",{className:"space-y-4",children:[l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:[l.jsx("strong",{children:"源代码模式(高级功能):"}),"直接编辑 TOML 配置文件。此功能仅适用于熟悉 TOML 语法的高级用户。保存时会在后端验证格式,只有格式完全正确才能保存。",S&&l.jsx("span",{className:"text-destructive font-semibold ml-2",children:"⚠️ 上次保存失败,请检查 TOML 格式"})]})]}),l.jsx(mhe,{value:y,onChange:ie=>{w(ie),o(!0),S&&k(!1)},language:"toml",theme:"dark",height:"calc(100vh - 280px)",minHeight:"500px",placeholder:"TOML 配置内容"})]}),g==="visual"&&l.jsx(l.Fragment,{children:l.jsxs(na,{defaultValue:"bot",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(_i,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5 lg:grid-cols-10",children:[l.jsx(Et,{value:"bot",className:"flex-shrink-0",children:"基本信息"}),l.jsx(Et,{value:"personality",className:"flex-shrink-0",children:"人格"}),l.jsx(Et,{value:"chat",className:"flex-shrink-0",children:"聊天"}),l.jsx(Et,{value:"expression",className:"flex-shrink-0",children:"表达"}),l.jsx(Et,{value:"features",className:"flex-shrink-0",children:"功能"}),l.jsx(Et,{value:"processing",className:"flex-shrink-0",children:"处理"}),l.jsx(Et,{value:"mood",className:"flex-shrink-0",children:"情绪"}),l.jsx(Et,{value:"voice",className:"flex-shrink-0",children:"语音"}),l.jsx(Et,{value:"lpmm",className:"flex-shrink-0",children:"知识库"}),l.jsx(Et,{value:"other",className:"flex-shrink-0",children:"其他"})]})}),l.jsx(Kt,{value:"bot",className:"space-y-4",children:C&&l.jsx(ghe,{config:C,onChange:T})}),l.jsx(Kt,{value:"personality",className:"space-y-4",children:_&&l.jsx(xhe,{config:_,onChange:E})}),l.jsx(Kt,{value:"chat",className:"space-y-4",children:M&&l.jsx(vhe,{config:M,onChange:q})}),l.jsx(Kt,{value:"expression",className:"space-y-4",children:L&&l.jsx(bhe,{config:L,onChange:I})}),l.jsx(Kt,{value:"features",className:"space-y-4",children:$&&ee&&H&&l.jsx(whe,{emojiConfig:$,memoryConfig:ee,toolConfig:H,onEmojiChange:V,onMemoryChange:z,onToolChange:P})}),l.jsx(Kt,{value:"processing",className:"space-y-4",children:F&&te&&Y&&re&&l.jsx(She,{keywordReactionConfig:F,responsePostProcessConfig:te,chineseTypoConfig:Y,responseSplitterConfig:re,onKeywordReactionChange:U,onResponsePostProcessChange:ne,onChineseTypoChange:ae,onResponseSplitterChange:le})}),l.jsx(Kt,{value:"mood",className:"space-y-4",children:W&&l.jsx(khe,{config:W,onChange:J})}),l.jsx(Kt,{value:"voice",className:"space-y-4",children:X&&l.jsx(Ohe,{config:X,onChange:R})}),l.jsx(Kt,{value:"lpmm",className:"space-y-4",children:se&&l.jsx(jhe,{config:se,onChange:G})}),l.jsxs(Kt,{value:"other",className:"space-y-4",children:[_e&&l.jsx(Nhe,{config:_e,onChange:Ge}),tt&&l.jsx(Che,{config:tt,onChange:Xe}),je&&l.jsx(The,{config:je,onChange:Qe}),He&&l.jsx(Ehe,{config:He,onChange:$e})]})]})}),f&&l.jsx(y6,{onRestartComplete:jt,onRestartFailed:Ne})]})})}function ghe({config:t,onChange:e}){const n=()=>{e({...t,platforms:[...t.platforms,""]})},r=c=>{e({...t,platforms:t.platforms.filter((h,f)=>f!==c)})},s=(c,h)=>{const f=[...t.platforms];f[c]=h,e({...t,platforms:f})},i=()=>{e({...t,alias_names:[...t.alias_names,""]})},a=c=>{e({...t,alias_names:t.alias_names.filter((h,f)=>f!==c)})},o=(c,h)=>{const f=[...t.alias_names];f[c]=h,e({...t,alias_names:f})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"基本信息"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"platform",children:"平台"}),l.jsx(Pe,{id:"platform",value:t.platform,onChange:c=>e({...t,platform:c.target.value}),placeholder:"qq"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"qq_account",children:"QQ账号"}),l.jsx(Pe,{id:"qq_account",value:t.qq_account,onChange:c=>e({...t,qq_account:c.target.value}),placeholder:"123456789"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"nickname",children:"昵称"}),l.jsx(Pe,{id:"nickname",value:t.nickname,onChange:c=>e({...t,nickname:c.target.value}),placeholder:"麦麦"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"其他平台账号"}),l.jsxs(fe,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.platforms.map((c,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{value:c,onChange:f=>s(h,f.target.value),placeholder:"wx:114514"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除平台账号 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(h),children:"删除"})]})]})]})]},h)),t.platforms.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无其他平台账号"})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"别名"}),l.jsxs(fe,{onClick:i,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加"]})]}),l.jsxs("div",{className:"space-y-2",children:[t.alias_names.map((c,h)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{value:c,onChange:f=>o(h,f.target.value),placeholder:"小麦"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除别名 "',c||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>a(h),children:"删除"})]})]})]})]},h)),t.alias_names.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无别名"})]})]})]})]})})}function xhe({config:t,onChange:e}){const n=()=>{e({...t,states:[...t.states,""]})},r=i=>{e({...t,states:t.states.filter((a,o)=>o!==i)})},s=(i,a)=>{const o=[...t.states];o[i]=a,e({...t,states:o})};return l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"人格设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"personality",children:"人格特质"}),l.jsx(dr,{id:"personality",value:t.personality,onChange:i=>e({...t,personality:i.target.value}),placeholder:"描述人格特质和身份特征(建议120字以内)",rows:3}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"建议120字以内,描述人格特质和身份特征"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"reply_style",children:"表达风格"}),l.jsx(dr,{id:"reply_style",value:t.reply_style,onChange:i=>e({...t,reply_style:i.target.value}),placeholder:"描述说话的表达风格和习惯",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"interest",children:"兴趣"}),l.jsx(dr,{id:"interest",value:t.interest,onChange:i=>e({...t,interest:i.target.value}),placeholder:"会影响麦麦对什么话题进行回复",rows:2})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"plan_style",children:"说话规则与行为风格"}),l.jsx(dr,{id:"plan_style",value:t.plan_style,onChange:i=>e({...t,plan_style:i.target.value}),placeholder:"麦麦的说话规则和行为风格",rows:5})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"visual_style",children:"识图规则"}),l.jsx(dr,{id:"visual_style",value:t.visual_style,onChange:i=>e({...t,visual_style:i.target.value}),placeholder:"识图时的处理规则",rows:3})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"private_plan_style",children:"私聊规则"}),l.jsx(dr,{id:"private_plan_style",value:t.private_plan_style,onChange:i=>e({...t,private_plan_style:i.target.value}),placeholder:"私聊的说话规则和行为风格",rows:4})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"状态列表(人格多样性)"}),l.jsxs(fe,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加状态"]})]}),l.jsx("div",{className:"space-y-2",children:t.states.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(dr,{value:i,onChange:o=>s(a,o.target.value),placeholder:"描述一个人格状态",rows:2}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsx(mn,{children:"确定要删除这个人格状态吗?此操作无法撤销。"})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(a),children:"删除"})]})]})]})]},a))})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"state_probability",children:"状态替换概率"}),l.jsx(Pe,{id:"state_probability",type:"number",step:"0.1",min:"0",max:"1",value:t.state_probability,onChange:i=>e({...t,state_probability:parseFloat(i.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"每次构建人格时替换 personality 的概率(0.0-1.0)"})]})]})]})})}function vhe({config:t,onChange:e}){const n=()=>{e({...t,talk_value_rules:[...t.talk_value_rules,{target:"",time:"00:00-23:59",value:1}]})},r=o=>{e({...t,talk_value_rules:t.talk_value_rules.filter((c,h)=>h!==o)})},s=(o,c,h)=>{const f=[...t.talk_value_rules];f[o]={...f[o],[c]:h},e({...t,talk_value_rules:f})},i=({value:o,onChange:c})=>{const[h,f]=b.useState("00"),[m,g]=b.useState("00"),[x,y]=b.useState("23"),[w,S]=b.useState("59");b.useEffect(()=>{const N=o.split("-");if(N.length===2){const[C,T]=N,[_,E]=C.split(":"),[M,q]=T.split(":");_&&f(_.padStart(2,"0")),E&&g(E.padStart(2,"0")),M&&y(M.padStart(2,"0")),q&&S(q.padStart(2,"0"))}},[o]);const k=(N,C,T,_)=>{const E=`${N}:${C}-${T}:${_}`;c(E)};return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",className:"w-full justify-start font-mono text-sm",children:[l.jsx(Yd,{className:"h-4 w-4 mr-2"}),o||"选择时间段"]})}),l.jsx(ol,{className:"w-80",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"开始时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"小时"}),l.jsxs(zt,{value:h,onValueChange:N=>{f(N),k(N,m,x,w)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"分钟"}),l.jsxs(zt,{value:m,onValueChange:N=>{g(N),k(h,N,x,w)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]}),l.jsxs("div",{children:[l.jsx("h4",{className:"font-medium text-sm mb-3",children:"结束时间"}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:gap-3",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"小时"}),l.jsxs(zt,{value:x,onValueChange:N=>{y(N),k(h,m,N,w)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:24},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-xs",children:"分钟"}),l.jsxs(zt,{value:w,onValueChange:N=>{S(N),k(h,m,x,N)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:Array.from({length:60},(N,C)=>C).map(N=>l.jsx(ze,{value:N.toString().padStart(2,"0"),children:N.toString().padStart(2,"0")},N))})]})]})]})]})]})})]})},a=({rule:o})=>{const c=`{ target = "${o.target}", time = "${o.time}", value = ${o.value.toFixed(1)} }`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:c}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"聊天设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"talk_value",children:"聊天频率(基础值)"}),l.jsx(Pe,{id:"talk_value",type:"number",step:"0.1",min:"0",max:"1",value:t.talk_value,onChange:o=>e({...t,talk_value:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越小越沉默,范围 0-1"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"mentioned_bot_reply",checked:t.mentioned_bot_reply,onCheckedChange:o=>e({...t,mentioned_bot_reply:o})}),l.jsx(de,{htmlFor:"mentioned_bot_reply",className:"cursor-pointer",children:"启用提及必回复"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_context_size",children:"上下文长度"}),l.jsx(Pe,{id:"max_context_size",type:"number",min:"1",value:t.max_context_size,onChange:o=>e({...t,max_context_size:parseInt(o.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"planner_smooth",children:"规划器平滑"}),l.jsx(Pe,{id:"planner_smooth",type:"number",step:"1",min:"0",value:t.planner_smooth,onChange:o=>e({...t,planner_smooth:parseFloat(o.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"增大数值会减小 planner 负荷,推荐 1-5,0 为关闭"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_talk_value_rules",checked:t.enable_talk_value_rules,onCheckedChange:o=>e({...t,enable_talk_value_rules:o})}),l.jsx(de,{htmlFor:"enable_talk_value_rules",className:"cursor-pointer",children:"启用动态发言频率规则"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"include_planner_reasoning",checked:t.include_planner_reasoning,onCheckedChange:o=>e({...t,include_planner_reasoning:o})}),l.jsx(de,{htmlFor:"include_planner_reasoning",className:"cursor-pointer",children:"将 planner 推理加入 replyer"})]})]})]}),t.enable_talk_value_rules&&l.jsxs("div",{className:"border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"动态发言频率规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"按时段或聊天流ID调整发言频率,优先匹配具体聊天,再匹配全局规则"})]}),l.jsxs(fe,{onClick:n,size:"sm",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),t.talk_value_rules&&t.talk_value_rules.length>0?l.jsx("div",{className:"space-y-4",children:t.talk_value_rules.map((o,c)=>l.jsxs("div",{className:"rounded-lg border p-4 bg-muted/50 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["规则 #",c+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(a,{rule:o}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{variant:"ghost",size:"sm",children:l.jsx(ln,{className:"h-4 w-4 text-destructive"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除规则 #",c+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(c),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(zt,{value:o.target===""?"global":"specific",onValueChange:h=>{h==="global"?s(c,"target",""):s(c,"target","qq::group")},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"global",children:"全局配置"}),l.jsx(ze,{value:"specific",children:"详细配置"})]})]})]}),o.target!==""&&(()=>{const h=o.target.split(":"),f=h[0]||"qq",m=h[1]||"",g=h[2]||"group";return l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"平台"}),l.jsxs(zt,{value:f,onValueChange:x=>{s(c,"target",`${x}:${m}:${g}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"qq",children:"QQ"}),l.jsx(ze,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Pe,{value:m,onChange:x=>{s(c,"target",`${f}:${x.target.value}:${g}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"类型"}),l.jsxs(zt,{value:g,onValueChange:x=>{s(c,"target",`${f}:${m}:${x}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"group",children:"群组(group)"}),l.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",o.target||"(未设置)"]})]})})(),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"时间段 (Time)"}),l.jsx(i,{value:o.time,onChange:h=>s(c,"time",h)}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"支持跨夜区间,例如 23:00-02:00"})]}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{htmlFor:`rule-value-${c}`,className:"text-xs font-medium",children:"发言频率值 (Value)"}),l.jsx(Pe,{id:`rule-value-${c}`,type:"number",step:"0.01",min:"0.01",max:"1",value:o.value,onChange:h=>{const f=parseFloat(h.target.value);isNaN(f)||s(c,"value",Math.max(.01,Math.min(1,f)))},className:"w-20 h-8 text-xs"})]}),l.jsx($0,{value:[o.value],onValueChange:h=>s(c,"value",h[0]),min:.01,max:1,step:.01,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0.01 (极少发言)"}),l.jsx("span",{children:"0.5"}),l.jsx("span",{children:"1.0 (正常)"})]})]})]})]},c))}):l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:l.jsx("p",{className:"text-sm",children:'暂无规则,点击"添加规则"按钮创建'})}),l.jsxs("div",{className:"mt-4 p-4 bg-blue-50 dark:bg-blue-950/20 border border-blue-200 dark:border-blue-800 rounded-lg",children:[l.jsx("h5",{className:"text-sm font-semibold text-blue-900 dark:text-blue-100 mb-2",children:"📝 规则说明"}),l.jsxs("ul",{className:"text-xs text-blue-800 dark:text-blue-200 space-y-1",children:[l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 为空"}),":全局规则,对所有聊天生效"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"Target 指定"}),":仅对特定聊天流生效(格式:platform:id:type)"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"优先级"}),":先匹配具体聊天流规则,再匹配全局规则"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"时间支持跨夜"}),":例如 23:00-02:00 表示晚上11点到次日凌晨2点"]}),l.jsxs("li",{children:["• ",l.jsx("strong",{children:"数值范围"}),":建议 0-1,0 表示完全沉默,1 表示正常发言"]})]})]})]})]})}function yhe({member:t,groupIndex:e,memberIndex:n,availableChatIds:r,onUpdate:s,onRemove:i}){const a=r.includes(t)||t==="*",[o,c]=b.useState(!a);return l.jsxs("div",{className:"flex gap-2",children:[l.jsx("div",{className:"flex-1 flex gap-2",children:o?l.jsxs(l.Fragment,{children:[l.jsx(Pe,{value:t,onChange:h=>s(e,n,h.target.value),placeholder:'输入 "*" 或 "qq:123456:group"',className:"flex-1"}),r.length>0&&l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>c(!1),title:"切换到下拉选择",children:"下拉"})]}):l.jsxs(l.Fragment,{children:[l.jsxs(zt,{value:t,onValueChange:h=>s(e,n,h),children:[l.jsx(At,{className:"flex-1",children:l.jsx(Pt,{placeholder:"选择聊天流"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"*",children:"* (全局共享)"}),r.map((h,f)=>l.jsx(ze,{value:h,children:h},f))]})]}),l.jsx(fe,{size:"sm",variant:"outline",onClick:()=>c(!0),title:"切换到手动输入",children:"输入"})]})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除组成员 "',t||"(空)",'" 吗?此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>i(e,n),children:"删除"})]})]})]})]})}function bhe({config:t,onChange:e}){const n=()=>{e({...t,learning_list:[...t.learning_list,["","enable","enable","1.0"]]})},r=m=>{e({...t,learning_list:t.learning_list.filter((g,x)=>x!==m)})},s=(m,g,x)=>{const y=[...t.learning_list];y[m][g]=x,e({...t,learning_list:y})},i=({rule:m})=>{const g=`["${m[0]}", "${m[1]}", "${m[2]}", "${m[3]}"]`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-96",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:g}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},a=()=>{e({...t,expression_groups:[...t.expression_groups,[]]})},o=m=>{e({...t,expression_groups:t.expression_groups.filter((g,x)=>x!==m)})},c=m=>{const g=[...t.expression_groups];g[m]=[...g[m],""],e({...t,expression_groups:g})},h=(m,g)=>{const x=[...t.expression_groups];x[m]=x[m].filter((y,w)=>w!==g),e({...t,expression_groups:x})},f=(m,g,x)=>{const y=[...t.expression_groups];y[m][g]=x,e({...t,expression_groups:y})};return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达学习配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置麦麦如何学习和使用表达方式"})]}),l.jsxs(fe,{onClick:n,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加规则"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.learning_list.map((m,g)=>{const x=t.learning_list.some((C,T)=>T!==g&&C[0]===""),y=m[0]==="",w=m[0].split(":"),S=w[0]||"qq",k=w[1]||"",N=w[2]||"group";return l.jsxs("div",{className:"rounded-lg border p-4 space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["规则 ",g+1," ",y&&"(全局配置)"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(i,{rule:m}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除学习规则 ",g+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r(g),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"配置类型"}),l.jsxs(zt,{value:y?"global":"specific",onValueChange:C=>{C==="global"?s(g,0,""):s(g,0,"qq::group")},disabled:x&&!y,children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"global",children:"全局配置"}),l.jsx(ze,{value:"specific",disabled:x&&!y,children:"详细配置"})]})]}),x&&!y&&l.jsx("p",{className:"text-xs text-amber-600",children:"已存在全局配置,无法创建新的全局配置"})]}),!y&&l.jsxs("div",{className:"grid gap-4 p-4 rounded-lg bg-muted/50",children:[l.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"平台"}),l.jsxs(zt,{value:S,onValueChange:C=>{s(g,0,`${C}:${k}:${N}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"qq",children:"QQ"}),l.jsx(ze,{value:"wx",children:"微信"})]})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"群 ID"}),l.jsx(Pe,{value:k,onChange:C=>{s(g,0,`${S}:${C.target.value}:${N}`)},placeholder:"输入群 ID",className:"font-mono text-sm"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"类型"}),l.jsxs(zt,{value:N,onValueChange:C=>{s(g,0,`${S}:${k}:${C}`)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"group",children:"群组(group)"}),l.jsx(ze,{value:"private",children:"私聊(private)"})]})]})]})]}),l.jsxs("p",{className:"text-xs text-muted-foreground",children:["当前聊天流 ID:",m[0]||"(未设置)"]})]}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs font-medium",children:"使用学到的表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦使用从聊天中学到的表达方式"})]}),l.jsx(_t,{checked:m[1]==="enable",onCheckedChange:C=>s(g,1,C?"enable":"disable")})]})}),l.jsx("div",{className:"grid gap-2",children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-xs font-medium",children:"学习表达"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"允许麦麦从聊天中学习新的表达方式"})]}),l.jsx(_t,{checked:m[2]==="enable",onCheckedChange:C=>s(g,2,C?"enable":"disable")})]})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{className:"text-xs font-medium",children:"学习强度"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"5",value:m[3],onChange:C=>{const T=parseFloat(C.target.value);isNaN(T)||s(g,3,Math.max(0,Math.min(5,T)).toFixed(1))},className:"w-20 h-8 text-xs"})]}),l.jsx($0,{value:[parseFloat(m[3])||1],onValueChange:C=>s(g,3,C[0].toFixed(1)),min:0,max:5,step:.1,className:"w-full"}),l.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[l.jsx("span",{children:"0 (不学习)"}),l.jsx("span",{children:"2.5"}),l.jsx("span",{children:"5.0 (快速学习)"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"影响学习频率,最短学习间隔 = 300/学习强度(秒)"})]})]})]},g)}),t.learning_list.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无学习规则,点击"添加规则"开始配置'})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center justify-between mb-4",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold",children:"表达共享组配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"配置不同聊天流之间如何共享学到的表达方式"})]}),l.jsxs(fe,{onClick:a,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加共享组"]})]}),l.jsxs("div",{className:"space-y-4",children:[t.expression_groups.map((m,g)=>{const x=t.learning_list.map(y=>y[0]).filter(y=>y!=="");return l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["共享组 ",g+1,m.length===1&&m[0]==="*"&&"(全局共享)"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(fe,{onClick:()=>c(g),size:"sm",variant:"outline",children:l.jsx(gs,{className:"h-4 w-4"})}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除共享组 ",g+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>o(g),children:"删除"})]})]})]})]})]}),l.jsx("div",{className:"space-y-2",children:m.map((y,w)=>l.jsx(yhe,{member:y,groupIndex:g,memberIndex:w,availableChatIds:x,onUpdate:f,onRemove:h},`${g}-${w}`))}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'提示:可以从下拉框选择已配置的聊天流,或手动输入。输入 "*" 启用全局共享'})]},g)}),t.expression_groups.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无共享组,点击"添加共享组"开始配置'})]})]})})]})}function whe({emojiConfig:t,memoryConfig:e,toolConfig:n,onEmojiChange:r,onMemoryChange:s,onToolChange:i}){return l.jsxs("div",{className:"space-y-6",children:[l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"工具设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_tool",checked:n.enable_tool,onCheckedChange:a=>i({...n,enable_tool:a})}),l.jsx(de,{htmlFor:"enable_tool",className:"cursor-pointer",children:"启用工具系统"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"允许麦麦使用各种工具来增强功能"})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"记忆设置"}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_agent_iterations",children:"记忆思考深度"}),l.jsx(Pe,{id:"max_agent_iterations",type:"number",min:"1",value:e.max_agent_iterations,onChange:a=>s({...e,max_agent_iterations:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"最低为 1(不深入思考)"})]})]})}),l.jsx("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"表情包设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"emoji_chance",children:"表情包激活概率"}),l.jsx(Pe,{id:"emoji_chance",type:"number",step:"0.1",min:"0",max:"1",value:t.emoji_chance,onChange:a=>r({...t,emoji_chance:parseFloat(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"范围 0-1,越大越容易发送表情包"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_reg_num",children:"最大注册数量"}),l.jsx(Pe,{id:"max_reg_num",type:"number",min:"1",value:t.max_reg_num,onChange:a=>r({...t,max_reg_num:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦最多可以注册的表情包数量"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"check_interval",children:"检查间隔(分钟)"}),l.jsx(Pe,{id:"check_interval",type:"number",min:"1",value:t.check_interval,onChange:a=>r({...t,check_interval:parseInt(a.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"检查表情包(注册、破损、删除)的时间间隔"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"do_replace",checked:t.do_replace,onCheckedChange:a=>r({...t,do_replace:a})}),l.jsx(de,{htmlFor:"do_replace",className:"cursor-pointer",children:"达到最大数量时替换表情包"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"steal_emoji",checked:t.steal_emoji,onCheckedChange:a=>r({...t,steal_emoji:a})}),l.jsx(de,{htmlFor:"steal_emoji",className:"cursor-pointer",children:"偷取表情包"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"允许麦麦将看到的表情包据为己有"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"content_filtration",checked:t.content_filtration,onCheckedChange:a=>r({...t,content_filtration:a})}),l.jsx(de,{htmlFor:"content_filtration",className:"cursor-pointer",children:"启用表情包过滤"})]}),t.content_filtration&&l.jsxs("div",{className:"grid gap-2 pl-6 border-l-2 border-primary/20",children:[l.jsx(de,{htmlFor:"filtration_prompt",children:"过滤要求"}),l.jsx(Pe,{id:"filtration_prompt",value:t.filtration_prompt,onChange:a=>r({...t,filtration_prompt:a.target.value}),placeholder:"符合公序良俗"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"只有符合此要求的表情包才会被保存"})]})]})]})})]})}function She({keywordReactionConfig:t,responsePostProcessConfig:e,chineseTypoConfig:n,responseSplitterConfig:r,onKeywordReactionChange:s,onResponsePostProcessChange:i,onChineseTypoChange:a,onResponseSplitterChange:o}){const c=()=>{s({...t,regex_rules:[...t.regex_rules,{regex:[""],reaction:""}]})},h=T=>{s({...t,regex_rules:t.regex_rules.filter((_,E)=>E!==T)})},f=(T,_,E)=>{const M=[...t.regex_rules];_==="regex"&&typeof E=="string"?M[T]={...M[T],regex:[E]}:_==="reaction"&&typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,regex_rules:M})},m=({regex:T,reaction:_,onRegexChange:E,onReactionChange:M})=>{const[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState({}),[J,X]=b.useState(""),R=b.useRef(null),[se,G]=b.useState("build"),F=Y=>Y.replace(/\(\?P<([^>]+)>/g,"(?<$1>"),U=(Y,ae=0)=>{const re=R.current;if(!re)return;const le=re.selectionStart||0,_e=re.selectionEnd||0,Ge=T.substring(0,le)+Y+T.substring(_e);E(Ge),setTimeout(()=>{const tt=le+Y.length+ae;re.setSelectionRange(tt,tt),re.focus()},0)};b.useEffect(()=>{if(!T||!I){ee(null),W({}),X(_),H("");return}try{const Y=F(T),ae=new RegExp(Y,"g"),re=I.match(ae);ee(re),H("");const _e=new RegExp(Y).exec(I);if(_e&&_e.groups){W(_e.groups);let Ge=_;Object.entries(_e.groups).forEach(([tt,Xe])=>{Ge=Ge.replace(new RegExp(`\\[${tt}\\]`,"g"),Xe||"")}),X(Ge)}else W({}),X(_)}catch(Y){H(Y.message),ee(null),W({}),X(_)}},[T,I,_]);const te=()=>{if(!I||!V||V.length===0)return l.jsx("span",{className:"text-muted-foreground",children:I||"请输入测试文本"});try{const Y=F(T),ae=new RegExp(Y,"g");let re=0;const le=[];let _e;for(;(_e=ae.exec(I))!==null;)_e.index>re&&le.push(l.jsx("span",{children:I.substring(re,_e.index)},`text-${re}`)),le.push(l.jsx("span",{className:"bg-yellow-200 dark:bg-yellow-900 font-semibold",children:_e[0]},`match-${_e.index}`)),re=_e.index+_e[0].length;return re)",desc:"Python风格命名捕获组",moveCursor:-1},{label:"非捕获组",pattern:"(?:)",desc:"分组但不保存匹配结果",moveCursor:-1}]},{category:"字符类",items:[{label:"字符集",pattern:"[]",desc:"匹配括号内的任意字符",moveCursor:-1},{label:"排除字符",pattern:"[^]",desc:"匹配不在括号内的字符",moveCursor:-1},{label:"范围",pattern:"[a-z]",desc:"匹配a到z的字符"},{label:"中文字符",pattern:"[\\u4e00-\\u9fa5]",desc:"匹配中文汉字"}]},{category:"常用模板",items:[{label:"捕获词语",pattern:"(?P\\S+)",desc:"捕获一个词语"},{label:"捕获句子",pattern:"(?P.+)",desc:"捕获整个句子"},{label:"捕获数字",pattern:"(?P\\d+)",desc:"捕获一个或多个数字"},{label:"可选词语",pattern:"(?:词语1|词语2)",desc:"匹配多个可选项之一"}]}];return l.jsxs(fr,{open:q,onOpenChange:L,children:[l.jsx(Bh,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(j1,{className:"h-4 w-4 mr-1"}),"正则编辑器"]})}),l.jsxs(rr,{className:"max-w-[95vw] sm:max-w-[900px] max-h-[90vh]",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"正则表达式编辑器"}),l.jsx(Ir,{className:"text-sm",children:"使用可视化工具构建正则表达式,并实时测试效果"})]}),l.jsx(on,{className:"max-h-[calc(90vh-120px)]",children:l.jsxs(na,{value:se,onValueChange:Y=>G(Y),className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-2",children:[l.jsx(Et,{value:"build",children:"🔧 构建器"}),l.jsx(Et,{value:"test",children:"🧪 测试器"})]}),l.jsxs(Kt,{value:"build",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"正则表达式"}),l.jsx(Pe,{ref:R,value:T,onChange:Y=>E(Y.target.value),className:"font-mono text-sm",placeholder:"点击下方按钮构建正则表达式..."})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"Reaction 内容"}),l.jsx(dr,{value:_,onChange:Y=>M(Y.target.value),placeholder:"使用 [捕获组名] 引用捕获的内容...",rows:3,className:"text-sm"})]}),l.jsxs("div",{className:"space-y-4 border-t pt-4",children:[ne.map(Y=>l.jsxs("div",{className:"space-y-2",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:Y.category}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:Y.items.map(ae=>l.jsx(fe,{variant:"outline",size:"sm",className:"justify-start h-auto py-2 px-3",onClick:()=>U(ae.pattern,ae.moveCursor||0),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l.jsx("span",{className:"text-xs font-medium",children:ae.label}),l.jsx("code",{className:"ml-auto text-xs bg-muted px-1.5 py-0.5 rounded font-mono",children:ae.pattern})]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-0.5",children:ae.desc})]})},ae.label))})]},Y.category)),l.jsxs("div",{className:"space-y-2 border-t pt-4",children:[l.jsx("h5",{className:"text-xs font-semibold text-primary",children:"完整示例模板"}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(fe,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("^(?P\\S{1,20})是这样的$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsxs("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:["^(?P\\S","{1,20}",")是这样的$"]}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「某事物是这样的」并捕获事物名称"})]})}),l.jsx(fe,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?:[^,。.\\s]+,\\s*)?我(?:也)?[没沒]要求你\\s*(?P.+?)[.。,,]?$"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"匹配「我没要求你做某事」并捕获具体行为"})]})}),l.jsx(fe,{variant:"outline",size:"sm",className:"w-full justify-start h-auto py-2 px-3",onClick:()=>E("(?P.+?)(?:是|为什么|怎么)"),children:l.jsxs("div",{className:"flex flex-col items-start w-full",children:[l.jsx("code",{className:"text-xs font-mono bg-muted px-2 py-1 rounded w-full overflow-x-auto",children:"(?P.+?)(?:是|为什么|怎么)"}),l.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"捕获问题主题词"})]})})]})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 使用提示"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"点击输入框设置光标位置,然后点击按钮插入模式"}),l.jsxs("li",{children:["命名捕获组格式:",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"(?P<名称>模式)"})]}),l.jsxs("li",{children:["在 reaction 中使用 ",l.jsx("code",{className:"bg-blue-100 dark:bg-blue-900 px-1 rounded",children:"[名称]"})," 引用捕获的内容"]}),l.jsx("li",{children:"切换到测试器标签页验证正则表达式效果"})]})]})]}),l.jsxs(Kt,{value:"test",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"当前正则表达式"}),l.jsx("div",{className:"rounded-md bg-muted p-3 font-mono text-xs break-all",children:T||"(未设置)"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"test-text",className:"text-sm font-medium",children:"测试文本"}),l.jsx(dr,{id:"test-text",value:I,onChange:Y=>$(Y.target.value),placeholder:`在此输入要测试的文本... +例如:打游戏是这样的`,className:"min-h-[100px] text-sm"})]}),z&&l.jsxs("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-3",children:[l.jsx("p",{className:"text-sm text-destructive font-medium",children:"正则表达式错误"}),l.jsx("p",{className:"text-xs text-destructive/80 mt-1",children:z})]}),!z&&I&&l.jsxs("div",{className:"space-y-3",children:[l.jsx("div",{className:"flex items-center gap-2",children:V&&V.length>0?l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-green-500"}),l.jsxs("span",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:["匹配成功 (",V.length," 处)"]})]}):l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"h-2 w-2 rounded-full bg-gray-400"}),l.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:"无匹配"})]})}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"匹配高亮"}),l.jsx(on,{className:"h-40 rounded-md bg-muted p-3",children:l.jsx("div",{className:"text-sm break-words",children:te()})})]}),Object.keys(P).length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"命名捕获组"}),l.jsx(on,{className:"h-32 rounded-md border p-3",children:l.jsx("div",{className:"space-y-2",children:Object.entries(P).map(([Y,ae])=>l.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[l.jsxs("span",{className:"font-mono font-semibold text-primary min-w-[80px]",children:["[",Y,"]"]}),l.jsx("span",{className:"text-muted-foreground",children:"="}),l.jsx("span",{className:"font-mono bg-muted px-2 py-0.5 rounded",children:ae})]},Y))})})]}),Object.keys(P).length>0&&_&&l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{className:"text-sm font-medium",children:"Reaction 替换预览"}),l.jsx(on,{className:"h-48 rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3",children:l.jsx("div",{className:"text-sm break-words",children:J})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"reaction 中的 [name] 已被替换为对应的捕获组值"})]})]}),l.jsxs("div",{className:"rounded-md bg-blue-50 dark:bg-blue-950/30 border border-blue-200 dark:border-blue-800 p-3 space-y-1",children:[l.jsx("p",{className:"text-xs font-medium text-blue-900 dark:text-blue-100",children:"💡 测试说明"}),l.jsxs("ul",{className:"text-xs text-blue-700 dark:text-blue-300 space-y-1 list-disc list-inside",children:[l.jsx("li",{children:"匹配的文本会以黄色背景高亮显示"}),l.jsx("li",{children:"命名捕获组的值会显示在下方列表中"}),l.jsx("li",{children:"Reaction 替换预览显示最终生成的反应内容"}),l.jsx("li",{children:"如需修改正则,切换回构建器标签页"})]})]})]})]})})]})]})},g=()=>{s({...t,keyword_rules:[...t.keyword_rules,{keywords:[],reaction:""}]})},x=T=>{s({...t,keyword_rules:t.keyword_rules.filter((_,E)=>E!==T)})},y=(T,_,E)=>{const M=[...t.keyword_rules];typeof E=="string"&&(M[T]={...M[T],reaction:E}),s({...t,keyword_rules:M})},w=T=>{const _=[...t.keyword_rules];_[T]={..._[T],keywords:[..._[T].keywords||[],""]},s({...t,keyword_rules:_})},S=(T,_)=>{const E=[...t.keyword_rules];E[T]={...E[T],keywords:(E[T].keywords||[]).filter((M,q)=>q!==_)},s({...t,keyword_rules:E})},k=(T,_,E)=>{const M=[...t.keyword_rules],q=[...M[T].keywords||[]];q[_]=E,M[T]={...M[T],keywords:q},s({...t,keyword_rules:M})},N=({rule:T})=>{const _=`{ regex = [${(T.regex||[]).map(E=>`"${E}"`).join(", ")}], reaction = "${T.reaction}" }`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(on,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs break-all",children:_})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})},C=({rule:T})=>{const _=`[[keyword_reaction.keyword_rules]] keywords = [${(T.keywords||[]).map(E=>`"${E}"`).join(", ")}] -reaction = "${T.reaction}"`;return o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"预览"]})}),o.jsx(so,{className:"w-[95vw] sm:w-[500px]",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),o.jsx(kn,{className:"h-60 rounded-md bg-muted p-3",children:o.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:_})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),o.jsxs(me,{onClick:c,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,_)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",_+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:E=>f(_,"regex",E),onReactionChange:E=>f(_,"reaction",E)}),o.jsx(N,{rule:T}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除正则规则 ",_+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>h(_),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),o.jsx(Pe,{value:T.regex&&T.regex[0]||"",onChange:E=>f(_,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(nr,{value:T.reaction,onChange:E=>f(_,"reaction",E.target.value),placeholder:`触发后麦麦的反应... -可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},_)),t.regex_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),o.jsxs("div",{className:"space-y-4 border-t pt-6",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),o.jsxs(me,{onClick:g,size:"sm",variant:"outline",children:[o.jsx(ms,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),o.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,_)=>o.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",_+1]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(C,{rule:T}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除关键词规则 ",_+1," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>x(_),children:"删除"})]})]})]})]})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{className:"text-xs font-medium",children:"关键词列表"}),o.jsxs(me,{onClick:()=>w(_),size:"sm",variant:"ghost",children:[o.jsx(ms,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),o.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((E,M)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{value:E,onChange:q=>k(_,M,q.target.value),placeholder:"关键词",className:"flex-1"}),o.jsx(me,{onClick:()=>S(_,M),size:"sm",variant:"ghost",children:o.jsx(sn,{className:"h-4 w-4"})})]},M)),(!T.keywords||T.keywords.length===0)&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),o.jsx(nr,{value:T.reaction,onChange:E=>y(_,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},_)),t.keyword_rules.length===0&&o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),o.jsx(de,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Tt,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),o.jsx(de,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),o.jsx(Pe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),o.jsx(Pe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),o.jsx(Pe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),o.jsx(Pe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),o.jsx("div",{className:"border-t pt-6 space-y-4",children:o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[o.jsx(Tt,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>l({...r,enable:T})}),o.jsx(de,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),o.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&o.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),o.jsx(Pe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>l({...r,max_length:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),o.jsx(Pe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>l({...r,max_sentence_num:parseInt(T.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>l({...r,enable_kaomoji_protection:T})}),o.jsx(de,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>l({...r,enable_overflow_return_all:T})}),o.jsx(de,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),o.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function ohe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),o.jsx(de,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"情绪更新阈值"}),o.jsx(Pe,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"情感特征"}),o.jsx(nr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function lhe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),o.jsx(de,{className:"cursor-pointer",children:"启用语音识别"})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function che({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),o.jsx(de,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"LPMM 模式"}),o.jsxs(Dt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[o.jsx(Mt,{children:o.jsx(zt,{placeholder:"选择 LPMM 模式"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"classic",children:"经典模式"}),o.jsx(ze,{value:"agent",children:"Agent 模式"})]})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"同义词搜索 TopK"}),o.jsx(Pe,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"同义词阈值"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"实体提取线程数"}),o.jsx(Pe,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"嵌入向量维度"}),o.jsx(Pe,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function uhe({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},l=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},f=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"日期格式"}),o.jsx(Pe,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"日志级别样式"}),o.jsxs(Dt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:m.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"日志文本颜色"}),o.jsxs(Dt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:g.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"全局日志级别"}),o.jsxs(Dt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"控制台日志级别"}),o.jsxs(Dt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"文件日志级别"}),o.jsxs(Dt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"mb-2 block",children:"完全屏蔽的库"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),o.jsx(me,{onClick:a,size:"sm",className:"flex-shrink-0",children:o.jsx(ms,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>o.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[o.jsx("span",{className:"text-sm",children:x}),o.jsx(me,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>l(x),children:o.jsx(sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),o.jsxs("div",{children:[o.jsx(de,{className:"mb-2 block",children:"特定库的日志级别"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),o.jsxs(Dt,{value:s,onValueChange:i,children:[o.jsx(Mt,{className:"w-32",children:o.jsx(zt,{})}),o.jsx(At,{children:f.map(x=>o.jsx(ze,{value:x,children:x},x))})]}),o.jsx(me,{onClick:c,size:"sm",children:o.jsx(ms,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-medium",children:x}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm text-muted-foreground",children:y}),o.jsx(me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(x),children:o.jsx(sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function dhe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),o.jsx(Tt,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示回复器 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),o.jsx(Tt,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示回复器推理"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),o.jsx(Tt,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 Jargon Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),o.jsx(Tt,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示记忆检索 Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),o.jsx(Tt,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 Planner Prompt"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),o.jsx(Tt,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"显示 LPMM 相关文段"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),o.jsx(Tt,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function hhe({config:t,onChange:e}){const[n,r]=b.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((l,c)=>c!==a)})};return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"启用自定义服务器"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),o.jsx(Tt,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"主机地址"}),o.jsx(Pe,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"端口号"}),o.jsx(Pe,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"连接模式"}),o.jsxs(Dt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"ws",children:"WebSocket (ws)"}),o.jsx(ze,{value:"tcp",children:"TCP"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),o.jsx(de,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"SSL 证书文件路径"}),o.jsx(Pe,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"SSL 密钥文件路径"}),o.jsx(Pe,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"mb-2 block",children:"认证令牌"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),o.jsxs("div",{className:"flex gap-2 mb-2",children:[o.jsx(Pe,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),o.jsx(me,{onClick:s,size:"sm",children:o.jsx(ms,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),o.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,l)=>o.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[o.jsx("span",{className:"text-sm font-mono",children:a}),o.jsx(me,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(l),children:o.jsx(sn,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},l))})]})]})}function fhe({config:t,onChange:e}){return o.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"space-y-0.5",children:[o.jsx(de,{children:"启用统计信息发送"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),o.jsx(Tt,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Qh=b.forwardRef(({className:t,...e},n)=>o.jsx("div",{className:"relative w-full overflow-auto",children:o.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Qh.displayName="Table";const Hh=b.forwardRef(({className:t,...e},n)=>o.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Hh.displayName="TableHeader";const Vh=b.forwardRef(({className:t,...e},n)=>o.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));Vh.displayName="TableBody";const mhe=b.forwardRef(({className:t,...e},n)=>o.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));mhe.displayName="TableFooter";const fs=b.forwardRef(({className:t,...e},n)=>o.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));fs.displayName="TableRow";const en=b.forwardRef(({className:t,...e},n)=>o.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));en.displayName="TableHead";const Lt=b.forwardRef(({className:t,...e},n)=>o.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));Lt.displayName="TableCell";const phe=b.forwardRef(({className:t,...e},n)=>o.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));phe.displayName="TableCaption";var TE=1,ghe=.9,xhe=.8,vhe=.17,qw=.1,Fw=.999,yhe=.9999,bhe=.99,whe=/[\\\/_+.#"@\[\(\{&]/,She=/[\\\/_+.#"@\[\(\{&]/g,khe=/[\s-]/,eF=/[\s-]/g;function LS(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?TE:bhe;var l=`${s},${i}`;if(a[l]!==void 0)return a[l];for(var c=r.charAt(i),h=n.indexOf(c,s),f=0,m,g,x,y;h>=0;)m=LS(t,e,n,r,h+1,i+1,a),m>f&&(h===s?m*=TE:whe.test(t.charAt(h-1))?(m*=xhe,x=t.slice(s,h-1).match(She),x&&s>0&&(m*=Math.pow(Fw,x.length))):khe.test(t.charAt(h-1))?(m*=ghe,y=t.slice(s,h-1).match(eF),y&&s>0&&(m*=Math.pow(Fw,y.length))):(m*=vhe,s>0&&(m*=Math.pow(Fw,h-s))),t.charAt(h)!==e.charAt(i)&&(m*=yhe)),(mm&&(m=g*qw)),m>f&&(f=m),h=n.indexOf(c,h+1);return a[l]=f,f}function EE(t){return t.toLowerCase().replace(eF," ")}function Ohe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,LS(t,e,EE(t),EE(e),0,0,{})}var jhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ac=jhe.reduce((t,e)=>{const n=qk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...l}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),tm='[cmdk-group=""]',$w='[cmdk-group-items=""]',Nhe='[cmdk-group-heading=""]',tF='[cmdk-item=""]',_E=`${tF}:not([aria-disabled="true"])`,IS="cmdk-item-select",Bd="data-value",Che=(t,e,n)=>Ohe(t,e,n),nF=b.createContext(void 0),J0=()=>b.useContext(nF),rF=b.createContext(void 0),iO=()=>b.useContext(rF),sF=b.createContext(void 0),iF=b.forwardRef((t,e)=>{let n=qd(()=>{var G,F;return{search:"",value:(F=(G=t.value)!=null?G:t.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=qd(()=>new Set),s=qd(()=>new Map),i=qd(()=>new Map),a=qd(()=>new Set),l=aF(t),{label:c,children:h,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,N=ea(),C=ea(),T=ea(),_=b.useRef(null),E=Ihe();Ru(()=>{if(f!==void 0){let G=f.trim();n.current.value=G,M.emit()}},[f]),Ru(()=>{E(6,ee)},[]);let M=b.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,F,U)=>{var te,ne,Y,ae;if(!Object.is(n.current[G],F)){if(n.current[G]=F,G==="search")V(),I(),E(1,$);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(E(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,M.emit()}),U||E(5,ee),((ne=l.current)==null?void 0:ne.value)!==void 0){let re=F??"";(ae=(Y=l.current).onValueChange)==null||ae.call(Y,re);return}}M.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),q=b.useMemo(()=>({value:(G,F,U)=>{var te;F!==((te=i.current.get(G))==null?void 0:te.value)&&(i.current.set(G,{value:F,keywords:U}),n.current.filtered.items.set(G,L(F,U)),E(2,()=>{I(),M.emit()}))},item:(G,F)=>(r.current.add(G),F&&(s.current.has(F)?s.current.get(F).add(G):s.current.set(F,new Set([G]))),E(3,()=>{V(),I(),n.current.value||$(),M.emit()}),()=>{i.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let U=z();E(4,()=>{V(),U?.getAttribute("id")===G&&$(),M.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{i.current.delete(G),s.current.delete(G)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:_}),[]);function L(G,F){var U,te;let ne=(te=(U=l.current)==null?void 0:U.filter)!=null?te:Che;return G?ne(G,n.current.search,F):0}function I(){if(!n.current.search||l.current.shouldFilter===!1)return;let G=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(te=>{let ne=s.current.get(te),Y=0;ne.forEach(ae=>{let re=G.get(ae);Y=Math.max(re,Y)}),F.push([te,Y])});let U=_.current;H().sort((te,ne)=>{var Y,ae;let re=te.getAttribute("id"),oe=ne.getAttribute("id");return((Y=G.get(oe))!=null?Y:0)-((ae=G.get(re))!=null?ae:0)}).forEach(te=>{let ne=te.closest($w);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${$w} > *`)):U.appendChild(te.parentElement===U?te:te.closest(`${$w} > *`))}),F.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let Y=(ne=_.current)==null?void 0:ne.querySelector(`${tm}[${Bd}="${encodeURIComponent(te[0])}"]`);Y?.parentElement.appendChild(Y)})}function $(){let G=H().find(U=>U.getAttribute("aria-disabled")!=="true"),F=G?.getAttribute(Bd);M.setState("value",F||void 0)}function V(){var G,F,U,te;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let Y of r.current){let ae=(F=(G=i.current.get(Y))==null?void 0:G.value)!=null?F:"",re=(te=(U=i.current.get(Y))==null?void 0:U.keywords)!=null?te:[],oe=L(ae,re);n.current.filtered.items.set(Y,oe),oe>0&&ne++}for(let[Y,ae]of s.current)for(let re of ae)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(Y);break}n.current.filtered.count=ne}function ee(){var G,F,U;let te=z();te&&(((G=te.parentElement)==null?void 0:G.firstChild)===te&&((U=(F=te.closest(tm))==null?void 0:F.querySelector(Nhe))==null||U.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function z(){var G;return(G=_.current)==null?void 0:G.querySelector(`${tF}[aria-selected="true"]`)}function H(){var G;return Array.from(((G=_.current)==null?void 0:G.querySelectorAll(_E))||[])}function P(G){let F=H()[G];F&&M.setState("value",F.getAttribute(Bd))}function W(G){var F;let U=z(),te=H(),ne=te.findIndex(ae=>ae===U),Y=te[ne+G];(F=l.current)!=null&&F.loop&&(Y=ne+G<0?te[te.length-1]:ne+G===te.length?te[0]:te[ne+G]),Y&&M.setState("value",Y.getAttribute(Bd))}function J(G){let F=z(),U=F?.closest(tm),te;for(;U&&!te;)U=G>0?Phe(U,tm):Lhe(U,tm),te=U?.querySelector(_E);te?M.setState("value",te.getAttribute(Bd)):W(G)}let X=()=>P(H().length-1),R=G=>{G.preventDefault(),G.metaKey?X():G.altKey?J(1):W(1)},se=G=>{G.preventDefault(),G.metaKey?P(0):G.altKey?J(-1):W(-1)};return b.createElement(Ac.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:G=>{var F;(F=k.onKeyDown)==null||F.call(k,G);let U=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||U))switch(G.key){case"n":case"j":{S&&G.ctrlKey&&R(G);break}case"ArrowDown":{R(G);break}case"p":case"k":{S&&G.ctrlKey&&se(G);break}case"ArrowUp":{se(G);break}case"Home":{G.preventDefault(),P(0);break}case"End":{G.preventDefault(),X();break}case"Enter":{G.preventDefault();let te=z();if(te){let ne=new Event(IS);te.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:qhe},c),ry(t,G=>b.createElement(rF.Provider,{value:M},b.createElement(nF.Provider,{value:q},G))))}),The=b.forwardRef((t,e)=>{var n,r;let s=ea(),i=b.useRef(null),a=b.useContext(sF),l=J0(),c=aF(t),h=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;Ru(()=>{if(!h)return l.item(s,a?.id)},[h]);let f=oF(s,i,[t.value,t.children,i],t.keywords),m=iO(),g=wc(E=>E.value&&E.value===f.current),x=wc(E=>h||l.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);b.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener(IS,y),()=>E.removeEventListener(IS,y)},[x,t.onSelect,t.disabled]);function y(){var E,M;w(),(M=(E=c.current).onSelect)==null||M.call(E,f.current)}function w(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:N,forceMount:C,keywords:T,..._}=t;return b.createElement(Ac.div,{ref:mc(i,e),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||l.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),Ehe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=ea(),l=b.useRef(null),c=b.useRef(null),h=ea(),f=J0(),m=wc(x=>s||f.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);Ru(()=>f.group(a),[]),oF(a,l,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(Ac.div,{ref:mc(l,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),ry(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(sF.Provider,{value:g},x))))}),_he=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=wc(a=>!a.search);return!n&&!i?null:b.createElement(Ac.div,{ref:mc(s,e),...r,"cmdk-separator":"",role:"separator"})}),Mhe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=iO(),a=wc(h=>h.search),l=wc(h=>h.selectedItemId),c=J0();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Ac.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),Ahe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),l=wc(h=>h.selectedItemId),c=J0();return b.useEffect(()=>{if(a.current&&i.current){let h=a.current,f=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(h),()=>{cancelAnimationFrame(m),g.unobserve(h)}}},[]),b.createElement(Ac.div,{ref:mc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},ry(t,h=>b.createElement("div",{ref:mc(a,c.listInnerRef),"cmdk-list-sizer":""},h)))}),Rhe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...l}=t;return b.createElement(Vk,{open:n,onOpenChange:r},b.createElement(Fk,{container:a},b.createElement(kv,{"cmdk-overlay":"",className:s}),b.createElement(Ov,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(iF,{ref:e,...l}))))}),Dhe=b.forwardRef((t,e)=>wc(n=>n.filtered.count===0)?b.createElement(Ac.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),zhe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Ac.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},ry(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),oi=Object.assign(iF,{List:Ahe,Item:The,Input:Mhe,Group:Ehe,Separator:_he,Dialog:Rhe,Empty:Dhe,Loading:zhe});function Phe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Lhe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function aF(t){let e=b.useRef(t);return Ru(()=>{e.current=t}),e}var Ru=typeof window>"u"?b.useEffect:b.useLayoutEffect;function qd(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function wc(t){let e=iO(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function oF(t,e,n,r=[]){let s=b.useRef(),i=J0();return Ru(()=>{var a;let l=(()=>{var h;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(h=f.current.textContent)==null?void 0:h.trim():s.current}})(),c=r.map(h=>h.trim());i.value(t,l,c),(a=e.current)==null||a.setAttribute(Bd,l),s.current=l}),s}var Ihe=()=>{let[t,e]=b.useState(),n=qd(()=>new Map);return Ru(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function Bhe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function ry({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(Bhe(e),{ref:e.ref},n(e.props.children)):n(e)}var qhe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const aO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));aO.displayName=oi.displayName;const oO=b.forwardRef(({className:t,...e},n)=>o.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[o.jsx(ii,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),o.jsx(oi.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));oO.displayName=oi.Input.displayName;const lO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));lO.displayName=oi.List.displayName;const cO=b.forwardRef((t,e)=>o.jsx(oi.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));cO.displayName=oi.Empty.displayName;const uO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));uO.displayName=oi.Group.displayName;const Fhe=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));Fhe.displayName=oi.Separator.displayName;const dO=b.forwardRef(({className:t,...e},n)=>o.jsx(oi.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));dO.displayName=oi.Item.displayName;const ri=b.forwardRef(({className:t,...e},n)=>o.jsx(QD,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:o.jsx(oK,{className:ye("grid place-content-center text-current"),children:o.jsx(dc,{className:"h-4 w-4"})})}));ri.displayName=QD.displayName;const xx=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)"},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek"},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI"},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)"},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)"},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)"},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)"},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)"},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)"},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)"},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)"},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI"},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)"},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini"},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq"},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI"},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI"},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI"},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function $he(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,l]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[N,C]=b.useState(null),[T,_]=b.useState("custom"),[E,M]=b.useState(!1),[q,L]=b.useState(!1),[I,$]=b.useState(null),[V,ee]=b.useState(!1),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Wr(),Y=b.useRef(null),ae=b.useRef(!0);b.useEffect(()=>{re()},[]);const re=async()=>{try{r(!0);const Ne=await Zd();e(Ne.api_providers||[]),h(!1),ae.current=!1}catch(Ne){console.error("加载配置失败:",Ne)}finally{r(!1)}},oe=async()=>{try{m(!0),Bv().catch(()=>{}),x(!0)}catch(Ne){console.error("重启失败:",Ne),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},_e=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Zd();Ne.api_providers=t,await T1(Ne),h(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await oe()}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"}),i(!1)}},Ge=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},tt=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Xe=b.useCallback(async Ne=>{if(!ae.current)try{l(!0),await B3("api_providers",Ne),h(!1)}catch(ie){console.error("自动保存失败:",ie),h(!0)}finally{l(!1)}},[]);b.useEffect(()=>{if(!ae.current)return h(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{Xe(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,Xe]);const je=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Zd();Ne.api_providers=t,await T1(Ne),h(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"})}finally{i(!1)}},Qe=(Ne,ie)=>{if(Ne){const xe=xx.find(Je=>Je.base_url===Ne.base_url&&Je.client_type===Ne.client_type);_(xe?.id||"custom"),k(Ne)}else _("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});C(ie),ee(!1),w(!0)},He=Ne=>{_(Ne),M(!1);const ie=xx.find(xe=>xe.id===Ne);ie&&ie.id!=="custom"?k(xe=>({...xe,name:ie.name,base_url:ie.base_url,client_type:ie.client_type})):ie?.id==="custom"&&k(xe=>({...xe,name:"",base_url:"",client_type:"openai"}))},$e=b.useMemo(()=>T!=="custom",[T]),bt=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},ot=()=>{if(!S)return;const Ne={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(N!==null){const ie=[...t];ie[N]=Ne,e(ie)}else e([...t,Ne]);w(!1),k(null),C(null)},on=Ne=>{if(!Ne&&S){const ie={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(ie)}w(Ne)},Tn=Ne=>{$(Ne),L(!0)},Nn=()=>{if(I!==null){const Ne=t.filter((ie,xe)=>xe!==I);e(Ne),ne({title:"删除成功",description:"提供商已从列表中移除"})}L(!1),$(null)},Rt=Ne=>{const ie=new Set(P);ie.has(Ne)?ie.delete(Ne):ie.add(Ne),W(ie)},xt=()=>{if(P.size===qe.length)W(new Set);else{const Ne=qe.map((ie,xe)=>t.findIndex(Je=>Je===qe[xe]));W(new Set(Ne))}},Te=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}X(!0)},Re=()=>{const Ne=t.filter((ie,xe)=>!P.has(xe));e(Ne),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个提供商`})},qe=t.filter(Ne=>{if(!z)return!0;const ie=z.toLowerCase();return Ne.name.toLowerCase().includes(ie)||Ne.base_url.toLowerCase().includes(ie)||Ne.client_type.toLowerCase().includes(ie)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const Ne=parseInt(U);Ne>=1&&Ne<=rt&&(se(Ne),te(""))};return n?o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[P.size>0&&o.jsxs(me,{onClick:Te,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),o.jsxs(me,{onClick:()=>Qe(null,null),size:"sm",className:"w-full sm:w-auto",children:[o.jsx(ms,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),o.jsxs(me,{onClick:je,disabled:s||a||!c||f,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{disabled:s||a||f,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(Yk,{className:"mr-2 h-4 w-4"}),f?"重启中...":c?"保存并重启":"重启麦麦"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重启麦麦?"}),o.jsxs(fn,{className:"space-y-3",children:[o.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(nl,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(wa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(rl,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})]})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:c?_e:oe,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(kn,{className:"h-[calc(100vh-260px)]",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:Ne=>H(Ne.target.value),className:"pl-9"})]}),z&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:qe.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h3",{className:"font-semibold text-base truncate",children:Ne.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:Ne.base_url})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>Tn(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),o.jsx("p",{className:"font-medium",children:Ne.client_type})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),o.jsx("p",{className:"font-medium",children:Ne.max_retry})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),o.jsx("p",{className:"font-medium",children:Ne.timeout})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),o.jsx("p",{className:"font-medium",children:Ne.retry_interval})]})]})]},ie)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:xt})}),o.jsx(en,{children:"名称"}),o.jsx(en,{children:"基础URL"}),o.jsx(en,{children:"客户端类型"}),o.jsx(en,{className:"text-right",children:"最大重试"}),o.jsx(en,{className:"text-right",children:"超时(秒)"}),o.jsx(en,{className:"text-right",children:"重试间隔(秒)"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:wt.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:P.has(xe),onCheckedChange:()=>Rt(xe)})}),o.jsx(Lt,{className:"font-medium",children:Ne.name}),o.jsx(Lt,{className:"max-w-xs truncate",title:Ne.base_url,children:Ne.base_url}),o.jsx(Lt,{children:Ne.client_type}),o.jsx(Lt,{className:"text-right",children:Ne.max_retry}),o.jsx(Lt,{className:"text-right",children:Ne.timeout}),o.jsx(Lt,{className:"text-right",children:Ne.retry_interval}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>Tn(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ie)})})]})})}),qe.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:G.toString(),onValueChange:Ne=>{F(parseInt(Ne)),se(1),W(new Set)},children:[o.jsx(Mt,{id:"page-size-provider",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Math.max(1,Ne-1)),disabled:R===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:U,onChange:Ne=>te(Ne.target.value),onKeyDown:Ne=>Ne.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),o.jsx(me,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Ne+1),disabled:R>=rt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]}),o.jsx(zr,{open:y,onOpenChange:on,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:N!==null?"编辑提供商":"添加提供商"}),o.jsx(ps,{children:"配置 API 提供商的连接信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"template",children:"提供商模板"}),o.jsxs(cl,{open:E,onOpenChange:M,children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":E,className:"w-full justify-between",children:[T?xx.find(Ne=>Ne.id===T)?.display_name:"选择提供商模板...",o.jsx(YD,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),o.jsx(so,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:o.jsxs(aO,{children:[o.jsx(oO,{placeholder:"搜索提供商模板..."}),o.jsx(kn,{className:"h-[300px]",children:o.jsxs(lO,{className:"max-h-none overflow-visible",children:[o.jsx(cO,{children:"未找到匹配的模板"}),o.jsx(uO,{children:xx.map(Ne=>o.jsxs(dO,{value:Ne.display_name,onSelect:()=>He(Ne.id),children:[o.jsx(dc,{className:`mr-2 h-4 w-4 ${T===Ne.id?"opacity-100":"opacity-0"}`}),Ne.display_name]},Ne.id))})]})})]})})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"name",children:"名称 *"}),o.jsx(Pe,{id:"name",value:S?.name||"",onChange:Ne=>k(ie=>ie?{...ie,name:Ne.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"base_url",children:"基础 URL *"}),o.jsx(Pe,{id:"base_url",value:S?.base_url||"",onChange:Ne=>k(ie=>ie?{...ie,base_url:Ne.target.value}:null),placeholder:"https://api.example.com/v1",disabled:$e,className:$e?"bg-muted cursor-not-allowed":""}),$e&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"api_key",children:"API Key *"}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{id:"api_key",type:V?"text":"password",value:S?.api_key||"",onChange:Ne=>k(ie=>ie?{...ie,api_key:Ne.target.value}:null),placeholder:"sk-...",className:"flex-1"}),o.jsx(me,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!V),title:V?"隐藏密钥":"显示密钥",children:V?o.jsx(b1,{className:"h-4 w-4"}):o.jsx(sa,{className:"h-4 w-4"})}),o.jsx(me,{type:"button",variant:"outline",size:"icon",onClick:bt,title:"复制密钥",children:o.jsx(S3,{className:"h-4 w-4"})})]})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"client_type",children:"客户端类型"}),o.jsxs(Dt,{value:S?.client_type||"openai",onValueChange:Ne=>k(ie=>ie?{...ie,client_type:Ne}:null),disabled:$e,children:[o.jsx(Mt,{id:"client_type",className:$e?"bg-muted cursor-not-allowed":"",children:o.jsx(zt,{placeholder:"选择客户端类型"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"openai",children:"OpenAI"}),o.jsx(ze,{value:"gemini",children:"Gemini"})]})]}),$e&&o.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"max_retry",children:"最大重试"}),o.jsx(Pe,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,max_retry:ie}:null)},placeholder:"默认: 2"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"timeout",children:"超时(秒)"}),o.jsx(Pe,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,timeout:ie}:null)},placeholder:"默认: 30"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),o.jsx(Pe,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,retry_interval:ie}:null)},placeholder:"默认: 10"})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>w(!1),children:"取消"}),o.jsx(me,{onClick:ot,children:"保存"})]})]})}),o.jsx(jn,{open:q,onOpenChange:L,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除提供商 "',I!==null?t[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Nn,children:"删除"})]})]})}),o.jsx(jn,{open:J,onOpenChange:X,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["确定要删除选中的 ",P.size," 个提供商吗? 此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Re,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&o.jsx(p6,{onRestartComplete:Ge,onRestartFailed:tt})]})}function Qhe(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const sy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Uh(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function hO(t){return"nodeType"in t}function li(t){var e,n;return t?Uh(t)?t:hO(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function fO(t){const{Document:e}=li(t);return t instanceof e}function ep(t){return Uh(t)?!1:t instanceof li(t).HTMLElement}function lF(t){return t instanceof li(t).SVGElement}function Wh(t){return t?Uh(t)?t.document:hO(t)?fO(t)?t:ep(t)||lF(t)?t.ownerDocument:document:document:document}const ao=sy?b.useLayoutEffect:b.useEffect;function mO(t){const e=b.useRef(t);return ao(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function c0(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return ao(()=>{n.current!==t&&(n.current=t)},e),n}function tp(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function K1(t){const e=mO(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function BS(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let Qw={};function np(t,e){return b.useMemo(()=>{if(e)return e;const n=Qw[t]==null?0:Qw[t]+1;return Qw[t]=n,t+"-"+n},[t,e])}function cF(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const l=Object.entries(a);for(const[c,h]of l){const f=i[c];f!=null&&(i[c]=f+t*h)}return i},{...e})}}const ih=cF(1),u0=cF(-1);function Vhe(t){return"clientX"in t&&"clientY"in t}function pO(t){if(!t)return!1;const{KeyboardEvent:e}=li(t.target);return e&&t instanceof e}function Uhe(t){if(!t)return!1;const{TouchEvent:e}=li(t.target);return e&&t instanceof e}function qS(t){if(Uhe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return Vhe(t)?{x:t.clientX,y:t.clientY}:null}const d0=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[d0.Translate.toString(t),d0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),ME="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Whe(t){return t.matches(ME)?t:t.querySelector(ME)}const Ghe={display:"none"};function Xhe(t){let{id:e,value:n}=t;return he.createElement("div",{id:e,style:Ghe},n)}function Yhe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return he.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function Khe(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const uF=b.createContext(null);function Zhe(t){const e=b.useContext(uF);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function Jhe(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var l;return(l=a[s])==null?void 0:l.call(a,i)})},[t]),e]}const efe={draggable:` +reaction = "${T.reaction}"`;return l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"预览"]})}),l.jsx(ol,{className:"w-[95vw] sm:w-[500px]",children:l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-medium text-sm",children:"配置预览"}),l.jsx(on,{className:"h-60 rounded-md bg-muted p-3",children:l.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-all",children:_})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"这是保存到 bot_config.toml 文件中的格式"})]})})]})};return l.jsxs("div",{className:"space-y-6",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"关键词反应配置"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置触发特定反应的关键词和正则表达式规则"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"正则表达式规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用正则表达式匹配消息内容"})]}),l.jsxs(fe,{onClick:c,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加正则规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.regex_rules.map((T,_)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["正则规则 ",_+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(m,{regex:T.regex&&T.regex[0]||"",reaction:T.reaction,onRegexChange:E=>f(_,"regex",E),onReactionChange:E=>f(_,"reaction",E)}),l.jsx(N,{rule:T}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除正则规则 ",_+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>h(_),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"正则表达式(Python 语法)"}),l.jsx(Pe,{value:T.regex&&T.regex[0]||"",onChange:E=>f(_,"regex",E.target.value),placeholder:"例如:^(?P\\\\S{1,20})是这样的$ (点击正则编辑器按钮可视化构建)",className:"font-mono text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:'支持命名捕获组 (?Ppattern),可在 reaction 中使用 [name] 引用。点击"正则编辑器"可视化构建和测试!'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(dr,{value:T.reaction,onChange:E=>f(_,"reaction",E.target.value),placeholder:`触发后麦麦的反应... +可以使用 [捕获组名] 来引用正则表达式中的内容`,rows:3,className:"text-sm"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"使用 [捕获组名] 引用正则表达式中的命名捕获组,例如 [n] 会被替换为捕获的内容"})]})]})]},_)),t.regex_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无正则规则,点击"添加正则规则"开始配置'})]})]}),l.jsxs("div",{className:"space-y-4 border-t pt-6",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"text-base font-semibold",children:"关键词规则"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"使用关键词列表匹配消息内容"})]}),l.jsxs(fe,{onClick:g,size:"sm",variant:"outline",children:[l.jsx(gs,{className:"h-4 w-4 mr-1"}),"添加关键词规则"]})]}),l.jsxs("div",{className:"space-y-3",children:[t.keyword_rules.map((T,_)=>l.jsxs("div",{className:"rounded-lg border p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("span",{className:"text-sm font-medium",children:["关键词规则 ",_+1]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(C,{rule:T}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除关键词规则 ",_+1," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>x(_),children:"删除"})]})]})]})]})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{className:"text-xs font-medium",children:"关键词列表"}),l.jsxs(fe,{onClick:()=>w(_),size:"sm",variant:"ghost",children:[l.jsx(gs,{className:"h-3 w-3 mr-1"}),"添加关键词"]})]}),l.jsxs("div",{className:"space-y-2",children:[(T.keywords||[]).map((E,M)=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{value:E,onChange:q=>k(_,M,q.target.value),placeholder:"关键词",className:"flex-1"}),l.jsx(fe,{onClick:()=>S(_,M),size:"sm",variant:"ghost",children:l.jsx(ln,{className:"h-4 w-4"})})]},M)),(!T.keywords||T.keywords.length===0)&&l.jsx("p",{className:"text-xs text-muted-foreground text-center py-2",children:'暂无关键词,点击"添加关键词"开始配置'})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-xs font-medium",children:"反应内容"}),l.jsx(dr,{value:T.reaction,onChange:E=>y(_,"reaction",E.target.value),placeholder:"触发后麦麦的反应...",rows:3,className:"text-sm"})]})]})]},_)),t.keyword_rules.length===0&&l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'暂无关键词规则,点击"添加关键词规则"开始配置'})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"回复后处理配置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_response_post_process",checked:e.enable_response_post_process,onCheckedChange:T=>i({...e,enable_response_post_process:T})}),l.jsx(de,{htmlFor:"enable_response_post_process",className:"cursor-pointer",children:"启用回复后处理"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mt-2",children:"包括错别字生成器和回复分割器"})]}),e.enable_response_post_process&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(_t,{id:"enable_chinese_typo",checked:n.enable,onCheckedChange:T=>a({...n,enable:T})}),l.jsx(de,{htmlFor:"enable_chinese_typo",className:"cursor-pointer font-semibold",children:"中文错别字生成器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"为回复添加随机错别字,让麦麦的回复更自然"}),n.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"error_rate",className:"text-xs font-medium",children:"单字替换概率"}),l.jsx(Pe,{id:"error_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.error_rate,onChange:T=>a({...n,error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"min_freq",className:"text-xs font-medium",children:"最小字频阈值"}),l.jsx(Pe,{id:"min_freq",type:"number",min:"0",value:n.min_freq,onChange:T=>a({...n,min_freq:parseInt(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"tone_error_rate",className:"text-xs font-medium",children:"声调错误概率"}),l.jsx(Pe,{id:"tone_error_rate",type:"number",step:"0.01",min:"0",max:"1",value:n.tone_error_rate,onChange:T=>a({...n,tone_error_rate:parseFloat(T.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"word_replace_rate",className:"text-xs font-medium",children:"整词替换概率"}),l.jsx(Pe,{id:"word_replace_rate",type:"number",step:"0.001",min:"0",max:"1",value:n.word_replace_rate,onChange:T=>a({...n,word_replace_rate:parseFloat(T.target.value)})})]})]})]})}),l.jsx("div",{className:"border-t pt-6 space-y-4",children:l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center space-x-2 mb-4",children:[l.jsx(_t,{id:"enable_response_splitter",checked:r.enable,onCheckedChange:T=>o({...r,enable:T})}),l.jsx(de,{htmlFor:"enable_response_splitter",className:"cursor-pointer font-semibold",children:"回复分割器"})]}),l.jsx("p",{className:"text-xs text-muted-foreground mb-4",children:"控制回复的长度和句子数量"}),r.enable&&l.jsxs("div",{className:"grid gap-4 pl-6 border-l-2 border-primary/20",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_length",className:"text-xs font-medium",children:"最大长度"}),l.jsx(Pe,{id:"max_length",type:"number",min:"1",value:r.max_length,onChange:T=>o({...r,max_length:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大字符数"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_sentence_num",className:"text-xs font-medium",children:"最大句子数"}),l.jsx(Pe,{id:"max_sentence_num",type:"number",min:"1",value:r.max_sentence_num,onChange:T=>o({...r,max_sentence_num:parseInt(T.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"回复允许的最大句子数量"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_kaomoji_protection",checked:r.enable_kaomoji_protection,onCheckedChange:T=>o({...r,enable_kaomoji_protection:T})}),l.jsx(de,{htmlFor:"enable_kaomoji_protection",className:"cursor-pointer",children:"启用颜文字保护"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"enable_overflow_return_all",checked:r.enable_overflow_return_all,onCheckedChange:T=>o({...r,enable_overflow_return_all:T})}),l.jsx(de,{htmlFor:"enable_overflow_return_all",className:"cursor-pointer",children:"超出时一次性返回全部"})]}),l.jsx("p",{className:"text-xs text-muted-foreground -mt-2",children:"当句子数量超出限制时,合并后一次性返回所有内容"})]})]})})]})]})]})}function khe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"情绪设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.enable_mood,onCheckedChange:n=>e({...t,enable_mood:n})}),l.jsx(de,{className:"cursor-pointer",children:"启用情绪系统"})]}),t.enable_mood&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"情绪更新阈值"}),l.jsx(Pe,{type:"number",min:"1",value:t.mood_update_threshold,onChange:n=>e({...t,mood_update_threshold:parseInt(n.target.value)})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"越高,更新越慢"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"情感特征"}),l.jsx(dr,{value:t.emotion_style,onChange:n=>e({...t,emotion_style:n.target.value}),placeholder:"影响情绪的变化情况",rows:2})]})]})]})]})}function Ohe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"语音设置"}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.enable_asr,onCheckedChange:n=>e({...t,enable_asr:n})}),l.jsx(de,{className:"cursor-pointer",children:"启用语音识别"})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"启用后麦麦可以识别语音消息,需要配置语音识别模型"})]})}function jhe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库设置"}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})}),l.jsx(de,{className:"cursor-pointer",children:"启用 LPMM 知识库"})]}),t.enable&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"LPMM 模式"}),l.jsxs(zt,{value:t.lpmm_mode,onValueChange:n=>e({...t,lpmm_mode:n}),children:[l.jsx(At,{children:l.jsx(Pt,{placeholder:"选择 LPMM 模式"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"classic",children:"经典模式"}),l.jsx(ze,{value:"agent",children:"Agent 模式"})]})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"同义词搜索 TopK"}),l.jsx(Pe,{type:"number",min:"1",value:t.rag_synonym_search_top_k,onChange:n=>e({...t,rag_synonym_search_top_k:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"同义词阈值"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:t.rag_synonym_threshold,onChange:n=>e({...t,rag_synonym_threshold:parseFloat(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"实体提取线程数"}),l.jsx(Pe,{type:"number",min:"1",value:t.info_extraction_workers,onChange:n=>e({...t,info_extraction_workers:parseInt(n.target.value)})})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"嵌入向量维度"}),l.jsx(Pe,{type:"number",min:"1",value:t.embedding_dimension,onChange:n=>e({...t,embedding_dimension:parseInt(n.target.value)})})]})]})]})]})]})}function Nhe({config:t,onChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState("WARNING"),a=()=>{n&&!t.suppress_libraries.includes(n)&&(e({...t,suppress_libraries:[...t.suppress_libraries,n]}),r(""))},o=x=>{e({...t,suppress_libraries:t.suppress_libraries.filter(y=>y!==x)})},c=()=>{n&&!t.library_log_levels[n]&&(e({...t,library_log_levels:{...t.library_log_levels,[n]:s}}),r(""),i("WARNING"))},h=x=>{const y={...t.library_log_levels};delete y[x],e({...t,library_log_levels:y})},f=["DEBUG","INFO","WARNING","ERROR","CRITICAL"],m=["FULL","compact","lite"],g=["none","title","full"];return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"日志配置"}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"日期格式"}),l.jsx(Pe,{value:t.date_style,onChange:x=>e({...t,date_style:x.target.value}),placeholder:"例如: m-d H:i:s"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"m=月, d=日, H=时, i=分, s=秒"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"日志级别样式"}),l.jsxs(zt,{value:t.log_level_style,onValueChange:x=>e({...t,log_level_style:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:m.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"日志文本颜色"}),l.jsxs(zt,{value:t.color_text,onValueChange:x=>e({...t,color_text:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:g.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"全局日志级别"}),l.jsxs(zt,{value:t.log_level,onValueChange:x=>e({...t,log_level:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"控制台日志级别"}),l.jsxs(zt,{value:t.console_log_level,onValueChange:x=>e({...t,console_log_level:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"文件日志级别"}),l.jsxs(zt,{value:t.file_log_level,onValueChange:x=>e({...t,file_log_level:x}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]})]})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"mb-2 block",children:"完全屏蔽的库"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1",onKeyDown:x=>{x.key==="Enter"&&(x.preventDefault(),a())}}),l.jsx(fe,{onClick:a,size:"sm",className:"flex-shrink-0",children:l.jsx(gs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"flex flex-wrap gap-2",children:t.suppress_libraries.map(x=>l.jsxs("div",{className:"flex items-center gap-1 bg-secondary px-3 py-1 rounded-md",children:[l.jsx("span",{className:"text-sm",children:x}),l.jsx(fe,{variant:"ghost",size:"sm",className:"h-5 w-5 p-0",onClick:()=>o(x),children:l.jsx(ln,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},x))})]}),l.jsxs("div",{children:[l.jsx(de,{className:"mb-2 block",children:"特定库的日志级别"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:x=>r(x.target.value),placeholder:"输入库名",className:"flex-1"}),l.jsxs(zt,{value:s,onValueChange:i,children:[l.jsx(At,{className:"w-32",children:l.jsx(Pt,{})}),l.jsx(Rt,{children:f.map(x=>l.jsx(ze,{value:x,children:x},x))})]}),l.jsx(fe,{onClick:c,size:"sm",children:l.jsx(gs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:Object.entries(t.library_log_levels).map(([x,y])=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-medium",children:x}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-sm text-muted-foreground",children:y}),l.jsx(fe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>h(x),children:l.jsx(ln,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]})]},x))})]})]})}function Che({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"调试配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否在日志中显示提示词"})]}),l.jsx(_t,{checked:t.show_prompt,onCheckedChange:n=>e({...t,show_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示回复器 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的提示词"})]}),l.jsx(_t,{checked:t.show_replyer_prompt,onCheckedChange:n=>e({...t,show_replyer_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示回复器推理"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示回复器的推理过程"})]}),l.jsx(_t,{checked:t.show_replyer_reasoning,onCheckedChange:n=>e({...t,show_replyer_reasoning:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 Jargon Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示术语相关的提示词"})]}),l.jsx(_t,{checked:t.show_jargon_prompt,onCheckedChange:n=>e({...t,show_jargon_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示记忆检索 Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示记忆检索相关的提示词"})]}),l.jsx(_t,{checked:t.show_memory_prompt,onCheckedChange:n=>e({...t,show_memory_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 Planner Prompt"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 Planner 的提示词和原始返回结果"})]}),l.jsx(_t,{checked:t.show_planner_prompt,onCheckedChange:n=>e({...t,show_planner_prompt:n})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"显示 LPMM 相关文段"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否显示 LPMM 知识库找到的相关文段日志"})]}),l.jsx(_t,{checked:t.show_lpmm_paragraph,onCheckedChange:n=>e({...t,show_lpmm_paragraph:n})})]})]})]})}function The({config:t,onChange:e}){const[n,r]=b.useState(""),s=()=>{n&&!t.auth_token.includes(n)&&(e({...t,auth_token:[...t.auth_token,n]}),r(""))},i=a=>{e({...t,auth_token:t.auth_token.filter((o,c)=>c!==a)})};return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-6",children:[l.jsxs("div",{children:[l.jsx("h3",{className:"text-lg font-semibold mb-4",children:"MaimMessage 服务配置"}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"启用自定义服务器"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"是否使用自定义的 MaimMessage 服务器"})]}),l.jsx(_t,{checked:t.use_custom,onCheckedChange:a=>e({...t,use_custom:a})})]}),t.use_custom&&l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"主机地址"}),l.jsx(Pe,{value:t.host,onChange:a=>e({...t,host:a.target.value}),placeholder:"127.0.0.1"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"端口号"}),l.jsx(Pe,{type:"number",value:t.port,onChange:a=>e({...t,port:parseInt(a.target.value)}),placeholder:"8090"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"连接模式"}),l.jsxs(zt,{value:t.mode,onValueChange:a=>e({...t,mode:a}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"ws",children:"WebSocket (ws)"}),l.jsx(ze,{value:"tcp",children:"TCP"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{checked:t.use_wss,onCheckedChange:a=>e({...t,use_wss:a}),disabled:t.mode!=="ws"}),l.jsx(de,{children:"使用 WSS 安全连接"})]})]}),t.use_wss&&t.mode==="ws"&&l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"SSL 证书文件路径"}),l.jsx(Pe,{value:t.cert_file,onChange:a=>e({...t,cert_file:a.target.value}),placeholder:"cert.pem"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"SSL 密钥文件路径"}),l.jsx(Pe,{value:t.key_file,onChange:a=>e({...t,key_file:a.target.value}),placeholder:"key.pem"})]})]})]})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"mb-2 block",children:"认证令牌"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"用于 API 验证,为空则不启用验证"}),l.jsxs("div",{className:"flex gap-2 mb-2",children:[l.jsx(Pe,{value:n,onChange:a=>r(a.target.value),placeholder:"输入认证令牌",onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),s())}}),l.jsx(fe,{onClick:s,size:"sm",children:l.jsx(gs,{className:"h-4 w-4",strokeWidth:2,fill:"none"})})]}),l.jsx("div",{className:"space-y-2",children:t.auth_token.map((a,o)=>l.jsxs("div",{className:"flex items-center justify-between bg-secondary px-3 py-2 rounded-md",children:[l.jsx("span",{className:"text-sm font-mono",children:a}),l.jsx(fe,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:()=>i(o),children:l.jsx(ln,{className:"h-3 w-3",strokeWidth:2,fill:"none"})})]},o))})]})]})}function Ehe({config:t,onChange:e}){return l.jsxs("div",{className:"rounded-lg border bg-card p-6 space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"统计信息"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"space-y-0.5",children:[l.jsx(de,{children:"启用统计信息发送"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"发送匿名统计信息,帮助我们了解全球有多少只麦麦在运行"})]}),l.jsx(_t,{checked:t.enable,onCheckedChange:n=>e({...t,enable:n})})]})]})}const Vh=b.forwardRef(({className:t,...e},n)=>l.jsx("div",{className:"relative w-full overflow-auto",children:l.jsx("table",{ref:n,className:ye("w-full caption-bottom text-sm",t),...e})}));Vh.displayName="Table";const Uh=b.forwardRef(({className:t,...e},n)=>l.jsx("thead",{ref:n,className:ye("[&_tr]:border-b",t),...e}));Uh.displayName="TableHeader";const Wh=b.forwardRef(({className:t,...e},n)=>l.jsx("tbody",{ref:n,className:ye("[&_tr:last-child]:border-0",t),...e}));Wh.displayName="TableBody";const _he=b.forwardRef(({className:t,...e},n)=>l.jsx("tfoot",{ref:n,className:ye("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));_he.displayName="TableFooter";const ps=b.forwardRef(({className:t,...e},n)=>l.jsx("tr",{ref:n,className:ye("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...e}));ps.displayName="TableRow";const tn=b.forwardRef(({className:t,...e},n)=>l.jsx("th",{ref:n,className:ye("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));tn.displayName="TableHead";const It=b.forwardRef(({className:t,...e},n)=>l.jsx("td",{ref:n,className:ye("px-4 py-3 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...e}));It.displayName="TableCell";const Mhe=b.forwardRef(({className:t,...e},n)=>l.jsx("caption",{ref:n,className:ye("mt-4 text-sm text-muted-foreground",t),...e}));Mhe.displayName="TableCaption";var zE=1,Ahe=.9,Rhe=.8,Dhe=.17,Uw=.1,Ww=.999,zhe=.9999,Phe=.99,Lhe=/[\\\/_+.#"@\[\(\{&]/,Ihe=/[\\\/_+.#"@\[\(\{&]/g,Bhe=/[\s-]/,cF=/[\s-]/g;function FS(t,e,n,r,s,i,a){if(i===e.length)return s===t.length?zE:Phe;var o=`${s},${i}`;if(a[o]!==void 0)return a[o];for(var c=r.charAt(i),h=n.indexOf(c,s),f=0,m,g,x,y;h>=0;)m=FS(t,e,n,r,h+1,i+1,a),m>f&&(h===s?m*=zE:Lhe.test(t.charAt(h-1))?(m*=Rhe,x=t.slice(s,h-1).match(Ihe),x&&s>0&&(m*=Math.pow(Ww,x.length))):Bhe.test(t.charAt(h-1))?(m*=Ahe,y=t.slice(s,h-1).match(cF),y&&s>0&&(m*=Math.pow(Ww,y.length))):(m*=Dhe,s>0&&(m*=Math.pow(Ww,h-s))),t.charAt(h)!==e.charAt(i)&&(m*=zhe)),(mm&&(m=g*Uw)),m>f&&(f=m),h=n.indexOf(c,h+1);return a[o]=f,f}function PE(t){return t.toLowerCase().replace(cF," ")}function qhe(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,FS(t,e,PE(t),PE(e),0,0,{})}var Fhe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rc=Fhe.reduce((t,e)=>{const n=Vk(`Primitive.${e}`),r=b.forwardRef((s,i)=>{const{asChild:a,...o}=s,c=a?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(c,{...o,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),rm='[cmdk-group=""]',Gw='[cmdk-group-items=""]',$he='[cmdk-group-heading=""]',uF='[cmdk-item=""]',LE=`${uF}:not([aria-disabled="true"])`,$S="cmdk-item-select",Fd="data-value",Qhe=(t,e,n)=>qhe(t,e,n),dF=b.createContext(void 0),np=()=>b.useContext(dF),hF=b.createContext(void 0),cO=()=>b.useContext(hF),fF=b.createContext(void 0),mF=b.forwardRef((t,e)=>{let n=$d(()=>{var G,F;return{search:"",value:(F=(G=t.value)!=null?G:t.defaultValue)!=null?F:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=$d(()=>new Set),s=$d(()=>new Map),i=$d(()=>new Map),a=$d(()=>new Set),o=pF(t),{label:c,children:h,value:f,onValueChange:m,filter:g,shouldFilter:x,loop:y,disablePointerSelection:w=!1,vimBindings:S=!0,...k}=t,N=Ei(),C=Ei(),T=Ei(),_=b.useRef(null),E=efe();zu(()=>{if(f!==void 0){let G=f.trim();n.current.value=G,M.emit()}},[f]),zu(()=>{E(6,ee)},[]);let M=b.useMemo(()=>({subscribe:G=>(a.current.add(G),()=>a.current.delete(G)),snapshot:()=>n.current,setState:(G,F,U)=>{var te,ne,Y,ae;if(!Object.is(n.current[G],F)){if(n.current[G]=F,G==="search")V(),I(),E(1,$);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(T);re?re.focus():(te=document.getElementById(N))==null||te.focus()}if(E(7,()=>{var re;n.current.selectedItemId=(re=z())==null?void 0:re.id,M.emit()}),U||E(5,ee),((ne=o.current)==null?void 0:ne.value)!==void 0){let re=F??"";(ae=(Y=o.current).onValueChange)==null||ae.call(Y,re);return}}M.emit()}},emit:()=>{a.current.forEach(G=>G())}}),[]),q=b.useMemo(()=>({value:(G,F,U)=>{var te;F!==((te=i.current.get(G))==null?void 0:te.value)&&(i.current.set(G,{value:F,keywords:U}),n.current.filtered.items.set(G,L(F,U)),E(2,()=>{I(),M.emit()}))},item:(G,F)=>(r.current.add(G),F&&(s.current.has(F)?s.current.get(F).add(G):s.current.set(F,new Set([G]))),E(3,()=>{V(),I(),n.current.value||$(),M.emit()}),()=>{i.current.delete(G),r.current.delete(G),n.current.filtered.items.delete(G);let U=z();E(4,()=>{V(),U?.getAttribute("id")===G&&$(),M.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{i.current.delete(G),s.current.delete(G)}),filter:()=>o.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:N,inputId:T,labelId:C,listInnerRef:_}),[]);function L(G,F){var U,te;let ne=(te=(U=o.current)==null?void 0:U.filter)!=null?te:Qhe;return G?ne(G,n.current.search,F):0}function I(){if(!n.current.search||o.current.shouldFilter===!1)return;let G=n.current.filtered.items,F=[];n.current.filtered.groups.forEach(te=>{let ne=s.current.get(te),Y=0;ne.forEach(ae=>{let re=G.get(ae);Y=Math.max(re,Y)}),F.push([te,Y])});let U=_.current;H().sort((te,ne)=>{var Y,ae;let re=te.getAttribute("id"),le=ne.getAttribute("id");return((Y=G.get(le))!=null?Y:0)-((ae=G.get(re))!=null?ae:0)}).forEach(te=>{let ne=te.closest(Gw);ne?ne.appendChild(te.parentElement===ne?te:te.closest(`${Gw} > *`)):U.appendChild(te.parentElement===U?te:te.closest(`${Gw} > *`))}),F.sort((te,ne)=>ne[1]-te[1]).forEach(te=>{var ne;let Y=(ne=_.current)==null?void 0:ne.querySelector(`${rm}[${Fd}="${encodeURIComponent(te[0])}"]`);Y?.parentElement.appendChild(Y)})}function $(){let G=H().find(U=>U.getAttribute("aria-disabled")!=="true"),F=G?.getAttribute(Fd);M.setState("value",F||void 0)}function V(){var G,F,U,te;if(!n.current.search||o.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ne=0;for(let Y of r.current){let ae=(F=(G=i.current.get(Y))==null?void 0:G.value)!=null?F:"",re=(te=(U=i.current.get(Y))==null?void 0:U.keywords)!=null?te:[],le=L(ae,re);n.current.filtered.items.set(Y,le),le>0&&ne++}for(let[Y,ae]of s.current)for(let re of ae)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(Y);break}n.current.filtered.count=ne}function ee(){var G,F,U;let te=z();te&&(((G=te.parentElement)==null?void 0:G.firstChild)===te&&((U=(F=te.closest(rm))==null?void 0:F.querySelector($he))==null||U.scrollIntoView({block:"nearest"})),te.scrollIntoView({block:"nearest"}))}function z(){var G;return(G=_.current)==null?void 0:G.querySelector(`${uF}[aria-selected="true"]`)}function H(){var G;return Array.from(((G=_.current)==null?void 0:G.querySelectorAll(LE))||[])}function P(G){let F=H()[G];F&&M.setState("value",F.getAttribute(Fd))}function W(G){var F;let U=z(),te=H(),ne=te.findIndex(ae=>ae===U),Y=te[ne+G];(F=o.current)!=null&&F.loop&&(Y=ne+G<0?te[te.length-1]:ne+G===te.length?te[0]:te[ne+G]),Y&&M.setState("value",Y.getAttribute(Fd))}function J(G){let F=z(),U=F?.closest(rm),te;for(;U&&!te;)U=G>0?Zhe(U,rm):Jhe(U,rm),te=U?.querySelector(LE);te?M.setState("value",te.getAttribute(Fd)):W(G)}let X=()=>P(H().length-1),R=G=>{G.preventDefault(),G.metaKey?X():G.altKey?J(1):W(1)},se=G=>{G.preventDefault(),G.metaKey?P(0):G.altKey?J(-1):W(-1)};return b.createElement(Rc.div,{ref:e,tabIndex:-1,...k,"cmdk-root":"",onKeyDown:G=>{var F;(F=k.onKeyDown)==null||F.call(k,G);let U=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||U))switch(G.key){case"n":case"j":{S&&G.ctrlKey&&R(G);break}case"ArrowDown":{R(G);break}case"p":case"k":{S&&G.ctrlKey&&se(G);break}case"ArrowUp":{se(G);break}case"Home":{G.preventDefault(),P(0);break}case"End":{G.preventDefault(),X();break}case"Enter":{G.preventDefault();let te=z();if(te){let ne=new Event($S);te.dispatchEvent(ne)}}}}},b.createElement("label",{"cmdk-label":"",htmlFor:q.inputId,id:q.labelId,style:nfe},c),oy(t,G=>b.createElement(hF.Provider,{value:M},b.createElement(dF.Provider,{value:q},G))))}),Hhe=b.forwardRef((t,e)=>{var n,r;let s=Ei(),i=b.useRef(null),a=b.useContext(fF),o=np(),c=pF(t),h=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:a?.forceMount;zu(()=>{if(!h)return o.item(s,a?.id)},[h]);let f=gF(s,i,[t.value,t.children,i],t.keywords),m=cO(),g=kc(E=>E.value&&E.value===f.current),x=kc(E=>h||o.filter()===!1?!0:E.search?E.filtered.items.get(s)>0:!0);b.useEffect(()=>{let E=i.current;if(!(!E||t.disabled))return E.addEventListener($S,y),()=>E.removeEventListener($S,y)},[x,t.onSelect,t.disabled]);function y(){var E,M;w(),(M=(E=c.current).onSelect)==null||M.call(E,f.current)}function w(){m.setState("value",f.current,!0)}if(!x)return null;let{disabled:S,value:k,onSelect:N,forceMount:C,keywords:T,..._}=t;return b.createElement(Rc.div,{ref:gc(i,e),..._,id:s,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!g,"data-disabled":!!S,"data-selected":!!g,onPointerMove:S||o.getDisablePointerSelection()?void 0:w,onClick:S?void 0:y},t.children)}),Vhe=b.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,a=Ei(),o=b.useRef(null),c=b.useRef(null),h=Ei(),f=np(),m=kc(x=>s||f.filter()===!1?!0:x.search?x.filtered.groups.has(a):!0);zu(()=>f.group(a),[]),gF(a,o,[t.value,t.heading,c]);let g=b.useMemo(()=>({id:a,forceMount:s}),[s]);return b.createElement(Rc.div,{ref:gc(o,e),...i,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&b.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:h},n),oy(t,x=>b.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?h:void 0},b.createElement(fF.Provider,{value:g},x))))}),Uhe=b.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=b.useRef(null),i=kc(a=>!a.search);return!n&&!i?null:b.createElement(Rc.div,{ref:gc(s,e),...r,"cmdk-separator":"",role:"separator"})}),Whe=b.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=cO(),a=kc(h=>h.search),o=kc(h=>h.selectedItemId),c=np();return b.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),b.createElement(Rc.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":o,id:c.inputId,type:"text",value:s?t.value:a,onChange:h=>{s||i.setState("search",h.target.value),n?.(h.target.value)}})}),Ghe=b.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=b.useRef(null),a=b.useRef(null),o=kc(h=>h.selectedItemId),c=np();return b.useEffect(()=>{if(a.current&&i.current){let h=a.current,f=i.current,m,g=new ResizeObserver(()=>{m=requestAnimationFrame(()=>{let x=h.offsetHeight;f.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return g.observe(h),()=>{cancelAnimationFrame(m),g.unobserve(h)}}},[]),b.createElement(Rc.div,{ref:gc(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":r,id:c.listId},oy(t,h=>b.createElement("div",{ref:gc(a,c.listInnerRef),"cmdk-list-sizer":""},h)))}),Xhe=b.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:a,...o}=t;return b.createElement(Xk,{open:n,onOpenChange:r},b.createElement(Uk,{container:a},b.createElement(Nv,{"cmdk-overlay":"",className:s}),b.createElement(Cv,{"aria-label":t.label,"cmdk-dialog":"",className:i},b.createElement(mF,{ref:e,...o}))))}),Yhe=b.forwardRef((t,e)=>kc(n=>n.filtered.count===0)?b.createElement(Rc.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),Khe=b.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return b.createElement(Rc.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},oy(t,a=>b.createElement("div",{"aria-hidden":!0},a)))}),oi=Object.assign(mF,{List:Ghe,Item:Hhe,Input:Whe,Group:Vhe,Separator:Uhe,Dialog:Xhe,Empty:Yhe,Loading:Khe});function Zhe(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function Jhe(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function pF(t){let e=b.useRef(t);return zu(()=>{e.current=t}),e}var zu=typeof window>"u"?b.useEffect:b.useLayoutEffect;function $d(t){let e=b.useRef();return e.current===void 0&&(e.current=t()),e}function kc(t){let e=cO(),n=()=>t(e.snapshot());return b.useSyncExternalStore(e.subscribe,n,n)}function gF(t,e,n,r=[]){let s=b.useRef(),i=np();return zu(()=>{var a;let o=(()=>{var h;for(let f of n){if(typeof f=="string")return f.trim();if(typeof f=="object"&&"current"in f)return f.current?(h=f.current.textContent)==null?void 0:h.trim():s.current}})(),c=r.map(h=>h.trim());i.value(t,o,c),(a=e.current)==null||a.setAttribute(Fd,o),s.current=o}),s}var efe=()=>{let[t,e]=b.useState(),n=$d(()=>new Map);return zu(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function tfe(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function oy({asChild:t,children:e},n){return t&&b.isValidElement(e)?b.cloneElement(tfe(e),{ref:e.ref},n(e.props.children)):n(e)}var nfe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const uO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi,{ref:n,className:ye("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));uO.displayName=oi.displayName;const dO=b.forwardRef(({className:t,...e},n)=>l.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[l.jsx(li,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),l.jsx(oi.Input,{ref:n,className:ye("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));dO.displayName=oi.Input.displayName;const hO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.List,{ref:n,className:ye("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));hO.displayName=oi.List.displayName;const fO=b.forwardRef((t,e)=>l.jsx(oi.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));fO.displayName=oi.Empty.displayName;const mO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.Group,{ref:n,className:ye("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));mO.displayName=oi.Group.displayName;const rfe=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.Separator,{ref:n,className:ye("-mx-1 h-px bg-border",t),...e}));rfe.displayName=oi.Separator.displayName;const pO=b.forwardRef(({className:t,...e},n)=>l.jsx(oi.Item,{ref:n,className:ye("relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...e}));pO.displayName=oi.Item.displayName;const ii=b.forwardRef(({className:t,...e},n)=>l.jsx(ZD,{ref:n,className:ye("grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:l.jsx(SK,{className:ye("grid place-content-center text-current"),children:l.jsx(so,{className:"h-4 w-4"})})}));ii.displayName=ZD.displayName;const bx=[{id:"siliconflow",name:"SiliconFlow",base_url:"https://api.siliconflow.cn/v1",client_type:"openai",display_name:"硅基流动 (SiliconFlow)"},{id:"deepseek",name:"DeepSeek",base_url:"https://api.deepseek.com",client_type:"openai",display_name:"DeepSeek"},{id:"rinkoai",name:"RinkoAI",base_url:"https://rinkoai.com/v1",client_type:"openai",display_name:"RinkoAI"},{id:"zhipu",name:"ZhipuAI",base_url:"https://open.bigmodel.cn/api/paas/v4",client_type:"openai",display_name:"智谱 AI (ZhipuAI / GLM)"},{id:"moonshot",name:"Moonshot",base_url:"https://api.moonshot.cn/v1",client_type:"openai",display_name:"月之暗面 (Moonshot / Kimi)"},{id:"doubao",name:"Doubao",base_url:"https://ark.cn-beijing.volces.com/api/v3",client_type:"openai",display_name:"字节豆包 (Doubao)"},{id:"alibaba",name:"Alibaba",base_url:"https://dashscope.aliyuncs.com/compatible-mode/v1",client_type:"openai",display_name:"阿里云百炼 (Alibaba Qwen)"},{id:"baichuan",name:"Baichuan",base_url:"https://api.baichuan-ai.com/v1",client_type:"openai",display_name:"百川智能 (Baichuan)"},{id:"minimax",name:"MiniMax",base_url:"https://api.minimax.chat/v1",client_type:"openai",display_name:"MiniMax (海螺 AI)"},{id:"stepfun",name:"StepFun",base_url:"https://api.stepfun.com/v1",client_type:"openai",display_name:"阶跃星辰 (StepFun)"},{id:"lingyi",name:"Lingyi",base_url:"https://api.lingyiwanwu.com/v1",client_type:"openai",display_name:"零一万物 (Lingyi / Yi)"},{id:"openai",name:"OpenAI",base_url:"https://api.openai.com/v1",client_type:"openai",display_name:"OpenAI"},{id:"xai",name:"xAI",base_url:"https://api.x.ai/v1",client_type:"openai",display_name:"xAI (Grok)"},{id:"anthropic",name:"Anthropic",base_url:"https://api.anthropic.com/v1",client_type:"openai",display_name:"Anthropic (Claude)"},{id:"gemini",name:"Gemini",base_url:"https://generativelanguage.googleapis.com/v1beta",client_type:"gemini",display_name:"Google Gemini"},{id:"cohere",name:"Cohere",base_url:"https://api.cohere.ai/v1",client_type:"openai",display_name:"Cohere"},{id:"groq",name:"Groq",base_url:"https://api.groq.com/openai/v1",client_type:"openai",display_name:"Groq"},{id:"together",name:"Together AI",base_url:"https://api.together.xyz/v1",client_type:"openai",display_name:"Together AI"},{id:"fireworks",name:"Fireworks",base_url:"https://api.fireworks.ai/inference/v1",client_type:"openai",display_name:"Fireworks AI"},{id:"mistral",name:"Mistral",base_url:"https://api.mistral.ai/v1",client_type:"openai",display_name:"Mistral AI"},{id:"perplexity",name:"Perplexity",base_url:"https://api.perplexity.ai",client_type:"openai",display_name:"Perplexity AI"},{id:"custom",name:"",base_url:"",client_type:"openai",display_name:"自定义"}];function sfe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(null),[N,C]=b.useState(null),[T,_]=b.useState("custom"),[E,M]=b.useState(!1),[q,L]=b.useState(!1),[I,$]=b.useState(null),[V,ee]=b.useState(!1),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Gr(),Y=b.useRef(null),ae=b.useRef(!0);b.useEffect(()=>{re()},[]);const re=async()=>{try{r(!0);const Ne=await Jd();e(Ne.api_providers||[]),h(!1),ae.current=!1}catch(Ne){console.error("加载配置失败:",Ne)}finally{r(!1)}},le=async()=>{try{m(!0),Hv().catch(()=>{}),x(!0)}catch(Ne){console.error("重启失败:",Ne),x(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),m(!1)}},_e=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Jd();Ne.api_providers=t,await M1(Ne),h(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await le()}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"}),i(!1)}},Ge=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},tt=()=>{x(!1),m(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},Xe=b.useCallback(async Ne=>{if(!ae.current)try{o(!0),await Q3("api_providers",Ne),h(!1)}catch(ie){console.error("自动保存失败:",ie),h(!0)}finally{o(!1)}},[]);b.useEffect(()=>{if(!ae.current)return h(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{Xe(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,Xe]);const je=async()=>{try{i(!0),Y.current&&clearTimeout(Y.current);const Ne=await Jd();Ne.api_providers=t,await M1(Ne),h(!1),ne({title:"保存成功",description:"模型提供商配置已保存"})}catch(Ne){console.error("保存配置失败:",Ne),ne({title:"保存失败",description:Ne.message,variant:"destructive"})}finally{i(!1)}},Qe=(Ne,ie)=>{if(Ne){const xe=bx.find(Je=>Je.base_url===Ne.base_url&&Je.client_type===Ne.client_type);_(xe?.id||"custom"),k(Ne)}else _("custom"),k({name:"",base_url:"",api_key:"",client_type:"openai",max_retry:2,timeout:30,retry_interval:10});C(ie),ee(!1),w(!0)},He=Ne=>{_(Ne),M(!1);const ie=bx.find(xe=>xe.id===Ne);ie&&ie.id!=="custom"?k(xe=>({...xe,name:ie.name,base_url:ie.base_url,client_type:ie.client_type})):ie?.id==="custom"&&k(xe=>({...xe,name:"",base_url:"",client_type:"openai"}))},$e=b.useMemo(()=>T!=="custom",[T]),bt=async()=>{if(S?.api_key)try{await navigator.clipboard.writeText(S.api_key),ne({title:"复制成功",description:"API Key 已复制到剪贴板"})}catch{ne({title:"复制失败",description:"无法访问剪贴板",variant:"destructive"})}},lt=()=>{if(!S)return;const Ne={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};if(N!==null){const ie=[...t];ie[N]=Ne,e(ie)}else e([...t,Ne]);w(!1),k(null),C(null)},xn=Ne=>{if(!Ne&&S){const ie={...S,max_retry:S.max_retry??2,timeout:S.timeout??30,retry_interval:S.retry_interval??10};k(ie)}w(Ne)},_n=Ne=>{$(Ne),L(!0)},Cn=()=>{if(I!==null){const Ne=t.filter((ie,xe)=>xe!==I);e(Ne),ne({title:"删除成功",description:"提供商已从列表中移除"})}L(!1),$(null)},Dt=Ne=>{const ie=new Set(P);ie.has(Ne)?ie.delete(Ne):ie.add(Ne),W(ie)},xt=()=>{if(P.size===qe.length)W(new Set);else{const Ne=qe.map((ie,xe)=>t.findIndex(Je=>Je===qe[xe]));W(new Set(Ne))}},Te=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的提供商",variant:"default"});return}X(!0)},Re=()=>{const Ne=t.filter((ie,xe)=>!P.has(xe));e(Ne),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个提供商`})},qe=t.filter(Ne=>{if(!z)return!0;const ie=z.toLowerCase();return Ne.name.toLowerCase().includes(ie)||Ne.base_url.toLowerCase().includes(ie)||Ne.client_type.toLowerCase().includes(ie)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const Ne=parseInt(U);Ne>=1&&Ne<=rt&&(se(Ne),te(""))};return n?l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})}):l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"AI模型厂商配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理 AI 模型厂商的 API 配置"})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[P.size>0&&l.jsxs(fe,{onClick:Te,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(ln,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),l.jsxs(fe,{onClick:()=>Qe(null,null),size:"sm",className:"w-full sm:w-auto",children:[l.jsx(gs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加提供商"]}),l.jsxs(fe,{onClick:je,disabled:s||a||!c||f,size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),s?"保存中...":a?"自动保存中...":c?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{disabled:s||a||f,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(e6,{className:"mr-2 h-4 w-4"}),f?"重启中...":c?"保存并重启":"重启麦麦"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重启麦麦?"}),l.jsx(mn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:c?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(il,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(al,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Av,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Ir,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(na,{defaultValue:"windows",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsx(Et,{value:"windows",children:"Windows"}),l.jsx(Et,{value:"macos",children:"macOS"}),l.jsx(Et,{value:"linux",children:"Linux"})]}),l.jsxs(Kt,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:["在“进程”或“详细信息”标签页中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:"右键点击并选择“结束任务”"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(Kt,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"})," 打开 Spotlight,搜索“活动监视器”"]}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(Kt,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(ts,{children:l.jsx(g6,{asChild:!0,children:l.jsx(fe,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:c?_e:le,children:c?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(on,{className:"h-[calc(100vh-260px)]",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2 mb-4",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索提供商名称、URL 或类型...",value:z,onChange:Ne=>H(Ne.target.value),className:"pl-9"})]}),z&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:qe.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("h3",{className:"font-semibold text-base truncate",children:Ne.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 break-all",children:Ne.base_url})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>_n(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"客户端类型"}),l.jsx("p",{className:"font-medium",children:Ne.client_type})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"最大重试"}),l.jsx("p",{className:"font-medium",children:Ne.max_retry})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"超时(秒)"}),l.jsx("p",{className:"font-medium",children:Ne.timeout})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"重试间隔(秒)"}),l.jsx("p",{className:"font-medium",children:Ne.retry_interval})]})]})]},ie)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:xt})}),l.jsx(tn,{children:"名称"}),l.jsx(tn,{children:"基础URL"}),l.jsx(tn,{children:"客户端类型"}),l.jsx(tn,{className:"text-right",children:"最大重试"}),l.jsx(tn,{className:"text-right",children:"超时(秒)"}),l.jsx(tn,{className:"text-right",children:"重试间隔(秒)"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:wt.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:8,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的提供商":'暂无提供商配置,点击"添加提供商"开始配置'})}):wt.map((Ne,ie)=>{const xe=t.findIndex(Je=>Je===Ne);return l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:P.has(xe),onCheckedChange:()=>Dt(xe)})}),l.jsx(It,{className:"font-medium",children:Ne.name}),l.jsx(It,{className:"max-w-xs truncate",title:Ne.base_url,children:Ne.base_url}),l.jsx(It,{children:Ne.client_type}),l.jsx(It,{className:"text-right",children:Ne.max_retry}),l.jsx(It,{className:"text-right",children:Ne.timeout}),l.jsx(It,{className:"text-right",children:Ne.retry_interval}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>Qe(Ne,xe),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>_n(xe),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},ie)})})]})})}),qe.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size-provider",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:G.toString(),onValueChange:Ne=>{F(parseInt(Ne)),se(1),W(new Set)},children:[l.jsx(At,{id:"page-size-provider",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Math.max(1,Ne-1)),disabled:R===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:U,onChange:Ne=>te(Ne.target.value),onKeyDown:Ne=>Ne.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),l.jsx(fe,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(Ne=>Ne+1),disabled:R>=rt,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]}),l.jsx(fr,{open:y,onOpenChange:xn,children:l.jsxs(rr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:N!==null?"编辑提供商":"添加提供商"}),l.jsx(Ir,{children:"配置 API 提供商的连接信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"template",children:"提供商模板"}),l.jsxs(uo,{open:E,onOpenChange:M,children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",role:"combobox","aria-expanded":E,className:"w-full justify-between",children:[T?bx.find(Ne=>Ne.id===T)?.display_name:"选择提供商模板...",l.jsx(iz,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),l.jsx(ol,{className:"p-0",align:"start",style:{width:"var(--radix-popover-trigger-width)"},children:l.jsxs(uO,{children:[l.jsx(dO,{placeholder:"搜索提供商模板..."}),l.jsx(on,{className:"h-[300px]",children:l.jsxs(hO,{className:"max-h-none overflow-visible",children:[l.jsx(fO,{children:"未找到匹配的模板"}),l.jsx(mO,{children:bx.map(Ne=>l.jsxs(pO,{value:Ne.display_name,onSelect:()=>He(Ne.id),children:[l.jsx(so,{className:`mr-2 h-4 w-4 ${T===Ne.id?"opacity-100":"opacity-0"}`}),Ne.display_name]},Ne.id))})]})})]})})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"选择预设模板可自动填充 URL 和客户端类型,支持搜索"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"name",children:"名称 *"}),l.jsx(Pe,{id:"name",value:S?.name||"",onChange:Ne=>k(ie=>ie?{...ie,name:Ne.target.value}:null),placeholder:"例如: DeepSeek, SiliconFlow"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"base_url",children:"基础 URL *"}),l.jsx(Pe,{id:"base_url",value:S?.base_url||"",onChange:Ne=>k(ie=>ie?{...ie,base_url:Ne.target.value}:null),placeholder:"https://api.example.com/v1",disabled:$e,className:$e?"bg-muted cursor-not-allowed":""}),$e&&l.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时 URL 不可编辑,切换到"自定义"以手动配置'})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"api_key",children:"API Key *"}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{id:"api_key",type:V?"text":"password",value:S?.api_key||"",onChange:Ne=>k(ie=>ie?{...ie,api_key:Ne.target.value}:null),placeholder:"sk-...",className:"flex-1"}),l.jsx(fe,{type:"button",variant:"outline",size:"icon",onClick:()=>ee(!V),title:V?"隐藏密钥":"显示密钥",children:V?l.jsx(O1,{className:"h-4 w-4"}):l.jsx(aa,{className:"h-4 w-4"})}),l.jsx(fe,{type:"button",variant:"outline",size:"icon",onClick:bt,title:"复制密钥",children:l.jsx(k1,{className:"h-4 w-4"})})]})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"client_type",children:"客户端类型"}),l.jsxs(zt,{value:S?.client_type||"openai",onValueChange:Ne=>k(ie=>ie?{...ie,client_type:Ne}:null),disabled:$e,children:[l.jsx(At,{id:"client_type",className:$e?"bg-muted cursor-not-allowed":"",children:l.jsx(Pt,{placeholder:"选择客户端类型"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"openai",children:"OpenAI"}),l.jsx(ze,{value:"gemini",children:"Gemini"})]})]}),$e&&l.jsx("p",{className:"text-xs text-muted-foreground",children:'使用模板时客户端类型不可编辑,切换到"自定义"以手动配置'})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"max_retry",children:"最大重试"}),l.jsx(Pe,{id:"max_retry",type:"number",min:"0",value:S?.max_retry??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,max_retry:ie}:null)},placeholder:"默认: 2"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"timeout",children:"超时(秒)"}),l.jsx(Pe,{id:"timeout",type:"number",min:"1",value:S?.timeout??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,timeout:ie}:null)},placeholder:"默认: 30"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"retry_interval",children:"重试间隔(秒)"}),l.jsx(Pe,{id:"retry_interval",type:"number",min:"1",value:S?.retry_interval??"",onChange:Ne=>{const ie=Ne.target.value===""?null:parseInt(Ne.target.value);k(xe=>xe?{...xe,retry_interval:ie}:null)},placeholder:"默认: 10"})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>w(!1),children:"取消"}),l.jsx(fe,{onClick:lt,children:"保存"})]})]})}),l.jsx(wn,{open:q,onOpenChange:L,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除提供商 "',I!==null?t[I]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Cn,children:"删除"})]})]})}),l.jsx(wn,{open:J,onOpenChange:X,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["确定要删除选中的 ",P.size," 个提供商吗? 此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Re,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),g&&l.jsx(y6,{onRestartComplete:Ge,onRestartFailed:tt})]})}function ife(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(s=>s(r))},e)}const cy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gh(t){const e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function gO(t){return"nodeType"in t}function ci(t){var e,n;return t?Gh(t)?t:gO(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function xO(t){const{Document:e}=ci(t);return t instanceof e}function rp(t){return Gh(t)?!1:t instanceof ci(t).HTMLElement}function xF(t){return t instanceof ci(t).SVGElement}function Xh(t){return t?Gh(t)?t.document:gO(t)?xO(t)?t:rp(t)||xF(t)?t.ownerDocument:document:document:document}const ul=cy?b.useLayoutEffect:b.useEffect;function vO(t){const e=b.useRef(t);return ul(()=>{e.current=t}),b.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s{t.current=setInterval(r,s)},[]),n=b.useCallback(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function h0(t,e){e===void 0&&(e=[t]);const n=b.useRef(t);return ul(()=>{n.current!==t&&(n.current=t)},e),n}function sp(t,e){const n=b.useRef();return b.useMemo(()=>{const r=t(n.current);return n.current=r,r},[...e])}function ev(t){const e=vO(t),n=b.useRef(null),r=b.useCallback(s=>{s!==n.current&&e?.(s,n.current),n.current=s},[]);return[n,r]}function QS(t){const e=b.useRef();return b.useEffect(()=>{e.current=t},[t]),e.current}let Xw={};function ip(t,e){return b.useMemo(()=>{if(e)return e;const n=Xw[t]==null?0:Xw[t]+1;return Xw[t]=n,t+"-"+n},[t,e])}function vF(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s{const o=Object.entries(a);for(const[c,h]of o){const f=i[c];f!=null&&(i[c]=f+t*h)}return i},{...e})}}const ah=vF(1),f0=vF(-1);function lfe(t){return"clientX"in t&&"clientY"in t}function yO(t){if(!t)return!1;const{KeyboardEvent:e}=ci(t.target);return e&&t instanceof e}function ofe(t){if(!t)return!1;const{TouchEvent:e}=ci(t.target);return e&&t instanceof e}function HS(t){if(ofe(t)){if(t.touches&&t.touches.length){const{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){const{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return lfe(t)?{x:t.clientX,y:t.clientY}:null}const m0=Object.freeze({Translate:{toString(t){if(!t)return;const{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;const{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[m0.Translate.toString(t),m0.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),IE="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function cfe(t){return t.matches(IE)?t:t.querySelector(IE)}const ufe={display:"none"};function dfe(t){let{id:e,value:n}=t;return he.createElement("div",{id:e,style:ufe},n)}function hfe(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return he.createElement("div",{id:e,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function ffe(){const[t,e]=b.useState("");return{announce:b.useCallback(r=>{r!=null&&e(r)},[]),announcement:t}}const yF=b.createContext(null);function mfe(t){const e=b.useContext(yF);b.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function pfe(){const[t]=b.useState(()=>new Set),e=b.useCallback(r=>(t.add(r),()=>t.delete(r)),[t]);return[b.useCallback(r=>{let{type:s,event:i}=r;t.forEach(a=>{var o;return(o=a[s])==null?void 0:o.call(a,i)})},[t]),e]}const gfe={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. - `},tfe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};function nfe(t){let{announcements:e=tfe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=efe}=t;const{announce:i,announcement:a}=Khe(),l=np("DndLiveRegion"),[c,h]=b.useState(!1);if(b.useEffect(()=>{h(!0)},[]),Zhe(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const f=he.createElement(he.Fragment,null,he.createElement(Xhe,{id:r,value:s.draggable}),he.createElement(Yhe,{id:l,announcement:a}));return n?du.createPortal(f,n):f}var Qr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Qr||(Qr={}));function Z1(){}function AE(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function rfe(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const ja=Object.freeze({x:0,y:0});function dF(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function hF(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function sfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function RE(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function fF(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function DE(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const ife=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=DE(e,e.left,e.top),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const h=dF(DE(c),s);i.push({id:l,data:{droppableContainer:a,value:h}})}}return i.sort(hF)},afe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=RE(e),i=[];for(const a of r){const{id:l}=a,c=n.get(l);if(c){const h=RE(c),f=s.reduce((g,x,y)=>g+dF(h[y],x),0),m=Number((f/4).toFixed(4));i.push({id:l,data:{droppableContainer:a,value:m}})}}return i.sort(hF)};function ofe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,l=i-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,l=n.get(a);if(l){const c=ofe(l,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(sfe)};function cfe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function mF(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:ja}function ufe(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...a,top:a.top+t*l.y,bottom:a.bottom+t*l.y,left:a.left+t*l.x,right:a.right+t*l.x}),{...n})}}const dfe=ufe(1);function hfe(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function ffe(t,e,n){const r=hfe(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:l}=r,c=t.left-a-(1-s)*parseFloat(n),h=t.top-l-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:f,height:m,top:h,right:c+f,bottom:h+m,left:c}}const mfe={ignoreTransform:!1};function Gh(t,e){e===void 0&&(e=mfe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:h,transformOrigin:f}=li(t).getComputedStyle(t);h&&(n=ffe(n,h,f))}const{top:r,left:s,width:i,height:a,bottom:l,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:l,right:c}}function zE(t){return Gh(t,{ignoreTransform:!0})}function pfe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function gfe(t,e){return e===void 0&&(e=li(t).getComputedStyle(t)),e.position==="fixed"}function xfe(t,e){e===void 0&&(e=li(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function iy(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(fO(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!ep(s)||lF(s)||n.includes(s))return n;const i=li(t).getComputedStyle(s);return s!==t&&xfe(s,i)&&n.push(s),gfe(s,i)?n:r(s.parentNode)}return t?r(t):n}function pF(t){const[e]=iy(t,1);return e??null}function Hw(t){return!sy||!t?null:Uh(t)?t:hO(t)?fO(t)||t===Wh(t).scrollingElement?window:ep(t)?t:null:null}function gF(t){return Uh(t)?t.scrollX:t.scrollLeft}function xF(t){return Uh(t)?t.scrollY:t.scrollTop}function FS(t){return{x:gF(t),y:xF(t)}}var Zr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Zr||(Zr={}));function vF(t){return!sy||!t?!1:t===document.scrollingElement}function yF(t){const e={x:0,y:0},n=vF(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,l=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:l,maxScroll:r,minScroll:e}}const vfe={x:.2,y:.2};function yfe(t,e,n,r,s){let{top:i,left:a,right:l,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=vfe);const{isTop:h,isBottom:f,isLeft:m,isRight:g}=yF(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!h&&i<=e.top+w.height?(x.y=Zr.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!f&&c>=e.bottom-w.height&&(x.y=Zr.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&l>=e.right-w.width?(x.x=Zr.Forward,y.x=r*Math.abs((e.right-w.width-l)/w.width)):!m&&a<=e.left+w.width&&(x.x=Zr.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function bfe(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function bF(t){return t.reduce((e,n)=>ih(e,FS(n)),ja)}function wfe(t){return t.reduce((e,n)=>e+gF(n),0)}function Sfe(t){return t.reduce((e,n)=>e+xF(n),0)}function kfe(t,e){if(e===void 0&&(e=Gh),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);pF(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const Ofe=[["x",["left","right"],wfe],["y",["top","bottom"],Sfe]];class gO{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=iy(n),s=bF(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,l]of Ofe)for(const c of a)Object.defineProperty(this,c,{get:()=>{const h=l(r),f=s[i]-h;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Mm{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function jfe(t){const{EventTarget:e}=li(t);return t instanceof e?t:Wh(t)}function Vw(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Vi;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Vi||(Vi={}));function PE(t){t.preventDefault()}function Nfe(t){t.stopPropagation()}var nn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(nn||(nn={}));const wF={start:[nn.Space,nn.Enter],cancel:[nn.Esc],end:[nn.Space,nn.Enter,nn.Tab]},Cfe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case nn.Right:return{...n,x:n.x+25};case nn.Left:return{...n,x:n.x-25};case nn.Down:return{...n,y:n.y+25};case nn.Up:return{...n,y:n.y-25}}};class xO{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Mm(Wh(n)),this.windowListeners=new Mm(li(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Vi.Resize,this.handleCancel),this.windowListeners.add(Vi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Vi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&kfe(r),n(ja)}handleKeyDown(e){if(pO(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=wF,coordinateGetter:a=Cfe,scrollBehavior:l="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:ja;this.referenceCoordinates||(this.referenceCoordinates=f);const m=a(e,{active:n,context:r.current,currentCoordinates:f});if(m){const g=u0(m,f),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:N,isLeft:C,isBottom:T,maxScroll:_,minScroll:E}=yF(w),M=bfe(w),q={x:Math.min(S===nn.Right?M.right-M.width/2:M.right,Math.max(S===nn.Right?M.left:M.left+M.width/2,m.x)),y:Math.min(S===nn.Down?M.bottom-M.height/2:M.bottom,Math.max(S===nn.Down?M.top:M.top+M.height/2,m.y))},L=S===nn.Right&&!N||S===nn.Left&&!C,I=S===nn.Down&&!T||S===nn.Up&&!k;if(L&&q.x!==m.x){const $=w.scrollLeft+g.x,V=S===nn.Right&&$<=_.x||S===nn.Left&&$>=E.x;if(V&&!g.y){w.scrollTo({left:$,behavior:l});return}V?x.x=w.scrollLeft-$:x.x=S===nn.Right?w.scrollLeft-_.x:w.scrollLeft-E.x,x.x&&w.scrollBy({left:-x.x,behavior:l});break}else if(I&&q.y!==m.y){const $=w.scrollTop+g.y,V=S===nn.Down&&$<=_.y||S===nn.Up&&$>=E.y;if(V&&!g.x){w.scrollTo({top:$,behavior:l});return}V?x.y=w.scrollTop-$:x.y=S===nn.Down?w.scrollTop-_.y:w.scrollTop-E.y,x.y&&w.scrollBy({top:-x.y,behavior:l});break}}this.handleMove(e,ih(u0(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}xO.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=wF,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const l=i.activatorNode.current;return l&&t.target!==l?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function LE(t){return!!(t&&"distance"in t)}function IE(t){return!!(t&&"delay"in t)}class vO{constructor(e,n,r){var s;r===void 0&&(r=jfe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=Wh(a),this.documentListeners=new Mm(this.document),this.listeners=new Mm(r),this.windowListeners=new Mm(li(a)),this.initialCoordinates=(s=qS(i))!=null?s:ja,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Vi.Resize,this.handleCancel),this.windowListeners.add(Vi.DragStart,PE),this.windowListeners.add(Vi.VisibilityChange,this.handleCancel),this.windowListeners.add(Vi.ContextMenu,PE),this.documentListeners.add(Vi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(IE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(LE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Vi.Click,Nfe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Vi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:l}}=i;if(!s)return;const c=(n=qS(e))!=null?n:ja,h=u0(s,c);if(!r&&l){if(LE(l)){if(l.tolerance!=null&&Vw(h,l.tolerance))return this.handleCancel();if(Vw(h,l.distance))return this.handleStart()}if(IE(l)&&Vw(h,l.tolerance))return this.handleCancel();this.handlePending(l,h);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===nn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Tfe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class yO extends vO{constructor(e){const{event:n}=e,r=Wh(n.target);super(e,Tfe,r)}}yO.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Efe={move:{name:"mousemove"},end:{name:"mouseup"}};var $S;(function(t){t[t.RightClick=2]="RightClick"})($S||($S={}));class _fe extends vO{constructor(e){super(e,Efe,Wh(e.event.target))}}_fe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===$S.RightClick?!1:(r?.({event:n}),!0)}}];const Uw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Mfe extends vO{constructor(e){super(e,Uw)}static setup(){return window.addEventListener(Uw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Uw.move.name,e)};function e(){}}}Mfe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Am;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Am||(Am={}));var J1;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(J1||(J1={}));function Afe(t){let{acceleration:e,activator:n=Am.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:l=J1.TreeOrder,pointerCoordinates:c,scrollableAncestors:h,scrollableAncestorRects:f,delta:m,threshold:g}=t;const x=Dfe({delta:m,disabled:!i}),[y,w]=Hhe(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),N=b.useMemo(()=>{switch(n){case Am.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Am.DraggableRect:return s}},[n,s,c]),C=b.useRef(null),T=b.useCallback(()=>{const E=C.current;if(!E)return;const M=S.current.x*k.current.x,q=S.current.y*k.current.y;E.scrollBy(M,q)},[]),_=b.useMemo(()=>l===J1.TreeOrder?[...h].reverse():h,[l,h]);b.useEffect(()=>{if(!i||!h.length||!N){w();return}for(const E of _){if(r?.(E)===!1)continue;const M=h.indexOf(E),q=f[M];if(!q)continue;const{direction:L,speed:I}=yfe(E,q,N,e,g);for(const $ of["x","y"])x[$][L[$]]||(I[$]=0,L[$]=0);if(I.x>0||I.y>0){w(),C.current=E,y(T,a),S.current=I,k.current=L;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(N),JSON.stringify(x),y,h,_,f,JSON.stringify(g)])}const Rfe={x:{[Zr.Backward]:!1,[Zr.Forward]:!1},y:{[Zr.Backward]:!1,[Zr.Forward]:!1}};function Dfe(t){let{delta:e,disabled:n}=t;const r=BS(e);return tp(s=>{if(n||!r||!s)return Rfe;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Zr.Backward]:s.x[Zr.Backward]||i.x===-1,[Zr.Forward]:s.x[Zr.Forward]||i.x===1},y:{[Zr.Backward]:s.y[Zr.Backward]||i.y===-1,[Zr.Forward]:s.y[Zr.Forward]||i.y===1}}},[n,e,r])}function zfe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return tp(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function Pfe(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var h0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(h0||(h0={}));var QS;(function(t){t.Optimized="optimized"})(QS||(QS={}));const BE=new Map;function Lfe(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:l,measure:c,strategy:h}=s,f=b.useRef(t),m=S(),g=c0(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(N=>N===null?k:N.concat(k.filter(C=>!N.includes(C))))},[g]),y=b.useRef(null),w=tp(k=>{if(m&&!n)return BE;if(!k||k===BE||f.current!==t||i!=null){const N=new Map;for(let C of t){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){N.set(C.id,C.rect.current);continue}const T=C.node.current,_=T?new gO(c(T),T):null;C.rect.current=_,_&&N.set(C.id,_)}return N}return k},[t,i,n,m,c]);return b.useEffect(()=>{f.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof l!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},l))},[l,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(h){case h0.Always:return!1;case h0.BeforeDragging:return n;default:return!n}}}function SF(t,e){return tp(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Ife(t,e){return SF(t,e)}function Bfe(t){let{callback:e,disabled:n}=t;const r=mO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function ay(t){let{callback:e,disabled:n}=t;const r=mO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function qfe(t){return new gO(Gh(t),t)}function qE(t,e,n){e===void 0&&(e=qfe);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var h;return(h=c??n)!=null?h:null}const f=e(t);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const a=Bfe({callback(c){if(t)for(const h of c){const{type:f,target:m}=h;if(f==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),l=ay({callback:i});return ao(()=>{i(),t?(l?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(l?.disconnect(),a?.disconnect())},[t]),r}function Ffe(t){const e=SF(t);return mF(t,e)}const FE=[];function $fe(t){const e=b.useRef(t),n=tp(r=>t?r&&r!==FE&&t&&e.current&&t.parentNode===e.current.parentNode?r:iy(t):FE,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function Qfe(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=Hw(i.target);a&&n(l=>l?(l.set(a,FS(a)),new Map(l)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const l=t.map(c=>{const h=Hw(c);return h?(h.addEventListener("scroll",s,{passive:!0}),[h,FS(h)]):null}).filter(c=>c!=null);n(l.length?new Map(l):null),r.current=t}return()=>{a(t),a(i)};function a(l){l.forEach(c=>{const h=Hw(c);h?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>ih(i,a),ja):bF(t):ja,[t,e])}function $E(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==ja;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?u0(t,n.current):ja}function Hfe(t){b.useEffect(()=>{if(!sy)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function Vfe(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function kF(t){return b.useMemo(()=>t?pfe(t):null,[t])}const QE=[];function Ufe(t,e){e===void 0&&(e=Gh);const[n]=t,r=kF(n?li(n):null),[s,i]=b.useState(QE);function a(){i(()=>t.length?t.map(c=>vF(c)?r:new gO(e(c),c)):QE)}const l=ay({callback:a});return ao(()=>{l?.disconnect(),a(),t.forEach(c=>l?.observe(c))},[t]),s}function Wfe(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return ep(e)?e:t}function Gfe(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(h=>{for(const{target:f}of h)if(ep(f)){r(m=>{const g=e(f);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=ay({callback:s}),a=b.useCallback(h=>{const f=Wfe(h);i?.disconnect(),f&&i?.observe(f),r(f?e(f):null)},[e,i]),[l,c]=K1(a);return b.useMemo(()=>({nodeRef:l,rect:n,setRef:c}),[n,l,c])}const Xfe=[{sensor:yO,options:{}},{sensor:xO,options:{}}],Yfe={current:{}},d1={draggable:{measure:zE},droppable:{measure:zE,strategy:h0.WhileDragging,frequency:QS.Optimized},dragOverlay:{measure:Gh}};class Rm extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const Kfe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Rm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Z1},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:d1,measureDroppableContainers:Z1,windowRect:null,measuringScheduled:!1},Zfe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Z1,draggableNodes:new Map,over:null,measureDroppableContainers:Z1},oy=b.createContext(Zfe),OF=b.createContext(Kfe);function Jfe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Rm}}}function eme(t,e){switch(e.type){case Qr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Qr.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Qr.DragEnd:case Qr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Qr.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new Rm(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Qr.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new Rm(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case Qr.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new Rm(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function tme(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(oy),i=BS(r),a=BS(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!pO(i)||document.activeElement===i.target)return;const l=s.get(a);if(!l)return;const{activatorNode:c,node:h}=l;if(!c.current&&!h.current)return;requestAnimationFrame(()=>{for(const f of[c.current,h.current]){if(!f)continue;const m=Whe(f);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function nme(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function rme(t){return b.useMemo(()=>({draggable:{...d1.draggable,...t?.draggable},droppable:{...d1.droppable,...t?.droppable},dragOverlay:{...d1.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function sme(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:l}=typeof s=="boolean"?{x:s,y:s}:s;ao(()=>{if(!a&&!l||!e){i.current=!1;return}if(i.current||!r)return;const h=e?.node.current;if(!h||h.isConnected===!1)return;const f=n(h),m=mF(f,r);if(a||(m.x=0),l||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=pF(h);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,l,r,n])}const jF=b.createContext({...ja,scaleX:1,scaleY:1});var sc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(sc||(sc={}));const ime=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:l,autoScroll:c=!0,children:h,sensors:f=Xfe,collisionDetection:m=lfe,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(eme,void 0,Jfe),[S,k]=w,[N,C]=Jhe(),[T,_]=b.useState(sc.Uninitialized),E=T===sc.Initialized,{draggable:{active:M,nodes:q,translate:L},droppable:{containers:I}}=S,$=M!=null?q.get(M):null,V=b.useRef({initial:null,translated:null}),ee=b.useMemo(()=>{var Ht;return M!=null?{id:M,data:(Ht=$?.data)!=null?Ht:Yfe,rect:V}:null},[M,$]),z=b.useRef(null),[H,P]=b.useState(null),[W,J]=b.useState(null),X=c0(y,Object.values(y)),R=np("DndDescribedBy",a),se=b.useMemo(()=>I.getEnabled(),[I]),G=rme(g),{droppableRects:F,measureDroppableContainers:U,measuringScheduled:te}=Lfe(se,{dragging:E,dependencies:[L.x,L.y],config:G.droppable}),ne=zfe(q,M),Y=b.useMemo(()=>W?qS(W):null,[W]),ae=Wt(),re=Ife(ne,G.draggable.measure);sme({activeNode:M!=null?q.get(M):null,config:ae.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const oe=qE(ne,G.draggable.measure,re),_e=qE(ne?ne.parentElement:null),Ge=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:q,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=I.getNodeFor((n=Ge.current.over)==null?void 0:n.id),Xe=Gfe({measure:G.dragOverlay.measure}),je=(r=Xe.nodeRef.current)!=null?r:ne,Qe=E?(s=Xe.rect)!=null?s:oe:null,He=!!(Xe.nodeRef.current&&Xe.rect),$e=Ffe(He?null:oe),bt=kF(je?li(je):null),ot=$fe(E?tt??ne:null),on=Ufe(ot),Tn=nme(x,{transform:{x:L.x-$e.x,y:L.y-$e.y,scaleX:1,scaleY:1},activatorEvent:W,active:ee,activeNodeRect:oe,containerNodeRect:_e,draggingNodeRect:Qe,over:Ge.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:ot,scrollableAncestorRects:on,windowRect:bt}),Nn=Y?ih(Y,L):null,Rt=Qfe(ot),xt=$E(Rt),Te=$E(Rt,[oe]),Re=ih(Tn,xt),qe=Qe?dfe(Qe,Tn):null,rt=ee&&qe?m({active:ee,collisionRect:qe,droppableRects:F,droppableContainers:se,pointerCoordinates:Nn}):null,wt=fF(rt,"id"),[jt,Ne]=b.useState(null),ie=He?Tn:ih(Tn,Te),xe=cfe(ie,(i=jt?.rect)!=null?i:null,oe),Je=b.useRef(null),dt=b.useCallback((Ht,lt)=>{let{sensor:ur,options:Xr}=lt;if(z.current==null)return;const Yr=q.get(z.current);if(!Yr)return;const dr=Ht.nativeEvent,Nr=new ur({active:z.current,activeNode:Yr,event:dr,options:Xr,context:Ge,onAbort(xr){if(!q.get(xr))return;const{onDragAbort:Ns}=X.current,Bs={id:xr};Ns?.(Bs),N({type:"onDragAbort",event:Bs})},onPending(xr,di,Ns,Bs){if(!q.get(xr))return;const{onDragPending:ha}=X.current,hi={id:xr,constraint:di,initialCoordinates:Ns,offset:Bs};ha?.(hi),N({type:"onDragPending",event:hi})},onStart(xr){const di=z.current;if(di==null)return;const Ns=q.get(di);if(!Ns)return;const{onDragStart:Bs}=X.current,da={activatorEvent:dr,active:{id:di,data:Ns.data,rect:V}};du.unstable_batchedUpdates(()=>{Bs?.(da),_(sc.Initializing),k({type:Qr.DragStart,initialCoordinates:xr,active:di}),N({type:"onDragStart",event:da}),P(Je.current),J(dr)})},onMove(xr){k({type:Qr.DragMove,coordinates:xr})},onEnd:Is(Qr.DragEnd),onCancel:Is(Qr.DragCancel)});Je.current=Nr;function Is(xr){return async function(){const{active:Ns,collisions:Bs,over:da,scrollAdjustedTranslate:ha}=Ge.current;let hi=null;if(Ns&&ha){const{cancelDrop:Ra}=X.current;hi={activatorEvent:dr,active:Ns,collisions:Bs,delta:ha,over:da},xr===Qr.DragEnd&&typeof Ra=="function"&&await Promise.resolve(Ra(hi))&&(xr=Qr.DragCancel)}z.current=null,du.unstable_batchedUpdates(()=>{k({type:xr}),_(sc.Uninitialized),Ne(null),P(null),J(null),Je.current=null;const Ra=xr===Qr.DragEnd?"onDragEnd":"onDragCancel";if(hi){const qs=X.current[Ra];qs?.(hi),N({type:Ra,event:hi})}})}}},[q]),er=b.useCallback((Ht,lt)=>(ur,Xr)=>{const Yr=ur.nativeEvent,dr=q.get(Xr);if(z.current!==null||!dr||Yr.dndKit||Yr.defaultPrevented)return;const Nr={active:dr};Ht(ur,lt.options,Nr)===!0&&(Yr.dndKit={capturedBy:lt.sensor},z.current=Xr,dt(ur,lt))},[q,dt]),pt=Pfe(f,er);Hfe(f),ao(()=>{oe&&T===sc.Initializing&&_(sc.Initialized)},[oe,T]),b.useEffect(()=>{const{onDragMove:Ht}=X.current,{active:lt,activatorEvent:ur,collisions:Xr,over:Yr}=Ge.current;if(!lt||!ur)return;const dr={active:lt,activatorEvent:ur,collisions:Xr,delta:{x:Re.x,y:Re.y},over:Yr};du.unstable_batchedUpdates(()=>{Ht?.(dr),N({type:"onDragMove",event:dr})})},[Re.x,Re.y]),b.useEffect(()=>{const{active:Ht,activatorEvent:lt,collisions:ur,droppableContainers:Xr,scrollAdjustedTranslate:Yr}=Ge.current;if(!Ht||z.current==null||!lt||!Yr)return;const{onDragOver:dr}=X.current,Nr=Xr.get(wt),Is=Nr&&Nr.rect.current?{id:Nr.id,rect:Nr.rect.current,data:Nr.data,disabled:Nr.disabled}:null,xr={active:Ht,activatorEvent:lt,collisions:ur,delta:{x:Yr.x,y:Yr.y},over:Is};du.unstable_batchedUpdates(()=>{Ne(Is),dr?.(xr),N({type:"onDragOver",event:xr})})},[wt]),ao(()=>{Ge.current={activatorEvent:W,active:ee,activeNode:ne,collisionRect:qe,collisions:rt,droppableRects:F,draggableNodes:q,draggingNode:je,draggingNodeRect:Qe,droppableContainers:I,over:jt,scrollableAncestors:ot,scrollAdjustedTranslate:Re},V.current={initial:Qe,translated:qe}},[ee,ne,rt,qe,q,je,Qe,F,I,jt,ot,Re]),Afe({...ae,delta:L,draggingRect:qe,pointerCoordinates:Nn,scrollableAncestors:ot,scrollableAncestorRects:on});const vn=b.useMemo(()=>({active:ee,activeNode:ne,activeNodeRect:oe,activatorEvent:W,collisions:rt,containerNodeRect:_e,dragOverlay:Xe,draggableNodes:q,droppableContainers:I,droppableRects:F,over:jt,measureDroppableContainers:U,scrollableAncestors:ot,scrollableAncestorRects:on,measuringConfiguration:G,measuringScheduled:te,windowRect:bt}),[ee,ne,oe,W,rt,_e,Xe,q,I,F,jt,U,ot,on,G,te,bt]),vt=b.useMemo(()=>({activatorEvent:W,activators:pt,active:ee,activeNodeRect:oe,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:q,over:jt,measureDroppableContainers:U}),[W,pt,ee,oe,k,R,q,jt,U]);return he.createElement(uF.Provider,{value:C},he.createElement(oy.Provider,{value:vt},he.createElement(OF.Provider,{value:vn},he.createElement(jF.Provider,{value:xe},h)),he.createElement(tme,{disabled:l?.restoreFocus===!1})),he.createElement(nfe,{...l,hiddenTextDescribedById:R}));function Wt(){const Ht=H?.autoScrollEnabled===!1,lt=typeof c=="object"?c.enabled===!1:c===!1,ur=E&&!Ht&&!lt;return typeof c=="object"?{...c,enabled:ur}:{enabled:ur}}}),ame=b.createContext(null),HE="button",ome="Draggable";function lme(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=np(ome),{activators:a,activatorEvent:l,active:c,activeNodeRect:h,ariaDescribedById:f,draggableNodes:m,over:g}=b.useContext(oy),{role:x=HE,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?jF:ame),[N,C]=K1(),[T,_]=K1(),E=Vfe(a,e),M=c0(n);ao(()=>(m.set(e,{id:e,key:i,node:N,activatorNode:T,data:M}),()=>{const L=m.get(e);L&&L.key===i&&m.delete(e)}),[m,e]);const q=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===HE?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,x,w,S,y,f.draggable]);return{active:c,activatorEvent:l,activeNodeRect:h,attributes:q,isDragging:S,listeners:r?void 0:E,node:N,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:k}}function cme(){return b.useContext(OF)}const ume="Droppable",dme={timeout:25};function hme(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=np(ume),{active:a,dispatch:l,over:c,measureDroppableContainers:h}=b.useContext(oy),f=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...dme,...s},k=c0(w??r),N=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),C=ay({callback:N,disabled:y||!a}),T=b.useCallback((q,L)=>{C&&(L&&(C.unobserve(L),m.current=!1),q&&C.observe(q))},[C]),[_,E]=K1(T),M=c0(e);return b.useEffect(()=>{!C||!_.current||(C.disconnect(),m.current=!1,C.observe(_.current))},[_,C]),b.useEffect(()=>(l({type:Qr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:g,data:M}}),()=>l({type:Qr.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==f.current.disabled&&(l({type:Qr.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,l]),{active:a,rect:g,isOver:c?.id===r,node:_,over:c,setNodeRef:E}}function bO(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function fme(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function vx(t){return t!==null&&t>=0}function mme(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const l=(e=n[s])!=null?e:r;if(!l)return null;const c=xme(n,a,s);if(a===s){const h=n[i];return h?{x:ss&&a<=i?{x:-l.width-c,y:0,...yx}:a=i?{x:l.width+c,y:0,...yx}:{x:0,y:0,...yx}};function xme(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=bO(e,r,n),a=e[s],l=i[s];return!l||!a?null:{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}},CF="Sortable",TF=he.createContext({activeIndex:-1,containerId:CF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:NF,disabled:{draggable:!1,droppable:!1}});function vme(t){let{children:e,id:n,items:r,strategy:s=NF,disabled:i=!1}=t;const{active:a,dragOverlay:l,droppableRects:c,over:h,measureDroppableContainers:f}=cme(),m=np(CF,n),g=l.rect!==null,x=b.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=h?x.indexOf(h.id):-1,k=b.useRef(x),N=!mme(x,k.current),C=S!==-1&&w===-1||N,T=pme(i);ao(()=>{N&&y&&f(x)},[N,x,y,f]),b.useEffect(()=>{k.current=x},[x]);const _=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:C,items:x,overIndex:S,useDragOverlay:g,sortedRects:fme(x,c),strategy:s}),[w,m,T.draggable,T.droppable,C,x,S,c,g,s]);return he.createElement(TF.Provider,{value:_},e)}const yme=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return bO(n,r,s).indexOf(e)},bme=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:l,previousContainerId:c,transition:h}=t;return!h||!r||l!==i&&s===a?!1:n?!0:a!==s&&e===c},wme={duration:200,easing:"ease"},EF="transform",Sme=d0.Transition.toString({property:EF,duration:0,easing:"linear"}),kme={roleDescription:"sortable"};function Ome(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),l=b.useRef(n);return ao(()=>{if(!e&&n!==l.current&&r.current){const c=s.current;if(c){const h=Gh(r.current,{ignoreTransform:!0}),f={x:c.left-h.left,y:c.top-h.top,scaleX:c.width/h.width,scaleY:c.height/h.height};(f.x||f.y)&&a(f)}}n!==l.current&&(l.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function jme(t){let{animateLayoutChanges:e=bme,attributes:n,disabled:r,data:s,getNewIndex:i=yme,id:a,strategy:l,resizeObserverConfig:c,transition:h=wme}=t;const{items:f,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:N}=b.useContext(TF),C=Nme(r,x),T=f.indexOf(a),_=b.useMemo(()=>({sortable:{containerId:m,index:T,items:f},...s}),[m,s,T,f]),E=b.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:M,node:q,isOver:L,setNodeRef:I}=hme({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:$,activatorEvent:V,activeNodeRect:ee,attributes:z,setNodeRef:H,listeners:P,isDragging:W,over:J,setActivatorNodeRef:X,transform:R}=lme({id:a,data:_,attributes:{...kme,...n},disabled:C.draggable}),se=Qhe(I,H),G=!!$,F=G&&!y&&vx(g)&&vx(S),U=!k&&W,te=U&&F?R:null,Y=F?te??(l??N)({rects:w,activeNodeRect:ee,activeIndex:g,overIndex:S,index:T}):null,ae=vx(g)&&vx(S)?i({id:a,items:f,activeIndex:g,overIndex:S}):T,re=$?.id,oe=b.useRef({activeId:re,items:f,newIndex:ae,containerId:m}),_e=f!==oe.current.items,Ge=e({active:$,containerId:m,isDragging:W,isSorting:G,id:a,index:T,items:f,newIndex:oe.current.newIndex,previousItems:oe.current.items,previousContainerId:oe.current.containerId,transition:h,wasDragging:oe.current.activeId!=null}),tt=Ome({disabled:!Ge,index:T,node:q,rect:M});return b.useEffect(()=>{G&&oe.current.newIndex!==ae&&(oe.current.newIndex=ae),m!==oe.current.containerId&&(oe.current.containerId=m),f!==oe.current.items&&(oe.current.items=f)},[G,ae,m,f]),b.useEffect(()=>{if(re===oe.current.activeId)return;if(re!=null&&oe.current.activeId==null){oe.current.activeId=re;return}const je=setTimeout(()=>{oe.current.activeId=re},50);return()=>clearTimeout(je)},[re]),{active:$,activeIndex:g,attributes:z,data:_,rect:M,index:T,newIndex:ae,items:f,isOver:L,isSorting:G,isDragging:W,listeners:P,node:q,overIndex:S,over:J,setNodeRef:se,setActivatorNodeRef:X,setDroppableNodeRef:I,setDraggableNodeRef:H,transform:tt??Y,transition:Xe()};function Xe(){if(tt||_e&&oe.current.newIndex===T)return Sme;if(!(U&&!pO(V)||!h)&&(G||Ge))return d0.Transition.toString({...h,property:EF})}}function Nme(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function ev(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Cme=[nn.Down,nn.Right,nn.Up,nn.Left],Tme=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:l}}=e;if(Cme.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case nn.Down:r.topg.top&&c.push(m);break;case nn.Left:r.left>g.left&&c.push(m);break;case nn.Right:r.left1&&(f=h[1].id),f!=null){const m=i.get(n.id),g=i.get(f),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=iy(y).some((E,M)=>l[M]!==E),k=_F(m,g),N=Eme(m,g),C=S||!k?{x:0,y:0}:{x:N?r.width-x.width:0,y:N?r.height-x.height:0},T={x:x.left,y:x.top};return C.x&&C.y?T:u0(T,C)}}}};function _F(t,e){return!ev(t)||!ev(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Eme(t,e){return!ev(t)||!ev(e)||!_F(t,e)?!1:t.data.current.sortable.index{f.stopPropagation(),n(t)}})]})})}function Mme({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,l]=b.useState(!1),c=rfe(AE(yO,{activationConstraint:{distance:8}}),AE(xO,{coordinateGetter:Tme})),h=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},f=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(bO(e,w,S))}};return o.jsxs(cl,{open:a,onOpenChange:l,children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",role:"combobox","aria-expanded":a,className:ye("w-full justify-between min-h-10 h-auto",i),children:[o.jsx(ime,{sensors:c,collisionDetection:ife,onDragEnd:m,children:o.jsx(vme,{items:e,strategy:gme,children:o.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?o.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return o.jsx(_me,{value:g,label:x?.label||g,onRemove:f},g)})})})}),o.jsx(YD,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),o.jsx(so,{className:"w-full p-0",align:"start",children:o.jsxs(aO,{children:[o.jsx(oO,{placeholder:"搜索...",className:"h-9"}),o.jsxs(lO,{children:[o.jsx(cO,{children:s}),o.jsx(uO,{children:t.map(g=>{const x=e.includes(g.value);return o.jsxs(dO,{value:g.value,onSelect:()=>h(g.value),children:[o.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:o.jsx(dc,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),o.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}function Ame(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,l]=b.useState(null),[c,h]=b.useState(!0),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState(null),[I,$]=b.useState(!1),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Wr(),Y=b.useRef(null),ae=b.useRef(null),re=b.useRef(!0);b.useEffect(()=>{oe()},[]);const oe=async()=>{try{h(!0);const ie=await Zd(),xe=ie.models||[];e(xe),i(xe.map(dt=>dt.name));const Je=ie.api_providers||[];r(Je.map(dt=>dt.name)),l(ie.model_task_config||null),w(!1),re.current=!1}catch(ie){console.error("加载配置失败:",ie)}finally{h(!1)}},_e=async()=>{try{k(!0),Bv().catch(()=>{}),C(!0)}catch(ie){console.error("重启失败:",ie),C(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),k(!1)}},Ge=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Zd();ie.models=t,ie.model_task_config=a,await T1(ie),w(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await _e()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"}),m(!1)}},tt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Xe=()=>{C(!1),k(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},je=b.useCallback(async ie=>{if(!re.current)try{x(!0),await B3("models",ie),w(!1)}catch(xe){console.error("自动保存模型列表失败:",xe),w(!0)}finally{x(!1)}},[]),Qe=b.useCallback(async ie=>{if(!re.current)try{x(!0),await B3("model_task_config",ie),w(!1)}catch(xe){console.error("自动保存任务配置失败:",xe),w(!0)}finally{x(!1)}},[]);b.useEffect(()=>{if(!re.current)return w(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{je(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,je]),b.useEffect(()=>{if(!(re.current||!a))return w(!0),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{Qe(a)},2e3),()=>{ae.current&&clearTimeout(ae.current)}},[a,Qe]);const He=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Zd();ie.models=t,ie.model_task_config=a,await T1(ie),w(!1),ne({title:"保存成功",description:"模型配置已保存"}),await oe()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"})}finally{m(!1)}},$e=(ie,xe)=>{M(ie||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),L(xe),_(!0)},bt=()=>{if(!E)return;const ie={...E,price_in:E.price_in??0,price_out:E.price_out??0};let xe;q!==null?(xe=[...t],xe[q]=ie):xe=[...t,ie],e(xe),i(xe.map(Je=>Je.name)),_(!1),M(null),L(null)},ot=ie=>{if(!ie&&E){const xe={...E,price_in:E.price_in??0,price_out:E.price_out??0};M(xe)}_(ie)},on=ie=>{ee(ie),$(!0)},Tn=()=>{if(V!==null){const ie=t.filter((xe,Je)=>Je!==V);e(ie),i(ie.map(xe=>xe.name)),ne({title:"删除成功",description:"模型已从列表中移除"})}$(!1),ee(null)},Nn=ie=>{const xe=new Set(P);xe.has(ie)?xe.delete(ie):xe.add(ie),W(xe)},Rt=()=>{if(P.size===qe.length)W(new Set);else{const ie=qe.map((xe,Je)=>t.findIndex(dt=>dt===qe[Je]));W(new Set(ie))}},xt=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}X(!0)},Te=()=>{const ie=t.filter((xe,Je)=>!P.has(Je));e(ie),i(ie.map(xe=>xe.name)),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个模型`})},Re=(ie,xe,Je)=>{a&&l({...a,[ie]:{...a[ie],[xe]:Je}})},qe=t.filter(ie=>{if(!z)return!0;const xe=z.toLowerCase();return ie.name.toLowerCase().includes(xe)||ie.model_identifier.toLowerCase().includes(xe)||ie.api_provider.toLowerCase().includes(xe)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const ie=parseInt(U);ie>=1&&ie<=rt&&(se(ie),te(""))},Ne=ie=>a?[a.utils?.model_list||[],a.utils_small?.model_list||[],a.tool_use?.model_list||[],a.replyer?.model_list||[],a.planner?.model_list||[],a.vlm?.model_list||[],a.voice?.model_list||[],a.embedding?.model_list||[],a.lpmm_entity_extract?.model_list||[],a.lpmm_rdf_build?.model_list||[],a.lpmm_qa?.model_list||[]].some(Je=>Je.includes(ie)):!1;return c?o.jsx(kn,{className:"h-full",children:o.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:o.jsx("div",{className:"flex items-center justify-center h-64",children:o.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[o.jsxs(me,{onClick:He,disabled:f||g||!y||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),f?"保存中...":g?"自动保存中...":y?"保存配置":"已保存"]}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsxs(me,{disabled:f||g||S,size:"sm",className:"flex-1 sm:flex-none",children:[o.jsx(Yk,{className:"mr-2 h-4 w-4"}),S?"重启中...":y?"保存并重启":"重启麦麦"]})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认重启麦麦?"}),o.jsxs(fn,{className:"space-y-3",children:[o.jsx("p",{children:y?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),o.jsxs(nl,{className:"border-yellow-500/50 bg-yellow-500/10",children:[o.jsx(wa,{className:"h-4 w-4 text-yellow-600"}),o.jsxs(rl,{className:"text-yellow-900 dark:text-yellow-100",children:[o.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",o.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。如需结束程序,请使用脚本目录下的进程管理脚本。"]})]})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:y?Ge:_e,children:y?"保存并重启":"确认重启"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsxs(rl,{children:["配置更新后需要",o.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),o.jsxs(ll,{defaultValue:"models",className:"w-full",children:[o.jsxs(ro,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[o.jsx(Jt,{value:"models",children:"添加模型"}),o.jsx(Jt,{value:"tasks",children:"为模型分配功能"})]}),o.jsxs(Pn,{value:"models",className:"space-y-4 mt-0",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),o.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[P.size>0&&o.jsxs(me,{onClick:xt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(sn,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),o.jsxs(me,{onClick:()=>$e(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(ms,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[o.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索模型名称、标识符或提供商...",value:z,onChange:ie=>H(ie.target.value),className:"pl-9"})]}),z&&o.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),o.jsx("div",{className:"md:hidden space-y-3",children:wt.length===0?o.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的模型":"暂无模型配置"}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx("h3",{className:"font-semibold text-base",children:ie.name}),o.jsx(Ln,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})]}),o.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ie.model_identifier,children:ie.model_identifier})]}),o.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>on(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),o.jsx("p",{className:"font-medium",children:ie.api_provider})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),o.jsx("p",{className:"font-medium",children:ie.force_stream_mode?"是":"否"})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ie.price_in,"/M"]})]}),o.jsxs("div",{children:[o.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),o.jsxs("p",{className:"font-medium",children:["¥",ie.price_out,"/M"]})]})]})]},xe)})}),o.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:o.jsx("div",{className:"overflow-x-auto",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:Rt})}),o.jsx(en,{className:"w-24",children:"使用状态"}),o.jsx(en,{children:"模型名称"}),o.jsx(en,{children:"模型标识符"}),o.jsx(en,{children:"提供商"}),o.jsx(en,{className:"text-right",children:"输入价格"}),o.jsx(en,{className:"text-right",children:"输出价格"}),o.jsx(en,{className:"text-center",children:"强制流式"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:wt.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:9,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的模型":"暂无模型配置"})}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:P.has(Je),onCheckedChange:()=>Nn(Je)})}),o.jsx(Lt,{children:o.jsx(Ln,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})}),o.jsx(Lt,{className:"font-medium",children:ie.name}),o.jsx(Lt,{className:"max-w-xs truncate",title:ie.model_identifier,children:ie.model_identifier}),o.jsx(Lt,{children:ie.api_provider}),o.jsxs(Lt,{className:"text-right",children:["¥",ie.price_in,"/M"]}),o.jsxs(Lt,{className:"text-right",children:["¥",ie.price_out,"/M"]}),o.jsx(Lt,{className:"text-center",children:ie.force_stream_mode?"是":"否"}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[o.jsx(hh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>on(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},xe)})})]})})}),qe.length>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:G.toString(),onValueChange:ie=>{F(parseInt(ie)),se(1),W(new Set)},children:[o.jsx(Mt,{id:"page-size-model",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(ie=>Math.max(1,ie-1)),disabled:R===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:U,onChange:ie=>te(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),o.jsx(me,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>se(ie=>ie+1),disabled:R>=rt,children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]}),o.jsxs(Pn,{value:"tasks",className:"space-y-6 mt-0",children:[o.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),a&&o.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[o.jsx(ga,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:a.utils,modelNames:s,onChange:(ie,xe)=>Re("utils",ie,xe)}),o.jsx(ga,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:a.utils_small,modelNames:s,onChange:(ie,xe)=>Re("utils_small",ie,xe)}),o.jsx(ga,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:a.tool_use,modelNames:s,onChange:(ie,xe)=>Re("tool_use",ie,xe)}),o.jsx(ga,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:a.replyer,modelNames:s,onChange:(ie,xe)=>Re("replyer",ie,xe)}),o.jsx(ga,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:a.planner,modelNames:s,onChange:(ie,xe)=>Re("planner",ie,xe)}),o.jsx(ga,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:a.vlm,modelNames:s,onChange:(ie,xe)=>Re("vlm",ie,xe),hideTemperature:!0}),o.jsx(ga,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:a.voice,modelNames:s,onChange:(ie,xe)=>Re("voice",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),o.jsx(ga,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:a.embedding,modelNames:s,onChange:(ie,xe)=>Re("embedding",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),o.jsx(ga,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:a.lpmm_entity_extract,modelNames:s,onChange:(ie,xe)=>Re("lpmm_entity_extract",ie,xe)}),o.jsx(ga,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:a.lpmm_rdf_build,modelNames:s,onChange:(ie,xe)=>Re("lpmm_rdf_build",ie,xe)}),o.jsx(ga,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:a.lpmm_qa,modelNames:s,onChange:(ie,xe)=>Re("lpmm_qa",ie,xe)})]})]})]})]}),o.jsx(zr,{open:T,onOpenChange:ot,children:o.jsxs(Sr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:q!==null?"编辑模型":"添加模型"}),o.jsx(ps,{children:"配置模型的基本信息和参数"})]}),o.jsxs("div",{className:"grid gap-4 py-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"model_name",children:"模型名称 *"}),o.jsx(Pe,{id:"model_name",value:E?.name||"",onChange:ie=>M(xe=>xe?{...xe,name:ie.target.value}:null),placeholder:"例如: qwen3-30b"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"model_identifier",children:"模型标识符 *"}),o.jsx(Pe,{id:"model_identifier",value:E?.model_identifier||"",onChange:ie=>M(xe=>xe?{...xe,model_identifier:ie.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"api_provider",children:"API 提供商 *"}),o.jsxs(Dt,{value:E?.api_provider||"",onValueChange:ie=>M(xe=>xe?{...xe,api_provider:ie}:null),children:[o.jsx(Mt,{id:"api_provider",children:o.jsx(zt,{placeholder:"选择提供商"})}),o.jsx(At,{children:n.map(ie=>o.jsx(ze,{value:ie,children:ie},ie))})]})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),o.jsx(Pe,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_in:xe}:null)},placeholder:"默认: 0"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),o.jsx(Pe,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_out:xe}:null)},placeholder:"默认: 0"})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:ie=>M(xe=>xe?{...xe,force_stream_mode:ie}:null)}),o.jsx(de,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>_(!1),children:"取消"}),o.jsx(me,{onClick:bt,children:"保存"})]})]})}),o.jsx(jn,{open:I,onOpenChange:$,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Tn,children:"删除"})]})]})}),o.jsx(jn,{open:J,onOpenChange:X,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["确定要删除选中的 ",P.size," 个模型吗? 此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&o.jsx(p6,{onRestartComplete:tt,onRestartFailed:Xe})]})})}function ga({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1}){const l=c=>{s("model_list",c)};return o.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[o.jsxs("div",{children:[o.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),o.jsxs("div",{className:"grid gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"模型列表"}),o.jsx(Mme,{options:r.map(c=>({label:c,value:c})),selected:n.model_list||[],onChange:l,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&o.jsxs("div",{className:"grid gap-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(de,{children:"温度"}),o.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:c=>{const h=parseFloat(c.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),o.jsx(B0,{value:[n.temperature??.3],onValueChange:c=>s("temperature",c[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{children:"最大 Token"}),o.jsx(Pe,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:c=>s("max_tokens",parseInt(c.target.value))})]})]})]})]})}const ly="/api/webui/config";async function Rme(){const e=await(await mt(`${ly}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function VE(t){const n=await(await mt(`${ly}/adapter-config/path`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function UE(t){const n=await(await mt(`${ly}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function WE(t,e){const r=await(await mt(`${ly}/adapter-config`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const Si={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Ww={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:fh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"./docker-config/adapters/config.toml",icon:NK}};function Dme(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,l]=b.useState(""),[c,h]=b.useState("oneclick"),[f,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),E=b.useRef(null),{toast:M}=Wr(),q=b.useRef(null),L=Y=>{if(!Y.trim())return{valid:!1,error:"路径不能为空"};if(!Y.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ae=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,oe=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,_e=ae.test(Y),Ge=re.test(Y),tt=oe.test(Y);return!_e&&!Ge&&!tt?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(Y)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},I=Y=>{if(l(Y),Y.trim()){const ae=L(Y);m(ae.error)}else m("")},$=b.useCallback(async Y=>{const ae=Ww[Y];w(!0);try{const re=await UE(ae.path),oe=G(re);r(oe),h(Y),l(ae.path),await VE(ae.path),M({title:"加载成功",description:`已从${ae.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[M]),V=b.useCallback(async Y=>{const ae=L(Y);if(!ae.valid){m(ae.error),M({title:"路径无效",description:ae.error,variant:"destructive"});return}m(""),w(!0);try{const re=await UE(Y),oe=G(re);r(oe),l(Y),await VE(Y),M({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[M]);b.useEffect(()=>{(async()=>{try{const ae=await Rme();if(ae&&ae.path){l(ae.path);const re=Object.entries(Ww).find(([,oe])=>oe.path===ae.path);re?(e("preset"),h(re[0]),await $(re[0])):(e("path"),await V(ae.path))}}catch(ae){console.error("加载保存的路径失败:",ae)}})()},[V,$]);const ee=b.useCallback(Y=>{t!=="path"&&t!=="preset"||!a||(q.current&&clearTimeout(q.current),q.current=setTimeout(async()=>{x(!0);try{const ae=F(Y);await WE(a,ae),M({title:"自动保存成功",description:"配置已保存到文件"})}catch(ae){console.error("自动保存失败:",ae),M({title:"自动保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,M]),z=async()=>{if(!n||!a)return;const Y=L(a);if(!Y.valid){M({title:"保存失败",description:Y.error,variant:"destructive"});return}x(!0);try{const ae=F(n);await WE(a,ae),M({title:"保存成功",description:"配置已保存到文件"})}catch(ae){console.error("保存失败:",ae),M({title:"保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},H=async()=>{a&&await V(a)},P=Y=>{if(Y!==t){if(n){_(Y),k(!0);return}W(Y)}},W=Y=>{r(null),i(""),m(""),e(Y),Y==="preset"&&$("oneclick"),M({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Y]})},J=()=>{T&&(W(T),_(null)),k(!1)},X=()=>{if(n){C(!0);return}R()},R=()=>{l(""),r(null),m(""),M({title:"已清空",description:"路径和配置已清空"})},se=()=>{R(),C(!1)},G=Y=>{const ae=JSON.parse(JSON.stringify(Si)),re=Y.split(` -`);let oe="";for(const _e of re){const Ge=_e.trim();if(!Ge||Ge.startsWith("#"))continue;const tt=Ge.match(/^\[(\w+)\]/);if(tt){oe=tt[1];continue}const Xe=Ge.match(/^(\w+)\s*=\s*(.+)$/);if(Xe&&oe){const[,je,Qe]=Xe;let He=Qe.trim();const $e=He.match(/^("[^"]*")/);if($e)He=$e[1];else{const ot=He.indexOf("#");ot!==-1&&(He=He.substring(0,ot).trim())}let bt;if(He==="true")bt=!0;else if(He==="false")bt=!1;else if(He.startsWith("[")&&He.endsWith("]")){const ot=He.slice(1,-1).trim();if(ot){const on=ot.split(",").map(Nn=>{const Rt=Nn.trim();return isNaN(Number(Rt))?Rt.replace(/"/g,""):Number(Rt)}),Tn=typeof on[0];bt=on.every(Nn=>typeof Nn===Tn)?on:on.filter(Nn=>typeof Nn=="number")}else bt=[]}else He.startsWith('"')&&He.endsWith('"')?bt=He.slice(1,-1):isNaN(Number(He))?bt=He.replace(/"/g,""):bt=Number(He);if(oe in ae){const ot=ae[oe];ot[je]=bt}}}return ae},F=Y=>{const ae=[],re=(oe,_e)=>oe===""||oe===null||oe===void 0?_e:oe;return ae.push("[inner]"),ae.push(`version = "${re(Y.inner.version,Si.inner.version)}" # 版本号`),ae.push("# 请勿修改版本号,除非你知道自己在做什么"),ae.push(""),ae.push("[nickname] # 现在没用"),ae.push(`nickname = "${re(Y.nickname.nickname,Si.nickname.nickname)}"`),ae.push(""),ae.push("[napcat_server] # Napcat连接的ws服务设置"),ae.push(`host = "${re(Y.napcat_server.host,Si.napcat_server.host)}" # Napcat设定的主机地址`),ae.push(`port = ${re(Y.napcat_server.port||0,Si.napcat_server.port)} # Napcat设定的端口`),ae.push(`token = "${re(Y.napcat_server.token,Si.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),ae.push(`heartbeat_interval = ${re(Y.napcat_server.heartbeat_interval||0,Si.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),ae.push(""),ae.push("[maibot_server] # 连接麦麦的ws服务设置"),ae.push(`host = "${re(Y.maibot_server.host,Si.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),ae.push(`port = ${re(Y.maibot_server.port||0,Si.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),ae.push(""),ae.push("[chat] # 黑白名单功能"),ae.push(`group_list_type = "${re(Y.chat.group_list_type,Si.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),ae.push(`group_list = [${Y.chat.group_list.join(", ")}] # 群组名单`),ae.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),ae.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),ae.push(`private_list_type = "${re(Y.chat.private_list_type,Si.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),ae.push(`private_list = [${Y.chat.private_list.join(", ")}] # 私聊名单`),ae.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),ae.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),ae.push(`ban_user_id = [${Y.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ae.push(`ban_qq_bot = ${Y.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ae.push(`enable_poke = ${Y.chat.enable_poke} # 是否启用戳一戳功能`),ae.push(""),ae.push("[voice] # 发送语音设置"),ae.push(`use_tts = ${Y.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),ae.push(""),ae.push("[debug]"),ae.push(`level = "${re(Y.debug.level,Si.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),ae.join(` -`)},U=Y=>{const ae=Y.target.files?.[0];if(!ae)return;const re=new FileReader;re.onload=oe=>{try{const _e=oe.target?.result,Ge=G(_e);r(Ge),i(ae.name),M({title:"上传成功",description:`已加载配置文件:${ae.name}`})}catch(_e){console.error("解析配置文件失败:",_e),M({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(ae)},te=()=>{if(!n)return;const Y=F(n),ae=new Blob([Y],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(ae),oe=document.createElement("a");oe.href=re,oe.download=s||"config.toml",document.body.appendChild(oe),oe.click(),document.body.removeChild(oe),URL.revokeObjectURL(re),M({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(Si))),i("config.toml"),M({title:"已加载默认配置",description:"可以开始编辑配置"})};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"工作模式"}),o.jsx(Fr,{children:"选择配置文件的管理方式"})]}),o.jsxs(An,{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("preset"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(fh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("upload"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(_C,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),o.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("path"),children:o.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[o.jsx(CK,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsx(de,{className:"text-sm md:text-base",children:"选择部署方式"}),o.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Ww).map(([Y,ae])=>{const re=ae.icon,oe=c===Y;return o.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${oe?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{h(Y),$(Y)},children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h4",{className:"font-semibold text-sm",children:ae.name}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ae.description}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ae.path})]})]})},Y)})})]}),t==="path"&&o.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs("div",{className:"flex-1 space-y-1",children:[o.jsx(Pe,{id:"config-path",value:a,onChange:Y=>I(Y.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${f?"border-destructive":""}`}),f&&o.jsx("p",{className:"text-xs text-destructive",children:f})]}),o.jsx(me,{onClick:()=>V(a),disabled:y||!a||!!f,className:"w-full sm:w-auto",children:y?o.jsxs(o.Fragment,{children:[o.jsx(Ti,{className:"h-4 w-4 animate-spin mr-2"}),o.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"sm:hidden",children:"加载配置"}),o.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),o.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[o.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[o.jsx("span",{children:"路径格式说明"}),o.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:o.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),o.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"C:\\Adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"flex items-center gap-2",children:o.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),o.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[o.jsx("div",{children:"/opt/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),o.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),o.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),o.jsxs(nl,{children:[o.jsx(wa,{className:"h-4 w-4"}),o.jsx(rl,{children:t==="preset"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):o.jsxs(o.Fragment,{children:[o.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[o.jsx("input",{ref:E,type:"file",accept:".toml",className:"hidden",onChange:U}),o.jsxs(me,{onClick:()=>E.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(_C,{className:"mr-2 h-4 w-4"}),"上传配置"]}),o.jsxs(me,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&o.jsx("div",{className:"flex gap-2",children:o.jsxs(me,{onClick:te,size:"sm",className:"w-full sm:w-auto",children:[o.jsx(yu,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[o.jsxs(me,{onClick:z,size:"sm",disabled:g||!!f,className:"w-full sm:w-auto",children:[o.jsx(Tv,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),o.jsxs(me,{onClick:H,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[o.jsx(Ti,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&o.jsxs(me,{onClick:X,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[o.jsx(sn,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?o.jsxs(ll,{defaultValue:"napcat",className:"w-full",children:[o.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:o.jsxs(ro,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[o.jsxs(Jt,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),o.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),o.jsxs(Jt,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),o.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),o.jsxs(Jt,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),o.jsx("span",{className:"sm:hidden",children:"聊天"})]}),o.jsxs(Jt,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[o.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),o.jsx("span",{className:"sm:hidden",children:"语音"})]}),o.jsx(Jt,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),o.jsx(Pn,{value:"napcat",className:"space-y-4",children:o.jsx(zme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"maibot",className:"space-y-4",children:o.jsx(Pme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"chat",className:"space-y-4",children:o.jsx(Lme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"voice",className:"space-y-4",children:o.jsx(Ime,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),o.jsx(Pn,{value:"debug",className:"space-y-4",children:o.jsx(Bme,{config:n,onChange:Y=>{r(Y),ee(Y)}})})]}):o.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:o.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[o.jsx(tl,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),o.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),o.jsx(jn,{open:S,onOpenChange:k,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认切换模式"}),o.jsxs(fn,{children:["切换模式将清空当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>{k(!1),_(null)},children:"取消"}),o.jsx(mn,{onClick:J,children:"确认切换"})]})]})}),o.jsx(jn,{open:N,onOpenChange:C,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认清空路径"}),o.jsxs(fn,{children:["清空路径将清除当前配置,确定要继续吗?",o.jsx("br",{}),o.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>C(!1),children:"取消"}),o.jsx(mn,{onClick:se,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function zme({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(Pe,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(Pe,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),o.jsx(Pe,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),o.jsx(Pe,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Pme({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),o.jsxs("div",{className:"grid gap-3 md:gap-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),o.jsx(Pe,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),o.jsx(Pe,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Lme({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const l={...t};i==="group"?l.chat.group_list=l.chat.group_list.filter((c,h)=>h!==a):i==="private"?l.chat.private_list=l.chat.private_list.filter((c,h)=>h!==a):l.chat.ban_user_id=l.chat.ban_user_id.filter((c,h)=>h!==a),e(l)},s=(i,a,l)=>{const c={...t};i==="group"?c.chat.group_list[a]=l:i==="private"?c.chat.private_list[a]=l:c.chat.ban_user_id[a]=l,e(c)};return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),o.jsxs("div",{className:"grid gap-4 md:gap-6",children:[o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-sm md:text-base",children:"群组名单类型"}),o.jsxs(Dt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(de,{className:"text-sm md:text-base",children:"群组列表"}),o.jsxs(me,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("group",a,parseInt(l.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),o.jsxs("div",{className:"space-y-3 md:space-y-4",children:[o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-sm md:text-base",children:"私聊名单类型"}),o.jsxs(Dt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),o.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsx(de,{className:"text-sm md:text-base",children:"私聊列表"}),o.jsxs(me,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("private",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"全局禁止名单"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),o.jsxs(me,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[o.jsx(tl,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Pe,{type:"number",value:i,onChange:l=>s("ban",a,parseInt(l.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),o.jsxs(jn,{children:[o.jsx(Vr,{asChild:!0,children:o.jsx(me,{size:"icon",variant:"outline",children:o.jsx(sn,{className:"h-4 w-4"})})}),o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&o.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),o.jsx(Tt,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),o.jsx(Tt,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function Ime({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),o.jsx(Tt,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function Bme({config:t,onChange:e}){return o.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:o.jsxs("div",{children:[o.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),o.jsx("div",{className:"grid gap-3 md:gap-4",children:o.jsxs("div",{className:"grid gap-2",children:[o.jsx(de,{className:"text-sm md:text-base",children:"日志等级"}),o.jsxs(Dt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"DEBUG",children:"DEBUG(调试)"}),o.jsx(ze,{value:"INFO",children:"INFO(信息)"}),o.jsx(ze,{value:"WARNING",children:"WARNING(警告)"}),o.jsx(ze,{value:"ERROR",children:"ERROR(错误)"}),o.jsx(ze,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function GE(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function qme(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const Fme=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,$me=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,Qme={};function XE(t,e){return(Qme.jsx?$me:Fme).test(t)}const Hme=/[ \t\n\f\r]/g;function Vme(t){return typeof t=="object"?t.type==="text"?YE(t.value):!1:YE(t)}function YE(t){return t.replace(Hme,"")===""}class rp{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}rp.prototype.normal={};rp.prototype.property={};rp.prototype.space=void 0;function MF(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new rp(n,r,e)}function f0(t){return t.toLowerCase()}class ci{constructor(e,n){this.attribute=n,this.property=e}}ci.prototype.attribute="";ci.prototype.booleanish=!1;ci.prototype.boolean=!1;ci.prototype.commaOrSpaceSeparated=!1;ci.prototype.commaSeparated=!1;ci.prototype.defined=!1;ci.prototype.mustUseProperty=!1;ci.prototype.number=!1;ci.prototype.overloadedBoolean=!1;ci.prototype.property="";ci.prototype.spaceSeparated=!1;ci.prototype.space=void 0;let Ume=0;const qt=qu(),Ar=qu(),HS=qu(),Fe=qu(),Wn=qu(),ah=qu(),ki=qu();function qu(){return 2**++Ume}const VS=Object.freeze(Object.defineProperty({__proto__:null,boolean:qt,booleanish:Ar,commaOrSpaceSeparated:ki,commaSeparated:ah,number:Fe,overloadedBoolean:HS,spaceSeparated:Wn},Symbol.toStringTag,{value:"Module"})),Gw=Object.keys(VS);class wO extends ci{constructor(e,n,r,s){let i=-1;if(super(e,n),KE(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&Kme.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(ZE,Jme);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!ZE.test(i)){let a=i.replace(Yme,Zme);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=wO}return new s(r,e)}function Zme(t){return"-"+t.toLowerCase()}function Jme(t){return t.charAt(1).toUpperCase()}const BF=MF([AF,Wme,zF,PF,LF],"html"),cy=MF([AF,Gme,zF,PF,LF],"svg");function JE(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function e0e(t){return t.join(" ").trim()}var jd={},Xw,e_;function t0e(){if(e_)return Xw;e_=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,l=/^\s+|\s+$/g,c=` -`,h="/",f="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var N=1,C=1;function T(z){var H=z.match(e);H&&(N+=H.length);var P=z.lastIndexOf(c);C=~P?z.length-P:C+z.length}function _(){var z={line:N,column:C};return function(H){return H.position=new E(z),L(),H}}function E(z){this.start=z,this.end={line:N,column:C},this.source=k.source}E.prototype.content=S;function M(z){var H=new Error(k.source+":"+N+":"+C+": "+z);if(H.reason=z,H.filename=k.source,H.line=N,H.column=C,H.source=S,!k.silent)throw H}function q(z){var H=z.exec(S);if(H){var P=H[0];return T(P),S=S.slice(P.length),H}}function L(){q(n)}function I(z){var H;for(z=z||[];H=$();)H!==!1&&z.push(H);return z}function $(){var z=_();if(!(h!=S.charAt(0)||f!=S.charAt(1))){for(var H=2;m!=S.charAt(H)&&(f!=S.charAt(H)||h!=S.charAt(H+1));)++H;if(H+=2,m===S.charAt(H-1))return M("End of comment missing");var P=S.slice(2,H-2);return C+=2,T(P),S=S.slice(H),C+=2,z({type:g,comment:P})}}function V(){var z=_(),H=q(r);if(H){if($(),!q(s))return M("property missing ':'");var P=q(i),W=z({type:x,property:w(H[0].replace(t,m)),value:P?w(P[0].replace(t,m)):m});return q(a),W}}function ee(){var z=[];I(z);for(var H;H=V();)H!==!1&&(z.push(H),I(z));return z}return L(),ee()}function w(S){return S?S.replace(l,m):m}return Xw=y,Xw}var t_;function n0e(){if(t_)return jd;t_=1;var t=jd&&jd.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(jd,"__esModule",{value:!0}),jd.default=n;const e=t(t0e());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),l=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;l?s(h,f,c):f&&(i=i||{},i[h]=f)}),i}return jd}var nm={},n_;function r0e(){if(n_)return nm;n_=1,Object.defineProperty(nm,"__esModule",{value:!0}),nm.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},a=function(h,f){return f.toUpperCase()},l=function(h,f){return"".concat(f,"-")},c=function(h,f){return f===void 0&&(f={}),i(h)?h:(h=h.toLowerCase(),f.reactCompat?h=h.replace(s,l):h=h.replace(r,l),h.replace(e,a))};return nm.camelCase=c,nm}var rm,r_;function s0e(){if(r_)return rm;r_=1;var t=rm&&rm.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(n0e()),n=r0e();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(l,c){l&&c&&(a[(0,n.camelCase)(l,i)]=c)}),a}return r.default=r,rm=r,rm}var i0e=s0e();const a0e=Mk(i0e),qF=FF("end"),SO=FF("start");function FF(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function o0e(t){const e=SO(t),n=qF(t);if(e&&n)return{start:e,end:n}}function Dm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?s_(t.position):"start"in t||"end"in t?s_(t):"line"in t||"column"in t?US(t):""}function US(t){return i_(t&&t.line)+":"+i_(t&&t.column)}function s_(t){return US(t&&t.start)+"-"+US(t&&t.end)}function i_(t){return t&&typeof t=="number"?t:1}class Os extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.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=Dm(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=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Os.prototype.file="";Os.prototype.name="";Os.prototype.reason="";Os.prototype.message="";Os.prototype.stack="";Os.prototype.column=void 0;Os.prototype.line=void 0;Os.prototype.ancestors=void 0;Os.prototype.cause=void 0;Os.prototype.fatal=void 0;Os.prototype.place=void 0;Os.prototype.ruleId=void 0;Os.prototype.source=void 0;const kO={}.hasOwnProperty,l0e=new Map,c0e=/[A-Z]/g,u0e=new Set(["table","tbody","thead","tfoot","tr"]),d0e=new Set(["td","th"]),$F="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function h0e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=b0e(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=y0e(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?cy:BF,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=QF(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function QF(t,e,n){if(e.type==="element")return f0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return m0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return g0e(t,e,n);if(e.type==="mdxjsEsm")return p0e(t,e);if(e.type==="root")return x0e(t,e,n);if(e.type==="text")return v0e(t,e)}function f0e(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=cy,t.schema=s),t.ancestors.push(e);const i=VF(t,e.tagName,!1),a=w0e(t,e);let l=jO(t,e);return u0e.has(e.tagName)&&(l=l.filter(function(c){return typeof c=="string"?!Vme(c):!0})),HF(t,a,i,e),OO(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function m0e(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}m0(t,e.position)}function p0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);m0(t,e.position)}function g0e(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=cy,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:VF(t,e.name,!0),a=S0e(t,e),l=jO(t,e);return HF(t,a,i,e),OO(a,l),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function x0e(t,e,n){const r={};return OO(r,jO(t,e)),t.create(e,t.Fragment,r,n)}function v0e(t,e){return e.value}function HF(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function OO(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function y0e(t,e,n){return r;function r(s,i,a,l){const h=Array.isArray(a.children)?n:e;return l?h(i,a,l):h(i,a)}}function b0e(t,e){return n;function n(r,s,i,a){const l=Array.isArray(i.children),c=SO(r);return e(s,i,a,l,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function w0e(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&kO.call(e.properties,s)){const i=k0e(t,s,e.properties[s]);if(i){const[a,l]=i;t.tableCellAlignToStyle&&a==="align"&&typeof l=="string"&&d0e.has(e.tagName)?r=l:n[a]=l}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function S0e(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const l=a.properties[0];l.type,Object.assign(n,t.evaluater.evaluateExpression(l.argument))}else m0(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const l=r.value.data.estree.body[0];l.type,i=t.evaluater.evaluateExpression(l.expression)}else m0(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function jO(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:l0e;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(Ei(t,t.length,0,e),t):e}const l_={}.hasOwnProperty;function WF(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Sa(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const _s=Rc(/[A-Za-z]/),Ss=Rc(/[\dA-Za-z]/),A0e=Rc(/[#-'*+\--9=?A-Z^-~]/);function tv(t){return t!==null&&(t<32||t===127)}const WS=Rc(/\d/),R0e=Rc(/[\dA-Fa-f]/),D0e=Rc(/[!-/:-@[-`{-~]/);function ut(t){return t!==null&&t<-2}function Vn(t){return t!==null&&(t<0||t===32)}function Yt(t){return t===-2||t===-1||t===32}const uy=Rc(new RegExp("\\p{P}|\\p{S}","u")),Du=Rc(/\s/);function Rc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Yh(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const l=t.charCodeAt(n+1);i<56320&&l>56319&&l<57344?(a=String.fromCharCode(i,l),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Ut(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Yt(c)?(t.enter(n),l(c)):e(c)}function l(c){return Yt(c)&&i++a))return;const M=e.events.length;let q=M,L,I;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(L){I=e.events[q][1].end;break}L=!0}for(k(r),E=M;EC;){const _=n[T];e.containerState=_[1],_[0].exit.call(e,t)}n.length=C}function N(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function B0e(t,e,n){return Ut(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Nh(t){if(t===null||Vn(t)||Du(t))return 1;if(uy(t))return 2}function dy(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};u_(m,-c),u_(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},l={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...l.end}},t[r][1].end={...a.start},t[n][1].start={...l.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Wi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Wi(h,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),h=Wi(h,dy(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Wi(h,[["exit",i,e],["enter",l,e],["exit",l,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,h=Wi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Ei(t,r-1,n-r+3,h),n=r+h.length-f-2;break}}for(n=-1;++n0&&Yt(E)?Ut(t,N,"linePrefix",i+1)(E):N(E)}function N(E){return E===null||ut(E)?t.check(d_,w,T)(E):(t.enter("codeFlowValue"),C(E))}function C(E){return E===null||ut(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),C)}function T(E){return t.exit("codeFenced"),e(E)}function _(E,M,q){let L=0;return I;function I(H){return E.enter("lineEnding"),E.consume(H),E.exit("lineEnding"),$}function $(H){return E.enter("codeFencedFence"),Yt(H)?Ut(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):V(H)}function V(H){return H===l?(E.enter("codeFencedFenceSequence"),ee(H)):q(H)}function ee(H){return H===l?(L++,E.consume(H),ee):L>=a?(E.exit("codeFencedFenceSequence"),Yt(H)?Ut(E,z,"whitespace")(H):z(H)):q(H)}function z(H){return H===null||ut(H)?(E.exit("codeFencedFence"),M(H)):q(H)}}}function K0e(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const Kw={name:"codeIndented",tokenize:J0e},Z0e={partial:!0,tokenize:epe};function J0e(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Ut(t,i,"linePrefix",5)(h)}function i(h){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(h):n(h)}function a(h){return h===null?c(h):ut(h)?t.attempt(Z0e,a,c)(h):(t.enter("codeFlowValue"),l(h))}function l(h){return h===null||ut(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),l)}function c(h){return t.exit("codeIndented"),e(h)}}function epe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Ut(t,i,"linePrefix",5)(a)}function i(a){const l=r.events[r.events.length-1];return l&&l[1].type==="linePrefix"&&l[2].sliceSerialize(l[1],!0).length>=4?e(a):ut(a)?s(a):n(a)}}const tpe={name:"codeText",previous:rpe,resolve:npe,tokenize:spe};function npe(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&sm(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),sm(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),sm(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function JF(t,e,n,r,s,i,a,l,c){const h=c||Number.POSITIVE_INFINITY;let f=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||tv(k)?n(k):(t.enter(r),t.enter(a),t.enter(l),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(l),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(l),g(k)):k===null||k===60||ut(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!f&&(k===null||k===41||Vn(k))?(t.exit("chunkString"),t.exit(l),t.exit(a),t.exit(r),e(k)):f999||x===null||x===91||x===93&&!c||x===94&&!l&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):ut(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||ut(x)||l++>999?(t.exit("chunkString"),f(x)):(t.consume(x),c||(c=!Yt(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),l++,m):m(x)}}function t$(t,e,n,r,s,i){let a;return l;function l(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),h(g))}function h(g){return g===a?(t.exit(i),c(a)):g===null?n(g):ut(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Ut(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===a||g===null||ut(g)?(t.exit("chunkString"),h(g)):(t.consume(g),g===92?m:f)}function m(g){return g===a||g===92?(t.consume(g),f):f(g)}}function zm(t,e){let n;return r;function r(s){return ut(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Yt(s)?Ut(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const hpe={name:"definition",tokenize:mpe},fpe={partial:!0,tokenize:ppe};function mpe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return e$.call(r,t,l,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function l(x){return s=Sa(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return Vn(x)?zm(t,h)(x):h(x)}function h(x){return JF(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(fpe,m,m)(x)}function m(x){return Yt(x)?Ut(t,g,"whitespace")(x):g(x)}function g(x){return x===null||ut(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function ppe(t,e,n){return r;function r(l){return Vn(l)?zm(t,s)(l):n(l)}function s(l){return t$(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(l)}function i(l){return Yt(l)?Ut(t,a,"whitespace")(l):a(l)}function a(l){return l===null||ut(l)?e(l):n(l)}}const gpe={name:"hardBreakEscape",tokenize:xpe};function xpe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ut(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const vpe={name:"headingAtx",resolve:ype,tokenize:bpe};function ype(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Ei(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function bpe(t,e,n){let r=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(t.consume(f),a):f===null||Vn(f)?(t.exit("atxHeadingSequence"),l(f)):n(f)}function l(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||ut(f)?(t.exit("atxHeading"),e(f)):Yt(f)?Ut(t,l,"whitespace")(f):(t.enter("atxHeadingText"),h(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),l(f))}function h(f){return f===null||f===35||Vn(f)?(t.exit("atxHeadingText"),l(f)):(t.consume(f),h)}}const wpe=["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"],f_=["pre","script","style","textarea"],Spe={concrete:!0,name:"htmlFlow",resolveTo:jpe,tokenize:Npe},kpe={partial:!0,tokenize:Tpe},Ope={partial:!0,tokenize:Cpe};function jpe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function Npe(t,e,n){const r=this;let s,i,a,l,c;return h;function h(F){return f(F)}function f(F){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(F),m}function m(F){return F===33?(t.consume(F),g):F===47?(t.consume(F),i=!0,w):F===63?(t.consume(F),s=3,r.interrupt?e:R):_s(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function g(F){return F===45?(t.consume(F),s=2,x):F===91?(t.consume(F),s=5,l=0,y):_s(F)?(t.consume(F),s=4,r.interrupt?e:R):n(F)}function x(F){return F===45?(t.consume(F),r.interrupt?e:R):n(F)}function y(F){const U="CDATA[";return F===U.charCodeAt(l++)?(t.consume(F),l===U.length?r.interrupt?e:V:y):n(F)}function w(F){return _s(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function S(F){if(F===null||F===47||F===62||Vn(F)){const U=F===47,te=a.toLowerCase();return!U&&!i&&f_.includes(te)?(s=1,r.interrupt?e(F):V(F)):wpe.includes(a.toLowerCase())?(s=6,U?(t.consume(F),k):r.interrupt?e(F):V(F)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):i?N(F):C(F))}return F===45||Ss(F)?(t.consume(F),a+=String.fromCharCode(F),S):n(F)}function k(F){return F===62?(t.consume(F),r.interrupt?e:V):n(F)}function N(F){return Yt(F)?(t.consume(F),N):I(F)}function C(F){return F===47?(t.consume(F),I):F===58||F===95||_s(F)?(t.consume(F),T):Yt(F)?(t.consume(F),C):I(F)}function T(F){return F===45||F===46||F===58||F===95||Ss(F)?(t.consume(F),T):_(F)}function _(F){return F===61?(t.consume(F),E):Yt(F)?(t.consume(F),_):C(F)}function E(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),c=F,M):Yt(F)?(t.consume(F),E):q(F)}function M(F){return F===c?(t.consume(F),c=null,L):F===null||ut(F)?n(F):(t.consume(F),M)}function q(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Vn(F)?_(F):(t.consume(F),q)}function L(F){return F===47||F===62||Yt(F)?C(F):n(F)}function I(F){return F===62?(t.consume(F),$):n(F)}function $(F){return F===null||ut(F)?V(F):Yt(F)?(t.consume(F),$):n(F)}function V(F){return F===45&&s===2?(t.consume(F),P):F===60&&s===1?(t.consume(F),W):F===62&&s===4?(t.consume(F),se):F===63&&s===3?(t.consume(F),R):F===93&&s===5?(t.consume(F),X):ut(F)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(kpe,G,ee)(F)):F===null||ut(F)?(t.exit("htmlFlowData"),ee(F)):(t.consume(F),V)}function ee(F){return t.check(Ope,z,G)(F)}function z(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),H}function H(F){return F===null||ut(F)?ee(F):(t.enter("htmlFlowData"),V(F))}function P(F){return F===45?(t.consume(F),R):V(F)}function W(F){return F===47?(t.consume(F),a="",J):V(F)}function J(F){if(F===62){const U=a.toLowerCase();return f_.includes(U)?(t.consume(F),se):V(F)}return _s(F)&&a.length<8?(t.consume(F),a+=String.fromCharCode(F),J):V(F)}function X(F){return F===93?(t.consume(F),R):V(F)}function R(F){return F===62?(t.consume(F),se):F===45&&s===2?(t.consume(F),R):V(F)}function se(F){return F===null||ut(F)?(t.exit("htmlFlowData"),G(F)):(t.consume(F),se)}function G(F){return t.exit("htmlFlow"),e(F)}}function Cpe(t,e,n){const r=this;return s;function s(a){return ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Tpe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(sp,e,n)}}const Epe={name:"htmlText",tokenize:_pe};function _pe(t,e,n){const r=this;let s,i,a;return l;function l(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),_):R===63?(t.consume(R),C):_s(R)?(t.consume(R),q):n(R)}function h(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,y):_s(R)?(t.consume(R),N):n(R)}function f(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):ut(R)?(a=m,W(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?P(R):R===45?g(R):m(R)}function y(R){const se="CDATA[";return R===se.charCodeAt(i++)?(t.consume(R),i===se.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):ut(R)?(a=w,W(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?P(R):R===93?(t.consume(R),k):w(R)}function N(R){return R===null||R===62?P(R):ut(R)?(a=N,W(R)):(t.consume(R),N)}function C(R){return R===null?n(R):R===63?(t.consume(R),T):ut(R)?(a=C,W(R)):(t.consume(R),C)}function T(R){return R===62?P(R):C(R)}function _(R){return _s(R)?(t.consume(R),E):n(R)}function E(R){return R===45||Ss(R)?(t.consume(R),E):M(R)}function M(R){return ut(R)?(a=M,W(R)):Yt(R)?(t.consume(R),M):P(R)}function q(R){return R===45||Ss(R)?(t.consume(R),q):R===47||R===62||Vn(R)?L(R):n(R)}function L(R){return R===47?(t.consume(R),P):R===58||R===95||_s(R)?(t.consume(R),I):ut(R)?(a=L,W(R)):Yt(R)?(t.consume(R),L):P(R)}function I(R){return R===45||R===46||R===58||R===95||Ss(R)?(t.consume(R),I):$(R)}function $(R){return R===61?(t.consume(R),V):ut(R)?(a=$,W(R)):Yt(R)?(t.consume(R),$):L(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ee):ut(R)?(a=V,W(R)):Yt(R)?(t.consume(R),V):(t.consume(R),z)}function ee(R){return R===s?(t.consume(R),s=void 0,H):R===null?n(R):ut(R)?(a=ee,W(R)):(t.consume(R),ee)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Vn(R)?L(R):(t.consume(R),z)}function H(R){return R===47||R===62||Vn(R)?L(R):n(R)}function P(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function W(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return Yt(R)?Ut(t,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):X(R)}function X(R){return t.enter("htmlTextData"),a(R)}}const TO={name:"labelEnd",resolveAll:Dpe,resolveTo:zpe,tokenize:Ppe},Mpe={tokenize:Lpe},Ape={tokenize:Ipe},Rpe={tokenize:Bpe};function Dpe(t){let e=-1;const n=[];for(;++e=3&&(h===null||ut(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===s?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Yt(h)?Ut(t,l,"whitespace")(h):l(h))}}const Ws={continuation:{tokenize:Xpe},exit:Kpe,name:"list",tokenize:Gpe},Upe={partial:!0,tokenize:Zpe},Wpe={partial:!0,tokenize:Ype};function Gpe(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return l;function l(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:WS(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(h1,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return WS(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),h(x)):n(x)}function h(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(sp,r.interrupt?n:f,t.attempt(Upe,g,m))}function f(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return Yt(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function Xpe(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(sp,s,i);function s(l){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ut(t,e,"listItemIndent",r.containerState.size+1)(l)}function i(l){return r.containerState.furtherBlankLines||!Yt(l)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(l)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(Wpe,e,a)(l))}function a(l){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ut(t,t.attempt(Ws,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(l)}}function Ype(t,e,n){const r=this;return Ut(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function Kpe(t){t.exit(this.containerState.type)}function Zpe(t,e,n){const r=this;return Ut(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Yt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const m_={name:"setextUnderline",resolveTo:Jpe,tokenize:ege};function Jpe(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function ege(t,e,n){const r=this;let s;return i;function i(h){let f=r.events.length,m;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){m=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=h,a(h)):n(h)}function a(h){return t.enter("setextHeadingLineSequence"),l(h)}function l(h){return h===s?(t.consume(h),l):(t.exit("setextHeadingLineSequence"),Yt(h)?Ut(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||ut(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const tge={tokenize:nge};function nge(t){const e=this,n=t.attempt(sp,r,t.attempt(this.parser.constructs.flowInitial,s,Ut(t,t.attempt(this.parser.constructs.flow,s,t.attempt(ope,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const rge={resolveAll:r$()},sge=n$("string"),ige=n$("text");function n$(t){return{resolveAll:r$(t==="text"?age:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,l);return a;function a(f){return h(f)?i(f):l(f)}function l(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return h(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function h(f){if(f===null)return!0;const m=s[f];let g=-1;if(m)for(;++g-1){const l=a[0];typeof l=="string"?a[0]=l.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function yge(t,e){let n=-1;const r=[];let s;for(;++n{h(!0)},[]),mfe(b.useMemo(()=>({onDragStart(m){let{active:g}=m;i(e.onDragStart({active:g}))},onDragMove(m){let{active:g,over:x}=m;e.onDragMove&&i(e.onDragMove({active:g,over:x}))},onDragOver(m){let{active:g,over:x}=m;i(e.onDragOver({active:g,over:x}))},onDragEnd(m){let{active:g,over:x}=m;i(e.onDragEnd({active:g,over:x}))},onDragCancel(m){let{active:g,over:x}=m;i(e.onDragCancel({active:g,over:x}))}}),[i,e])),!c)return null;const f=he.createElement(he.Fragment,null,he.createElement(dfe,{id:r,value:s.draggable}),he.createElement(hfe,{id:o,announcement:a}));return n?hu.createPortal(f,n):f}var Vr;(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(Vr||(Vr={}));function tv(){}function BE(t,e){return b.useMemo(()=>({sensor:t,options:e??{}}),[t,e])}function yfe(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}const Ea=Object.freeze({x:0,y:0});function bF(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function wF(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function bfe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function qE(t){let{left:e,top:n,height:r,width:s}=t;return[{x:e,y:n},{x:e+s,y:n},{x:e,y:n+r},{x:e+s,y:n+r}]}function SF(t,e){if(!t||t.length===0)return null;const[n]=t;return n[e]}function FE(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}const wfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=FE(e,e.left,e.top),i=[];for(const a of r){const{id:o}=a,c=n.get(o);if(c){const h=bF(FE(c),s);i.push({id:o,data:{droppableContainer:a,value:h}})}}return i.sort(wF)},Sfe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=qE(e),i=[];for(const a of r){const{id:o}=a,c=n.get(o);if(c){const h=qE(c),f=s.reduce((g,x,y)=>g+bF(h[y],x),0),m=Number((f/4).toFixed(4));i.push({id:o,data:{droppableContainer:a,value:m}})}}return i.sort(wF)};function kfe(t,e){const n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),s=Math.min(e.left+e.width,t.left+t.width),i=Math.min(e.top+e.height,t.top+t.height),a=s-r,o=i-n;if(r{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t;const s=[];for(const i of r){const{id:a}=i,o=n.get(a);if(o){const c=kfe(o,e);c>0&&s.push({id:a,data:{droppableContainer:i,value:c}})}}return s.sort(bfe)};function jfe(t,e,n){return{...t,scaleX:e&&n?e.width/n.width:1,scaleY:e&&n?e.height/n.height:1}}function kF(t,e){return t&&e?{x:t.left-e.left,y:t.top-e.top}:Ea}function Nfe(t){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i({...a,top:a.top+t*o.y,bottom:a.bottom+t*o.y,left:a.left+t*o.x,right:a.right+t*o.x}),{...n})}}const Cfe=Nfe(1);function Tfe(t){if(t.startsWith("matrix3d(")){const e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){const e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function Efe(t,e,n){const r=Tfe(e);if(!r)return t;const{scaleX:s,scaleY:i,x:a,y:o}=r,c=t.left-a-(1-s)*parseFloat(n),h=t.top-o-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),f=s?t.width/s:t.width,m=i?t.height/i:t.height;return{width:f,height:m,top:h,right:c+f,bottom:h+m,left:c}}const _fe={ignoreTransform:!1};function Yh(t,e){e===void 0&&(e=_fe);let n=t.getBoundingClientRect();if(e.ignoreTransform){const{transform:h,transformOrigin:f}=ci(t).getComputedStyle(t);h&&(n=Efe(n,h,f))}const{top:r,left:s,width:i,height:a,bottom:o,right:c}=n;return{top:r,left:s,width:i,height:a,bottom:o,right:c}}function $E(t){return Yh(t,{ignoreTransform:!0})}function Mfe(t){const e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Afe(t,e){return e===void 0&&(e=ci(t).getComputedStyle(t)),e.position==="fixed"}function Rfe(t,e){e===void 0&&(e=ci(t).getComputedStyle(t));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=e[s];return typeof i=="string"?n.test(i):!1})}function uy(t,e){const n=[];function r(s){if(e!=null&&n.length>=e||!s)return n;if(xO(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!rp(s)||xF(s)||n.includes(s))return n;const i=ci(t).getComputedStyle(s);return s!==t&&Rfe(s,i)&&n.push(s),Afe(s,i)?n:r(s.parentNode)}return t?r(t):n}function OF(t){const[e]=uy(t,1);return e??null}function Yw(t){return!cy||!t?null:Gh(t)?t:gO(t)?xO(t)||t===Xh(t).scrollingElement?window:rp(t)?t:null:null}function jF(t){return Gh(t)?t.scrollX:t.scrollLeft}function NF(t){return Gh(t)?t.scrollY:t.scrollTop}function VS(t){return{x:jF(t),y:NF(t)}}var Jr;(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Jr||(Jr={}));function CF(t){return!cy||!t?!1:t===document.scrollingElement}function TF(t){const e={x:0,y:0},n=CF(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},s=t.scrollTop<=e.y,i=t.scrollLeft<=e.x,a=t.scrollTop>=r.y,o=t.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:a,isRight:o,maxScroll:r,minScroll:e}}const Dfe={x:.2,y:.2};function zfe(t,e,n,r,s){let{top:i,left:a,right:o,bottom:c}=n;r===void 0&&(r=10),s===void 0&&(s=Dfe);const{isTop:h,isBottom:f,isLeft:m,isRight:g}=TF(t),x={x:0,y:0},y={x:0,y:0},w={height:e.height*s.y,width:e.width*s.x};return!h&&i<=e.top+w.height?(x.y=Jr.Backward,y.y=r*Math.abs((e.top+w.height-i)/w.height)):!f&&c>=e.bottom-w.height&&(x.y=Jr.Forward,y.y=r*Math.abs((e.bottom-w.height-c)/w.height)),!g&&o>=e.right-w.width?(x.x=Jr.Forward,y.x=r*Math.abs((e.right-w.width-o)/w.width)):!m&&a<=e.left+w.width&&(x.x=Jr.Backward,y.x=r*Math.abs((e.left+w.width-a)/w.width)),{direction:x,speed:y}}function Pfe(t){if(t===document.scrollingElement){const{innerWidth:i,innerHeight:a}=window;return{top:0,left:0,right:i,bottom:a,width:i,height:a}}const{top:e,left:n,right:r,bottom:s}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:s,width:t.clientWidth,height:t.clientHeight}}function EF(t){return t.reduce((e,n)=>ah(e,VS(n)),Ea)}function Lfe(t){return t.reduce((e,n)=>e+jF(n),0)}function Ife(t){return t.reduce((e,n)=>e+NF(n),0)}function Bfe(t,e){if(e===void 0&&(e=Yh),!t)return;const{top:n,left:r,bottom:s,right:i}=e(t);OF(t)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}const qfe=[["x",["left","right"],Lfe],["y",["top","bottom"],Ife]];class bO{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=uy(n),s=EF(r);this.rect={...e},this.width=e.width,this.height=e.height;for(const[i,a,o]of qfe)for(const c of a)Object.defineProperty(this,c,{get:()=>{const h=o(r),f=s[i]-h;return this.rect[c]+f},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class Rm{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var s;(s=this.target)==null||s.addEventListener(e,n,r),this.listeners.push([e,n,r])}}function Ffe(t){const{EventTarget:e}=ci(t);return t instanceof e?t:Xh(t)}function Kw(t,e){const n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}var Wi;(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(Wi||(Wi={}));function QE(t){t.preventDefault()}function $fe(t){t.stopPropagation()}var sn;(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(sn||(sn={}));const _F={start:[sn.Space,sn.Enter],cancel:[sn.Esc],end:[sn.Space,sn.Enter,sn.Tab]},Qfe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case sn.Right:return{...n,x:n.x+25};case sn.Left:return{...n,x:n.x-25};case sn.Down:return{...n,y:n.y+25};case sn.Up:return{...n,y:n.y-25}}};class wO{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;const{event:{target:n}}=e;this.props=e,this.listeners=new Rm(Xh(n)),this.windowListeners=new Rm(ci(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Wi.Resize,this.handleCancel),this.windowListeners.add(Wi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Wi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Bfe(r),n(Ea)}handleKeyDown(e){if(yO(e)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=_F,coordinateGetter:a=Qfe,scrollBehavior:o="smooth"}=s,{code:c}=e;if(i.end.includes(c)){this.handleEnd(e);return}if(i.cancel.includes(c)){this.handleCancel(e);return}const{collisionRect:h}=r.current,f=h?{x:h.left,y:h.top}:Ea;this.referenceCoordinates||(this.referenceCoordinates=f);const m=a(e,{active:n,context:r.current,currentCoordinates:f});if(m){const g=f0(m,f),x={x:0,y:0},{scrollableAncestors:y}=r.current;for(const w of y){const S=e.code,{isTop:k,isRight:N,isLeft:C,isBottom:T,maxScroll:_,minScroll:E}=TF(w),M=Pfe(w),q={x:Math.min(S===sn.Right?M.right-M.width/2:M.right,Math.max(S===sn.Right?M.left:M.left+M.width/2,m.x)),y:Math.min(S===sn.Down?M.bottom-M.height/2:M.bottom,Math.max(S===sn.Down?M.top:M.top+M.height/2,m.y))},L=S===sn.Right&&!N||S===sn.Left&&!C,I=S===sn.Down&&!T||S===sn.Up&&!k;if(L&&q.x!==m.x){const $=w.scrollLeft+g.x,V=S===sn.Right&&$<=_.x||S===sn.Left&&$>=E.x;if(V&&!g.y){w.scrollTo({left:$,behavior:o});return}V?x.x=w.scrollLeft-$:x.x=S===sn.Right?w.scrollLeft-_.x:w.scrollLeft-E.x,x.x&&w.scrollBy({left:-x.x,behavior:o});break}else if(I&&q.y!==m.y){const $=w.scrollTop+g.y,V=S===sn.Down&&$<=_.y||S===sn.Up&&$>=E.y;if(V&&!g.x){w.scrollTo({top:$,behavior:o});return}V?x.y=w.scrollTop-$:x.y=S===sn.Down?w.scrollTop-_.y:w.scrollTop-E.y,x.y&&w.scrollBy({top:-x.y,behavior:o});break}}this.handleMove(e,ah(f0(m,this.referenceCoordinates),x))}}}handleMove(e,n){const{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){const{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){const{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}wO.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=_F,onActivation:s}=e,{active:i}=n;const{code:a}=t.nativeEvent;if(r.start.includes(a)){const o=i.activatorNode.current;return o&&t.target!==o?!1:(t.preventDefault(),s?.({event:t.nativeEvent}),!0)}return!1}}];function HE(t){return!!(t&&"distance"in t)}function VE(t){return!!(t&&"delay"in t)}class SO{constructor(e,n,r){var s;r===void 0&&(r=Ffe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;const{event:i}=e,{target:a}=i;this.props=e,this.events=n,this.document=Xh(a),this.documentListeners=new Rm(this.document),this.listeners=new Rm(r),this.windowListeners=new Rm(ci(a)),this.initialCoordinates=(s=HS(i))!=null?s:Ea,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(Wi.Resize,this.handleCancel),this.windowListeners.add(Wi.DragStart,QE),this.windowListeners.add(Wi.VisibilityChange,this.handleCancel),this.windowListeners.add(Wi.ContextMenu,QE),this.documentListeners.add(Wi.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(VE(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(HE(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){const{active:r,onPending:s}=this.props;s(r,e,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(Wi.Click,$fe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Wi.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:a,options:{activationConstraint:o}}=i;if(!s)return;const c=(n=HS(e))!=null?n:Ea,h=f0(s,c);if(!r&&o){if(HE(o)){if(o.tolerance!=null&&Kw(h,o.tolerance))return this.handleCancel();if(Kw(h,o.distance))return this.handleStart()}if(VE(o)&&Kw(h,o.tolerance))return this.handleCancel();this.handlePending(o,h);return}e.cancelable&&e.preventDefault(),a(c)}handleEnd(){const{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){const{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===sn.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}}const Hfe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class kO extends SO{constructor(e){const{event:n}=e,r=Xh(n.target);super(e,Hfe,r)}}kO.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const Vfe={move:{name:"mousemove"},end:{name:"mouseup"}};var US;(function(t){t[t.RightClick=2]="RightClick"})(US||(US={}));class Ufe extends SO{constructor(e){super(e,Vfe,Xh(e.event.target))}}Ufe.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===US.RightClick?!1:(r?.({event:n}),!0)}}];const Zw={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Wfe extends SO{constructor(e){super(e,Zw)}static setup(){return window.addEventListener(Zw.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(Zw.move.name,e)};function e(){}}}Wfe.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var Dm;(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(Dm||(Dm={}));var nv;(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(nv||(nv={}));function Gfe(t){let{acceleration:e,activator:n=Dm.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:a=5,order:o=nv.TreeOrder,pointerCoordinates:c,scrollableAncestors:h,scrollableAncestorRects:f,delta:m,threshold:g}=t;const x=Yfe({delta:m,disabled:!i}),[y,w]=afe(),S=b.useRef({x:0,y:0}),k=b.useRef({x:0,y:0}),N=b.useMemo(()=>{switch(n){case Dm.Pointer:return c?{top:c.y,bottom:c.y,left:c.x,right:c.x}:null;case Dm.DraggableRect:return s}},[n,s,c]),C=b.useRef(null),T=b.useCallback(()=>{const E=C.current;if(!E)return;const M=S.current.x*k.current.x,q=S.current.y*k.current.y;E.scrollBy(M,q)},[]),_=b.useMemo(()=>o===nv.TreeOrder?[...h].reverse():h,[o,h]);b.useEffect(()=>{if(!i||!h.length||!N){w();return}for(const E of _){if(r?.(E)===!1)continue;const M=h.indexOf(E),q=f[M];if(!q)continue;const{direction:L,speed:I}=zfe(E,q,N,e,g);for(const $ of["x","y"])x[$][L[$]]||(I[$]=0,L[$]=0);if(I.x>0||I.y>0){w(),C.current=E,y(T,a),S.current=I,k.current=L;return}}S.current={x:0,y:0},k.current={x:0,y:0},w()},[e,T,r,w,i,a,JSON.stringify(N),JSON.stringify(x),y,h,_,f,JSON.stringify(g)])}const Xfe={x:{[Jr.Backward]:!1,[Jr.Forward]:!1},y:{[Jr.Backward]:!1,[Jr.Forward]:!1}};function Yfe(t){let{delta:e,disabled:n}=t;const r=QS(e);return sp(s=>{if(n||!r||!s)return Xfe;const i={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[Jr.Backward]:s.x[Jr.Backward]||i.x===-1,[Jr.Forward]:s.x[Jr.Forward]||i.x===1},y:{[Jr.Backward]:s.y[Jr.Backward]||i.y===-1,[Jr.Forward]:s.y[Jr.Forward]||i.y===1}}},[n,e,r])}function Kfe(t,e){const n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return sp(s=>{var i;return e==null?null:(i=r??s)!=null?i:null},[r,e])}function Zfe(t,e){return b.useMemo(()=>t.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(a=>({eventName:a.eventName,handler:e(a.handler,r)}));return[...n,...i]},[]),[t,e])}var p0;(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(p0||(p0={}));var WS;(function(t){t.Optimized="optimized"})(WS||(WS={}));const UE=new Map;function Jfe(t,e){let{dragging:n,dependencies:r,config:s}=e;const[i,a]=b.useState(null),{frequency:o,measure:c,strategy:h}=s,f=b.useRef(t),m=S(),g=h0(m),x=b.useCallback(function(k){k===void 0&&(k=[]),!g.current&&a(N=>N===null?k:N.concat(k.filter(C=>!N.includes(C))))},[g]),y=b.useRef(null),w=sp(k=>{if(m&&!n)return UE;if(!k||k===UE||f.current!==t||i!=null){const N=new Map;for(let C of t){if(!C)continue;if(i&&i.length>0&&!i.includes(C.id)&&C.rect.current){N.set(C.id,C.rect.current);continue}const T=C.node.current,_=T?new bO(c(T),T):null;C.rect.current=_,_&&N.set(C.id,_)}return N}return k},[t,i,n,m,c]);return b.useEffect(()=>{f.current=t},[t]),b.useEffect(()=>{m||x()},[n,m]),b.useEffect(()=>{i&&i.length>0&&a(null)},[JSON.stringify(i)]),b.useEffect(()=>{m||typeof o!="number"||y.current!==null||(y.current=setTimeout(()=>{x(),y.current=null},o))},[o,m,x,...r]),{droppableRects:w,measureDroppableContainers:x,measuringScheduled:i!=null};function S(){switch(h){case p0.Always:return!1;case p0.BeforeDragging:return n;default:return!n}}}function MF(t,e){return sp(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function eme(t,e){return MF(t,e)}function tme(t){let{callback:e,disabled:n}=t;const r=vO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function dy(t){let{callback:e,disabled:n}=t;const r=vO(e),s=b.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return b.useEffect(()=>()=>s?.disconnect(),[s]),s}function nme(t){return new bO(Yh(t),t)}function WE(t,e,n){e===void 0&&(e=nme);const[r,s]=b.useState(null);function i(){s(c=>{if(!t)return null;if(t.isConnected===!1){var h;return(h=c??n)!=null?h:null}const f=e(t);return JSON.stringify(c)===JSON.stringify(f)?c:f})}const a=tme({callback(c){if(t)for(const h of c){const{type:f,target:m}=h;if(f==="childList"&&m instanceof HTMLElement&&m.contains(t)){i();break}}}}),o=dy({callback:i});return ul(()=>{i(),t?(o?.observe(t),a?.observe(document.body,{childList:!0,subtree:!0})):(o?.disconnect(),a?.disconnect())},[t]),r}function rme(t){const e=MF(t);return kF(t,e)}const GE=[];function sme(t){const e=b.useRef(t),n=sp(r=>t?r&&r!==GE&&t&&e.current&&t.parentNode===e.current.parentNode?r:uy(t):GE,[t]);return b.useEffect(()=>{e.current=t},[t]),n}function ime(t){const[e,n]=b.useState(null),r=b.useRef(t),s=b.useCallback(i=>{const a=Yw(i.target);a&&n(o=>o?(o.set(a,VS(a)),new Map(o)):null)},[]);return b.useEffect(()=>{const i=r.current;if(t!==i){a(i);const o=t.map(c=>{const h=Yw(c);return h?(h.addEventListener("scroll",s,{passive:!0}),[h,VS(h)]):null}).filter(c=>c!=null);n(o.length?new Map(o):null),r.current=t}return()=>{a(t),a(i)};function a(o){o.forEach(c=>{const h=Yw(c);h?.removeEventListener("scroll",s)})}},[s,t]),b.useMemo(()=>t.length?e?Array.from(e.values()).reduce((i,a)=>ah(i,a),Ea):EF(t):Ea,[t,e])}function XE(t,e){e===void 0&&(e=[]);const n=b.useRef(null);return b.useEffect(()=>{n.current=null},e),b.useEffect(()=>{const r=t!==Ea;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?f0(t,n.current):Ea}function ame(t){b.useEffect(()=>{if(!cy)return;const e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function lme(t,e){return b.useMemo(()=>t.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=a=>{i(a,e)},n},{}),[t,e])}function AF(t){return b.useMemo(()=>t?Mfe(t):null,[t])}const YE=[];function ome(t,e){e===void 0&&(e=Yh);const[n]=t,r=AF(n?ci(n):null),[s,i]=b.useState(YE);function a(){i(()=>t.length?t.map(c=>CF(c)?r:new bO(e(c),c)):YE)}const o=dy({callback:a});return ul(()=>{o?.disconnect(),a(),t.forEach(c=>o?.observe(c))},[t]),s}function cme(t){if(!t)return null;if(t.children.length>1)return t;const e=t.children[0];return rp(e)?e:t}function ume(t){let{measure:e}=t;const[n,r]=b.useState(null),s=b.useCallback(h=>{for(const{target:f}of h)if(rp(f)){r(m=>{const g=e(f);return m?{...m,width:g.width,height:g.height}:g});break}},[e]),i=dy({callback:s}),a=b.useCallback(h=>{const f=cme(h);i?.disconnect(),f&&i?.observe(f),r(f?e(f):null)},[e,i]),[o,c]=ev(a);return b.useMemo(()=>({nodeRef:o,rect:n,setRef:c}),[n,o,c])}const dme=[{sensor:kO,options:{}},{sensor:wO,options:{}}],hme={current:{}},m1={draggable:{measure:$E},droppable:{measure:$E,strategy:p0.WhileDragging,frequency:WS.Optimized},dragOverlay:{measure:Yh}};class zm extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}}const fme={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new zm,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:tv},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:m1,measureDroppableContainers:tv,windowRect:null,measuringScheduled:!1},mme={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:tv,draggableNodes:new Map,over:null,measureDroppableContainers:tv},hy=b.createContext(mme),RF=b.createContext(fme);function pme(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new zm}}}function gme(t,e){switch(e.type){case Vr.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case Vr.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case Vr.DragEnd:case Vr.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vr.RegisterDroppable:{const{element:n}=e,{id:r}=n,s=new zm(t.droppable.containers);return s.set(r,n),{...t,droppable:{...t.droppable,containers:s}}}case Vr.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=e,i=t.droppable.containers.get(n);if(!i||r!==i.key)return t;const a=new zm(t.droppable.containers);return a.set(n,{...i,disabled:s}),{...t,droppable:{...t.droppable,containers:a}}}case Vr.UnregisterDroppable:{const{id:n,key:r}=e,s=t.droppable.containers.get(n);if(!s||r!==s.key)return t;const i=new zm(t.droppable.containers);return i.delete(n),{...t,droppable:{...t.droppable,containers:i}}}default:return t}}function xme(t){let{disabled:e}=t;const{active:n,activatorEvent:r,draggableNodes:s}=b.useContext(hy),i=QS(r),a=QS(n?.id);return b.useEffect(()=>{if(!e&&!r&&i&&a!=null){if(!yO(i)||document.activeElement===i.target)return;const o=s.get(a);if(!o)return;const{activatorNode:c,node:h}=o;if(!c.current&&!h.current)return;requestAnimationFrame(()=>{for(const f of[c.current,h.current]){if(!f)continue;const m=cfe(f);if(m){m.focus();break}}})}},[r,e,s,a,i]),null}function vme(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((s,i)=>i({transform:s,...r}),n):n}function yme(t){return b.useMemo(()=>({draggable:{...m1.draggable,...t?.draggable},droppable:{...m1.droppable,...t?.droppable},dragOverlay:{...m1.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function bme(t){let{activeNode:e,measure:n,initialRect:r,config:s=!0}=t;const i=b.useRef(!1),{x:a,y:o}=typeof s=="boolean"?{x:s,y:s}:s;ul(()=>{if(!a&&!o||!e){i.current=!1;return}if(i.current||!r)return;const h=e?.node.current;if(!h||h.isConnected===!1)return;const f=n(h),m=kF(f,r);if(a||(m.x=0),o||(m.y=0),i.current=!0,Math.abs(m.x)>0||Math.abs(m.y)>0){const g=OF(h);g&&g.scrollBy({top:m.y,left:m.x})}},[e,a,o,r,n])}const DF=b.createContext({...Ea,scaleX:1,scaleY:1});var lc;(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(lc||(lc={}));const wme=b.memo(function(e){var n,r,s,i;let{id:a,accessibility:o,autoScroll:c=!0,children:h,sensors:f=dme,collisionDetection:m=Ofe,measuring:g,modifiers:x,...y}=e;const w=b.useReducer(gme,void 0,pme),[S,k]=w,[N,C]=pfe(),[T,_]=b.useState(lc.Uninitialized),E=T===lc.Initialized,{draggable:{active:M,nodes:q,translate:L},droppable:{containers:I}}=S,$=M!=null?q.get(M):null,V=b.useRef({initial:null,translated:null}),ee=b.useMemo(()=>{var Vt;return M!=null?{id:M,data:(Vt=$?.data)!=null?Vt:hme,rect:V}:null},[M,$]),z=b.useRef(null),[H,P]=b.useState(null),[W,J]=b.useState(null),X=h0(y,Object.values(y)),R=ip("DndDescribedBy",a),se=b.useMemo(()=>I.getEnabled(),[I]),G=yme(g),{droppableRects:F,measureDroppableContainers:U,measuringScheduled:te}=Jfe(se,{dragging:E,dependencies:[L.x,L.y],config:G.droppable}),ne=Kfe(q,M),Y=b.useMemo(()=>W?HS(W):null,[W]),ae=Gt(),re=eme(ne,G.draggable.measure);bme({activeNode:M!=null?q.get(M):null,config:ae.layoutShiftCompensation,initialRect:re,measure:G.draggable.measure});const le=WE(ne,G.draggable.measure,re),_e=WE(ne?ne.parentElement:null),Ge=b.useRef({activatorEvent:null,active:null,activeNode:ne,collisionRect:null,collisions:null,droppableRects:F,draggableNodes:q,draggingNode:null,draggingNodeRect:null,droppableContainers:I,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),tt=I.getNodeFor((n=Ge.current.over)==null?void 0:n.id),Xe=ume({measure:G.dragOverlay.measure}),je=(r=Xe.nodeRef.current)!=null?r:ne,Qe=E?(s=Xe.rect)!=null?s:le:null,He=!!(Xe.nodeRef.current&&Xe.rect),$e=rme(He?null:le),bt=AF(je?ci(je):null),lt=sme(E?tt??ne:null),xn=ome(lt),_n=vme(x,{transform:{x:L.x-$e.x,y:L.y-$e.y,scaleX:1,scaleY:1},activatorEvent:W,active:ee,activeNodeRect:le,containerNodeRect:_e,draggingNodeRect:Qe,over:Ge.current.over,overlayNodeRect:Xe.rect,scrollableAncestors:lt,scrollableAncestorRects:xn,windowRect:bt}),Cn=Y?ah(Y,L):null,Dt=ime(lt),xt=XE(Dt),Te=XE(Dt,[le]),Re=ah(_n,xt),qe=Qe?Cfe(Qe,_n):null,rt=ee&&qe?m({active:ee,collisionRect:qe,droppableRects:F,droppableContainers:se,pointerCoordinates:Cn}):null,wt=SF(rt,"id"),[jt,Ne]=b.useState(null),ie=He?_n:ah(_n,Te),xe=jfe(ie,(i=jt?.rect)!=null?i:null,le),Je=b.useRef(null),dt=b.useCallback((Vt,ot)=>{let{sensor:mr,options:Yr}=ot;if(z.current==null)return;const Kr=q.get(z.current);if(!Kr)return;const pr=Vt.nativeEvent,Cr=new mr({active:z.current,activeNode:Kr,event:pr,options:Yr,context:Ge,onAbort(wr){if(!q.get(wr))return;const{onDragAbort:Cs}=X.current,qs={id:wr};Cs?.(qs),N({type:"onDragAbort",event:qs})},onPending(wr,hi,Cs,qs){if(!q.get(wr))return;const{onDragPending:pa}=X.current,fi={id:wr,constraint:hi,initialCoordinates:Cs,offset:qs};pa?.(fi),N({type:"onDragPending",event:fi})},onStart(wr){const hi=z.current;if(hi==null)return;const Cs=q.get(hi);if(!Cs)return;const{onDragStart:qs}=X.current,ma={activatorEvent:pr,active:{id:hi,data:Cs.data,rect:V}};hu.unstable_batchedUpdates(()=>{qs?.(ma),_(lc.Initializing),k({type:Vr.DragStart,initialCoordinates:wr,active:hi}),N({type:"onDragStart",event:ma}),P(Je.current),J(pr)})},onMove(wr){k({type:Vr.DragMove,coordinates:wr})},onEnd:Bs(Vr.DragEnd),onCancel:Bs(Vr.DragCancel)});Je.current=Cr;function Bs(wr){return async function(){const{active:Cs,collisions:qs,over:ma,scrollAdjustedTranslate:pa}=Ge.current;let fi=null;if(Cs&&pa){const{cancelDrop:Pa}=X.current;fi={activatorEvent:pr,active:Cs,collisions:qs,delta:pa,over:ma},wr===Vr.DragEnd&&typeof Pa=="function"&&await Promise.resolve(Pa(fi))&&(wr=Vr.DragCancel)}z.current=null,hu.unstable_batchedUpdates(()=>{k({type:wr}),_(lc.Uninitialized),Ne(null),P(null),J(null),Je.current=null;const Pa=wr===Vr.DragEnd?"onDragEnd":"onDragCancel";if(fi){const Fs=X.current[Pa];Fs?.(fi),N({type:Pa,event:fi})}})}}},[q]),er=b.useCallback((Vt,ot)=>(mr,Yr)=>{const Kr=mr.nativeEvent,pr=q.get(Yr);if(z.current!==null||!pr||Kr.dndKit||Kr.defaultPrevented)return;const Cr={active:pr};Vt(mr,ot.options,Cr)===!0&&(Kr.dndKit={capturedBy:ot.sensor},z.current=Yr,dt(mr,ot))},[q,dt]),pt=Zfe(f,er);ame(f),ul(()=>{le&&T===lc.Initializing&&_(lc.Initialized)},[le,T]),b.useEffect(()=>{const{onDragMove:Vt}=X.current,{active:ot,activatorEvent:mr,collisions:Yr,over:Kr}=Ge.current;if(!ot||!mr)return;const pr={active:ot,activatorEvent:mr,collisions:Yr,delta:{x:Re.x,y:Re.y},over:Kr};hu.unstable_batchedUpdates(()=>{Vt?.(pr),N({type:"onDragMove",event:pr})})},[Re.x,Re.y]),b.useEffect(()=>{const{active:Vt,activatorEvent:ot,collisions:mr,droppableContainers:Yr,scrollAdjustedTranslate:Kr}=Ge.current;if(!Vt||z.current==null||!ot||!Kr)return;const{onDragOver:pr}=X.current,Cr=Yr.get(wt),Bs=Cr&&Cr.rect.current?{id:Cr.id,rect:Cr.rect.current,data:Cr.data,disabled:Cr.disabled}:null,wr={active:Vt,activatorEvent:ot,collisions:mr,delta:{x:Kr.x,y:Kr.y},over:Bs};hu.unstable_batchedUpdates(()=>{Ne(Bs),pr?.(wr),N({type:"onDragOver",event:wr})})},[wt]),ul(()=>{Ge.current={activatorEvent:W,active:ee,activeNode:ne,collisionRect:qe,collisions:rt,droppableRects:F,draggableNodes:q,draggingNode:je,draggingNodeRect:Qe,droppableContainers:I,over:jt,scrollableAncestors:lt,scrollAdjustedTranslate:Re},V.current={initial:Qe,translated:qe}},[ee,ne,rt,qe,q,je,Qe,F,I,jt,lt,Re]),Gfe({...ae,delta:L,draggingRect:qe,pointerCoordinates:Cn,scrollableAncestors:lt,scrollableAncestorRects:xn});const kn=b.useMemo(()=>({active:ee,activeNode:ne,activeNodeRect:le,activatorEvent:W,collisions:rt,containerNodeRect:_e,dragOverlay:Xe,draggableNodes:q,droppableContainers:I,droppableRects:F,over:jt,measureDroppableContainers:U,scrollableAncestors:lt,scrollableAncestorRects:xn,measuringConfiguration:G,measuringScheduled:te,windowRect:bt}),[ee,ne,le,W,rt,_e,Xe,q,I,F,jt,U,lt,xn,G,te,bt]),vt=b.useMemo(()=>({activatorEvent:W,activators:pt,active:ee,activeNodeRect:le,ariaDescribedById:{draggable:R},dispatch:k,draggableNodes:q,over:jt,measureDroppableContainers:U}),[W,pt,ee,le,k,R,q,jt,U]);return he.createElement(yF.Provider,{value:C},he.createElement(hy.Provider,{value:vt},he.createElement(RF.Provider,{value:kn},he.createElement(DF.Provider,{value:xe},h)),he.createElement(xme,{disabled:o?.restoreFocus===!1})),he.createElement(vfe,{...o,hiddenTextDescribedById:R}));function Gt(){const Vt=H?.autoScrollEnabled===!1,ot=typeof c=="object"?c.enabled===!1:c===!1,mr=E&&!Vt&&!ot;return typeof c=="object"?{...c,enabled:mr}:{enabled:mr}}}),Sme=b.createContext(null),KE="button",kme="Draggable";function Ome(t){let{id:e,data:n,disabled:r=!1,attributes:s}=t;const i=ip(kme),{activators:a,activatorEvent:o,active:c,activeNodeRect:h,ariaDescribedById:f,draggableNodes:m,over:g}=b.useContext(hy),{role:x=KE,roleDescription:y="draggable",tabIndex:w=0}=s??{},S=c?.id===e,k=b.useContext(S?DF:Sme),[N,C]=ev(),[T,_]=ev(),E=lme(a,e),M=h0(n);ul(()=>(m.set(e,{id:e,key:i,node:N,activatorNode:T,data:M}),()=>{const L=m.get(e);L&&L.key===i&&m.delete(e)}),[m,e]);const q=b.useMemo(()=>({role:x,tabIndex:w,"aria-disabled":r,"aria-pressed":S&&x===KE?!0:void 0,"aria-roledescription":y,"aria-describedby":f.draggable}),[r,x,w,S,y,f.draggable]);return{active:c,activatorEvent:o,activeNodeRect:h,attributes:q,isDragging:S,listeners:r?void 0:E,node:N,over:g,setNodeRef:C,setActivatorNodeRef:_,transform:k}}function jme(){return b.useContext(RF)}const Nme="Droppable",Cme={timeout:25};function Tme(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:s}=t;const i=ip(Nme),{active:a,dispatch:o,over:c,measureDroppableContainers:h}=b.useContext(hy),f=b.useRef({disabled:n}),m=b.useRef(!1),g=b.useRef(null),x=b.useRef(null),{disabled:y,updateMeasurementsFor:w,timeout:S}={...Cme,...s},k=h0(w??r),N=b.useCallback(()=>{if(!m.current){m.current=!0;return}x.current!=null&&clearTimeout(x.current),x.current=setTimeout(()=>{h(Array.isArray(k.current)?k.current:[k.current]),x.current=null},S)},[S]),C=dy({callback:N,disabled:y||!a}),T=b.useCallback((q,L)=>{C&&(L&&(C.unobserve(L),m.current=!1),q&&C.observe(q))},[C]),[_,E]=ev(T),M=h0(e);return b.useEffect(()=>{!C||!_.current||(C.disconnect(),m.current=!1,C.observe(_.current))},[_,C]),b.useEffect(()=>(o({type:Vr.RegisterDroppable,element:{id:r,key:i,disabled:n,node:_,rect:g,data:M}}),()=>o({type:Vr.UnregisterDroppable,key:i,id:r})),[r]),b.useEffect(()=>{n!==f.current.disabled&&(o({type:Vr.SetDroppableDisabled,id:r,key:i,disabled:n}),f.current.disabled=n)},[r,i,n,o]),{active:a,rect:g,isOver:c?.id===r,node:_,over:c,setNodeRef:E}}function OO(t,e,n){const r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function Eme(t,e){return t.reduce((n,r,s)=>{const i=e.get(r);return i&&(n[s]=i),n},Array(t.length))}function wx(t){return t!==null&&t>=0}function _me(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{var e;let{rects:n,activeNodeRect:r,activeIndex:s,overIndex:i,index:a}=t;const o=(e=n[s])!=null?e:r;if(!o)return null;const c=Rme(n,a,s);if(a===s){const h=n[i];return h?{x:ss&&a<=i?{x:-o.width-c,y:0,...Sx}:a=i?{x:o.width+c,y:0,...Sx}:{x:0,y:0,...Sx}};function Rme(t,e,n){const r=t[e],s=t[e-1],i=t[e+1];return!r||!s&&!i?0:n{let{rects:e,activeIndex:n,overIndex:r,index:s}=t;const i=OO(e,r,n),a=e[s],o=i[s];return!o||!a?null:{x:o.left-a.left,y:o.top-a.top,scaleX:o.width/a.width,scaleY:o.height/a.height}},PF="Sortable",LF=he.createContext({activeIndex:-1,containerId:PF,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:zF,disabled:{draggable:!1,droppable:!1}});function Dme(t){let{children:e,id:n,items:r,strategy:s=zF,disabled:i=!1}=t;const{active:a,dragOverlay:o,droppableRects:c,over:h,measureDroppableContainers:f}=jme(),m=ip(PF,n),g=o.rect!==null,x=b.useMemo(()=>r.map(E=>typeof E=="object"&&"id"in E?E.id:E),[r]),y=a!=null,w=a?x.indexOf(a.id):-1,S=h?x.indexOf(h.id):-1,k=b.useRef(x),N=!_me(x,k.current),C=S!==-1&&w===-1||N,T=Mme(i);ul(()=>{N&&y&&f(x)},[N,x,y,f]),b.useEffect(()=>{k.current=x},[x]);const _=b.useMemo(()=>({activeIndex:w,containerId:m,disabled:T,disableTransforms:C,items:x,overIndex:S,useDragOverlay:g,sortedRects:Eme(x,c),strategy:s}),[w,m,T.draggable,T.droppable,C,x,S,c,g,s]);return he.createElement(LF.Provider,{value:_},e)}const zme=t=>{let{id:e,items:n,activeIndex:r,overIndex:s}=t;return OO(n,r,s).indexOf(e)},Pme=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:o,previousContainerId:c,transition:h}=t;return!h||!r||o!==i&&s===a?!1:n?!0:a!==s&&e===c},Lme={duration:200,easing:"ease"},IF="transform",Ime=m0.Transition.toString({property:IF,duration:0,easing:"linear"}),Bme={roleDescription:"sortable"};function qme(t){let{disabled:e,index:n,node:r,rect:s}=t;const[i,a]=b.useState(null),o=b.useRef(n);return ul(()=>{if(!e&&n!==o.current&&r.current){const c=s.current;if(c){const h=Yh(r.current,{ignoreTransform:!0}),f={x:c.left-h.left,y:c.top-h.top,scaleX:c.width/h.width,scaleY:c.height/h.height};(f.x||f.y)&&a(f)}}n!==o.current&&(o.current=n)},[e,n,r,s]),b.useEffect(()=>{i&&a(null)},[i]),i}function Fme(t){let{animateLayoutChanges:e=Pme,attributes:n,disabled:r,data:s,getNewIndex:i=zme,id:a,strategy:o,resizeObserverConfig:c,transition:h=Lme}=t;const{items:f,containerId:m,activeIndex:g,disabled:x,disableTransforms:y,sortedRects:w,overIndex:S,useDragOverlay:k,strategy:N}=b.useContext(LF),C=$me(r,x),T=f.indexOf(a),_=b.useMemo(()=>({sortable:{containerId:m,index:T,items:f},...s}),[m,s,T,f]),E=b.useMemo(()=>f.slice(f.indexOf(a)),[f,a]),{rect:M,node:q,isOver:L,setNodeRef:I}=Tme({id:a,data:_,disabled:C.droppable,resizeObserverConfig:{updateMeasurementsFor:E,...c}}),{active:$,activatorEvent:V,activeNodeRect:ee,attributes:z,setNodeRef:H,listeners:P,isDragging:W,over:J,setActivatorNodeRef:X,transform:R}=Ome({id:a,data:_,attributes:{...Bme,...n},disabled:C.draggable}),se=ife(I,H),G=!!$,F=G&&!y&&wx(g)&&wx(S),U=!k&&W,te=U&&F?R:null,Y=F?te??(o??N)({rects:w,activeNodeRect:ee,activeIndex:g,overIndex:S,index:T}):null,ae=wx(g)&&wx(S)?i({id:a,items:f,activeIndex:g,overIndex:S}):T,re=$?.id,le=b.useRef({activeId:re,items:f,newIndex:ae,containerId:m}),_e=f!==le.current.items,Ge=e({active:$,containerId:m,isDragging:W,isSorting:G,id:a,index:T,items:f,newIndex:le.current.newIndex,previousItems:le.current.items,previousContainerId:le.current.containerId,transition:h,wasDragging:le.current.activeId!=null}),tt=qme({disabled:!Ge,index:T,node:q,rect:M});return b.useEffect(()=>{G&&le.current.newIndex!==ae&&(le.current.newIndex=ae),m!==le.current.containerId&&(le.current.containerId=m),f!==le.current.items&&(le.current.items=f)},[G,ae,m,f]),b.useEffect(()=>{if(re===le.current.activeId)return;if(re!=null&&le.current.activeId==null){le.current.activeId=re;return}const je=setTimeout(()=>{le.current.activeId=re},50);return()=>clearTimeout(je)},[re]),{active:$,activeIndex:g,attributes:z,data:_,rect:M,index:T,newIndex:ae,items:f,isOver:L,isSorting:G,isDragging:W,listeners:P,node:q,overIndex:S,over:J,setNodeRef:se,setActivatorNodeRef:X,setDroppableNodeRef:I,setDraggableNodeRef:H,transform:tt??Y,transition:Xe()};function Xe(){if(tt||_e&&le.current.newIndex===T)return Ime;if(!(U&&!yO(V)||!h)&&(G||Ge))return m0.Transition.toString({...h,property:IF})}}function $me(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}function rv(t){if(!t)return!1;const e=t.data.current;return!!(e&&"sortable"in e&&typeof e.sortable=="object"&&"containerId"in e.sortable&&"items"in e.sortable&&"index"in e.sortable)}const Qme=[sn.Down,sn.Right,sn.Up,sn.Left],Hme=(t,e)=>{let{context:{active:n,collisionRect:r,droppableRects:s,droppableContainers:i,over:a,scrollableAncestors:o}}=e;if(Qme.includes(t.code)){if(t.preventDefault(),!n||!r)return;const c=[];i.getEnabled().forEach(m=>{if(!m||m!=null&&m.disabled)return;const g=s.get(m.id);if(g)switch(t.code){case sn.Down:r.topg.top&&c.push(m);break;case sn.Left:r.left>g.left&&c.push(m);break;case sn.Right:r.left1&&(f=h[1].id),f!=null){const m=i.get(n.id),g=i.get(f),x=g?s.get(g.id):null,y=g?.node.current;if(y&&x&&m&&g){const S=uy(y).some((E,M)=>o[M]!==E),k=BF(m,g),N=Vme(m,g),C=S||!k?{x:0,y:0}:{x:N?r.width-x.width:0,y:N?r.height-x.height:0},T={x:x.left,y:x.top};return C.x&&C.y?T:f0(T,C)}}}};function BF(t,e){return!rv(t)||!rv(e)?!1:t.data.current.sortable.containerId===e.data.current.sortable.containerId}function Vme(t,e){return!rv(t)||!rv(e)||!BF(t,e)?!1:t.data.current.sortable.index{f.stopPropagation(),n(t)}})]})})}function Wme({options:t,selected:e,onChange:n,placeholder:r="选择选项...",emptyText:s="未找到选项",className:i}){const[a,o]=b.useState(!1),c=yfe(BE(kO,{activationConstraint:{distance:8}}),BE(wO,{coordinateGetter:Hme})),h=g=>{e.includes(g)?n(e.filter(x=>x!==g)):n([...e,g])},f=g=>{n(e.filter(x=>x!==g))},m=g=>{const{active:x,over:y}=g;if(y&&x.id!==y.id){const w=e.indexOf(x.id),S=e.indexOf(y.id);n(OO(e,w,S))}};return l.jsxs(uo,{open:a,onOpenChange:o,children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",role:"combobox","aria-expanded":a,className:ye("w-full justify-between min-h-10 h-auto",i),children:[l.jsx(wme,{sensors:c,collisionDetection:wfe,onDragEnd:m,children:l.jsx(Dme,{items:e,strategy:Ame,children:l.jsx("div",{className:"flex gap-1 flex-wrap flex-1",children:e.length===0?l.jsx("span",{className:"text-muted-foreground",children:r}):e.map(g=>{const x=t.find(y=>y.value===g);return l.jsx(Ume,{value:g,label:x?.label||g,onRemove:f},g)})})})}),l.jsx(iz,{className:"ml-2 h-4 w-4 shrink-0 opacity-50",strokeWidth:2,fill:"none"})]})}),l.jsx(ol,{className:"w-full p-0",align:"start",children:l.jsxs(uO,{children:[l.jsx(dO,{placeholder:"搜索...",className:"h-9"}),l.jsxs(hO,{children:[l.jsx(fO,{children:s}),l.jsx(mO,{children:t.map(g=>{const x=e.includes(g.value);return l.jsxs(pO,{value:g.value,onSelect:()=>h(g.value),children:[l.jsx("div",{className:ye("mr-2 flex h-4 w-4 items-center justify-center rounded-sm border border-primary",x?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:l.jsx(so,{className:"h-3 w-3",strokeWidth:2,fill:"none"})}),l.jsx("span",{children:g.label})]},g.value)})})]})]})})]})}function Gme(){const[t,e]=b.useState([]),[n,r]=b.useState([]),[s,i]=b.useState([]),[a,o]=b.useState(null),[c,h]=b.useState(!0),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState(null),[I,$]=b.useState(!1),[V,ee]=b.useState(null),[z,H]=b.useState(""),[P,W]=b.useState(new Set),[J,X]=b.useState(!1),[R,se]=b.useState(1),[G,F]=b.useState(20),[U,te]=b.useState(""),{toast:ne}=Gr(),Y=b.useRef(null),ae=b.useRef(null),re=b.useRef(!0);b.useEffect(()=>{le()},[]);const le=async()=>{try{h(!0);const ie=await Jd(),xe=ie.models||[];e(xe),i(xe.map(dt=>dt.name));const Je=ie.api_providers||[];r(Je.map(dt=>dt.name)),o(ie.model_task_config||null),w(!1),re.current=!1}catch(ie){console.error("加载配置失败:",ie)}finally{h(!1)}},_e=async()=>{try{k(!0),Hv().catch(()=>{}),C(!0)}catch(ie){console.error("重启失败:",ie),C(!1),ne({title:"重启失败",description:"无法发送重启请求,请手动重启",variant:"destructive"}),k(!1)}},Ge=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Jd();ie.models=t,ie.model_task_config=a,await M1(ie),w(!1),ne({title:"保存成功",description:"正在重启麦麦..."}),await _e()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"}),m(!1)}},tt=()=>{localStorage.removeItem("access-token"),window.location.href="/auth"},Xe=()=>{C(!1),k(!1),ne({title:"重启超时",description:"服务未能在预期时间内恢复,请手动检查或刷新页面",variant:"destructive"})},je=b.useCallback(async ie=>{if(!re.current)try{x(!0),await Q3("models",ie),w(!1)}catch(xe){console.error("自动保存模型列表失败:",xe),w(!0)}finally{x(!1)}},[]),Qe=b.useCallback(async ie=>{if(!re.current)try{x(!0),await Q3("model_task_config",ie),w(!1)}catch(xe){console.error("自动保存任务配置失败:",xe),w(!0)}finally{x(!1)}},[]);b.useEffect(()=>{if(!re.current)return w(!0),Y.current&&clearTimeout(Y.current),Y.current=setTimeout(()=>{je(t)},2e3),()=>{Y.current&&clearTimeout(Y.current)}},[t,je]),b.useEffect(()=>{if(!(re.current||!a))return w(!0),ae.current&&clearTimeout(ae.current),ae.current=setTimeout(()=>{Qe(a)},2e3),()=>{ae.current&&clearTimeout(ae.current)}},[a,Qe]);const He=async()=>{try{m(!0),Y.current&&clearTimeout(Y.current),ae.current&&clearTimeout(ae.current);const ie=await Jd();ie.models=t,ie.model_task_config=a,await M1(ie),w(!1),ne({title:"保存成功",description:"模型配置已保存"}),await le()}catch(ie){console.error("保存配置失败:",ie),ne({title:"保存失败",description:ie.message,variant:"destructive"})}finally{m(!1)}},$e=(ie,xe)=>{M(ie||{model_identifier:"",name:"",api_provider:n[0]||"",price_in:0,price_out:0,force_stream_mode:!1,extra_params:{}}),L(xe),_(!0)},bt=()=>{if(!E)return;const ie={...E,price_in:E.price_in??0,price_out:E.price_out??0};let xe;q!==null?(xe=[...t],xe[q]=ie):xe=[...t,ie],e(xe),i(xe.map(Je=>Je.name)),_(!1),M(null),L(null)},lt=ie=>{if(!ie&&E){const xe={...E,price_in:E.price_in??0,price_out:E.price_out??0};M(xe)}_(ie)},xn=ie=>{ee(ie),$(!0)},_n=()=>{if(V!==null){const ie=t.filter((xe,Je)=>Je!==V);e(ie),i(ie.map(xe=>xe.name)),ne({title:"删除成功",description:"模型已从列表中移除"})}$(!1),ee(null)},Cn=ie=>{const xe=new Set(P);xe.has(ie)?xe.delete(ie):xe.add(ie),W(xe)},Dt=()=>{if(P.size===qe.length)W(new Set);else{const ie=qe.map((xe,Je)=>t.findIndex(dt=>dt===qe[Je]));W(new Set(ie))}},xt=()=>{if(P.size===0){ne({title:"提示",description:"请先选择要删除的模型",variant:"default"});return}X(!0)},Te=()=>{const ie=t.filter((xe,Je)=>!P.has(Je));e(ie),i(ie.map(xe=>xe.name)),W(new Set),X(!1),ne({title:"批量删除成功",description:`已删除 ${P.size} 个模型`})},Re=(ie,xe,Je)=>{a&&o({...a,[ie]:{...a[ie],[xe]:Je}})},qe=t.filter(ie=>{if(!z)return!0;const xe=z.toLowerCase();return ie.name.toLowerCase().includes(xe)||ie.model_identifier.toLowerCase().includes(xe)||ie.api_provider.toLowerCase().includes(xe)}),rt=Math.ceil(qe.length/G),wt=qe.slice((R-1)*G,R*G),jt=()=>{const ie=parseInt(U);ie>=1&&ie<=rt&&(se(ie),te(""))},Ne=ie=>a?[a.utils?.model_list||[],a.utils_small?.model_list||[],a.tool_use?.model_list||[],a.replyer?.model_list||[],a.planner?.model_list||[],a.vlm?.model_list||[],a.voice?.model_list||[],a.embedding?.model_list||[],a.lpmm_entity_extract?.model_list||[],a.lpmm_rdf_build?.model_list||[],a.lpmm_qa?.model_list||[]].some(Je=>Je.includes(ie)):!1;return c?l.jsx(on,{className:"h-full",children:l.jsx("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:l.jsx("div",{className:"flex items-center justify-center h-64",children:l.jsx("p",{className:"text-muted-foreground",children:"加载中..."})})})}):l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"模型管理与分配"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"添加模型并为模型分配功能"})]}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[l.jsxs(fe,{onClick:He,disabled:f||g||!y||S,size:"sm",variant:"outline",className:"flex-1 sm:flex-none",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),f?"保存中...":g?"自动保存中...":y?"保存配置":"已保存"]}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsxs(fe,{disabled:f||g||S,size:"sm",className:"flex-1 sm:flex-none",children:[l.jsx(e6,{className:"mr-2 h-4 w-4"}),S?"重启中...":y?"保存并重启":"重启麦麦"]})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认重启麦麦?"}),l.jsx(mn,{className:"space-y-3",asChild:!0,children:l.jsxs("div",{children:[l.jsx("p",{children:y?"当前有未保存的配置更改。点击确认将先保存配置,然后重启麦麦使新配置生效。重启过程中麦麦将暂时离线。":"即将重启麦麦主程序。重启过程中麦麦将暂时离线,配置将在重启后生效。"}),l.jsxs(il,{className:"border-yellow-500/50 bg-yellow-500/10",children:[l.jsx(Oa,{className:"h-4 w-4 text-yellow-600"}),l.jsxs(al,{className:"text-yellow-900 dark:text-yellow-100",children:[l.jsx("strong",{children:"重要提示:"}),"由于技术原因,使用重启功能后,将无法再使用 ",l.jsx("code",{className:"px-1 py-0.5 bg-yellow-200 dark:bg-yellow-900 rounded",children:"Ctrl+C"})," 结束程序。",l.jsxs(fr,{children:[l.jsx(Bh,{asChild:!0,children:l.jsxs("button",{className:"ml-1 text-yellow-700 dark:text-yellow-300 underline hover:text-yellow-800 dark:hover:text-yellow-200 inline-flex items-center gap-1",children:[l.jsx(Av,{className:"h-3 w-3"}),"如何结束程序?"]})}),l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"如何结束使用重启功能后的麦麦程序"}),l.jsx(Ir,{children:"由于重启功能会使程序脱离终端控制,需要通过系统命令来结束进程"})]}),l.jsxs(na,{defaultValue:"windows",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsx(Et,{value:"windows",children:"Windows"}),l.jsx(Et,{value:"macos",children:"macOS"}),l.jsx(Et,{value:"linux",children:"Linux"})]}),l.jsxs(Kt,{value:"windows",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用任务管理器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Ctrl + Shift + Esc"})," 打开任务管理器"]}),l.jsxs("li",{children:['在"进程"或"详细信息"标签页中找到 ',l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"python.exe"})]}),l.jsx("li",{children:'右键点击并选择"结束任务"'})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用命令行"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开 PowerShell 或命令提示符,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:'Get-Process python | Where-Object {$_.MainWindowTitle -eq ""}'}),l.jsx("p",{className:"mt-2",children:"# 结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"Stop-Process -Name python -Force"})]})]})]}),l.jsxs(Kt,{value:"macos",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法一:使用活动监视器"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Cmd + Space"}),' 打开 Spotlight,搜索"活动监视器"']}),l.jsxs("li",{children:["在进程列表中找到 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"Python"})]}),l.jsx("li",{children:"选中后点击左上角的 X 按钮结束进程"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"方法二:使用终端"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]})]}),l.jsxs(Kt,{value:"linux",className:"space-y-4 mt-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用终端命令"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"打开终端,执行以下命令:"}),l.jsxs("div",{className:"bg-muted p-3 rounded-md font-mono text-sm",children:[l.jsx("p",{children:"# 查找麦麦进程"}),l.jsx("p",{children:"ps aux | grep python | grep -v grep"}),l.jsx("p",{className:"mt-2",children:"# 结束指定 PID 的进程"}),l.jsx("p",{children:"kill -9 "}),l.jsx("p",{className:"mt-2",children:"# 或使用 pkill 按名称结束"}),l.jsx("p",{children:'pkill -9 -f "bot.py"'}),l.jsx("p",{className:"mt-2",children:"# 或结束所有 Python 进程(谨慎使用)"}),l.jsx("p",{children:"pkill -9 python"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"font-semibold",children:"使用 htop(如已安装)"}),l.jsxs("ol",{className:"list-decimal list-inside space-y-1 text-sm text-muted-foreground",children:[l.jsxs("li",{children:["在终端输入 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"htop"})]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F3"})," 搜索 python"]}),l.jsxs("li",{children:["按 ",l.jsx("code",{className:"px-1 py-0.5 bg-muted rounded",children:"F9"})," 发送信号,选择 SIGKILL"]})]})]})]})]}),l.jsx(ts,{children:l.jsx(g6,{asChild:!0,children:l.jsx(fe,{variant:"outline",children:"关闭"})})})]})]})]})]})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:y?Ge:_e,children:y?"保存并重启":"确认重启"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsxs(al,{children:["配置更新后需要",l.jsx("strong",{children:"重启麦麦"}),'才能生效。你可以点击右上角的"保存并重启"按钮一键完成保存和重启。']})]}),l.jsxs(na,{defaultValue:"models",className:"w-full",children:[l.jsxs(_i,{className:"grid w-full max-w-full sm:max-w-md grid-cols-2",children:[l.jsx(Et,{value:"models",children:"添加模型"}),l.jsx(Et,{value:"tasks",children:"为模型分配功能"})]}),l.jsxs(Kt,{value:"models",className:"space-y-4 mt-0",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-2",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"配置可用的模型列表"}),l.jsxs("div",{className:"flex gap-2 w-full sm:w-auto",children:[P.size>0&&l.jsxs(fe,{onClick:xt,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(ln,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"批量删除 (",P.size,")"]}),l.jsxs(fe,{onClick:()=>$e(null,null),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(gs,{className:"mr-2 h-4 w-4",strokeWidth:2,fill:"none"}),"添加模型"]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-2",children:[l.jsxs("div",{className:"relative w-full sm:flex-1 sm:max-w-sm",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索模型名称、标识符或提供商...",value:z,onChange:ie=>H(ie.target.value),className:"pl-9"})]}),z&&l.jsxs("p",{className:"text-sm text-muted-foreground whitespace-nowrap",children:["找到 ",qe.length," 个结果"]})]}),l.jsx("div",{className:"md:hidden space-y-3",children:wt.length===0?l.jsx("div",{className:"text-center text-muted-foreground py-8 rounded-lg border bg-card",children:z?"未找到匹配的模型":"暂无模型配置"}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[l.jsx("h3",{className:"font-semibold text-base",children:ie.name}),l.jsx(In,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})]}),l.jsx("p",{className:"text-xs text-muted-foreground break-all",title:ie.model_identifier,children:ie.model_identifier})]}),l.jsxs("div",{className:"flex gap-1 flex-shrink-0",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>xn(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"提供商"}),l.jsx("p",{className:"font-medium",children:ie.api_provider})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"强制流式"}),l.jsx("p",{className:"font-medium",children:ie.force_stream_mode?"是":"否"})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输入价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ie.price_in,"/M"]})]}),l.jsxs("div",{children:[l.jsx("span",{className:"text-muted-foreground text-xs",children:"输出价格"}),l.jsxs("p",{className:"font-medium",children:["¥",ie.price_out,"/M"]})]})]})]},xe)})}),l.jsx("div",{className:"hidden md:block rounded-lg border bg-card overflow-hidden",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:P.size===qe.length&&qe.length>0,onCheckedChange:Dt})}),l.jsx(tn,{className:"w-24",children:"使用状态"}),l.jsx(tn,{children:"模型名称"}),l.jsx(tn,{children:"模型标识符"}),l.jsx(tn,{children:"提供商"}),l.jsx(tn,{className:"text-right",children:"输入价格"}),l.jsx(tn,{className:"text-right",children:"输出价格"}),l.jsx(tn,{className:"text-center",children:"强制流式"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:wt.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:9,className:"text-center text-muted-foreground py-8",children:z?"未找到匹配的模型":"暂无模型配置"})}):wt.map((ie,xe)=>{const Je=t.findIndex(er=>er===ie),dt=Ne(ie.name);return l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:P.has(Je),onCheckedChange:()=>Cn(Je)})}),l.jsx(It,{children:l.jsx(In,{variant:dt?"default":"secondary",className:dt?"bg-green-600 hover:bg-green-700":"",children:dt?"已使用":"未使用"})}),l.jsx(It,{className:"font-medium",children:ie.name}),l.jsx(It,{className:"max-w-xs truncate",title:ie.model_identifier,children:ie.model_identifier}),l.jsx(It,{children:ie.api_provider}),l.jsxs(It,{className:"text-right",children:["¥",ie.price_in,"/M"]}),l.jsxs(It,{className:"text-right",children:["¥",ie.price_out,"/M"]}),l.jsx(It,{className:"text-center",children:ie.force_stream_mode?"是":"否"}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>$e(ie,Je),children:[l.jsx(fh,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>xn(Je),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1",strokeWidth:2,fill:"none"}),"删除"]})]})})]},xe)})})]})})}),qe.length>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size-model",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:G.toString(),onValueChange:ie=>{F(parseInt(ie)),se(1),W(new Set)},children:[l.jsx(At,{id:"page-size-model",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:["显示 ",(R-1)*G+1," 到"," ",Math.min(R*G,qe.length)," 条,共 ",qe.length," 条"]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(1),disabled:R===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(ie=>Math.max(1,ie-1)),disabled:R===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:U,onChange:ie=>te(ie.target.value),onKeyDown:ie=>ie.key==="Enter"&&jt(),placeholder:R.toString(),className:"w-16 h-8 text-center",min:1,max:rt}),l.jsx(fe,{variant:"outline",size:"sm",onClick:jt,disabled:!U,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>se(ie=>ie+1),disabled:R>=rt,children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>se(rt),disabled:R>=rt,className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]}),l.jsxs(Kt,{value:"tasks",className:"space-y-6 mt-0",children:[l.jsx("p",{className:"text-sm text-muted-foreground",children:"为不同的任务配置使用的模型和参数"}),a&&l.jsxs("div",{className:"grid gap-4 sm:gap-6",children:[l.jsx(ya,{title:"组件模型 (utils)",description:"用于表情包、取名、关系、情绪变化等组件",taskConfig:a.utils,modelNames:s,onChange:(ie,xe)=>Re("utils",ie,xe)}),l.jsx(ya,{title:"组件小模型 (utils_small)",description:"消耗量较大的组件,建议使用速度较快的小模型",taskConfig:a.utils_small,modelNames:s,onChange:(ie,xe)=>Re("utils_small",ie,xe)}),l.jsx(ya,{title:"工具调用模型 (tool_use)",description:"需要使用支持工具调用的模型",taskConfig:a.tool_use,modelNames:s,onChange:(ie,xe)=>Re("tool_use",ie,xe)}),l.jsx(ya,{title:"首要回复模型 (replyer)",description:"用于表达器和表达方式学习",taskConfig:a.replyer,modelNames:s,onChange:(ie,xe)=>Re("replyer",ie,xe)}),l.jsx(ya,{title:"决策模型 (planner)",description:"负责决定麦麦该什么时候回复",taskConfig:a.planner,modelNames:s,onChange:(ie,xe)=>Re("planner",ie,xe)}),l.jsx(ya,{title:"图像识别模型 (vlm)",description:"视觉语言模型",taskConfig:a.vlm,modelNames:s,onChange:(ie,xe)=>Re("vlm",ie,xe),hideTemperature:!0}),l.jsx(ya,{title:"语音识别模型 (voice)",description:"语音转文字",taskConfig:a.voice,modelNames:s,onChange:(ie,xe)=>Re("voice",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),l.jsx(ya,{title:"嵌入模型 (embedding)",description:"用于向量化",taskConfig:a.embedding,modelNames:s,onChange:(ie,xe)=>Re("embedding",ie,xe),hideTemperature:!0,hideMaxTokens:!0}),l.jsxs("div",{className:"space-y-4",children:[l.jsx("h3",{className:"text-lg font-semibold",children:"LPMM 知识库模型"}),l.jsx(ya,{title:"实体提取模型 (lpmm_entity_extract)",description:"从文本中提取实体",taskConfig:a.lpmm_entity_extract,modelNames:s,onChange:(ie,xe)=>Re("lpmm_entity_extract",ie,xe)}),l.jsx(ya,{title:"RDF 构建模型 (lpmm_rdf_build)",description:"构建知识图谱",taskConfig:a.lpmm_rdf_build,modelNames:s,onChange:(ie,xe)=>Re("lpmm_rdf_build",ie,xe)}),l.jsx(ya,{title:"问答模型 (lpmm_qa)",description:"知识库问答",taskConfig:a.lpmm_qa,modelNames:s,onChange:(ie,xe)=>Re("lpmm_qa",ie,xe)})]})]})]})]}),l.jsx(fr,{open:T,onOpenChange:lt,children:l.jsxs(rr,{className:"max-w-[95vw] sm:max-w-2xl max-h-[90vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:q!==null?"编辑模型":"添加模型"}),l.jsx(Ir,{children:"配置模型的基本信息和参数"})]}),l.jsxs("div",{className:"grid gap-4 py-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"model_name",children:"模型名称 *"}),l.jsx(Pe,{id:"model_name",value:E?.name||"",onChange:ie=>M(xe=>xe?{...xe,name:ie.target.value}:null),placeholder:"例如: qwen3-30b"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"用于在任务配置中引用此模型"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"model_identifier",children:"模型标识符 *"}),l.jsx(Pe,{id:"model_identifier",value:E?.model_identifier||"",onChange:ie=>M(xe=>xe?{...xe,model_identifier:ie.target.value}:null),placeholder:"Qwen/Qwen3-30B-A3B-Instruct-2507"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"API 提供商提供的模型 ID"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"api_provider",children:"API 提供商 *"}),l.jsxs(zt,{value:E?.api_provider||"",onValueChange:ie=>M(xe=>xe?{...xe,api_provider:ie}:null),children:[l.jsx(At,{id:"api_provider",children:l.jsx(Pt,{placeholder:"选择提供商"})}),l.jsx(Rt,{children:n.map(ie=>l.jsx(ze,{value:ie,children:ie},ie))})]})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"price_in",children:"输入价格 (¥/M token)"}),l.jsx(Pe,{id:"price_in",type:"number",step:"0.1",min:"0",value:E?.price_in??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_in:xe}:null)},placeholder:"默认: 0"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"price_out",children:"输出价格 (¥/M token)"}),l.jsx(Pe,{id:"price_out",type:"number",step:"0.1",min:"0",value:E?.price_out??"",onChange:ie=>{const xe=ie.target.value===""?null:parseFloat(ie.target.value);M(Je=>Je?{...Je,price_out:xe}:null)},placeholder:"默认: 0"})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"force_stream_mode",checked:E?.force_stream_mode||!1,onCheckedChange:ie=>M(xe=>xe?{...xe,force_stream_mode:ie}:null)}),l.jsx(de,{htmlFor:"force_stream_mode",className:"cursor-pointer",children:"强制流式输出模式"})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>_(!1),children:"取消"}),l.jsx(fe,{onClick:bt,children:"保存"})]})]})}),l.jsx(wn,{open:I,onOpenChange:$,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除模型 "',V!==null?t[V]?.name:"",'" 吗? 此操作无法撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:_n,children:"删除"})]})]})}),l.jsx(wn,{open:J,onOpenChange:X,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["确定要删除选中的 ",P.size," 个模型吗? 此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Te,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})}),N&&l.jsx(y6,{onRestartComplete:tt,onRestartFailed:Xe})]})})}function ya({title:t,description:e,taskConfig:n,modelNames:r,onChange:s,hideTemperature:i=!1,hideMaxTokens:a=!1}){const o=c=>{s("model_list",c)};return l.jsxs("div",{className:"rounded-lg border bg-card p-4 sm:p-6 space-y-4",children:[l.jsxs("div",{children:[l.jsx("h4",{className:"font-semibold text-base sm:text-lg",children:t}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:e})]}),l.jsxs("div",{className:"grid gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"模型列表"}),l.jsx(Wme,{options:r.map(c=>({label:c,value:c})),selected:n.model_list||[],onChange:o,placeholder:"选择模型...",emptyText:"暂无可用模型"})]}),l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[!i&&l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(de,{children:"温度"}),l.jsx(Pe,{type:"number",step:"0.1",min:"0",max:"1",value:n.temperature??.3,onChange:c=>{const h=parseFloat(c.target.value);!isNaN(h)&&h>=0&&h<=1&&s("temperature",h)},className:"w-20 h-8 text-sm"})]}),l.jsx($0,{value:[n.temperature??.3],onValueChange:c=>s("temperature",c[0]),min:0,max:1,step:.1,className:"w-full"})]}),!a&&l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{children:"最大 Token"}),l.jsx(Pe,{type:"number",step:"1",min:"1",value:n.max_tokens??1024,onChange:c=>s("max_tokens",parseInt(c.target.value))})]})]})]})]})}const fy="/api/webui/config";async function Xme(){const e=await(await mt(`${fy}/adapter-config/path`)).json();return!e.success||!e.path?null:{path:e.path,lastModified:e.lastModified}}async function ZE(t){const n=await(await mt(`${fy}/adapter-config/path`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t})})).json();if(!n.success)throw new Error(n.message||"保存路径失败")}async function JE(t){const n=await(await mt(`${fy}/adapter-config?path=${encodeURIComponent(t)}`)).json();if(!n.success)throw new Error("读取配置文件失败");return n.content}async function e_(t,e){const r=await(await mt(`${fy}/adapter-config`,{method:"POST",headers:Nt(),body:JSON.stringify({path:t,content:e})})).json();if(!r.success)throw new Error(r.message||"保存配置失败")}const ki={inner:{version:"0.1.2"},nickname:{nickname:""},napcat_server:{host:"localhost",port:8095,token:"",heartbeat_interval:30},maibot_server:{host:"localhost",port:8e3},chat:{group_list_type:"whitelist",group_list:[],private_list_type:"whitelist",private_list:[],ban_user_id:[],ban_qq_bot:!1,enable_poke:!0},voice:{use_tts:!1},debug:{level:"INFO"}},Jw={oneclick:{name:"一键包",description:"使用一键包部署的适配器配置",path:"../MaiBot-Napcat-Adapter/config.toml",icon:mh},docker:{name:"Docker",description:"Docker Compose 部署的适配器配置",path:"./docker-config/adapters/config.toml",icon:qK}};function Yme(){const[t,e]=b.useState("upload"),[n,r]=b.useState(null),[s,i]=b.useState(""),[a,o]=b.useState(""),[c,h]=b.useState("oneclick"),[f,m]=b.useState(""),[g,x]=b.useState(!1),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),E=b.useRef(null),{toast:M}=Gr(),q=b.useRef(null),L=Y=>{if(!Y.trim())return{valid:!1,error:"路径不能为空"};if(!Y.toLowerCase().endsWith(".toml"))return{valid:!1,error:"文件必须是 .toml 格式"};const ae=/^([a-zA-Z]:\\|\\\\[^\\]+\\[^\\]+\\).+\.toml$/i,re=/^(\/|~\/).+\.toml$/i,le=/^(\.{1,2}[\\/]|[^:\\/]).+\.toml$/i,_e=ae.test(Y),Ge=re.test(Y),tt=le.test(Y);return!_e&&!Ge&&!tt?{valid:!1,error:"路径格式错误"}:/[<>"|?*\x00-\x1F]/.test(Y)?{valid:!1,error:"路径包含非法字符"}:{valid:!0,error:""}},I=Y=>{if(o(Y),Y.trim()){const ae=L(Y);m(ae.error)}else m("")},$=b.useCallback(async Y=>{const ae=Jw[Y];w(!0);try{const re=await JE(ae.path),le=G(re);r(le),h(Y),o(ae.path),await ZE(ae.path),M({title:"加载成功",description:`已从${ae.name}预设加载配置`})}catch(re){console.error("加载预设配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取预设配置文件",variant:"destructive"})}finally{w(!1)}},[M]),V=b.useCallback(async Y=>{const ae=L(Y);if(!ae.valid){m(ae.error),M({title:"路径无效",description:ae.error,variant:"destructive"});return}m(""),w(!0);try{const re=await JE(Y),le=G(re);r(le),o(Y),await ZE(Y),M({title:"加载成功",description:"已从配置文件加载"})}catch(re){console.error("加载配置失败:",re),M({title:"加载失败",description:re instanceof Error?re.message:"无法读取配置文件",variant:"destructive"})}finally{w(!1)}},[M]);b.useEffect(()=>{(async()=>{try{const ae=await Xme();if(ae&&ae.path){o(ae.path);const re=Object.entries(Jw).find(([,le])=>le.path===ae.path);re?(e("preset"),h(re[0]),await $(re[0])):(e("path"),await V(ae.path))}}catch(ae){console.error("加载保存的路径失败:",ae)}})()},[V,$]);const ee=b.useCallback(Y=>{t!=="path"&&t!=="preset"||!a||(q.current&&clearTimeout(q.current),q.current=setTimeout(async()=>{x(!0);try{const ae=F(Y);await e_(a,ae),M({title:"自动保存成功",description:"配置已保存到文件"})}catch(ae){console.error("自动保存失败:",ae),M({title:"自动保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},1e3))},[t,a,M]),z=async()=>{if(!n||!a)return;const Y=L(a);if(!Y.valid){M({title:"保存失败",description:Y.error,variant:"destructive"});return}x(!0);try{const ae=F(n);await e_(a,ae),M({title:"保存成功",description:"配置已保存到文件"})}catch(ae){console.error("保存失败:",ae),M({title:"保存失败",description:ae instanceof Error?ae.message:"保存配置失败",variant:"destructive"})}finally{x(!1)}},H=async()=>{a&&await V(a)},P=Y=>{if(Y!==t){if(n){_(Y),k(!0);return}W(Y)}},W=Y=>{r(null),i(""),m(""),e(Y),Y==="preset"&&$("oneclick"),M({title:"已切换模式",description:{upload:"现在可以上传配置文件",path:"现在可以指定配置文件路径",preset:"现在可以使用预设配置"}[Y]})},J=()=>{T&&(W(T),_(null)),k(!1)},X=()=>{if(n){C(!0);return}R()},R=()=>{o(""),r(null),m(""),M({title:"已清空",description:"路径和配置已清空"})},se=()=>{R(),C(!1)},G=Y=>{const ae=JSON.parse(JSON.stringify(ki)),re=Y.split(` +`);let le="";for(const _e of re){const Ge=_e.trim();if(!Ge||Ge.startsWith("#"))continue;const tt=Ge.match(/^\[(\w+)\]/);if(tt){le=tt[1];continue}const Xe=Ge.match(/^(\w+)\s*=\s*(.+)$/);if(Xe&&le){const[,je,Qe]=Xe;let He=Qe.trim();const $e=He.match(/^("[^"]*")/);if($e)He=$e[1];else{const lt=He.indexOf("#");lt!==-1&&(He=He.substring(0,lt).trim())}let bt;if(He==="true")bt=!0;else if(He==="false")bt=!1;else if(He.startsWith("[")&&He.endsWith("]")){const lt=He.slice(1,-1).trim();if(lt){const xn=lt.split(",").map(Cn=>{const Dt=Cn.trim();return isNaN(Number(Dt))?Dt.replace(/"/g,""):Number(Dt)}),_n=typeof xn[0];bt=xn.every(Cn=>typeof Cn===_n)?xn:xn.filter(Cn=>typeof Cn=="number")}else bt=[]}else He.startsWith('"')&&He.endsWith('"')?bt=He.slice(1,-1):isNaN(Number(He))?bt=He.replace(/"/g,""):bt=Number(He);if(le in ae){const lt=ae[le];lt[je]=bt}}}return ae},F=Y=>{const ae=[],re=(le,_e)=>le===""||le===null||le===void 0?_e:le;return ae.push("[inner]"),ae.push(`version = "${re(Y.inner.version,ki.inner.version)}" # 版本号`),ae.push("# 请勿修改版本号,除非你知道自己在做什么"),ae.push(""),ae.push("[nickname] # 现在没用"),ae.push(`nickname = "${re(Y.nickname.nickname,ki.nickname.nickname)}"`),ae.push(""),ae.push("[napcat_server] # Napcat连接的ws服务设置"),ae.push(`host = "${re(Y.napcat_server.host,ki.napcat_server.host)}" # Napcat设定的主机地址`),ae.push(`port = ${re(Y.napcat_server.port||0,ki.napcat_server.port)} # Napcat设定的端口`),ae.push(`token = "${re(Y.napcat_server.token,ki.napcat_server.token)}" # Napcat设定的访问令牌,若无则留空`),ae.push(`heartbeat_interval = ${re(Y.napcat_server.heartbeat_interval||0,ki.napcat_server.heartbeat_interval)} # 与Napcat设置的心跳相同(按秒计)`),ae.push(""),ae.push("[maibot_server] # 连接麦麦的ws服务设置"),ae.push(`host = "${re(Y.maibot_server.host,ki.maibot_server.host)}" # 麦麦在.env文件中设置的主机地址,即HOST字段`),ae.push(`port = ${re(Y.maibot_server.port||0,ki.maibot_server.port)} # 麦麦在.env文件中设置的端口,即PORT字段`),ae.push(""),ae.push("[chat] # 黑白名单功能"),ae.push(`group_list_type = "${re(Y.chat.group_list_type,ki.chat.group_list_type)}" # 群组名单类型,可选为:whitelist, blacklist`),ae.push(`group_list = [${Y.chat.group_list.join(", ")}] # 群组名单`),ae.push("# 当group_list_type为whitelist时,只有群组名单中的群组可以聊天"),ae.push("# 当group_list_type为blacklist时,群组名单中的任何群组无法聊天"),ae.push(`private_list_type = "${re(Y.chat.private_list_type,ki.chat.private_list_type)}" # 私聊名单类型,可选为:whitelist, blacklist`),ae.push(`private_list = [${Y.chat.private_list.join(", ")}] # 私聊名单`),ae.push("# 当private_list_type为whitelist时,只有私聊名单中的用户可以聊天"),ae.push("# 当private_list_type为blacklist时,私聊名单中的任何用户无法聊天"),ae.push(`ban_user_id = [${Y.chat.ban_user_id.join(", ")}] # 全局禁止名单(全局禁止名单中的用户无法进行任何聊天)`),ae.push(`ban_qq_bot = ${Y.chat.ban_qq_bot} # 是否屏蔽QQ官方机器人`),ae.push(`enable_poke = ${Y.chat.enable_poke} # 是否启用戳一戳功能`),ae.push(""),ae.push("[voice] # 发送语音设置"),ae.push(`use_tts = ${Y.voice.use_tts} # 是否使用tts语音(请确保你配置了tts并有对应的adapter)`),ae.push(""),ae.push("[debug]"),ae.push(`level = "${re(Y.debug.level,ki.debug.level)}" # 日志等级(DEBUG, INFO, WARNING, ERROR, CRITICAL)`),ae.join(` +`)},U=Y=>{const ae=Y.target.files?.[0];if(!ae)return;const re=new FileReader;re.onload=le=>{try{const _e=le.target?.result,Ge=G(_e);r(Ge),i(ae.name),M({title:"上传成功",description:`已加载配置文件:${ae.name}`})}catch(_e){console.error("解析配置文件失败:",_e),M({title:"解析失败",description:"配置文件格式错误,请检查文件内容",variant:"destructive"})}},re.readAsText(ae)},te=()=>{if(!n)return;const Y=F(n),ae=new Blob([Y],{type:"text/plain;charset=utf-8"}),re=URL.createObjectURL(ae),le=document.createElement("a");le.href=re,le.download=s||"config.toml",document.body.appendChild(le),le.click(),document.body.removeChild(le),URL.revokeObjectURL(re),M({title:"下载成功",description:"配置文件已下载,请手动覆盖并重启适配器"})},ne=()=>{r(JSON.parse(JSON.stringify(ki))),i("config.toml"),M({title:"已加载默认配置",description:"可以开始编辑配置"})};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦适配器配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理麦麦的 QQ 适配器的配置文件"})]})}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"工作模式"}),l.jsx(zr,{children:"选择配置文件的管理方式"})]}),l.jsxs(En,{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3 md:gap-4",children:[l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="preset"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("preset"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(mh,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"预设模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"使用预设的部署配置"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="upload"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("upload"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(LC,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"上传文件模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"上传配置文件,编辑后下载并手动覆盖"})]})]})}),l.jsx("div",{className:`border-2 rounded-lg p-3 md:p-4 cursor-pointer transition-all ${t==="path"?"border-primary bg-primary/5":"border-muted hover:border-primary/50 active:border-primary/70"}`,onClick:()=>P("path"),children:l.jsxs("div",{className:"flex items-start gap-2 md:gap-3",children:[l.jsx(FK,{className:"h-4 w-4 md:h-5 md:w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("h3",{className:"font-semibold text-sm md:text-base",children:"指定路径模式"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-1 line-clamp-2",children:"指定配置文件路径,自动加载和保存"})]})]})})]}),t==="preset"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsx(de,{className:"text-sm md:text-base",children:"选择部署方式"}),l.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Object.entries(Jw).map(([Y,ae])=>{const re=ae.icon,le=c===Y;return l.jsx("div",{className:`border-2 rounded-lg p-3 cursor-pointer transition-all ${le?"border-primary bg-primary/5":"border-muted hover:border-primary/50"}`,onClick:()=>{h(Y),$(Y)},children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(re,{className:"h-5 w-5 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"min-w-0 flex-1",children:[l.jsx("h4",{className:"font-semibold text-sm",children:ae.name}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:ae.description}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1 font-mono break-all",children:ae.path})]})]})},Y)})})]}),t==="path"&&l.jsxs("div",{className:"space-y-3 pt-2 border-t",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"config-path",className:"text-sm md:text-base",children:"配置文件路径"}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs("div",{className:"flex-1 space-y-1",children:[l.jsx(Pe,{id:"config-path",value:a,onChange:Y=>I(Y.target.value),placeholder:"例: C:\\Adapter\\config.toml",className:`text-sm ${f?"border-destructive":""}`}),f&&l.jsx("p",{className:"text-xs text-destructive",children:f})]}),l.jsx(fe,{onClick:()=>V(a),disabled:y||!a||!!f,className:"w-full sm:w-auto",children:y?l.jsxs(l.Fragment,{children:[l.jsx(ti,{className:"h-4 w-4 animate-spin mr-2"}),l.jsx("span",{className:"sm:hidden",children:"加载中..."})]}):l.jsxs(l.Fragment,{children:[l.jsx("span",{className:"sm:hidden",children:"加载配置"}),l.jsx("span",{className:"hidden sm:inline",children:"加载"})]})})]})]}),l.jsxs("details",{className:"rounded-lg bg-muted/50 p-3 group",children:[l.jsxs("summary",{className:"text-xs font-medium cursor-pointer select-none list-none flex items-center justify-between",children:[l.jsx("span",{children:"路径格式说明"}),l.jsx("svg",{className:"h-4 w-4 transition-transform group-open:rotate-180",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:l.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),l.jsxs("div",{className:"mt-2 space-y-2 text-xs text-muted-foreground",children:[l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Windows"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"C:\\Adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"D:\\MaiBot\\adapter\\config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"\\\\server\\share\\config.toml"})]})]}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("div",{className:"flex items-center gap-2",children:l.jsx("span",{className:"font-mono bg-background px-1.5 py-0.5 rounded text-[10px] md:text-xs whitespace-nowrap",children:"Linux"})}),l.jsxs("div",{className:"pl-2 space-y-0.5 text-[10px] md:text-xs break-all",children:[l.jsx("div",{children:"/opt/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"/home/user/adapter/config.toml"}),l.jsx("div",{className:"hidden sm:block",children:"~/adapter/config.toml"})]})]}),l.jsx("p",{className:"pt-1 border-t text-[10px] md:text-xs",children:"💡 配置会自动保存到指定文件,修改后 1 秒自动保存"})]})]})]})]})]}),l.jsxs(il,{children:[l.jsx(Oa,{className:"h-4 w-4"}),l.jsx(al,{children:t==="preset"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"预设模式:"}),"选择预设的部署方式,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]}):t==="upload"?l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"上传文件模式:"}),"上传配置文件 → 在线编辑 → 下载文件 → 手动覆盖并重启适配器"]}):l.jsxs(l.Fragment,{children:[l.jsx("strong",{children:"指定路径模式:"}),"指定配置文件路径后,配置会自动加载,修改后 1 秒自动保存",g&&" (正在保存...)"]})})]}),t==="upload"&&!n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 w-full",children:[l.jsx("input",{ref:E,type:"file",accept:".toml",className:"hidden",onChange:U}),l.jsxs(fe,{onClick:()=>E.current?.click(),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(LC,{className:"mr-2 h-4 w-4"}),"上传配置"]}),l.jsxs(fe,{onClick:ne,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-2 h-4 w-4"}),"使用默认配置"]})]}),t==="upload"&&n&&l.jsx("div",{className:"flex gap-2",children:l.jsxs(fe,{onClick:te,size:"sm",className:"w-full sm:w-auto",children:[l.jsx(bu,{className:"mr-2 h-4 w-4"}),"下载配置"]})}),(t==="preset"||t==="path")&&n&&l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[l.jsxs(fe,{onClick:z,size:"sm",disabled:g||!!f,className:"w-full sm:w-auto",children:[l.jsx(Rv,{className:"mr-2 h-4 w-4"}),g?"保存中...":"立即保存"]}),l.jsxs(fe,{onClick:H,size:"sm",variant:"outline",disabled:y,className:"w-full sm:w-auto",children:[l.jsx(ti,{className:`mr-2 h-4 w-4 ${y?"animate-spin":""}`}),"刷新"]}),t==="path"&&l.jsxs(fe,{onClick:X,size:"sm",variant:"destructive",className:"w-full sm:w-auto",children:[l.jsx(ln,{className:"mr-2 h-4 w-4"}),"清空路径"]})]}),n?l.jsxs(na,{defaultValue:"napcat",className:"w-full",children:[l.jsx("div",{className:"overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0",children:l.jsxs(_i,{className:"inline-flex w-auto min-w-full sm:grid sm:w-full sm:grid-cols-5",children:[l.jsxs(Et,{value:"napcat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"Napcat 连接"}),l.jsx("span",{className:"sm:hidden",children:"Napcat"})]}),l.jsxs(Et,{value:"maibot",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"麦麦连接"}),l.jsx("span",{className:"sm:hidden",children:"麦麦"})]}),l.jsxs(Et,{value:"chat",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"聊天控制"}),l.jsx("span",{className:"sm:hidden",children:"聊天"})]}),l.jsxs(Et,{value:"voice",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:[l.jsx("span",{className:"hidden sm:inline",children:"语音设置"}),l.jsx("span",{className:"sm:hidden",children:"语音"})]}),l.jsx(Et,{value:"debug",className:"flex-shrink-0 text-xs sm:text-sm whitespace-nowrap",children:"调试"})]})}),l.jsx(Kt,{value:"napcat",className:"space-y-4",children:l.jsx(Kme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"maibot",className:"space-y-4",children:l.jsx(Zme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"chat",className:"space-y-4",children:l.jsx(Jme,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"voice",className:"space-y-4",children:l.jsx(e0e,{config:n,onChange:Y=>{r(Y),ee(Y)}})}),l.jsx(Kt,{value:"debug",className:"space-y-4",children:l.jsx(t0e,{config:n,onChange:Y=>{r(Y),ee(Y)}})})]}):l.jsx("div",{className:"rounded-lg border bg-card p-6 md:p-12",children:l.jsxs("div",{className:"text-center space-y-3 md:space-y-4",children:[l.jsx(io,{className:"h-12 w-12 md:h-16 md:w-16 mx-auto text-muted-foreground"}),l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold",children:"尚未加载配置"}),l.jsx("p",{className:"text-xs md:text-sm text-muted-foreground mt-2 px-4",children:t==="preset"?"请选择预设的部署方式":t==="upload"?"请上传现有配置文件,或使用默认配置开始编辑":"请指定配置文件路径并点击加载按钮"})]})]})}),l.jsx(wn,{open:S,onOpenChange:k,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认切换模式"}),l.jsxs(mn,{children:["切换模式将清空当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-destructive font-medium",children:"请确保已保存重要配置"})]})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>{k(!1),_(null)},children:"取消"}),l.jsx(pn,{onClick:J,children:"确认切换"})]})]})}),l.jsx(wn,{open:N,onOpenChange:C,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认清空路径"}),l.jsxs(mn,{children:["清空路径将清除当前配置,确定要继续吗?",l.jsx("br",{}),l.jsx("span",{className:"text-muted-foreground text-sm",children:"此操作不会删除配置文件,只是清除界面中的配置"})]})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>C(!1),children:"取消"}),l.jsx(pn,{onClick:se,className:"bg-destructive hover:bg-destructive/90",children:"确认清空"})]})]})})]})})}function Kme({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"Napcat WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Pe,{id:"napcat-host",value:t.napcat_server.host,onChange:n=>e({...t,napcat_server:{...t.napcat_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的主机地址"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Pe,{id:"napcat-port",type:"number",value:t.napcat_server.port||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8095",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的端口(留空使用默认值 8095)"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-token",className:"text-sm md:text-base",children:"访问令牌(Token)"}),l.jsx(Pe,{id:"napcat-token",type:"password",value:t.napcat_server.token,onChange:n=>e({...t,napcat_server:{...t.napcat_server,token:n.target.value}}),placeholder:"留空表示无需令牌",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"Napcat 设定的访问令牌,若无则留空"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"napcat-heartbeat",className:"text-sm md:text-base",children:"心跳间隔(秒)"}),l.jsx(Pe,{id:"napcat-heartbeat",type:"number",value:t.napcat_server.heartbeat_interval||"",onChange:n=>e({...t,napcat_server:{...t.napcat_server,heartbeat_interval:n.target.value?parseInt(n.target.value):0}}),placeholder:"30",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"与 Napcat 设置的心跳间隔保持一致(留空使用默认值 30)"})]})]})]})})}function Zme({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"麦麦 WebSocket 服务设置"}),l.jsxs("div",{className:"grid gap-3 md:gap-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"maibot-host",className:"text-sm md:text-base",children:"主机地址"}),l.jsx(Pe,{id:"maibot-host",value:t.maibot_server.host,onChange:n=>e({...t,maibot_server:{...t.maibot_server,host:n.target.value}}),placeholder:"localhost",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 HOST 字段"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{htmlFor:"maibot-port",className:"text-sm md:text-base",children:"端口"}),l.jsx(Pe,{id:"maibot-port",type:"number",value:t.maibot_server.port||"",onChange:n=>e({...t,maibot_server:{...t.maibot_server,port:n.target.value?parseInt(n.target.value):0}}),placeholder:"8000",className:"text-sm md:text-base"}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"麦麦在 .env 文件中设置的 PORT 字段(留空使用默认值 8000)"})]})]})]})})}function Jme({config:t,onChange:e}){const n=i=>{const a={...t};i==="group"?a.chat.group_list=[...a.chat.group_list,0]:i==="private"?a.chat.private_list=[...a.chat.private_list,0]:a.chat.ban_user_id=[...a.chat.ban_user_id,0],e(a)},r=(i,a)=>{const o={...t};i==="group"?o.chat.group_list=o.chat.group_list.filter((c,h)=>h!==a):i==="private"?o.chat.private_list=o.chat.private_list.filter((c,h)=>h!==a):o.chat.ban_user_id=o.chat.ban_user_id.filter((c,h)=>h!==a),e(o)},s=(i,a,o)=>{const c={...t};i==="group"?c.chat.group_list[a]=o:i==="private"?c.chat.private_list[a]=o:c.chat.ban_user_id[a]=o,e(c)};return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"聊天黑白名单功能"}),l.jsxs("div",{className:"grid gap-4 md:gap-6",children:[l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-sm md:text-base",children:"群组名单类型"}),l.jsxs(zt,{value:t.chat.group_list_type,onValueChange:i=>e({...t,chat:{...t.chat,group_list_type:i}}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(de,{className:"text-sm md:text-base",children:"群组列表"}),l.jsxs(fe,{onClick:()=>n("group"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-1 h-4 w-4"}),"添加群号"]})]}),t.chat.group_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("group",a,parseInt(o.target.value)||0),placeholder:"输入群号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除群号 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r("group",a),children:"删除"})]})]})]})]},a)),t.chat.group_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无群组"})]})]}),l.jsxs("div",{className:"space-y-3 md:space-y-4",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-sm md:text-base",children:"私聊名单类型"}),l.jsxs(zt,{value:t.chat.private_list_type,onValueChange:i=>e({...t,chat:{...t.chat,private_list_type:i}}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"whitelist",children:"白名单(仅名单内可聊天)"}),l.jsx(ze,{value:"blacklist",children:"黑名单(名单内禁止聊天)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsx(de,{className:"text-sm md:text-base",children:"私聊列表"}),l.jsxs(fe,{onClick:()=>n("private"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.private_list.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("private",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r("private",a),children:"删除"})]})]})]})]},a)),t.chat.private_list.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无用户"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-0",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"全局禁止名单"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"名单中的用户无法进行任何聊天"})]}),l.jsxs(fe,{onClick:()=>n("ban"),size:"sm",variant:"outline",className:"w-full sm:w-auto",children:[l.jsx(io,{className:"mr-1 h-4 w-4"}),"添加用户"]})]}),t.chat.ban_user_id.map((i,a)=>l.jsxs("div",{className:"flex gap-2",children:[l.jsx(Pe,{type:"number",value:i,onChange:o=>s("ban",a,parseInt(o.target.value)||0),placeholder:"输入QQ号",className:"text-sm md:text-base"}),l.jsxs(wn,{children:[l.jsx(Lr,{asChild:!0,children:l.jsx(fe,{size:"icon",variant:"outline",children:l.jsx(ln,{className:"h-4 w-4"})})}),l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:["确定要从全局禁止名单中删除用户 ",i," 吗?此操作无法撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>r("ban",a),children:"删除"})]})]})]})]},a)),t.chat.ban_user_id.length===0&&l.jsx("p",{className:"text-sm text-muted-foreground",children:"暂无禁止用户"})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"屏蔽QQ官方机器人"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否屏蔽来自QQ官方机器人的消息"})]}),l.jsx(_t,{checked:t.chat.ban_qq_bot,onCheckedChange:i=>e({...t,chat:{...t.chat,ban_qq_bot:i}})})]}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"启用戳一戳功能"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"是否响应戳一戳消息"})]}),l.jsx(_t,{checked:t.chat.enable_poke,onCheckedChange:i=>e({...t,chat:{...t.chat,enable_poke:i}})})]})]})]})})}function e0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"发送语音设置"}),l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-sm md:text-base",children:"使用 TTS 语音"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"请确保已配置 TTS 并有对应的适配器"})]}),l.jsx(_t,{checked:t.voice.use_tts,onCheckedChange:n=>e({...t,voice:{use_tts:n}})})]})]})})}function t0e({config:t,onChange:e}){return l.jsx("div",{className:"rounded-lg border bg-card p-4 md:p-6 space-y-4 md:space-y-6",children:l.jsxs("div",{children:[l.jsx("h3",{className:"text-base md:text-lg font-semibold mb-3 md:mb-4",children:"调试设置"}),l.jsx("div",{className:"grid gap-3 md:gap-4",children:l.jsxs("div",{className:"grid gap-2",children:[l.jsx(de,{className:"text-sm md:text-base",children:"日志等级"}),l.jsxs(zt,{value:t.debug.level,onValueChange:n=>e({...t,debug:{level:n}}),children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"DEBUG",children:"DEBUG(调试)"}),l.jsx(ze,{value:"INFO",children:"INFO(信息)"}),l.jsx(ze,{value:"WARNING",children:"WARNING(警告)"}),l.jsx(ze,{value:"ERROR",children:"ERROR(错误)"}),l.jsx(ze,{value:"CRITICAL",children:"CRITICAL(严重)"})]})]}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"设置适配器的日志输出等级"})]})})]})})}function t_(t){const e=[],n=String(t||"");let r=n.indexOf(","),s=0,i=!1;for(;!i;){r===-1&&(r=n.length,i=!0);const a=n.slice(s,r).trim();(a||!i)&&e.push(a),s=r+1,r=n.indexOf(",",s)}return e}function n0e(t,e){const n={};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const r0e=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,s0e=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,i0e={};function n_(t,e){return(i0e.jsx?s0e:r0e).test(t)}const a0e=/[ \t\n\f\r]/g;function l0e(t){return typeof t=="object"?t.type==="text"?r_(t.value):!1:r_(t)}function r_(t){return t.replace(a0e,"")===""}class ap{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}ap.prototype.normal={};ap.prototype.property={};ap.prototype.space=void 0;function qF(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new ap(n,r,e)}function g0(t){return t.toLowerCase()}class ui{constructor(e,n){this.attribute=n,this.property=e}}ui.prototype.attribute="";ui.prototype.booleanish=!1;ui.prototype.boolean=!1;ui.prototype.commaOrSpaceSeparated=!1;ui.prototype.commaSeparated=!1;ui.prototype.defined=!1;ui.prototype.mustUseProperty=!1;ui.prototype.number=!1;ui.prototype.overloadedBoolean=!1;ui.prototype.property="";ui.prototype.spaceSeparated=!1;ui.prototype.space=void 0;let o0e=0;const Ft=$u(),Rr=$u(),GS=$u(),Fe=$u(),Wn=$u(),lh=$u(),Oi=$u();function $u(){return 2**++o0e}const XS=Object.freeze(Object.defineProperty({__proto__:null,boolean:Ft,booleanish:Rr,commaOrSpaceSeparated:Oi,commaSeparated:lh,number:Fe,overloadedBoolean:GS,spaceSeparated:Wn},Symbol.toStringTag,{value:"Module"})),e4=Object.keys(XS);class jO extends ui{constructor(e,n,r,s){let i=-1;if(super(e,n),s_(this,"space",s),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&f0e.test(e)){if(e.charAt(4)==="-"){const i=e.slice(5).replace(i_,p0e);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=e.slice(4);if(!i_.test(i)){let a=i.replace(h0e,m0e);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}s=jO}return new s(r,e)}function m0e(t){return"-"+t.toLowerCase()}function p0e(t){return t.charAt(1).toUpperCase()}const GF=qF([FF,c0e,HF,VF,UF],"html"),my=qF([FF,u0e,HF,VF,UF],"svg");function a_(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function g0e(t){return t.join(" ").trim()}var Cd={},t4,l_;function x0e(){if(l_)return t4;l_=1;var t=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,e=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,a=/^[;\s]*/,o=/^\s+|\s+$/g,c=` +`,h="/",f="*",m="",g="comment",x="declaration";function y(S,k){if(typeof S!="string")throw new TypeError("First argument must be a string");if(!S)return[];k=k||{};var N=1,C=1;function T(z){var H=z.match(e);H&&(N+=H.length);var P=z.lastIndexOf(c);C=~P?z.length-P:C+z.length}function _(){var z={line:N,column:C};return function(H){return H.position=new E(z),L(),H}}function E(z){this.start=z,this.end={line:N,column:C},this.source=k.source}E.prototype.content=S;function M(z){var H=new Error(k.source+":"+N+":"+C+": "+z);if(H.reason=z,H.filename=k.source,H.line=N,H.column=C,H.source=S,!k.silent)throw H}function q(z){var H=z.exec(S);if(H){var P=H[0];return T(P),S=S.slice(P.length),H}}function L(){q(n)}function I(z){var H;for(z=z||[];H=$();)H!==!1&&z.push(H);return z}function $(){var z=_();if(!(h!=S.charAt(0)||f!=S.charAt(1))){for(var H=2;m!=S.charAt(H)&&(f!=S.charAt(H)||h!=S.charAt(H+1));)++H;if(H+=2,m===S.charAt(H-1))return M("End of comment missing");var P=S.slice(2,H-2);return C+=2,T(P),S=S.slice(H),C+=2,z({type:g,comment:P})}}function V(){var z=_(),H=q(r);if(H){if($(),!q(s))return M("property missing ':'");var P=q(i),W=z({type:x,property:w(H[0].replace(t,m)),value:P?w(P[0].replace(t,m)):m});return q(a),W}}function ee(){var z=[];I(z);for(var H;H=V();)H!==!1&&(z.push(H),I(z));return z}return L(),ee()}function w(S){return S?S.replace(o,m):m}return t4=y,t4}var o_;function v0e(){if(o_)return Cd;o_=1;var t=Cd&&Cd.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Cd,"__esModule",{value:!0}),Cd.default=n;const e=t(x0e());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const a=(0,e.default)(r),o=typeof s=="function";return a.forEach(c=>{if(c.type!=="declaration")return;const{property:h,value:f}=c;o?s(h,f,c):f&&(i=i||{},i[h]=f)}),i}return Cd}var sm={},c_;function y0e(){if(c_)return sm;c_=1,Object.defineProperty(sm,"__esModule",{value:!0}),sm.camelCase=void 0;var t=/^--[a-zA-Z0-9_-]+$/,e=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(h){return!h||n.test(h)||t.test(h)},a=function(h,f){return f.toUpperCase()},o=function(h,f){return"".concat(f,"-")},c=function(h,f){return f===void 0&&(f={}),i(h)?h:(h=h.toLowerCase(),f.reactCompat?h=h.replace(s,o):h=h.replace(r,o),h.replace(e,a))};return sm.camelCase=c,sm}var im,u_;function b0e(){if(u_)return im;u_=1;var t=im&&im.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},e=t(v0e()),n=y0e();function r(s,i){var a={};return!s||typeof s!="string"||(0,e.default)(s,function(o,c){o&&c&&(a[(0,n.camelCase)(o,i)]=c)}),a}return r.default=r,im=r,im}var w0e=b0e();const S0e=zk(w0e),XF=YF("end"),NO=YF("start");function YF(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function k0e(t){const e=NO(t),n=XF(t);if(e&&n)return{start:e,end:n}}function Pm(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?d_(t.position):"start"in t||"end"in t?d_(t):"line"in t||"column"in t?YS(t):""}function YS(t){return h_(t&&t.line)+":"+h_(t&&t.column)}function d_(t){return YS(t&&t.start)+"-"+YS(t&&t.end)}function h_(t){return t&&typeof t=="number"?t:1}class js extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},a=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof e=="string"?s=e:!i.cause&&e&&(a=!0,s=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof r=="string"){const c=r.indexOf(":");c===-1?i.ruleId=r:(i.source=r.slice(0,c),i.ruleId=r.slice(c+1))}if(!i.place&&i.ancestors&&i.ancestors){const c=i.ancestors[i.ancestors.length-1];c&&(i.place=c.position)}const o=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=o?o.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=o?o.line:void 0,this.name=Pm(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=a&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}js.prototype.file="";js.prototype.name="";js.prototype.reason="";js.prototype.message="";js.prototype.stack="";js.prototype.column=void 0;js.prototype.line=void 0;js.prototype.ancestors=void 0;js.prototype.cause=void 0;js.prototype.fatal=void 0;js.prototype.place=void 0;js.prototype.ruleId=void 0;js.prototype.source=void 0;const CO={}.hasOwnProperty,O0e=new Map,j0e=/[A-Z]/g,N0e=new Set(["table","tbody","thead","tfoot","tr"]),C0e=new Set(["td","th"]),KF="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function T0e(t,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=e.filePath||void 0;let r;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=P0e(n,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=z0e(n,e.jsx,e.jsxs)}const s={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:r,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?my:GF,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},i=ZF(s,t,void 0);return i&&typeof i!="string"?i:s.create(t,s.Fragment,{children:i||void 0},void 0)}function ZF(t,e,n){if(e.type==="element")return E0e(t,e,n);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return _0e(t,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return A0e(t,e,n);if(e.type==="mdxjsEsm")return M0e(t,e);if(e.type==="root")return R0e(t,e,n);if(e.type==="text")return D0e(t,e)}function E0e(t,e,n){const r=t.schema;let s=r;e.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=my,t.schema=s),t.ancestors.push(e);const i=e$(t,e.tagName,!1),a=L0e(t,e);let o=EO(t,e);return N0e.has(e.tagName)&&(o=o.filter(function(c){return typeof c=="string"?!l0e(c):!0})),JF(t,a,i,e),TO(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function _0e(t,e){if(e.data&&e.data.estree&&t.evaluater){const r=e.data.estree.body[0];return r.type,t.evaluater.evaluateExpression(r.expression)}x0(t,e.position)}function M0e(t,e){if(e.data&&e.data.estree&&t.evaluater)return t.evaluater.evaluateProgram(e.data.estree);x0(t,e.position)}function A0e(t,e,n){const r=t.schema;let s=r;e.name==="svg"&&r.space==="html"&&(s=my,t.schema=s),t.ancestors.push(e);const i=e.name===null?t.Fragment:e$(t,e.name,!0),a=I0e(t,e),o=EO(t,e);return JF(t,a,i,e),TO(a,o),t.ancestors.pop(),t.schema=r,t.create(e,i,a,n)}function R0e(t,e,n){const r={};return TO(r,EO(t,e)),t.create(e,t.Fragment,r,n)}function D0e(t,e){return e.value}function JF(t,e,n,r){typeof n!="string"&&n!==t.Fragment&&t.passNode&&(e.node=r)}function TO(t,e){if(e.length>0){const n=e.length>1?e:e[0];n&&(t.children=n)}}function z0e(t,e,n){return r;function r(s,i,a,o){const h=Array.isArray(a.children)?n:e;return o?h(i,a,o):h(i,a)}}function P0e(t,e){return n;function n(r,s,i,a){const o=Array.isArray(i.children),c=NO(r);return e(s,i,a,o,{columnNumber:c?c.column-1:void 0,fileName:t,lineNumber:c?c.line:void 0},void 0)}}function L0e(t,e){const n={};let r,s;for(s in e.properties)if(s!=="children"&&CO.call(e.properties,s)){const i=B0e(t,s,e.properties[s]);if(i){const[a,o]=i;t.tableCellAlignToStyle&&a==="align"&&typeof o=="string"&&C0e.has(e.tagName)?r=o:n[a]=o}}if(r){const i=n.style||(n.style={});i[t.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function I0e(t,e){const n={};for(const r of e.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&t.evaluater){const i=r.data.estree.body[0];i.type;const a=i.expression;a.type;const o=a.properties[0];o.type,Object.assign(n,t.evaluater.evaluateExpression(o.argument))}else x0(t,e.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&t.evaluater){const o=r.value.data.estree.body[0];o.type,i=t.evaluater.evaluateExpression(o.expression)}else x0(t,e.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function EO(t,e){const n=[];let r=-1;const s=t.passKeys?new Map:O0e;for(;++rs?0:s+e:e=e>s?s:e,n=n>0?n:0,r.length<1e4)a=Array.from(r),a.unshift(e,n),t.splice(...a);else for(n&&t.splice(e,n);i0?(Mi(t,t.length,0,e),t):e}const p_={}.hasOwnProperty;function n$(t){const e={};let n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function Na(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ms=Dc(/[A-Za-z]/),ks=Dc(/[\dA-Za-z]/),G0e=Dc(/[#-'*+\--9=?A-Z^-~]/);function sv(t){return t!==null&&(t<32||t===127)}const KS=Dc(/\d/),X0e=Dc(/[\dA-Fa-f]/),Y0e=Dc(/[!-/:-@[-`{-~]/);function ut(t){return t!==null&&t<-2}function Vn(t){return t!==null&&(t<0||t===32)}function Zt(t){return t===-2||t===-1||t===32}const py=Dc(new RegExp("\\p{P}|\\p{S}","u")),Pu=Dc(/\s/);function Dc(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function Zh(t){const e=[];let n=-1,r=0,s=0;for(;++n55295&&i<57344){const o=t.charCodeAt(n+1);i<56320&&o>56319&&o<57344?(a=String.fromCharCode(i,o),s=1):a="�"}else a=String.fromCharCode(i);a&&(e.push(t.slice(r,n),encodeURIComponent(a)),r=n+s+1,a=""),s&&(n+=s,s=0)}return e.join("")+t.slice(r)}function Wt(t,e,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return a;function a(c){return Zt(c)?(t.enter(n),o(c)):e(c)}function o(c){return Zt(c)&&i++a))return;const M=e.events.length;let q=M,L,I;for(;q--;)if(e.events[q][0]==="exit"&&e.events[q][1].type==="chunkFlow"){if(L){I=e.events[q][1].end;break}L=!0}for(k(r),E=M;EC;){const _=n[T];e.containerState=_[1],_[0].exit.call(e,t)}n.length=C}function N(){s.write([null]),i=void 0,s=void 0,e.containerState._closeFlow=void 0}}function tpe(t,e,n){return Wt(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ch(t){if(t===null||Vn(t)||Pu(t))return 1;if(py(t))return 2}function gy(t,e,n){const r=[];let s=-1;for(;++s1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const m={...t[r][1].end},g={...t[n][1].start};x_(m,-c),x_(g,c),a={type:c>1?"strongSequence":"emphasisSequence",start:m,end:{...t[r][1].end}},o={type:c>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:g},i={type:c>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},s={type:c>1?"strong":"emphasis",start:{...a.start},end:{...o.end}},t[r][1].end={...a.start},t[n][1].start={...o.end},h=[],t[r][1].end.offset-t[r][1].start.offset&&(h=Xi(h,[["enter",t[r][1],e],["exit",t[r][1],e]])),h=Xi(h,[["enter",s,e],["enter",a,e],["exit",a,e],["enter",i,e]]),h=Xi(h,gy(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),h=Xi(h,[["exit",i,e],["enter",o,e],["exit",o,e],["exit",s,e]]),t[n][1].end.offset-t[n][1].start.offset?(f=2,h=Xi(h,[["enter",t[n][1],e],["exit",t[n][1],e]])):f=0,Mi(t,r-1,n-r+3,h),n=r+h.length-f-2;break}}for(n=-1;++n0&&Zt(E)?Wt(t,N,"linePrefix",i+1)(E):N(E)}function N(E){return E===null||ut(E)?t.check(v_,w,T)(E):(t.enter("codeFlowValue"),C(E))}function C(E){return E===null||ut(E)?(t.exit("codeFlowValue"),N(E)):(t.consume(E),C)}function T(E){return t.exit("codeFenced"),e(E)}function _(E,M,q){let L=0;return I;function I(H){return E.enter("lineEnding"),E.consume(H),E.exit("lineEnding"),$}function $(H){return E.enter("codeFencedFence"),Zt(H)?Wt(E,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(H):V(H)}function V(H){return H===o?(E.enter("codeFencedFenceSequence"),ee(H)):q(H)}function ee(H){return H===o?(L++,E.consume(H),ee):L>=a?(E.exit("codeFencedFenceSequence"),Zt(H)?Wt(E,z,"whitespace")(H):z(H)):q(H)}function z(H){return H===null||ut(H)?(E.exit("codeFencedFence"),M(H)):q(H)}}}function fpe(t,e,n){const r=this;return s;function s(a){return a===null?n(a):(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}const r4={name:"codeIndented",tokenize:ppe},mpe={partial:!0,tokenize:gpe};function ppe(t,e,n){const r=this;return s;function s(h){return t.enter("codeIndented"),Wt(t,i,"linePrefix",5)(h)}function i(h){const f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?a(h):n(h)}function a(h){return h===null?c(h):ut(h)?t.attempt(mpe,a,c)(h):(t.enter("codeFlowValue"),o(h))}function o(h){return h===null||ut(h)?(t.exit("codeFlowValue"),a(h)):(t.consume(h),o)}function c(h){return t.exit("codeIndented"),e(h)}}function gpe(t,e,n){const r=this;return s;function s(a){return r.parser.lazy[r.now().line]?n(a):ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),s):Wt(t,i,"linePrefix",5)(a)}function i(a){const o=r.events[r.events.length-1];return o&&o[1].type==="linePrefix"&&o[2].sliceSerialize(o[1],!0).length>=4?e(a):ut(a)?s(a):n(a)}}const xpe={name:"codeText",previous:ype,resolve:vpe,tokenize:bpe};function vpe(t){let e=t.length-4,n=3,r,s;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const s=n||0;this.setCursor(Math.trunc(e));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&am(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),am(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),am(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):t.interrupt(r.parser.constructs.flow,n,e)(a)}}function o$(t,e,n,r,s,i,a,o,c){const h=c||Number.POSITIVE_INFINITY;let f=0;return m;function m(k){return k===60?(t.enter(r),t.enter(s),t.enter(i),t.consume(k),t.exit(i),g):k===null||k===32||k===41||sv(k)?n(k):(t.enter(r),t.enter(a),t.enter(o),t.enter("chunkString",{contentType:"string"}),w(k))}function g(k){return k===62?(t.enter(i),t.consume(k),t.exit(i),t.exit(s),t.exit(r),e):(t.enter(o),t.enter("chunkString",{contentType:"string"}),x(k))}function x(k){return k===62?(t.exit("chunkString"),t.exit(o),g(k)):k===null||k===60||ut(k)?n(k):(t.consume(k),k===92?y:x)}function y(k){return k===60||k===62||k===92?(t.consume(k),x):x(k)}function w(k){return!f&&(k===null||k===41||Vn(k))?(t.exit("chunkString"),t.exit(o),t.exit(a),t.exit(r),e(k)):f999||x===null||x===91||x===93&&!c||x===94&&!o&&"_hiddenFootnoteSupport"in a.parser.constructs?n(x):x===93?(t.exit(i),t.enter(s),t.consume(x),t.exit(s),t.exit(r),e):ut(x)?(t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),f):(t.enter("chunkString",{contentType:"string"}),m(x))}function m(x){return x===null||x===91||x===93||ut(x)||o++>999?(t.exit("chunkString"),f(x)):(t.consume(x),c||(c=!Zt(x)),x===92?g:m)}function g(x){return x===91||x===92||x===93?(t.consume(x),o++,m):m(x)}}function u$(t,e,n,r,s,i){let a;return o;function o(g){return g===34||g===39||g===40?(t.enter(r),t.enter(s),t.consume(g),t.exit(s),a=g===40?41:g,c):n(g)}function c(g){return g===a?(t.enter(s),t.consume(g),t.exit(s),t.exit(r),e):(t.enter(i),h(g))}function h(g){return g===a?(t.exit(i),c(a)):g===null?n(g):ut(g)?(t.enter("lineEnding"),t.consume(g),t.exit("lineEnding"),Wt(t,h,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),f(g))}function f(g){return g===a||g===null||ut(g)?(t.exit("chunkString"),h(g)):(t.consume(g),g===92?m:f)}function m(g){return g===a||g===92?(t.consume(g),f):f(g)}}function Lm(t,e){let n;return r;function r(s){return ut(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),n=!0,r):Zt(s)?Wt(t,r,n?"linePrefix":"lineSuffix")(s):e(s)}}const Tpe={name:"definition",tokenize:_pe},Epe={partial:!0,tokenize:Mpe};function _pe(t,e,n){const r=this;let s;return i;function i(x){return t.enter("definition"),a(x)}function a(x){return c$.call(r,t,o,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(x)}function o(x){return s=Na(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),x===58?(t.enter("definitionMarker"),t.consume(x),t.exit("definitionMarker"),c):n(x)}function c(x){return Vn(x)?Lm(t,h)(x):h(x)}function h(x){return o$(t,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(x)}function f(x){return t.attempt(Epe,m,m)(x)}function m(x){return Zt(x)?Wt(t,g,"whitespace")(x):g(x)}function g(x){return x===null||ut(x)?(t.exit("definition"),r.parser.defined.push(s),e(x)):n(x)}}function Mpe(t,e,n){return r;function r(o){return Vn(o)?Lm(t,s)(o):n(o)}function s(o){return u$(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(o)}function i(o){return Zt(o)?Wt(t,a,"whitespace")(o):a(o)}function a(o){return o===null||ut(o)?e(o):n(o)}}const Ape={name:"hardBreakEscape",tokenize:Rpe};function Rpe(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),s}function s(i){return ut(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}const Dpe={name:"headingAtx",resolve:zpe,tokenize:Ppe};function zpe(t,e){let n=t.length-2,r=3,s,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},Mi(t,r,n-r+1,[["enter",s,e],["enter",i,e],["exit",i,e],["exit",s,e]])),t}function Ppe(t,e,n){let r=0;return s;function s(f){return t.enter("atxHeading"),i(f)}function i(f){return t.enter("atxHeadingSequence"),a(f)}function a(f){return f===35&&r++<6?(t.consume(f),a):f===null||Vn(f)?(t.exit("atxHeadingSequence"),o(f)):n(f)}function o(f){return f===35?(t.enter("atxHeadingSequence"),c(f)):f===null||ut(f)?(t.exit("atxHeading"),e(f)):Zt(f)?Wt(t,o,"whitespace")(f):(t.enter("atxHeadingText"),h(f))}function c(f){return f===35?(t.consume(f),c):(t.exit("atxHeadingSequence"),o(f))}function h(f){return f===null||f===35||Vn(f)?(t.exit("atxHeadingText"),o(f)):(t.consume(f),h)}}const Lpe=["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"],b_=["pre","script","style","textarea"],Ipe={concrete:!0,name:"htmlFlow",resolveTo:Fpe,tokenize:$pe},Bpe={partial:!0,tokenize:Hpe},qpe={partial:!0,tokenize:Qpe};function Fpe(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function $pe(t,e,n){const r=this;let s,i,a,o,c;return h;function h(F){return f(F)}function f(F){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(F),m}function m(F){return F===33?(t.consume(F),g):F===47?(t.consume(F),i=!0,w):F===63?(t.consume(F),s=3,r.interrupt?e:R):Ms(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function g(F){return F===45?(t.consume(F),s=2,x):F===91?(t.consume(F),s=5,o=0,y):Ms(F)?(t.consume(F),s=4,r.interrupt?e:R):n(F)}function x(F){return F===45?(t.consume(F),r.interrupt?e:R):n(F)}function y(F){const U="CDATA[";return F===U.charCodeAt(o++)?(t.consume(F),o===U.length?r.interrupt?e:V:y):n(F)}function w(F){return Ms(F)?(t.consume(F),a=String.fromCharCode(F),S):n(F)}function S(F){if(F===null||F===47||F===62||Vn(F)){const U=F===47,te=a.toLowerCase();return!U&&!i&&b_.includes(te)?(s=1,r.interrupt?e(F):V(F)):Lpe.includes(a.toLowerCase())?(s=6,U?(t.consume(F),k):r.interrupt?e(F):V(F)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(F):i?N(F):C(F))}return F===45||ks(F)?(t.consume(F),a+=String.fromCharCode(F),S):n(F)}function k(F){return F===62?(t.consume(F),r.interrupt?e:V):n(F)}function N(F){return Zt(F)?(t.consume(F),N):I(F)}function C(F){return F===47?(t.consume(F),I):F===58||F===95||Ms(F)?(t.consume(F),T):Zt(F)?(t.consume(F),C):I(F)}function T(F){return F===45||F===46||F===58||F===95||ks(F)?(t.consume(F),T):_(F)}function _(F){return F===61?(t.consume(F),E):Zt(F)?(t.consume(F),_):C(F)}function E(F){return F===null||F===60||F===61||F===62||F===96?n(F):F===34||F===39?(t.consume(F),c=F,M):Zt(F)?(t.consume(F),E):q(F)}function M(F){return F===c?(t.consume(F),c=null,L):F===null||ut(F)?n(F):(t.consume(F),M)}function q(F){return F===null||F===34||F===39||F===47||F===60||F===61||F===62||F===96||Vn(F)?_(F):(t.consume(F),q)}function L(F){return F===47||F===62||Zt(F)?C(F):n(F)}function I(F){return F===62?(t.consume(F),$):n(F)}function $(F){return F===null||ut(F)?V(F):Zt(F)?(t.consume(F),$):n(F)}function V(F){return F===45&&s===2?(t.consume(F),P):F===60&&s===1?(t.consume(F),W):F===62&&s===4?(t.consume(F),se):F===63&&s===3?(t.consume(F),R):F===93&&s===5?(t.consume(F),X):ut(F)&&(s===6||s===7)?(t.exit("htmlFlowData"),t.check(Bpe,G,ee)(F)):F===null||ut(F)?(t.exit("htmlFlowData"),ee(F)):(t.consume(F),V)}function ee(F){return t.check(qpe,z,G)(F)}function z(F){return t.enter("lineEnding"),t.consume(F),t.exit("lineEnding"),H}function H(F){return F===null||ut(F)?ee(F):(t.enter("htmlFlowData"),V(F))}function P(F){return F===45?(t.consume(F),R):V(F)}function W(F){return F===47?(t.consume(F),a="",J):V(F)}function J(F){if(F===62){const U=a.toLowerCase();return b_.includes(U)?(t.consume(F),se):V(F)}return Ms(F)&&a.length<8?(t.consume(F),a+=String.fromCharCode(F),J):V(F)}function X(F){return F===93?(t.consume(F),R):V(F)}function R(F){return F===62?(t.consume(F),se):F===45&&s===2?(t.consume(F),R):V(F)}function se(F){return F===null||ut(F)?(t.exit("htmlFlowData"),G(F)):(t.consume(F),se)}function G(F){return t.exit("htmlFlow"),e(F)}}function Qpe(t,e,n){const r=this;return s;function s(a){return ut(a)?(t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),i):n(a)}function i(a){return r.parser.lazy[r.now().line]?n(a):e(a)}}function Hpe(t,e,n){return r;function r(s){return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),t.attempt(lp,e,n)}}const Vpe={name:"htmlText",tokenize:Upe};function Upe(t,e,n){const r=this;let s,i,a;return o;function o(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),c}function c(R){return R===33?(t.consume(R),h):R===47?(t.consume(R),_):R===63?(t.consume(R),C):Ms(R)?(t.consume(R),q):n(R)}function h(R){return R===45?(t.consume(R),f):R===91?(t.consume(R),i=0,y):Ms(R)?(t.consume(R),N):n(R)}function f(R){return R===45?(t.consume(R),x):n(R)}function m(R){return R===null?n(R):R===45?(t.consume(R),g):ut(R)?(a=m,W(R)):(t.consume(R),m)}function g(R){return R===45?(t.consume(R),x):m(R)}function x(R){return R===62?P(R):R===45?g(R):m(R)}function y(R){const se="CDATA[";return R===se.charCodeAt(i++)?(t.consume(R),i===se.length?w:y):n(R)}function w(R){return R===null?n(R):R===93?(t.consume(R),S):ut(R)?(a=w,W(R)):(t.consume(R),w)}function S(R){return R===93?(t.consume(R),k):w(R)}function k(R){return R===62?P(R):R===93?(t.consume(R),k):w(R)}function N(R){return R===null||R===62?P(R):ut(R)?(a=N,W(R)):(t.consume(R),N)}function C(R){return R===null?n(R):R===63?(t.consume(R),T):ut(R)?(a=C,W(R)):(t.consume(R),C)}function T(R){return R===62?P(R):C(R)}function _(R){return Ms(R)?(t.consume(R),E):n(R)}function E(R){return R===45||ks(R)?(t.consume(R),E):M(R)}function M(R){return ut(R)?(a=M,W(R)):Zt(R)?(t.consume(R),M):P(R)}function q(R){return R===45||ks(R)?(t.consume(R),q):R===47||R===62||Vn(R)?L(R):n(R)}function L(R){return R===47?(t.consume(R),P):R===58||R===95||Ms(R)?(t.consume(R),I):ut(R)?(a=L,W(R)):Zt(R)?(t.consume(R),L):P(R)}function I(R){return R===45||R===46||R===58||R===95||ks(R)?(t.consume(R),I):$(R)}function $(R){return R===61?(t.consume(R),V):ut(R)?(a=$,W(R)):Zt(R)?(t.consume(R),$):L(R)}function V(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),s=R,ee):ut(R)?(a=V,W(R)):Zt(R)?(t.consume(R),V):(t.consume(R),z)}function ee(R){return R===s?(t.consume(R),s=void 0,H):R===null?n(R):ut(R)?(a=ee,W(R)):(t.consume(R),ee)}function z(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Vn(R)?L(R):(t.consume(R),z)}function H(R){return R===47||R===62||Vn(R)?L(R):n(R)}function P(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function W(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),J}function J(R){return Zt(R)?Wt(t,X,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):X(R)}function X(R){return t.enter("htmlTextData"),a(R)}}const AO={name:"labelEnd",resolveAll:Ype,resolveTo:Kpe,tokenize:Zpe},Wpe={tokenize:Jpe},Gpe={tokenize:ege},Xpe={tokenize:tge};function Ype(t){let e=-1;const n=[];for(;++e=3&&(h===null||ut(h))?(t.exit("thematicBreak"),e(h)):n(h)}function c(h){return h===s?(t.consume(h),r++,c):(t.exit("thematicBreakSequence"),Zt(h)?Wt(t,o,"whitespace")(h):o(h))}}const Gs={continuation:{tokenize:dge},exit:fge,name:"list",tokenize:uge},oge={partial:!0,tokenize:mge},cge={partial:!0,tokenize:hge};function uge(t,e,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,a=0;return o;function o(x){const y=r.containerState.type||(x===42||x===43||x===45?"listUnordered":"listOrdered");if(y==="listUnordered"?!r.containerState.marker||x===r.containerState.marker:KS(x)){if(r.containerState.type||(r.containerState.type=y,t.enter(y,{_container:!0})),y==="listUnordered")return t.enter("listItemPrefix"),x===42||x===45?t.check(p1,n,h)(x):h(x);if(!r.interrupt||x===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),c(x)}return n(x)}function c(x){return KS(x)&&++a<10?(t.consume(x),c):(!r.interrupt||a<2)&&(r.containerState.marker?x===r.containerState.marker:x===41||x===46)?(t.exit("listItemValue"),h(x)):n(x)}function h(x){return t.enter("listItemMarker"),t.consume(x),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||x,t.check(lp,r.interrupt?n:f,t.attempt(oge,g,m))}function f(x){return r.containerState.initialBlankLine=!0,i++,g(x)}function m(x){return Zt(x)?(t.enter("listItemPrefixWhitespace"),t.consume(x),t.exit("listItemPrefixWhitespace"),g):n(x)}function g(x){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(x)}}function dge(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(lp,s,i);function s(o){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Wt(t,e,"listItemIndent",r.containerState.size+1)(o)}function i(o){return r.containerState.furtherBlankLines||!Zt(o)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,a(o)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(cge,e,a)(o))}function a(o){return r.containerState._closeFlow=!0,r.interrupt=void 0,Wt(t,t.attempt(Gs,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o)}}function hge(t,e,n){const r=this;return Wt(t,s,"listItemIndent",r.containerState.size+1);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===r.containerState.size?e(i):n(i)}}function fge(t){t.exit(this.containerState.type)}function mge(t,e,n){const r=this;return Wt(t,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const a=r.events[r.events.length-1];return!Zt(i)&&a&&a[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}const w_={name:"setextUnderline",resolveTo:pge,tokenize:gge};function pge(t,e){let n=t.length,r,s,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(s=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);const a={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[s][1].type="setextHeadingText",i?(t.splice(s,0,["enter",a,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end={...t[i][1].end}):t[r][1]=a,t.push(["exit",a,e]),t}function gge(t,e,n){const r=this;let s;return i;function i(h){let f=r.events.length,m;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){m=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||m)?(t.enter("setextHeadingLine"),s=h,a(h)):n(h)}function a(h){return t.enter("setextHeadingLineSequence"),o(h)}function o(h){return h===s?(t.consume(h),o):(t.exit("setextHeadingLineSequence"),Zt(h)?Wt(t,c,"lineSuffix")(h):c(h))}function c(h){return h===null||ut(h)?(t.exit("setextHeadingLine"),e(h)):n(h)}}const xge={tokenize:vge};function vge(t){const e=this,n=t.attempt(lp,r,t.attempt(this.parser.constructs.flowInitial,s,Wt(t,t.attempt(this.parser.constructs.flow,s,t.attempt(kpe,s)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function s(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const yge={resolveAll:h$()},bge=d$("string"),wge=d$("text");function d$(t){return{resolveAll:h$(t==="text"?Sge:void 0),tokenize:e};function e(n){const r=this,s=this.parser.constructs[t],i=n.attempt(s,a,o);return a;function a(f){return h(f)?i(f):o(f)}function o(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return h(f)?(n.exit("data"),i(f)):(n.consume(f),c)}function h(f){if(f===null)return!0;const m=s[f];let g=-1;if(m)for(;++g-1){const o=a[0];typeof o=="string"?a[0]=o.slice(r):a.shift()}i>0&&a.push(t[s].slice(0,i))}return a}function zge(t,e){let n=-1;const r=[];let s;for(;++n0){const jt=qe.tokenStack[qe.tokenStack.length-1];(jt[1]||g_).call(qe,void 0,jt[0])}for(Re.position={start:Yl(Te.length>0?Te[0][1].start:{line:1,column:1,offset:0}),end:Yl(Te.length>0?Te[Te.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt1?"-"+l:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const h={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,h),t.applyData(e,h)}function Pge(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Lge(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function a$(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function Ige(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return a$(t,e);const s={src:Yh(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function Bge(t,e){const n={src:Yh(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function qge(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function Fge(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return a$(t,e);const s={href:Yh(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function $ge(t,e){const n={href:Yh(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function Qge(t,e,n){const r=t.all(e),s=n?Hge(n):o$(e),i={},a=[];if(typeof e.checked=="boolean"){const f=r[0];let m;f&&f.type==="element"&&f.tagName==="p"?m=f:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let l=-1;for(;++l0){const jt=qe.tokenStack[qe.tokenStack.length-1];(jt[1]||k_).call(qe,void 0,jt[0])}for(Re.position={start:Jo(Te.length>0?Te[0][1].start:{line:1,column:1,offset:0}),end:Jo(Te.length>0?Te[Te.length-2][1].end:{line:1,column:1,offset:0})},wt=-1;++wt1?"-"+o:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};t.patch(e,c);const h={type:"element",tagName:"sup",properties:{},children:[c]};return t.patch(e,h),t.applyData(e,h)}function Zge(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Jge(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function p$(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const s=t.all(e),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const a=s[s.length-1];return a&&a.type==="text"?a.value+=r:s.push({type:"text",value:r}),s}function exe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return p$(t,e);const s={src:Zh(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return t.patch(e,i),t.applyData(e,i)}function txe(t,e){const n={src:Zh(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function nxe(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function rxe(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return p$(t,e);const s={href:Zh(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:t.all(e)};return t.patch(e,i),t.applyData(e,i)}function sxe(t,e){const n={href:Zh(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ixe(t,e,n){const r=t.all(e),s=n?axe(n):g$(e),i={},a=[];if(typeof e.checked=="boolean"){const f=r[0];let m;f&&f.type==="element"&&f.tagName==="p"?m=f:(m={type:"element",tagName:"p",properties:{},children:[]},r.unshift(m)),m.children.length>0&&m.children.unshift({type:"text",value:" "}),m.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let o=-1;for(;++o1}function Vge(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},l=SO(e.children[1]),c=qF(e.children[e.children.length-1]);l&&c&&(a.position={start:l,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function Yge(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,l=a?a.length:e.children.length;let c=-1;const h=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(y_(e.slice(s),s>0,!1)),i.join("")}function y_(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===x_||i===v_;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===x_||i===v_;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function Jge(t,e){const n={type:"text",value:Zge(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function exe(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const txe={blockquote:_ge,break:Mge,code:Age,delete:Rge,emphasis:Dge,footnoteReference:zge,heading:Pge,html:Lge,imageReference:Ige,image:Bge,inlineCode:qge,linkReference:Fge,link:$ge,listItem:Qge,list:Vge,paragraph:Uge,root:Wge,strong:Gge,table:Xge,tableCell:Kge,tableRow:Yge,text:Jge,thematicBreak:exe,toml:bx,yaml:bx,definition:bx,footnoteDefinition:bx};function bx(){}const l$=-1,hy=0,Pm=1,nv=2,EO=3,_O=4,MO=5,AO=6,c$=7,u$=8,b_=typeof self=="object"?self:globalThis,nxe=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case hy:case l$:return n(a,s);case Pm:{const l=n([],s);for(const c of a)l.push(r(c));return l}case nv:{const l=n({},s);for(const[c,h]of a)l[r(c)]=r(h);return l}case EO:return n(new Date(a),s);case _O:{const{source:l,flags:c}=a;return n(new RegExp(l,c),s)}case MO:{const l=n(new Map,s);for(const[c,h]of a)l.set(r(c),r(h));return l}case AO:{const l=n(new Set,s);for(const c of a)l.add(r(c));return l}case c$:{const{name:l,message:c}=a;return n(new b_[l](c),s)}case u$:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:l}=new Uint8Array(a);return n(new DataView(l),a)}}return n(new b_[i](a),s)};return r},w_=t=>nxe(new Map,t)(0),Nd="",{toString:rxe}={},{keys:sxe}=Object,im=t=>{const e=typeof t;if(e!=="object"||!t)return[hy,e];const n=rxe.call(t).slice(8,-1);switch(n){case"Array":return[Pm,Nd];case"Object":return[nv,Nd];case"Date":return[EO,Nd];case"RegExp":return[_O,Nd];case"Map":return[MO,Nd];case"Set":return[AO,Nd];case"DataView":return[Pm,n]}return n.includes("Array")?[Pm,n]:n.includes("Error")?[c$,n]:[nv,n]},wx=([t,e])=>t===hy&&(e==="function"||e==="symbol"),ixe=(t,e,n,r)=>{const s=(a,l)=>{const c=r.push(a)-1;return n.set(l,c),c},i=a=>{if(n.has(a))return n.get(a);let[l,c]=im(a);switch(l){case hy:{let f=a;switch(c){case"bigint":l=u$,f=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([l$],a)}return s([l,f],a)}case Pm:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const f=[],m=s([l,f],a);for(const g of a)f.push(i(g));return m}case nv:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],m=s([l,f],a);for(const g of sxe(a))(t||!wx(im(a[g])))&&f.push([i(g),i(a[g])]);return m}case EO:return s([l,a.toISOString()],a);case _O:{const{source:f,flags:m}=a;return s([l,{source:f,flags:m}],a)}case MO:{const f=[],m=s([l,f],a);for(const[g,x]of a)(t||!(wx(im(g))||wx(im(x))))&&f.push([i(g),i(x)]);return m}case AO:{const f=[],m=s([l,f],a);for(const g of a)(t||!wx(im(g)))&&f.push(i(g));return m}}const{message:h}=a;return s([l,{name:c,message:h}],a)};return i},S_=(t,{json:e,lossy:n}={})=>{const r=[];return ixe(!(e||n),!!e,new Map,r)(t),r},rv=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?w_(S_(t,e)):structuredClone(t):(t,e)=>w_(S_(t,e));function axe(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function oxe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function lxe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||axe,r=t.options.footnoteBackLabel||oxe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},l=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,x);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else f.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(f,!0)};t.patch(h,k),l.push(k)}if(l.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...rv(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:t.wrap(l,!0)},{type:"text",value:` -`}]}}const ip=(function(t){if(t==null)return hxe;if(typeof t=="function")return fy(t);if(typeof t=="object")return Array.isArray(t)?cxe(t):uxe(t);if(typeof t=="string")return dxe(t);throw new Error("Expected function, string, or object as test")});function cxe(t){const e=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let x=d$,y,w,S;if((!e||i(c,h,f[f.length-1]||void 0))&&(x=pxe(n(c,f)),x[0]===XS))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==h$)for(w=(r?k.children.length:-1)+a,S=f.concat(k);w>-1&&w1}function lxe(t,e){const n={},r=t.all(e);let s=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++s0){const a={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},o=NO(e.children[1]),c=XF(e.children[e.children.length-1]);o&&c&&(a.position={start:o,end:c}),s.push(a)}const i={type:"element",tagName:"table",properties:{},children:t.wrap(s,!0)};return t.patch(e,i),t.applyData(e,i)}function hxe(t,e,n){const r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",a=n&&n.type==="table"?n.align:void 0,o=a?a.length:e.children.length;let c=-1;const h=[];for(;++c0,!0),r[0]),s=r.index+r[0].length,r=n.exec(e);return i.push(N_(e.slice(s),s>0,!1)),i.join("")}function N_(t,e,n){let r=0,s=t.length;if(e){let i=t.codePointAt(r);for(;i===O_||i===j_;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(s-1);for(;i===O_||i===j_;)s--,i=t.codePointAt(s-1)}return s>r?t.slice(r,s):""}function pxe(t,e){const n={type:"text",value:mxe(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function gxe(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const xxe={blockquote:Uge,break:Wge,code:Gge,delete:Xge,emphasis:Yge,footnoteReference:Kge,heading:Zge,html:Jge,imageReference:exe,image:txe,inlineCode:nxe,linkReference:rxe,link:sxe,listItem:ixe,list:lxe,paragraph:oxe,root:cxe,strong:uxe,table:dxe,tableCell:fxe,tableRow:hxe,text:pxe,thematicBreak:gxe,toml:kx,yaml:kx,definition:kx,footnoteDefinition:kx};function kx(){}const x$=-1,xy=0,Im=1,iv=2,RO=3,DO=4,zO=5,PO=6,v$=7,y$=8,C_=typeof self=="object"?self:globalThis,vxe=(t,e)=>{const n=(s,i)=>(t.set(i,s),s),r=s=>{if(t.has(s))return t.get(s);const[i,a]=e[s];switch(i){case xy:case x$:return n(a,s);case Im:{const o=n([],s);for(const c of a)o.push(r(c));return o}case iv:{const o=n({},s);for(const[c,h]of a)o[r(c)]=r(h);return o}case RO:return n(new Date(a),s);case DO:{const{source:o,flags:c}=a;return n(new RegExp(o,c),s)}case zO:{const o=n(new Map,s);for(const[c,h]of a)o.set(r(c),r(h));return o}case PO:{const o=n(new Set,s);for(const c of a)o.add(r(c));return o}case v$:{const{name:o,message:c}=a;return n(new C_[o](c),s)}case y$:return n(BigInt(a),s);case"BigInt":return n(Object(BigInt(a)),s);case"ArrayBuffer":return n(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:o}=new Uint8Array(a);return n(new DataView(o),a)}}return n(new C_[i](a),s)};return r},T_=t=>vxe(new Map,t)(0),Td="",{toString:yxe}={},{keys:bxe}=Object,lm=t=>{const e=typeof t;if(e!=="object"||!t)return[xy,e];const n=yxe.call(t).slice(8,-1);switch(n){case"Array":return[Im,Td];case"Object":return[iv,Td];case"Date":return[RO,Td];case"RegExp":return[DO,Td];case"Map":return[zO,Td];case"Set":return[PO,Td];case"DataView":return[Im,n]}return n.includes("Array")?[Im,n]:n.includes("Error")?[v$,n]:[iv,n]},Ox=([t,e])=>t===xy&&(e==="function"||e==="symbol"),wxe=(t,e,n,r)=>{const s=(a,o)=>{const c=r.push(a)-1;return n.set(o,c),c},i=a=>{if(n.has(a))return n.get(a);let[o,c]=lm(a);switch(o){case xy:{let f=a;switch(c){case"bigint":o=y$,f=a.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+c);f=null;break;case"undefined":return s([x$],a)}return s([o,f],a)}case Im:{if(c){let g=a;return c==="DataView"?g=new Uint8Array(a.buffer):c==="ArrayBuffer"&&(g=new Uint8Array(a)),s([c,[...g]],a)}const f=[],m=s([o,f],a);for(const g of a)f.push(i(g));return m}case iv:{if(c)switch(c){case"BigInt":return s([c,a.toString()],a);case"Boolean":case"Number":case"String":return s([c,a.valueOf()],a)}if(e&&"toJSON"in a)return i(a.toJSON());const f=[],m=s([o,f],a);for(const g of bxe(a))(t||!Ox(lm(a[g])))&&f.push([i(g),i(a[g])]);return m}case RO:return s([o,a.toISOString()],a);case DO:{const{source:f,flags:m}=a;return s([o,{source:f,flags:m}],a)}case zO:{const f=[],m=s([o,f],a);for(const[g,x]of a)(t||!(Ox(lm(g))||Ox(lm(x))))&&f.push([i(g),i(x)]);return m}case PO:{const f=[],m=s([o,f],a);for(const g of a)(t||!Ox(lm(g)))&&f.push(i(g));return m}}const{message:h}=a;return s([o,{name:c,message:h}],a)};return i},E_=(t,{json:e,lossy:n}={})=>{const r=[];return wxe(!(e||n),!!e,new Map,r)(t),r},av=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?T_(E_(t,e)):structuredClone(t):(t,e)=>T_(E_(t,e));function Sxe(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function kxe(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function Oxe(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||Sxe,r=t.options.footnoteBackLabel||kxe,s=t.options.footnoteLabel||"Footnotes",i=t.options.footnoteLabelTagName||"h2",a=t.options.footnoteLabelProperties||{className:["sr-only"]},o=[];let c=-1;for(;++c0&&y.push({type:"text",value:" "});let N=typeof n=="string"?n:n(c,x);typeof N=="string"&&(N={type:"text",value:N}),y.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+g+(x>1?"-"+x:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(c,x),className:["data-footnote-backref"]},children:Array.isArray(N)?N:[N]})}const S=f[f.length-1];if(S&&S.type==="element"&&S.tagName==="p"){const N=S.children[S.children.length-1];N&&N.type==="text"?N.value+=" ":S.children.push({type:"text",value:" "}),S.children.push(...y)}else f.push(...y);const k={type:"element",tagName:"li",properties:{id:e+"fn-"+g},children:t.wrap(f,!0)};t.patch(h,k),o.push(k)}if(o.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...av(a),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:t.wrap(o,!0)},{type:"text",value:` +`}]}}const op=(function(t){if(t==null)return Txe;if(typeof t=="function")return vy(t);if(typeof t=="object")return Array.isArray(t)?jxe(t):Nxe(t);if(typeof t=="string")return Cxe(t);throw new Error("Expected function, string, or object as test")});function jxe(t){const e=[];let n=-1;for(;++n":""))+")"})}return g;function g(){let x=b$,y,w,S;if((!e||i(c,h,f[f.length-1]||void 0))&&(x=Mxe(n(c,f)),x[0]===JS))return x;if("children"in c&&c.children){const k=c;if(k.children&&x[0]!==w$)for(w=(r?k.children.length:-1)+a,S=f.concat(k);w>-1&&w0&&n.push({type:"text",value:` -`}),n}function k_(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function O_(t,e){const n=xxe(t,e),r=n.one(t,void 0),s=lxe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` -`},s),i}function Sxe(t,e){return t&&"run"in t?async function(n,r){const s=O_(n,{file:r,...e});await t.run(s,r)}:function(n,r){return O_(n,{file:r,...t||e})}}function j_(t){if(t)throw t}var Jw,N_;function kxe(){if(N_)return Jw;N_=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var f=t.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!f&&!m)return!1;var g;for(g in h);return typeof g>"u"||t.call(h,g)},a=function(h,f){n&&f.name==="__proto__"?n(h,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):h[f.name]=f.newValue},l=function(h,f){if(f==="__proto__")if(t.call(h,f)){if(r)return r(h,f).value}else return;return h[f]};return Jw=function c(){var h,f,m,g,x,y,w=arguments[0],S=1,k=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Sa.length;let c;l&&a.push(s);try{c=t.apply(this,a)}catch(h){const f=h;if(l&&n)throw f;return s(f)}l||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...l){n||(n=!0,e(a,...l))}function i(a){s(null,a)}}const Qa={basename:Cxe,dirname:Txe,extname:Exe,join:_xe,sep:"/"};function Cxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');ap(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,l=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),l>-1&&(t.codePointAt(s)===e.codePointAt(l--)?l<0&&(r=s):(l=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Txe(t){if(ap(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Exe(t){ap(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const l=t.codePointAt(e);if(l===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),l===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function _xe(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Axe(t,e){let n="",r=0,s=-1,i=0,a=-1,l,c;for(;++a<=t.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else l===46&&i>-1?i++:i=-1}return n}function ap(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Rxe={cwd:Dxe};function Dxe(){return"/"}function ZS(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function zxe(t){if(typeof t=="string")t=new URL(t);else if(!ZS(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Pxe(t)}function Pxe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=f;const w=r[g][1];KS(w)&&KS(x)&&(x=e4(!0,w,x)),r[g]=[h,x,...y]}}}}const qxe=new zO().freeze();function s4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function i4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function a4(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function T_(t){if(!KS(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function E_(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Sx(t){return Fxe(t)?t:new f$(t)}function Fxe(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function $xe(t){return typeof t=="string"||Qxe(t)}function Qxe(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const Hxe="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",__=[],M_={allowDangerousHtml:!0},Vxe=/^(https?|ircs?|mailto|xmpp)$/i,Uxe=[{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 Wxe(t){const e=Gxe(t),n=Xxe(t);return Yxe(e.runSync(e.parse(n),n),t)}function Gxe(t){const e=t.rehypePlugins||__,n=t.remarkPlugins||__,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...M_}:M_;return qxe().use(Ege).use(n).use(Sxe,r).use(e)}function Xxe(t){const e=t.children||"",n=new f$;return typeof e=="string"&&(n.value=e),n}function Yxe(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,l=e.unwrapDisallowed,c=e.urlTransform||Kxe;for(const f of Uxe)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+Hxe+f.id,void 0);return DO(t,h),h0e(t,{Fragment:o.Fragment,components:s,ignoreInvalidStyle:!0,jsx:o.jsx,jsxs:o.jsxs,passKeys:!0,passNode:!0});function h(f,m,g){if(f.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:f.value},m;if(f.type==="element"){let x;for(x in Yw)if(Object.hasOwn(Yw,x)&&Object.hasOwn(f.properties,x)){const y=f.properties[x],w=Yw[x];(w===null||w.includes(f.tagName))&&(f.properties[x]=c(String(y||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(f,m,g)),x&&g&&typeof m=="number")return l&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function Kxe(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||Vxe.test(t.slice(0,e))?t:""}function A_(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function Zxe(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Jxe(t,e,n){const s=ip((n||{}).ignore||[]),i=e1e(e);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=T+1:(y!==T&&N.push({type:"text",value:h.value.slice(y,T)}),Array.isArray(E)?N.push(...E):E&&N.push(E),y=T+C[0].length,k=!0),!g.global)break;C=g.exec(h.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=A_(t,"(");let i=A_(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function m$(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Du(n)||uy(n))&&(!e||n!==47)}p$.peek=k1e;function p1e(){this.buffer()}function g1e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function x1e(){this.buffer()}function v1e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function y1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sa(this.sliceSerialize(t)).toLowerCase(),n.label=e}function b1e(t){this.exit(t)}function w1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Sa(this.sliceSerialize(t)).toLowerCase(),n.label=e}function S1e(t){this.exit(t)}function k1e(){return"["}function p$(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),l=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),l(),a(),i+=s.move("]"),i}function O1e(){return{enter:{gfmFootnoteCallString:p1e,gfmFootnoteCall:g1e,gfmFootnoteDefinitionLabelString:x1e,gfmFootnoteDefinition:v1e},exit:{gfmFootnoteCallString:y1e,gfmFootnoteCall:b1e,gfmFootnoteDefinitionLabelString:w1e,gfmFootnoteDefinition:S1e}}}function j1e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:p$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const l=i.createTracker(a);let c=l.move("[^");const h=i.enter("footnoteDefinition"),f=i.enter("label");return c+=l.move(i.safe(i.associationId(r),{before:c,after:"]"})),f(),c+=l.move("]:"),r.children&&r.children.length>0&&(l.shift(4),c+=l.move((e?` -`:" ")+i.indentLines(i.containerFlow(r,l.current()),e?g$:N1e))),h(),c}}function N1e(t,e,n){return e===0?t:g$(t,e,n)}function g$(t,e,n){return(n?"":" ")+t}const C1e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];x$.peek=A1e;function T1e(){return{canContainEols:["delete"],enter:{strikethrough:_1e},exit:{strikethrough:M1e}}}function E1e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:C1e}],handlers:{delete:x$}}}function _1e(t){this.enter({type:"delete",children:[]},t)}function M1e(t){this.exit(t)}function x$(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function A1e(){return"~"}function R1e(t){return t.length}function D1e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||R1e,i=[],a=[],l=[],c=[];let h=0,f=-1;for(;++fh&&(h=t[f].length);++kc[k])&&(c[k]=C)}w.push(N)}a[f]=w,l[f]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mc[m]&&(c[m]=N),x[m]=N),g[m]=C}a.splice(1,0,g),l.splice(1,0,x),f=-1;const y=[];for(;++f "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),L1e);return s(),a}function L1e(t,e,n){return">"+(n?"":" ")+t}function I1e(t,e){return D_(t,e.inConstruct,!0)&&!D_(t,e.notInConstruct,!1)}function D_(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function B1e(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function q1e(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function F1e(t,e,n,r){const s=q1e(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(B1e(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,$1e);return m(),g}const l=n.createTracker(r),c=s.repeat(Math.max(v$(i,s)+1,3)),h=n.enter("codeFenced");let f=l.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);f+=l.move(n.safe(t.lang,{before:f,after:" ",encode:["`"],...l.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);f+=l.move(" "),f+=l.move(n.safe(t.meta,{before:f,after:` -`,encode:["`"],...l.current()})),m()}return f+=l.move(` -`),i&&(f+=l.move(i+` -`)),f+=l.move(c),h(),f}function $1e(t,e,n){return(n?"":" ")+t}function PO(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function Q1e(t,e,n,r){const s=PO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),l(),!t.url||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(l=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":` -`,...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),l()),a(),h}function H1e(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function p0(t){return"&#x"+t.toString(16).toUpperCase()+";"}function sv(t,e,n){const r=Nh(t),s=Nh(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===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}}y$.peek=V1e;function y$(t,e,n,r){const s=H1e(n),i=n.enter("emphasis"),a=n.createTracker(r),l=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const h=c.charCodeAt(0),f=sv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=p0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=sv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+p0(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},l+c+x}function V1e(t,e,n){return n.options.emphasis||"*"}function U1e(t,e){let n=!1;return DO(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,XS}),!!((!t.depth||t.depth<3)&&NO(t)&&(e.options.setext||n))}function W1e(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(U1e(t,n)){const f=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` +`}),n}function __(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function M_(t,e){const n=Rxe(t,e),r=n.one(t,void 0),s=Oxe(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:` +`},s),i}function Ixe(t,e){return t&&"run"in t?async function(n,r){const s=M_(n,{file:r,...e});await t.run(s,r)}:function(n,r){return M_(n,{file:r,...t||e})}}function A_(t){if(t)throw t}var i4,R_;function Bxe(){if(R_)return i4;R_=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(h){return typeof Array.isArray=="function"?Array.isArray(h):e.call(h)==="[object Array]"},i=function(h){if(!h||e.call(h)!=="[object Object]")return!1;var f=t.call(h,"constructor"),m=h.constructor&&h.constructor.prototype&&t.call(h.constructor.prototype,"isPrototypeOf");if(h.constructor&&!f&&!m)return!1;var g;for(g in h);return typeof g>"u"||t.call(h,g)},a=function(h,f){n&&f.name==="__proto__"?n(h,f.name,{enumerable:!0,configurable:!0,value:f.newValue,writable:!0}):h[f.name]=f.newValue},o=function(h,f){if(f==="__proto__")if(t.call(h,f)){if(r)return r(h,f).value}else return;return h[f]};return i4=function c(){var h,f,m,g,x,y,w=arguments[0],S=1,k=arguments.length,N=!1;for(typeof w=="boolean"&&(N=w,w=arguments[1]||{},S=2),(w==null||typeof w!="object"&&typeof w!="function")&&(w={});Sa.length;let c;o&&a.push(s);try{c=t.apply(this,a)}catch(h){const f=h;if(o&&n)throw f;return s(f)}o||(c&&c.then&&typeof c.then=="function"?c.then(i,s):c instanceof Error?s(c):i(c))}function s(a,...o){n||(n=!0,e(a,...o))}function i(a){s(null,a)}}const Ua={basename:Qxe,dirname:Hxe,extname:Vxe,join:Uxe,sep:"/"};function Qxe(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');cp(t);let n=0,r=-1,s=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let a=-1,o=e.length-1;for(;s--;)if(t.codePointAt(s)===47){if(i){n=s+1;break}}else a<0&&(i=!0,a=s+1),o>-1&&(t.codePointAt(s)===e.codePointAt(o--)?o<0&&(r=s):(o=-1,r=a));return n===r?r=a:r<0&&(r=t.length),t.slice(n,r)}function Hxe(t){if(cp(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function Vxe(t){cp(t);let e=t.length,n=-1,r=0,s=-1,i=0,a;for(;e--;){const o=t.codePointAt(e);if(o===47){if(a){r=e+1;break}continue}n<0&&(a=!0,n=e+1),o===46?s<0?s=e:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":t.slice(s,n)}function Uxe(...t){let e=-1,n;for(;++e0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function Gxe(t,e){let n="",r=0,s=-1,i=0,a=-1,o,c;for(;++a<=t.length;){if(a2){if(c=n.lastIndexOf("/"),c!==n.length-1){c<0?(n="",r=0):(n=n.slice(0,c),r=n.length-1-n.lastIndexOf("/")),s=a,i=0;continue}}else if(n.length>0){n="",r=0,s=a,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(s+1,a):n=t.slice(s+1,a),r=a-s-1;s=a,i=0}else o===46&&i>-1?i++:i=-1}return n}function cp(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const Xxe={cwd:Yxe};function Yxe(){return"/"}function nk(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function Kxe(t){if(typeof t=="string")t=new URL(t);else if(!nk(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return Zxe(t)}function Zxe(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n0){let[x,...y]=f;const w=r[g][1];tk(w)&&tk(x)&&(x=a4(!0,w,x)),r[g]=[h,x,...y]}}}}const n1e=new BO().freeze();function u4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function d4(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function h4(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function z_(t){if(!tk(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function P_(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function jx(t){return r1e(t)?t:new S$(t)}function r1e(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function s1e(t){return typeof t=="string"||i1e(t)}function i1e(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const a1e="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",L_=[],I_={allowDangerousHtml:!0},l1e=/^(https?|ircs?|mailto|xmpp)$/i,o1e=[{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 c1e(t){const e=u1e(t),n=d1e(t);return h1e(e.runSync(e.parse(n),n),t)}function u1e(t){const e=t.rehypePlugins||L_,n=t.remarkPlugins||L_,r=t.remarkRehypeOptions?{...t.remarkRehypeOptions,...I_}:I_;return n1e().use(Vge).use(n).use(Ixe,r).use(e)}function d1e(t){const e=t.children||"",n=new S$;return typeof e=="string"&&(n.value=e),n}function h1e(t,e){const n=e.allowedElements,r=e.allowElement,s=e.components,i=e.disallowedElements,a=e.skipHtml,o=e.unwrapDisallowed,c=e.urlTransform||f1e;for(const f of o1e)Object.hasOwn(e,f.from)&&(""+f.from+(f.to?"use `"+f.to+"` instead":"remove it")+a1e+f.id,void 0);return IO(t,h),T0e(t,{Fragment:l.Fragment,components:s,ignoreInvalidStyle:!0,jsx:l.jsx,jsxs:l.jsxs,passKeys:!0,passNode:!0});function h(f,m,g){if(f.type==="raw"&&g&&typeof m=="number")return a?g.children.splice(m,1):g.children[m]={type:"text",value:f.value},m;if(f.type==="element"){let x;for(x in n4)if(Object.hasOwn(n4,x)&&Object.hasOwn(f.properties,x)){const y=f.properties[x],w=n4[x];(w===null||w.includes(f.tagName))&&(f.properties[x]=c(String(y||""),x,f))}}if(f.type==="element"){let x=n?!n.includes(f.tagName):i?i.includes(f.tagName):!1;if(!x&&r&&typeof m=="number"&&(x=!r(f,m,g)),x&&g&&typeof m=="number")return o&&f.children?g.children.splice(m,1,...f.children):g.children.splice(m,1),m}}}function f1e(t){const e=t.indexOf(":"),n=t.indexOf("?"),r=t.indexOf("#"),s=t.indexOf("/");return e===-1||s!==-1&&e>s||n!==-1&&e>n||r!==-1&&e>r||l1e.test(t.slice(0,e))?t:""}function B_(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function m1e(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function p1e(t,e,n){const s=op((n||{}).ignore||[]),i=g1e(e);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1?g.lastIndex=T+1:(y!==T&&N.push({type:"text",value:h.value.slice(y,T)}),Array.isArray(E)?N.push(...E):E&&N.push(E),y=T+C[0].length,k=!0),!g.global)break;C=g.exec(h.value)}return k?(y?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const s=B_(t,"(");let i=B_(t,")");for(;r!==-1&&s>i;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[t,n]}function k$(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Pu(n)||py(n))&&(!e||n!==47)}O$.peek=B1e;function M1e(){this.buffer()}function A1e(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function R1e(){this.buffer()}function D1e(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function z1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Na(this.sliceSerialize(t)).toLowerCase(),n.label=e}function P1e(t){this.exit(t)}function L1e(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Na(this.sliceSerialize(t)).toLowerCase(),n.label=e}function I1e(t){this.exit(t)}function B1e(){return"["}function O$(t,e,n,r){const s=n.createTracker(r);let i=s.move("[^");const a=n.enter("footnoteReference"),o=n.enter("reference");return i+=s.move(n.safe(n.associationId(t),{after:"]",before:i})),o(),a(),i+=s.move("]"),i}function q1e(){return{enter:{gfmFootnoteCallString:M1e,gfmFootnoteCall:A1e,gfmFootnoteDefinitionLabelString:R1e,gfmFootnoteDefinition:D1e},exit:{gfmFootnoteCallString:z1e,gfmFootnoteCall:P1e,gfmFootnoteDefinitionLabelString:L1e,gfmFootnoteDefinition:I1e}}}function F1e(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:O$},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,a){const o=i.createTracker(a);let c=o.move("[^");const h=i.enter("footnoteDefinition"),f=i.enter("label");return c+=o.move(i.safe(i.associationId(r),{before:c,after:"]"})),f(),c+=o.move("]:"),r.children&&r.children.length>0&&(o.shift(4),c+=o.move((e?` +`:" ")+i.indentLines(i.containerFlow(r,o.current()),e?j$:$1e))),h(),c}}function $1e(t,e,n){return e===0?t:j$(t,e,n)}function j$(t,e,n){return(n?"":" ")+t}const Q1e=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];N$.peek=G1e;function H1e(){return{canContainEols:["delete"],enter:{strikethrough:U1e},exit:{strikethrough:W1e}}}function V1e(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:Q1e}],handlers:{delete:N$}}}function U1e(t){this.enter({type:"delete",children:[]},t)}function W1e(t){this.exit(t)}function N$(t,e,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let a=s.move("~~");return a+=n.containerPhrasing(t,{...s.current(),before:a,after:"~"}),a+=s.move("~~"),i(),a}function G1e(){return"~"}function X1e(t){return t.length}function Y1e(t,e){const n=e||{},r=(n.align||[]).concat(),s=n.stringLength||X1e,i=[],a=[],o=[],c=[];let h=0,f=-1;for(;++fh&&(h=t[f].length);++kc[k])&&(c[k]=C)}w.push(N)}a[f]=w,o[f]=S}let m=-1;if(typeof r=="object"&&"length"in r)for(;++mc[m]&&(c[m]=N),x[m]=N),g[m]=C}a.splice(1,0,g),o.splice(1,0,x),f=-1;const y=[];for(;++f "),i.shift(2);const a=n.indentLines(n.containerFlow(t,i.current()),J1e);return s(),a}function J1e(t,e,n){return">"+(n?"":" ")+t}function eve(t,e){return F_(t,e.inConstruct,!0)&&!F_(t,e.notInConstruct,!1)}function F_(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++ra&&(a=i):i=1,s=r+e.length,r=n.indexOf(e,s);return a}function tve(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function nve(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function rve(t,e,n,r){const s=nve(n),i=t.value||"",a=s==="`"?"GraveAccent":"Tilde";if(tve(t,n)){const m=n.enter("codeIndented"),g=n.indentLines(i,sve);return m(),g}const o=n.createTracker(r),c=s.repeat(Math.max(C$(i,s)+1,3)),h=n.enter("codeFenced");let f=o.move(c);if(t.lang){const m=n.enter(`codeFencedLang${a}`);f+=o.move(n.safe(t.lang,{before:f,after:" ",encode:["`"],...o.current()})),m()}if(t.lang&&t.meta){const m=n.enter(`codeFencedMeta${a}`);f+=o.move(" "),f+=o.move(n.safe(t.meta,{before:f,after:` +`,encode:["`"],...o.current()})),m()}return f+=o.move(` +`),i&&(f+=o.move(i+` +`)),f+=o.move(c),h(),f}function sve(t,e,n){return(n?"":" ")+t}function qO(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function ive(t,e,n,r){const s=qO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("definition");let o=n.enter("label");const c=n.createTracker(r);let h=c.move("[");return h+=c.move(n.safe(n.associationId(t),{before:h,after:"]",...c.current()})),h+=c.move("]: "),o(),!t.url||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(o=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":` +`,...c.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),o()),a(),h}function ave(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function v0(t){return"&#x"+t.toString(16).toUpperCase()+";"}function lv(t,e,n){const r=Ch(t),s=Ch(e);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===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}}T$.peek=lve;function T$(t,e,n,r){const s=ave(n),i=n.enter("emphasis"),a=n.createTracker(r),o=a.move(s);let c=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=c.charCodeAt(0),f=lv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=v0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=lv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+v0(m));const x=a.move(s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+c+x}function lve(t,e,n){return n.options.emphasis||"*"}function ove(t,e){let n=!1;return IO(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,JS}),!!((!t.depth||t.depth<3)&&_O(t)&&(e.options.setext||n))}function cve(t,e,n,r){const s=Math.max(Math.min(6,t.depth||1),1),i=n.createTracker(r);if(ove(t,n)){const f=n.enter("headingSetext"),m=n.enter("phrasing"),g=n.containerPhrasing(t,{...i.current(),before:` `,after:` `});return m(),f(),g+` `+(s===1?"=":"-").repeat(g.length-(Math.max(g.lastIndexOf("\r"),g.lastIndexOf(` -`))+1))}const a="#".repeat(s),l=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let h=n.containerPhrasing(t,{before:"# ",after:` -`,...i.current()});return/^[\t ]/.test(h)&&(h=p0(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),c(),l(),h}b$.peek=G1e;function b$(t){return t.value||""}function G1e(){return"<"}w$.peek=X1e;function w$(t,e,n,r){const s=PO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let l=n.enter("label");const c=n.createTracker(r);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(l=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),l(),t.title&&(l=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),l()),h+=c.move(")"),a(),h}function X1e(){return"!"}S$.peek=Y1e;function S$(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");const h=n.safe(t.alt,{before:c,after:"]",...l.current()});c+=l.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function Y1e(){return"!"}k$.peek=K1e;function k$(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}j$.peek=Z1e;function j$(t,e,n,r){const s=PO(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let l,c;if(O$(t,n)){const f=n.stack;n.stack=[],l=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),l(),n.stack=f,m}l=n.enter("link"),c=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(c=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=a.move(" "+s),h+=a.move(n.safe(t.title,{before:h,after:s,...a.current()})),h+=a.move(s),c()),h+=a.move(")"),l(),h}function Z1e(t,e,n){return O$(t,n)?"<":"["}N$.peek=J1e;function N$(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...l.current()});c+=l.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...l.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=l.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=l.move("]"),c}function J1e(){return"["}function LO(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function eve(t){const e=LO(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function tve(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function C$(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function nve(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?tve(n):LO(n);const l=t.ordered?a==="."?")":".":eve(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),C$(n)===a&&f){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const l=n.createTracker(r);l.move(i+" ".repeat(a-i.length)),l.shift(a);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,l.current()),f);return c(),h;function f(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function ive(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const ave=ip(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function ove(t,e,n,r){return(t.children.some(function(a){return ave(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function lve(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}T$.peek=cve;function T$(t,e,n,r){const s=lve(n),i=n.enter("strong"),a=n.createTracker(r),l=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:l,...a.current()}));const h=c.charCodeAt(0),f=sv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=p0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=sv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+p0(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},l+c+x}function cve(t,e,n){return n.options.strong||"*"}function uve(t,e,n,r){return n.safe(t.value,r)}function dve(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function hve(t,e,n){const r=(C$(n)+(n.options.ruleSpaces?" ":"")).repeat(dve(n));return n.options.ruleSpaces?r.slice(0,-1):r}const E$={blockquote:P1e,break:z_,code:F1e,definition:Q1e,emphasis:y$,hardBreak:z_,heading:W1e,html:b$,image:w$,imageReference:S$,inlineCode:k$,link:j$,linkReference:N$,list:nve,listItem:sve,paragraph:ive,root:ove,strong:T$,text:uve,thematicBreak:hve};function fve(){return{enter:{table:mve,tableData:P_,tableHeader:P_,tableRow:gve},exit:{codeText:xve,table:pve,tableData:u4,tableHeader:u4,tableRow:u4}}}function mve(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function pve(t){this.exit(t),this.data.inTable=void 0}function gve(t){this.enter({type:"tableRow",children:[]},t)}function u4(t){this.exit(t)}function P_(t){this.enter({type:"tableCell",children:[]},t)}function xve(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,vve));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function vve(t,e){return e==="|"?e:t}function yve(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:l}};function a(x,y,w,S){return h(f(x,w,S),x.align)}function l(x,y,w,S){const k=m(x,w,S),N=h([k]);return N.slice(0,N.indexOf(` -`))}function c(x,y,w,S){const k=w.enter("tableCell"),N=w.enter("phrasing"),C=w.containerPhrasing(x,{...S,before:i,after:i});return N(),k(),C}function h(x,y){return D1e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function f(x,y,w){const S=x.children;let k=-1;const N=[],C=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Lve={tokenize:Vve,partial:!0};function Ive(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:$ve,continuation:{tokenize:Qve},exit:Hve}},text:{91:{name:"gfmFootnoteCall",tokenize:Fve},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:Bve,resolveTo:qve}}}}function Bve(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=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(!a||!a._balanced)return n(c);const h=Sa(r.sliceSerialize({start:a.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function qve(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},l=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...l),t}function Fve(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return l;function l(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(m){if(i>999||m===93&&!a||m===null||m===91||Vn(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Sa(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return Vn(m)||(a=!0),i++,t.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(t.consume(m),i++,h):h(m)}}function $ve(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,l;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(y)}function f(y){if(a>999||y===93&&!l||y===null||y===91||Vn(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Sa(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Vn(y)||(l=!0),a++,t.consume(y),y===92?m:f}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,f):f(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),Ut(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function Qve(t,e,n){return t.check(sp,e,t.attempt(Lve,e,n))}function Hve(t){t.exit("gfmFootnoteDefinition")}function Vve(t,e,n){const r=this;return Ut(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function Uve(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,l){let c=-1;for(;++c1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=Nh(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,l(y)}}}class Wve{constructor(){this.map=[]}add(e,n,r){Gve(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function Gve(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const z=r.events[$][1].type;if(z==="lineEnding"||z==="linePrefix")$--;else break}const V=$>-1?r.events[$][1].type:null,ee=V==="tableHead"||V==="tableRow"?E:c;return ee===E&&r.parser.lazy[r.now().line]?n(I):ee(I)}function c(I){return t.enter("tableHead"),t.enter("tableRow"),h(I)}function h(I){return I===124||(a=!0,i+=1),f(I)}function f(I){return I===null?n(I):ut(I)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),x):n(I):Yt(I)?Ut(t,f,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),m(I)))}function m(I){return I===null||I===124||Vn(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?g:m)}function g(I){return I===92||I===124?(t.consume(I),m):m(I)}function x(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,Yt(I)?Ut(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):y(I))}function y(I){return I===45||I===58?S(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),w):_(I)}function w(I){return Yt(I)?Ut(t,S,"whitespace")(I):S(I)}function S(I){return I===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),k):I===45?(i+=1,k(I)):I===null||ut(I)?T(I):_(I)}function k(I){return I===45?(t.enter("tableDelimiterFiller"),N(I)):_(I)}function N(I){return I===45?(t.consume(I),N):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),C):(t.exit("tableDelimiterFiller"),C(I))}function C(I){return Yt(I)?Ut(t,T,"whitespace")(I):T(I)}function T(I){return I===124?y(I):I===null||ut(I)?!a||s!==i?_(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):_(I)}function _(I){return n(I)}function E(I){return t.enter("tableRow"),M(I)}function M(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),M):I===null||ut(I)?(t.exit("tableRow"),e(I)):Yt(I)?Ut(t,M,"whitespace")(I):(t.enter("data"),q(I))}function q(I){return I===null||I===124||Vn(I)?(t.exit("data"),M(I)):(t.consume(I),I===92?L:q)}function L(I){return I===92||I===124?(t.consume(I),q):q(I)}}function Zve(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],l=!1,c=0,h,f,m;const g=new Wve;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},Fd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function I_(t,e,n,r,s){const i=[],a=Fd(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function Fd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const Jve={name:"tasklistCheck",tokenize:tye};function eye(){return{text:{91:Jve}}}function tye(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return Vn(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),l):n(c)}function l(c){return ut(c)?e(c):Yt(c)?t.check({tokenize:nye},e,n)(c):n(c)}}function nye(t,e,n){return Ut(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function rye(t){return WF([Tve(),Ive(),Uve(t),Yve(),eye()])}const sye={};function iye(t){const e=this,n=t||sye,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(rye(n)),i.push(Ove()),a.push(jve(n))}function aye(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:l,mathText:a,mathTextData:l}};function t(c){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h;const m=f.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:h}),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 a(c){const h=this.resume(),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h,f.data.hChildren.push({type:"text",value:h})}function l(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function oye(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` -`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,l,c){const h=i.value||"",f=l.createTracker(c),m="$".repeat(Math.max(v$(h,"$")+1,2)),g=l.enter("mathFlow");let x=f.move(m);if(i.meta){const y=l.enter("mathFlowMeta");x+=f.move(l.safe(i.meta,{after:` +`))+1))}const a="#".repeat(s),o=n.enter("headingAtx"),c=n.enter("phrasing");i.move(a+" ");let h=n.containerPhrasing(t,{before:"# ",after:` +`,...i.current()});return/^[\t ]/.test(h)&&(h=v0(h.charCodeAt(0))+h.slice(1)),h=h?a+" "+h:a,n.options.closeAtx&&(h+=" "+a),c(),o(),h}E$.peek=uve;function E$(t){return t.value||""}function uve(){return"<"}_$.peek=dve;function _$(t,e,n,r){const s=qO(n),i=s==='"'?"Quote":"Apostrophe",a=n.enter("image");let o=n.enter("label");const c=n.createTracker(r);let h=c.move("![");return h+=c.move(n.safe(t.alt,{before:h,after:"]",...c.current()})),h+=c.move("]("),o(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(o=n.enter("destinationLiteral"),h+=c.move("<"),h+=c.move(n.safe(t.url,{before:h,after:">",...c.current()})),h+=c.move(">")):(o=n.enter("destinationRaw"),h+=c.move(n.safe(t.url,{before:h,after:t.title?" ":")",...c.current()}))),o(),t.title&&(o=n.enter(`title${i}`),h+=c.move(" "+s),h+=c.move(n.safe(t.title,{before:h,after:s,...c.current()})),h+=c.move(s),o()),h+=c.move(")"),a(),h}function dve(){return"!"}M$.peek=hve;function M$(t,e,n,r){const s=t.referenceType,i=n.enter("imageReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("![");const h=n.safe(t.alt,{before:c,after:"]",...o.current()});c+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=o.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function hve(){return"!"}A$.peek=fve;function A$(t,e,n){let r=t.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i\u007F]/.test(t.url))}D$.peek=mve;function D$(t,e,n,r){const s=qO(n),i=s==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let o,c;if(R$(t,n)){const f=n.stack;n.stack=[],o=n.enter("autolink");let m=a.move("<");return m+=a.move(n.containerPhrasing(t,{before:m,after:">",...a.current()})),m+=a.move(">"),o(),n.stack=f,m}o=n.enter("link"),c=n.enter("label");let h=a.move("[");return h+=a.move(n.containerPhrasing(t,{before:h,after:"](",...a.current()})),h+=a.move("]("),c(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(c=n.enter("destinationLiteral"),h+=a.move("<"),h+=a.move(n.safe(t.url,{before:h,after:">",...a.current()})),h+=a.move(">")):(c=n.enter("destinationRaw"),h+=a.move(n.safe(t.url,{before:h,after:t.title?" ":")",...a.current()}))),c(),t.title&&(c=n.enter(`title${i}`),h+=a.move(" "+s),h+=a.move(n.safe(t.title,{before:h,after:s,...a.current()})),h+=a.move(s),c()),h+=a.move(")"),o(),h}function mve(t,e,n){return R$(t,n)?"<":"["}z$.peek=pve;function z$(t,e,n,r){const s=t.referenceType,i=n.enter("linkReference");let a=n.enter("label");const o=n.createTracker(r);let c=o.move("[");const h=n.containerPhrasing(t,{before:c,after:"]",...o.current()});c+=o.move(h+"]["),a();const f=n.stack;n.stack=[],a=n.enter("reference");const m=n.safe(n.associationId(t),{before:c,after:"]",...o.current()});return a(),n.stack=f,i(),s==="full"||!h||h!==m?c+=o.move(m+"]"):s==="shortcut"?c=c.slice(0,-1):c+=o.move("]"),c}function pve(){return"["}function FO(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function gve(t){const e=FO(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function xve(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function P$(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function vve(t,e,n,r){const s=n.enter("list"),i=n.bulletCurrent;let a=t.ordered?xve(n):FO(n);const o=t.ordered?a==="."?")":".":gve(n);let c=e&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!t.ordered){const f=t.children?t.children[0]:void 0;if((a==="*"||a==="-")&&f&&(!f.children||!f.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),P$(n)===a&&f){let m=-1;for(;++m-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+i);let a=i.length+1;(s==="tab"||s==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(a=Math.ceil(a/4)*4);const o=n.createTracker(r);o.move(i+" ".repeat(a-i.length)),o.shift(a);const c=n.enter("listItem"),h=n.indentLines(n.containerFlow(t,o.current()),f);return c(),h;function f(m,g,x){return g?(x?"":" ".repeat(a))+m:(x?i:i+" ".repeat(a-i.length))+m}}function wve(t,e,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),a=n.containerPhrasing(t,r);return i(),s(),a}const Sve=op(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function kve(t,e,n,r){return(t.children.some(function(a){return Sve(a)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function Ove(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}L$.peek=jve;function L$(t,e,n,r){const s=Ove(n),i=n.enter("strong"),a=n.createTracker(r),o=a.move(s+s);let c=a.move(n.containerPhrasing(t,{after:s,before:o,...a.current()}));const h=c.charCodeAt(0),f=lv(r.before.charCodeAt(r.before.length-1),h,s);f.inside&&(c=v0(h)+c.slice(1));const m=c.charCodeAt(c.length-1),g=lv(r.after.charCodeAt(0),m,s);g.inside&&(c=c.slice(0,-1)+v0(m));const x=a.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:g.outside,before:f.outside},o+c+x}function jve(t,e,n){return n.options.strong||"*"}function Nve(t,e,n,r){return n.safe(t.value,r)}function Cve(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function Tve(t,e,n){const r=(P$(n)+(n.options.ruleSpaces?" ":"")).repeat(Cve(n));return n.options.ruleSpaces?r.slice(0,-1):r}const I$={blockquote:Z1e,break:$_,code:rve,definition:ive,emphasis:T$,hardBreak:$_,heading:cve,html:E$,image:_$,imageReference:M$,inlineCode:A$,link:D$,linkReference:z$,list:vve,listItem:bve,paragraph:wve,root:kve,strong:L$,text:Nve,thematicBreak:Tve};function Eve(){return{enter:{table:_ve,tableData:Q_,tableHeader:Q_,tableRow:Ave},exit:{codeText:Rve,table:Mve,tableData:g4,tableHeader:g4,tableRow:g4}}}function _ve(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function Mve(t){this.exit(t),this.data.inTable=void 0}function Ave(t){this.enter({type:"tableRow",children:[]},t)}function g4(t){this.exit(t)}function Q_(t){this.enter({type:"tableCell",children:[]},t)}function Rve(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,Dve));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function Dve(t,e){return e==="|"?e:t}function zve(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,s=e.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:g,table:a,tableCell:c,tableRow:o}};function a(x,y,w,S){return h(f(x,w,S),x.align)}function o(x,y,w,S){const k=m(x,w,S),N=h([k]);return N.slice(0,N.indexOf(` +`))}function c(x,y,w,S){const k=w.enter("tableCell"),N=w.enter("phrasing"),C=w.containerPhrasing(x,{...S,before:i,after:i});return N(),k(),C}function h(x,y){return Y1e(x,{align:y,alignDelimiters:r,padding:n,stringLength:s})}function f(x,y,w){const S=x.children;let k=-1;const N=[],C=y.enter("table");for(;++k0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const Jve={tokenize:lye,partial:!0};function eye(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sye,continuation:{tokenize:iye},exit:aye}},text:{91:{name:"gfmFootnoteCall",tokenize:rye},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:tye,resolveTo:nye}}}}function tye(t,e,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;s--;){const c=r.events[s][1];if(c.type==="labelImage"){a=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return o;function o(c){if(!a||!a._balanced)return n(c);const h=Na(r.sliceSerialize({start:a.end,end:r.now()}));return h.codePointAt(0)!==94||!i.includes(h.slice(1))?n(c):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(c),t.exit("gfmFootnoteCallLabelMarker"),e(c))}}function nye(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},t[t.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},o=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",s,e],["exit",s,e],["enter",i,e],["enter",a,e],["exit",a,e],["exit",i,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...o),t}function rye(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,a;return o;function o(m){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),c}function c(m){return m!==94?n(m):(t.enter("gfmFootnoteCallMarker"),t.consume(m),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",h)}function h(m){if(i>999||m===93&&!a||m===null||m===91||Vn(m))return n(m);if(m===93){t.exit("chunkString");const g=t.exit("gfmFootnoteCallString");return s.includes(Na(r.sliceSerialize(g)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(m),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(m)}return Vn(m)||(a=!0),i++,t.consume(m),m===92?f:h}function f(m){return m===91||m===92||m===93?(t.consume(m),i++,h):h(m)}}function sye(t,e,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,a=0,o;return c;function c(y){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),h}function h(y){return y===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",f):n(y)}function f(y){if(a>999||y===93&&!o||y===null||y===91||Vn(y))return n(y);if(y===93){t.exit("chunkString");const w=t.exit("gfmFootnoteDefinitionLabelString");return i=Na(r.sliceSerialize(w)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(y),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),g}return Vn(y)||(o=!0),a++,t.consume(y),y===92?m:f}function m(y){return y===91||y===92||y===93?(t.consume(y),a++,f):f(y)}function g(y){return y===58?(t.enter("definitionMarker"),t.consume(y),t.exit("definitionMarker"),s.includes(i)||s.push(i),Wt(t,x,"gfmFootnoteDefinitionWhitespace")):n(y)}function x(y){return e(y)}}function iye(t,e,n){return t.check(lp,e,t.attempt(Jve,e,n))}function aye(t){t.exit("gfmFootnoteDefinition")}function lye(t,e,n){const r=this;return Wt(t,s,"gfmFootnoteDefinitionIndent",5);function s(i){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(i):n(i)}}function oye(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(a,o){let c=-1;for(;++c1?c(y):(a.consume(y),m++,x);if(m<2&&!n)return c(y);const S=a.exit("strikethroughSequenceTemporary"),k=Ch(y);return S._open=!k||k===2&&!!w,S._close=!w||w===2&&!!k,o(y)}}}class cye{constructor(){this.map=[]}add(e,n,r){uye(this,e,n,r)}consume(e){if(this.map.sort(function(i,a){return i[0]-a[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let s=r.pop();for(;s;){for(const i of s)e.push(i);s=r.pop()}this.map.length=0}}function uye(t,e,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s-1;){const z=r.events[$][1].type;if(z==="lineEnding"||z==="linePrefix")$--;else break}const V=$>-1?r.events[$][1].type:null,ee=V==="tableHead"||V==="tableRow"?E:c;return ee===E&&r.parser.lazy[r.now().line]?n(I):ee(I)}function c(I){return t.enter("tableHead"),t.enter("tableRow"),h(I)}function h(I){return I===124||(a=!0,i+=1),f(I)}function f(I){return I===null?n(I):ut(I)?i>1?(i=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(I),t.exit("lineEnding"),x):n(I):Zt(I)?Wt(t,f,"whitespace")(I):(i+=1,a&&(a=!1,s+=1),I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),a=!0,f):(t.enter("data"),m(I)))}function m(I){return I===null||I===124||Vn(I)?(t.exit("data"),f(I)):(t.consume(I),I===92?g:m)}function g(I){return I===92||I===124?(t.consume(I),m):m(I)}function x(I){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(I):(t.enter("tableDelimiterRow"),a=!1,Zt(I)?Wt(t,y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(I):y(I))}function y(I){return I===45||I===58?S(I):I===124?(a=!0,t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),w):_(I)}function w(I){return Zt(I)?Wt(t,S,"whitespace")(I):S(I)}function S(I){return I===58?(i+=1,a=!0,t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),k):I===45?(i+=1,k(I)):I===null||ut(I)?T(I):_(I)}function k(I){return I===45?(t.enter("tableDelimiterFiller"),N(I)):_(I)}function N(I){return I===45?(t.consume(I),N):I===58?(a=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(I),t.exit("tableDelimiterMarker"),C):(t.exit("tableDelimiterFiller"),C(I))}function C(I){return Zt(I)?Wt(t,T,"whitespace")(I):T(I)}function T(I){return I===124?y(I):I===null||ut(I)?!a||s!==i?_(I):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(I)):_(I)}function _(I){return n(I)}function E(I){return t.enter("tableRow"),M(I)}function M(I){return I===124?(t.enter("tableCellDivider"),t.consume(I),t.exit("tableCellDivider"),M):I===null||ut(I)?(t.exit("tableRow"),e(I)):Zt(I)?Wt(t,M,"whitespace")(I):(t.enter("data"),q(I))}function q(I){return I===null||I===124||Vn(I)?(t.exit("data"),M(I)):(t.consume(I),I===92?L:q)}function L(I){return I===92||I===124?(t.consume(I),q):q(I)}}function mye(t,e){let n=-1,r=!0,s=0,i=[0,0,0,0],a=[0,0,0,0],o=!1,c=0,h,f,m;const g=new cye;for(;++nn[2]+1){const y=n[2]+1,w=n[3]-n[2]-1;t.add(y,w,[])}}t.add(n[3]+1,0,[["exit",m,e]])}return s!==void 0&&(i.end=Object.assign({},Qd(e.events,s)),t.add(s,0,[["exit",i,e]]),i=void 0),i}function V_(t,e,n,r,s){const i=[],a=Qd(e.events,n);s&&(s.end=Object.assign({},a),i.push(["exit",s,e])),r.end=Object.assign({},a),i.push(["exit",r,e]),t.add(n+1,0,i)}function Qd(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const pye={name:"tasklistCheck",tokenize:xye};function gye(){return{text:{91:pye}}}function xye(t,e,n){const r=this;return s;function s(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),i)}function i(c){return Vn(c)?(t.enter("taskListCheckValueUnchecked"),t.consume(c),t.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(t.enter("taskListCheckValueChecked"),t.consume(c),t.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(t.enter("taskListCheckMarker"),t.consume(c),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),o):n(c)}function o(c){return ut(c)?e(c):Zt(c)?t.check({tokenize:vye},e,n)(c):n(c)}}function vye(t,e,n){return Wt(t,r,"whitespace");function r(s){return s===null?n(s):e(s)}}function yye(t){return n$([Hve(),eye(),oye(t),hye(),gye()])}const bye={};function wye(t){const e=this,n=t||bye,r=e.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(yye(n)),i.push(qve()),a.push(Fve(n))}function Sye(){return{enter:{mathFlow:t,mathFlowFenceMeta:e,mathText:i},exit:{mathFlow:s,mathFlowFence:r,mathFlowFenceMeta:n,mathFlowValue:o,mathText:a,mathTextData:o}};function t(c){const h={type:"element",tagName:"code",properties:{className:["language-math","math-display"]},children:[]};this.enter({type:"math",meta:null,value:"",data:{hName:"pre",hChildren:[h]}},c)}function e(){this.buffer()}function n(){const c=this.resume(),h=this.stack[this.stack.length-1];h.type,h.meta=c}function r(){this.data.mathFlowInside||(this.buffer(),this.data.mathFlowInside=!0)}function s(c){const h=this.resume().replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h;const m=f.data.hChildren[0];m.type,m.tagName,m.children.push({type:"text",value:h}),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 a(c){const h=this.resume(),f=this.stack[this.stack.length-1];f.type,this.exit(c),f.value=h,f.data.hChildren.push({type:"text",value:h})}function o(c){this.config.enter.data.call(this,c),this.config.exit.data.call(this,c)}}function kye(t){let e=(t||{}).singleDollarTextMath;return e==null&&(e=!0),r.peek=s,{unsafe:[{character:"\r",inConstruct:"mathFlowMeta"},{character:` +`,inConstruct:"mathFlowMeta"},{character:"$",after:e?void 0:"\\$",inConstruct:"phrasing"},{character:"$",inConstruct:"mathFlowMeta"},{atBreak:!0,character:"$",after:"\\$"}],handlers:{math:n,inlineMath:r}};function n(i,a,o,c){const h=i.value||"",f=o.createTracker(c),m="$".repeat(Math.max(C$(h,"$")+1,2)),g=o.enter("mathFlow");let x=f.move(m);if(i.meta){const y=o.enter("mathFlowMeta");x+=f.move(o.safe(i.meta,{after:` `,before:x,encode:["$"],...f.current()})),y()}return x+=f.move(` `),h&&(x+=f.move(h+` -`)),x+=f.move(m),g(),x}function r(i,a,l){let c=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(c);)h++;const f="$".repeat(h);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m15?h="…"+l.slice(s-15,s):h=l.slice(0,s);var f;i+15":">","<":"<",'"':""","'":"'"},yye=/[&><"']/g;function bye(t){return String(t).replace(yye,e=>vye[e])}var I$=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},wye=function(e){var n=I$(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Sye=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},kye=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},On={deflt:pye,escape:bye,hyphenate:xye,getBaseElem:I$,isCharacterBox:wye,protocolFromUrl:kye},f1={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 "},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 ",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:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},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:t=>Math.max(0,t),cli:"--min-rule-thickness ",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:t=>Math.max(0,t),cli:"-s, --max-size ",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:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function Oye(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class BO{constructor(e){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,e=e||{};for(var n in f1)if(f1.hasOwnProperty(n)){var r=f1[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:Oye(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Be("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}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': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=On.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class Kl{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Va[jye[this.id]]}sub(){return Va[Nye[this.id]]}fracNum(){return Va[Cye[this.id]]}fracDen(){return Va[Tye[this.id]]}cramp(){return Va[Eye[this.id]]}text(){return Va[_ye[this.id]]}isTight(){return this.size>=2}}var qO=0,iv=1,oh=2,il=3,g0=4,Zi=5,Ch=6,Ms=7,Va=[new Kl(qO,0,!1),new Kl(iv,0,!0),new Kl(oh,1,!1),new Kl(il,1,!0),new Kl(g0,2,!1),new Kl(Zi,2,!0),new Kl(Ch,3,!1),new Kl(Ms,3,!0)],jye=[g0,Zi,g0,Zi,Ch,Ms,Ch,Ms],Nye=[Zi,Zi,Zi,Zi,Ms,Ms,Ms,Ms],Cye=[oh,il,g0,Zi,Ch,Ms,Ch,Ms],Tye=[il,il,Zi,Zi,Ms,Ms,Ms,Ms],Eye=[iv,iv,il,il,Zi,Zi,Ms,Ms],_ye=[qO,iv,oh,il,oh,il,oh,il],kt={DISPLAY:Va[qO],TEXT:Va[oh],SCRIPT:Va[g0],SCRIPTSCRIPT:Va[Ch]},ek=[{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 Mye(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var m1=[];ek.forEach(t=>t.blocks.forEach(e=>m1.push(...e)));function B$(t){for(var e=0;e=m1[e]&&t<=m1[e+1])return!0;return!1}var Cd=80,Aye=function(e,n){return"M95,"+(622+e+n)+` +`)),x+=f.move(m),g(),x}function r(i,a,o){let c=i.value||"",h=1;for(e||h++;new RegExp("(^|[^$])"+"\\$".repeat(h)+"([^$]|$)").test(c);)h++;const f="$".repeat(h);/[^ \r\n]/.test(c)&&(/^[ \r\n]/.test(c)&&/[ \r\n]$/.test(c)||/^\$|\$$/.test(c))&&(c=" "+c+" ");let m=-1;for(;++m15?h="…"+o.slice(s-15,s):h=o.slice(0,s);var f;i+15":">","<":"<",'"':""","'":"'"},zye=/[&><"']/g;function Pye(t){return String(t).replace(zye,e=>Dye[e])}var W$=function t(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?t(e.body[0]):e:e.type==="font"?t(e.body):e},Lye=function(e){var n=W$(e);return n.type==="mathord"||n.type==="textord"||n.type==="atom"},Iye=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},Bye=function(e){var n=/^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e);return n?n[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(n[1])?null:n[1].toLowerCase():"_relative"},Nn={deflt:Mye,escape:Pye,hyphenate:Rye,getBaseElem:W$,isCharacterBox:Lye,protocolFromUrl:Bye},g1={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 "},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 ",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:t=>"#"+t},macros:{type:"object",cli:"-m, --macro ",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(t,e)=>(e.push(t),e)},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:t=>Math.max(0,t),cli:"--min-rule-thickness ",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:t=>Math.max(0,t),cli:"-s, --max-size ",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:t=>Math.max(0,t),cli:"-e, --max-expand ",cliProcessor:t=>t==="Infinity"?1/0:parseInt(t)},globalGroup:{type:"boolean",cli:!1}};function qye(t){if(t.default)return t.default;var e=t.type,n=Array.isArray(e)?e[0]:e;if(typeof n!="string")return n.enum[0];switch(n){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class QO{constructor(e){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,e=e||{};for(var n in g1)if(g1.hasOwnProperty(n)){var r=g1[n];this[n]=e[n]!==void 0?r.processor?r.processor(e[n]):e[n]:qye(r)}}reportNonstrict(e,n,r){var s=this.strict;if(typeof s=="function"&&(s=s(e,n,r)),!(!s||s==="ignore")){if(s===!0||s==="error")throw new Be("LaTeX-incompatible input and strict mode is set to 'error': "+(n+" ["+e+"]"),r);s==="warn"?typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to 'warn': "+(n+" ["+e+"]")):typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]"))}}useStrictBehavior(e,n,r){var s=this.strict;if(typeof s=="function")try{s=s(e,n,r)}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': "+(n+" ["+e+"]")),!1):(typeof console<"u"&&console.warn("LaTeX-incompatible input and strict mode is set to "+("unrecognized '"+s+"': "+n+" ["+e+"]")),!1)}isTrusted(e){if(e.url&&!e.protocol){var n=Nn.protocolFromUrl(e.url);if(n==null)return!1;e.protocol=n}var r=typeof this.trust=="function"?this.trust(e):this.trust;return!!r}}class ec{constructor(e,n,r){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=n,this.cramped=r}sup(){return Ga[Fye[this.id]]}sub(){return Ga[$ye[this.id]]}fracNum(){return Ga[Qye[this.id]]}fracDen(){return Ga[Hye[this.id]]}cramp(){return Ga[Vye[this.id]]}text(){return Ga[Uye[this.id]]}isTight(){return this.size>=2}}var HO=0,ov=1,oh=2,lo=3,y0=4,ea=5,Th=6,As=7,Ga=[new ec(HO,0,!1),new ec(ov,0,!0),new ec(oh,1,!1),new ec(lo,1,!0),new ec(y0,2,!1),new ec(ea,2,!0),new ec(Th,3,!1),new ec(As,3,!0)],Fye=[y0,ea,y0,ea,Th,As,Th,As],$ye=[ea,ea,ea,ea,As,As,As,As],Qye=[oh,lo,y0,ea,Th,As,Th,As],Hye=[lo,lo,ea,ea,As,As,As,As],Vye=[ov,ov,lo,lo,ea,ea,As,As],Uye=[HO,ov,oh,lo,oh,lo,oh,lo],kt={DISPLAY:Ga[HO],TEXT:Ga[oh],SCRIPT:Ga[y0],SCRIPTSCRIPT:Ga[Th]},sk=[{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 Wye(t){for(var e=0;e=s[0]&&t<=s[1])return n.name}return null}var x1=[];sk.forEach(t=>t.blocks.forEach(e=>x1.push(...e)));function G$(t){for(var e=0;e=x1[e]&&t<=x1[e+1])return!0;return!1}var Ed=80,Gye=function(e,n){return"M95,"+(622+e+n)+` c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 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 @@ -108,7 +108,7 @@ c5.3,-9.3,12,-14,20,-14 H400000v`+(40+e)+`H845.2724 s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z -M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Rye=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 +M`+(834+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Xye=function(e,n){return"M263,"+(601+e+n)+`c0.7,0,18,39.7,52,119 c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 c340,-704.7,510.7,-1060.3,512,-1067 l`+e/2.084+" -"+e+` @@ -118,7 +118,7 @@ s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5, 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 s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z -M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Dye=function(e,n){return"M983 "+(10+e+n)+` +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Yye=function(e,n){return"M983 "+(10+e+n)+` l`+e/3.13+" -"+e+` c4,-6.7,10,-10,18,-10 H400000v`+(40+e)+` 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 @@ -127,7 +127,7 @@ c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 c53.7,-170.3,84.5,-266.8,92.5,-289.5z -M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},zye=function(e,n){return"M424,"+(2398+e+n)+` +M`+(1001+e)+" "+n+"h400000v"+(40+e)+"h-400000z"},Kye=function(e,n){return"M424,"+(2398+e+n)+` c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 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 s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 @@ -137,18 +137,18 @@ v`+(40+e)+`H1014.6 s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 c-2,6,-10,9,-24,9 c-8,0,-12,-0.7,-12,-2z M`+(1001+e)+" "+n+` -h400000v`+(40+e)+"h-400000z"},Pye=function(e,n){return"M473,"+(2713+e+n)+` +h400000v`+(40+e)+"h-400000z"},Zye=function(e,n){return"M473,"+(2713+e+n)+` c339.3,-1799.3,509.3,-2700,510,-2702 l`+e/5.298+" -"+e+` c3.3,-7.3,9.3,-11,18,-11 H400000v`+(40+e)+`H1017.7 s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 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 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 s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, -606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},Lye=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},Iye=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` +606zM`+(1001+e)+" "+n+"h400000v"+(40+e)+"H1017.7z"},Jye=function(e){var n=e/2;return"M400000 "+e+" H0 L"+n+" 0 l65 45 L145 "+(e-80)+" H400000z"},ebe=function(e,n,r){var s=r-54-n-e;return"M702 "+(e+n)+"H400000"+(40+e)+` 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 h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 -219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},Bye=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Aye(n,Cd);break;case"sqrtSize1":s=Rye(n,Cd);break;case"sqrtSize2":s=Dye(n,Cd);break;case"sqrtSize3":s=zye(n,Cd);break;case"sqrtSize4":s=Pye(n,Cd);break;case"sqrtTall":s=Iye(n,Cd,r)}return s},qye=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},q_={doubleleftarrow:`M262 157 +219 661 l218 661zM702 `+n+"H400000v"+(40+e)+"H742z"},tbe=function(e,n,r){n=1e3*n;var s="";switch(e){case"sqrtMain":s=Gye(n,Ed);break;case"sqrtSize1":s=Xye(n,Ed);break;case"sqrtSize2":s=Yye(n,Ed);break;case"sqrtSize3":s=Kye(n,Ed);break;case"sqrtSize4":s=Zye(n,Ed);break;case"sqrtTall":s=ebe(n,Ed,r)}return s},nbe=function(e,n){switch(e){case"⎜":return"M291 0 H417 V"+n+" H291z M291 0 H417 V"+n+" H291z";case"∣":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z";case"∥":return"M145 0 H188 V"+n+" H145z M145 0 H188 V"+n+" H145z"+("M367 0 H410 V"+n+" H367z M367 0 H410 V"+n+" H367z");case"⎟":return"M457 0 H583 V"+n+" H457z M457 0 H583 V"+n+" H457z";case"⎢":return"M319 0 H403 V"+n+" H319z M319 0 H403 V"+n+" H319z";case"⎥":return"M263 0 H347 V"+n+" H263z M263 0 H347 V"+n+" H263z";case"⎪":return"M384 0 H504 V"+n+" H384z M384 0 H504 V"+n+" H384z";case"⏐":return"M312 0 H355 V"+n+" H312z M312 0 H355 V"+n+" H312z";case"‖":return"M257 0 H300 V"+n+" H257z M257 0 H300 V"+n+" H257z"+("M478 0 H521 V"+n+" H478z M478 0 H521 V"+n+" H478z");default:return""}},W_={doubleleftarrow:`M262 157 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 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 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 @@ -323,7 +323,7 @@ M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z` 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, -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 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 -M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},Fye=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z`},rbe=function(e,n){switch(e){case"lbrack":return"M403 1759 V84 H666 V0 H319 V1759 v"+n+` v1759 h347 v-84 H403z M403 1759 V0 H319 V1759 v`+n+" v1759 h84z";case"rbrack":return"M347 1759 V0 H0 V84 H263 V1759 v"+n+` v1759 H0 v84 H347z M347 1759 V0 H263 V1759 v`+n+" v1759 h84z";case"vert":return"M145 15 v585 v"+n+` v585 c2.667,10,9.667,15,21,15 c10,0,16.667,-5,20,-15 v-585 v`+-n+` v-585 c-2.667,-10,-9.667,-15,-21,-15 @@ -351,17 +351,31 @@ 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 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 c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, --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 op{constructor(e){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=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var Ja={"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]}},Ox={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]},F_={Å:"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 $ye(t,e){Ja[t]=e}function FO(t,e,n){if(!Ja[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=Ja[e][r];if(!s&&t[0]in F_&&(r=F_[t[0]].charCodeAt(0),s=Ja[e][r]),!s&&n==="text"&&B$(r)&&(s=Ja[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var d4={};function Qye(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!d4[e]){var n=d4[e]={cssEmPerMu:Ox.quad[e]/18};for(var r in Ox)Ox.hasOwnProperty(r)&&(n[r]=Ox[r][e])}return d4[e]}var Hye=[[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]],$_=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Q_=function(e,n){return n.size<2?e:Hye[e-1][n.size-1]};class Xo{constructor(e){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=e.style,this.color=e.color,this.size=e.size||Xo.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=$_[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={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 r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new Xo(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Q_(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:$_[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=Q_(Xo.BASESIZE,e);return this.size===n&&this.textSize===Xo.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Xo.BASESIZE?["sizing","reset-size"+this.size,"size"+Xo.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=Qye(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Xo.BASESIZE=6;var tk={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},Vye={ex:!0,em:!0,mu:!0},q$=function(e){return typeof e!="string"&&(e=e.unit),e in tk||e in Vye||e==="ex"},cr=function(e,n){var r;if(e.unit in tk)r=tk[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new Be("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Ve=function(e){return+e.toFixed(4)+"em"},Sc=function(e){return e.filter(n=>n).join(" ")},F$=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},$$=function(e){var n=document.createElement(e);n.className=Sc(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,Q$=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+On.escape(Sc(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=On.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+On.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(Uye.test(i))throw new Be("Invalid attribute name '"+i+"'");n+=" "+i+'="'+On.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class lp{constructor(e,n,r,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,F$.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return $$.call(this,"span")}toMarkup(){return Q$.call(this,"span")}}class $O{constructor(e,n,r,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,F$.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return $$.call(this,"a")}toMarkup(){return Q$.call(this,"a")}}class Wye{constructor(e,n,r){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=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+On.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Ve(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Sc(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=On.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+On.escape(r)+'"');var i=On.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class ml{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class nk{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var Yye={bin:1,close:1,inner:1,open:1,punct:1,rel:1},Kye={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Gn={math:{},text:{}};function A(t,e,n,r,s,i){Gn[t][s]={font:e,group:n,replace:r},i&&r&&(Gn[t][r]=Gn[t][s])}var D="math",Le="text",Q="main",le="ams",sr="accent-token",nt="bin",Ps="close",Kh="inner",St="mathord",Lr="op-token",Ri="open",my="punct",ce="rel",wl="spacing",pe="textord";A(D,Q,ce,"≡","\\equiv",!0);A(D,Q,ce,"≺","\\prec",!0);A(D,Q,ce,"≻","\\succ",!0);A(D,Q,ce,"∼","\\sim",!0);A(D,Q,ce,"⊥","\\perp");A(D,Q,ce,"⪯","\\preceq",!0);A(D,Q,ce,"⪰","\\succeq",!0);A(D,Q,ce,"≃","\\simeq",!0);A(D,Q,ce,"∣","\\mid",!0);A(D,Q,ce,"≪","\\ll",!0);A(D,Q,ce,"≫","\\gg",!0);A(D,Q,ce,"≍","\\asymp",!0);A(D,Q,ce,"∥","\\parallel");A(D,Q,ce,"⋈","\\bowtie",!0);A(D,Q,ce,"⌣","\\smile",!0);A(D,Q,ce,"⊑","\\sqsubseteq",!0);A(D,Q,ce,"⊒","\\sqsupseteq",!0);A(D,Q,ce,"≐","\\doteq",!0);A(D,Q,ce,"⌢","\\frown",!0);A(D,Q,ce,"∋","\\ni",!0);A(D,Q,ce,"∝","\\propto",!0);A(D,Q,ce,"⊢","\\vdash",!0);A(D,Q,ce,"⊣","\\dashv",!0);A(D,Q,ce,"∋","\\owns");A(D,Q,my,".","\\ldotp");A(D,Q,my,"⋅","\\cdotp");A(D,Q,pe,"#","\\#");A(Le,Q,pe,"#","\\#");A(D,Q,pe,"&","\\&");A(Le,Q,pe,"&","\\&");A(D,Q,pe,"ℵ","\\aleph",!0);A(D,Q,pe,"∀","\\forall",!0);A(D,Q,pe,"ℏ","\\hbar",!0);A(D,Q,pe,"∃","\\exists",!0);A(D,Q,pe,"∇","\\nabla",!0);A(D,Q,pe,"♭","\\flat",!0);A(D,Q,pe,"ℓ","\\ell",!0);A(D,Q,pe,"♮","\\natural",!0);A(D,Q,pe,"♣","\\clubsuit",!0);A(D,Q,pe,"℘","\\wp",!0);A(D,Q,pe,"♯","\\sharp",!0);A(D,Q,pe,"♢","\\diamondsuit",!0);A(D,Q,pe,"ℜ","\\Re",!0);A(D,Q,pe,"♡","\\heartsuit",!0);A(D,Q,pe,"ℑ","\\Im",!0);A(D,Q,pe,"♠","\\spadesuit",!0);A(D,Q,pe,"§","\\S",!0);A(Le,Q,pe,"§","\\S");A(D,Q,pe,"¶","\\P",!0);A(Le,Q,pe,"¶","\\P");A(D,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\textdagger");A(D,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\textdaggerdbl");A(D,Q,Ps,"⎱","\\rmoustache",!0);A(D,Q,Ri,"⎰","\\lmoustache",!0);A(D,Q,Ps,"⟯","\\rgroup",!0);A(D,Q,Ri,"⟮","\\lgroup",!0);A(D,Q,nt,"∓","\\mp",!0);A(D,Q,nt,"⊖","\\ominus",!0);A(D,Q,nt,"⊎","\\uplus",!0);A(D,Q,nt,"⊓","\\sqcap",!0);A(D,Q,nt,"∗","\\ast");A(D,Q,nt,"⊔","\\sqcup",!0);A(D,Q,nt,"◯","\\bigcirc",!0);A(D,Q,nt,"∙","\\bullet",!0);A(D,Q,nt,"‡","\\ddagger");A(D,Q,nt,"≀","\\wr",!0);A(D,Q,nt,"⨿","\\amalg");A(D,Q,nt,"&","\\And");A(D,Q,ce,"⟵","\\longleftarrow",!0);A(D,Q,ce,"⇐","\\Leftarrow",!0);A(D,Q,ce,"⟸","\\Longleftarrow",!0);A(D,Q,ce,"⟶","\\longrightarrow",!0);A(D,Q,ce,"⇒","\\Rightarrow",!0);A(D,Q,ce,"⟹","\\Longrightarrow",!0);A(D,Q,ce,"↔","\\leftrightarrow",!0);A(D,Q,ce,"⟷","\\longleftrightarrow",!0);A(D,Q,ce,"⇔","\\Leftrightarrow",!0);A(D,Q,ce,"⟺","\\Longleftrightarrow",!0);A(D,Q,ce,"↦","\\mapsto",!0);A(D,Q,ce,"⟼","\\longmapsto",!0);A(D,Q,ce,"↗","\\nearrow",!0);A(D,Q,ce,"↩","\\hookleftarrow",!0);A(D,Q,ce,"↪","\\hookrightarrow",!0);A(D,Q,ce,"↘","\\searrow",!0);A(D,Q,ce,"↼","\\leftharpoonup",!0);A(D,Q,ce,"⇀","\\rightharpoonup",!0);A(D,Q,ce,"↙","\\swarrow",!0);A(D,Q,ce,"↽","\\leftharpoondown",!0);A(D,Q,ce,"⇁","\\rightharpoondown",!0);A(D,Q,ce,"↖","\\nwarrow",!0);A(D,Q,ce,"⇌","\\rightleftharpoons",!0);A(D,le,ce,"≮","\\nless",!0);A(D,le,ce,"","\\@nleqslant");A(D,le,ce,"","\\@nleqq");A(D,le,ce,"⪇","\\lneq",!0);A(D,le,ce,"≨","\\lneqq",!0);A(D,le,ce,"","\\@lvertneqq");A(D,le,ce,"⋦","\\lnsim",!0);A(D,le,ce,"⪉","\\lnapprox",!0);A(D,le,ce,"⊀","\\nprec",!0);A(D,le,ce,"⋠","\\npreceq",!0);A(D,le,ce,"⋨","\\precnsim",!0);A(D,le,ce,"⪹","\\precnapprox",!0);A(D,le,ce,"≁","\\nsim",!0);A(D,le,ce,"","\\@nshortmid");A(D,le,ce,"∤","\\nmid",!0);A(D,le,ce,"⊬","\\nvdash",!0);A(D,le,ce,"⊭","\\nvDash",!0);A(D,le,ce,"⋪","\\ntriangleleft");A(D,le,ce,"⋬","\\ntrianglelefteq",!0);A(D,le,ce,"⊊","\\subsetneq",!0);A(D,le,ce,"","\\@varsubsetneq");A(D,le,ce,"⫋","\\subsetneqq",!0);A(D,le,ce,"","\\@varsubsetneqq");A(D,le,ce,"≯","\\ngtr",!0);A(D,le,ce,"","\\@ngeqslant");A(D,le,ce,"","\\@ngeqq");A(D,le,ce,"⪈","\\gneq",!0);A(D,le,ce,"≩","\\gneqq",!0);A(D,le,ce,"","\\@gvertneqq");A(D,le,ce,"⋧","\\gnsim",!0);A(D,le,ce,"⪊","\\gnapprox",!0);A(D,le,ce,"⊁","\\nsucc",!0);A(D,le,ce,"⋡","\\nsucceq",!0);A(D,le,ce,"⋩","\\succnsim",!0);A(D,le,ce,"⪺","\\succnapprox",!0);A(D,le,ce,"≆","\\ncong",!0);A(D,le,ce,"","\\@nshortparallel");A(D,le,ce,"∦","\\nparallel",!0);A(D,le,ce,"⊯","\\nVDash",!0);A(D,le,ce,"⋫","\\ntriangleright");A(D,le,ce,"⋭","\\ntrianglerighteq",!0);A(D,le,ce,"","\\@nsupseteqq");A(D,le,ce,"⊋","\\supsetneq",!0);A(D,le,ce,"","\\@varsupsetneq");A(D,le,ce,"⫌","\\supsetneqq",!0);A(D,le,ce,"","\\@varsupsetneqq");A(D,le,ce,"⊮","\\nVdash",!0);A(D,le,ce,"⪵","\\precneqq",!0);A(D,le,ce,"⪶","\\succneqq",!0);A(D,le,ce,"","\\@nsubseteqq");A(D,le,nt,"⊴","\\unlhd");A(D,le,nt,"⊵","\\unrhd");A(D,le,ce,"↚","\\nleftarrow",!0);A(D,le,ce,"↛","\\nrightarrow",!0);A(D,le,ce,"⇍","\\nLeftarrow",!0);A(D,le,ce,"⇏","\\nRightarrow",!0);A(D,le,ce,"↮","\\nleftrightarrow",!0);A(D,le,ce,"⇎","\\nLeftrightarrow",!0);A(D,le,ce,"△","\\vartriangle");A(D,le,pe,"ℏ","\\hslash");A(D,le,pe,"▽","\\triangledown");A(D,le,pe,"◊","\\lozenge");A(D,le,pe,"Ⓢ","\\circledS");A(D,le,pe,"®","\\circledR");A(Le,le,pe,"®","\\circledR");A(D,le,pe,"∡","\\measuredangle",!0);A(D,le,pe,"∄","\\nexists");A(D,le,pe,"℧","\\mho");A(D,le,pe,"Ⅎ","\\Finv",!0);A(D,le,pe,"⅁","\\Game",!0);A(D,le,pe,"‵","\\backprime");A(D,le,pe,"▲","\\blacktriangle");A(D,le,pe,"▼","\\blacktriangledown");A(D,le,pe,"■","\\blacksquare");A(D,le,pe,"⧫","\\blacklozenge");A(D,le,pe,"★","\\bigstar");A(D,le,pe,"∢","\\sphericalangle",!0);A(D,le,pe,"∁","\\complement",!0);A(D,le,pe,"ð","\\eth",!0);A(Le,Q,pe,"ð","ð");A(D,le,pe,"╱","\\diagup");A(D,le,pe,"╲","\\diagdown");A(D,le,pe,"□","\\square");A(D,le,pe,"□","\\Box");A(D,le,pe,"◊","\\Diamond");A(D,le,pe,"¥","\\yen",!0);A(Le,le,pe,"¥","\\yen",!0);A(D,le,pe,"✓","\\checkmark",!0);A(Le,le,pe,"✓","\\checkmark");A(D,le,pe,"ℶ","\\beth",!0);A(D,le,pe,"ℸ","\\daleth",!0);A(D,le,pe,"ℷ","\\gimel",!0);A(D,le,pe,"ϝ","\\digamma",!0);A(D,le,pe,"ϰ","\\varkappa");A(D,le,Ri,"┌","\\@ulcorner",!0);A(D,le,Ps,"┐","\\@urcorner",!0);A(D,le,Ri,"└","\\@llcorner",!0);A(D,le,Ps,"┘","\\@lrcorner",!0);A(D,le,ce,"≦","\\leqq",!0);A(D,le,ce,"⩽","\\leqslant",!0);A(D,le,ce,"⪕","\\eqslantless",!0);A(D,le,ce,"≲","\\lesssim",!0);A(D,le,ce,"⪅","\\lessapprox",!0);A(D,le,ce,"≊","\\approxeq",!0);A(D,le,nt,"⋖","\\lessdot");A(D,le,ce,"⋘","\\lll",!0);A(D,le,ce,"≶","\\lessgtr",!0);A(D,le,ce,"⋚","\\lesseqgtr",!0);A(D,le,ce,"⪋","\\lesseqqgtr",!0);A(D,le,ce,"≑","\\doteqdot");A(D,le,ce,"≓","\\risingdotseq",!0);A(D,le,ce,"≒","\\fallingdotseq",!0);A(D,le,ce,"∽","\\backsim",!0);A(D,le,ce,"⋍","\\backsimeq",!0);A(D,le,ce,"⫅","\\subseteqq",!0);A(D,le,ce,"⋐","\\Subset",!0);A(D,le,ce,"⊏","\\sqsubset",!0);A(D,le,ce,"≼","\\preccurlyeq",!0);A(D,le,ce,"⋞","\\curlyeqprec",!0);A(D,le,ce,"≾","\\precsim",!0);A(D,le,ce,"⪷","\\precapprox",!0);A(D,le,ce,"⊲","\\vartriangleleft");A(D,le,ce,"⊴","\\trianglelefteq");A(D,le,ce,"⊨","\\vDash",!0);A(D,le,ce,"⊪","\\Vvdash",!0);A(D,le,ce,"⌣","\\smallsmile");A(D,le,ce,"⌢","\\smallfrown");A(D,le,ce,"≏","\\bumpeq",!0);A(D,le,ce,"≎","\\Bumpeq",!0);A(D,le,ce,"≧","\\geqq",!0);A(D,le,ce,"⩾","\\geqslant",!0);A(D,le,ce,"⪖","\\eqslantgtr",!0);A(D,le,ce,"≳","\\gtrsim",!0);A(D,le,ce,"⪆","\\gtrapprox",!0);A(D,le,nt,"⋗","\\gtrdot");A(D,le,ce,"⋙","\\ggg",!0);A(D,le,ce,"≷","\\gtrless",!0);A(D,le,ce,"⋛","\\gtreqless",!0);A(D,le,ce,"⪌","\\gtreqqless",!0);A(D,le,ce,"≖","\\eqcirc",!0);A(D,le,ce,"≗","\\circeq",!0);A(D,le,ce,"≜","\\triangleq",!0);A(D,le,ce,"∼","\\thicksim");A(D,le,ce,"≈","\\thickapprox");A(D,le,ce,"⫆","\\supseteqq",!0);A(D,le,ce,"⋑","\\Supset",!0);A(D,le,ce,"⊐","\\sqsupset",!0);A(D,le,ce,"≽","\\succcurlyeq",!0);A(D,le,ce,"⋟","\\curlyeqsucc",!0);A(D,le,ce,"≿","\\succsim",!0);A(D,le,ce,"⪸","\\succapprox",!0);A(D,le,ce,"⊳","\\vartriangleright");A(D,le,ce,"⊵","\\trianglerighteq");A(D,le,ce,"⊩","\\Vdash",!0);A(D,le,ce,"∣","\\shortmid");A(D,le,ce,"∥","\\shortparallel");A(D,le,ce,"≬","\\between",!0);A(D,le,ce,"⋔","\\pitchfork",!0);A(D,le,ce,"∝","\\varpropto");A(D,le,ce,"◀","\\blacktriangleleft");A(D,le,ce,"∴","\\therefore",!0);A(D,le,ce,"∍","\\backepsilon");A(D,le,ce,"▶","\\blacktriangleright");A(D,le,ce,"∵","\\because",!0);A(D,le,ce,"⋘","\\llless");A(D,le,ce,"⋙","\\gggtr");A(D,le,nt,"⊲","\\lhd");A(D,le,nt,"⊳","\\rhd");A(D,le,ce,"≂","\\eqsim",!0);A(D,Q,ce,"⋈","\\Join");A(D,le,ce,"≑","\\Doteq",!0);A(D,le,nt,"∔","\\dotplus",!0);A(D,le,nt,"∖","\\smallsetminus");A(D,le,nt,"⋒","\\Cap",!0);A(D,le,nt,"⋓","\\Cup",!0);A(D,le,nt,"⩞","\\doublebarwedge",!0);A(D,le,nt,"⊟","\\boxminus",!0);A(D,le,nt,"⊞","\\boxplus",!0);A(D,le,nt,"⋇","\\divideontimes",!0);A(D,le,nt,"⋉","\\ltimes",!0);A(D,le,nt,"⋊","\\rtimes",!0);A(D,le,nt,"⋋","\\leftthreetimes",!0);A(D,le,nt,"⋌","\\rightthreetimes",!0);A(D,le,nt,"⋏","\\curlywedge",!0);A(D,le,nt,"⋎","\\curlyvee",!0);A(D,le,nt,"⊝","\\circleddash",!0);A(D,le,nt,"⊛","\\circledast",!0);A(D,le,nt,"⋅","\\centerdot");A(D,le,nt,"⊺","\\intercal",!0);A(D,le,nt,"⋒","\\doublecap");A(D,le,nt,"⋓","\\doublecup");A(D,le,nt,"⊠","\\boxtimes",!0);A(D,le,ce,"⇢","\\dashrightarrow",!0);A(D,le,ce,"⇠","\\dashleftarrow",!0);A(D,le,ce,"⇇","\\leftleftarrows",!0);A(D,le,ce,"⇆","\\leftrightarrows",!0);A(D,le,ce,"⇚","\\Lleftarrow",!0);A(D,le,ce,"↞","\\twoheadleftarrow",!0);A(D,le,ce,"↢","\\leftarrowtail",!0);A(D,le,ce,"↫","\\looparrowleft",!0);A(D,le,ce,"⇋","\\leftrightharpoons",!0);A(D,le,ce,"↶","\\curvearrowleft",!0);A(D,le,ce,"↺","\\circlearrowleft",!0);A(D,le,ce,"↰","\\Lsh",!0);A(D,le,ce,"⇈","\\upuparrows",!0);A(D,le,ce,"↿","\\upharpoonleft",!0);A(D,le,ce,"⇃","\\downharpoonleft",!0);A(D,Q,ce,"⊶","\\origof",!0);A(D,Q,ce,"⊷","\\imageof",!0);A(D,le,ce,"⊸","\\multimap",!0);A(D,le,ce,"↭","\\leftrightsquigarrow",!0);A(D,le,ce,"⇉","\\rightrightarrows",!0);A(D,le,ce,"⇄","\\rightleftarrows",!0);A(D,le,ce,"↠","\\twoheadrightarrow",!0);A(D,le,ce,"↣","\\rightarrowtail",!0);A(D,le,ce,"↬","\\looparrowright",!0);A(D,le,ce,"↷","\\curvearrowright",!0);A(D,le,ce,"↻","\\circlearrowright",!0);A(D,le,ce,"↱","\\Rsh",!0);A(D,le,ce,"⇊","\\downdownarrows",!0);A(D,le,ce,"↾","\\upharpoonright",!0);A(D,le,ce,"⇂","\\downharpoonright",!0);A(D,le,ce,"⇝","\\rightsquigarrow",!0);A(D,le,ce,"⇝","\\leadsto");A(D,le,ce,"⇛","\\Rrightarrow",!0);A(D,le,ce,"↾","\\restriction");A(D,Q,pe,"‘","`");A(D,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\textdollar");A(D,Q,pe,"%","\\%");A(Le,Q,pe,"%","\\%");A(D,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\textunderscore");A(D,Q,pe,"∠","\\angle",!0);A(D,Q,pe,"∞","\\infty",!0);A(D,Q,pe,"′","\\prime");A(D,Q,pe,"△","\\triangle");A(D,Q,pe,"Γ","\\Gamma",!0);A(D,Q,pe,"Δ","\\Delta",!0);A(D,Q,pe,"Θ","\\Theta",!0);A(D,Q,pe,"Λ","\\Lambda",!0);A(D,Q,pe,"Ξ","\\Xi",!0);A(D,Q,pe,"Π","\\Pi",!0);A(D,Q,pe,"Σ","\\Sigma",!0);A(D,Q,pe,"Υ","\\Upsilon",!0);A(D,Q,pe,"Φ","\\Phi",!0);A(D,Q,pe,"Ψ","\\Psi",!0);A(D,Q,pe,"Ω","\\Omega",!0);A(D,Q,pe,"A","Α");A(D,Q,pe,"B","Β");A(D,Q,pe,"E","Ε");A(D,Q,pe,"Z","Ζ");A(D,Q,pe,"H","Η");A(D,Q,pe,"I","Ι");A(D,Q,pe,"K","Κ");A(D,Q,pe,"M","Μ");A(D,Q,pe,"N","Ν");A(D,Q,pe,"O","Ο");A(D,Q,pe,"P","Ρ");A(D,Q,pe,"T","Τ");A(D,Q,pe,"X","Χ");A(D,Q,pe,"¬","\\neg",!0);A(D,Q,pe,"¬","\\lnot");A(D,Q,pe,"⊤","\\top");A(D,Q,pe,"⊥","\\bot");A(D,Q,pe,"∅","\\emptyset");A(D,le,pe,"∅","\\varnothing");A(D,Q,St,"α","\\alpha",!0);A(D,Q,St,"β","\\beta",!0);A(D,Q,St,"γ","\\gamma",!0);A(D,Q,St,"δ","\\delta",!0);A(D,Q,St,"ϵ","\\epsilon",!0);A(D,Q,St,"ζ","\\zeta",!0);A(D,Q,St,"η","\\eta",!0);A(D,Q,St,"θ","\\theta",!0);A(D,Q,St,"ι","\\iota",!0);A(D,Q,St,"κ","\\kappa",!0);A(D,Q,St,"λ","\\lambda",!0);A(D,Q,St,"μ","\\mu",!0);A(D,Q,St,"ν","\\nu",!0);A(D,Q,St,"ξ","\\xi",!0);A(D,Q,St,"ο","\\omicron",!0);A(D,Q,St,"π","\\pi",!0);A(D,Q,St,"ρ","\\rho",!0);A(D,Q,St,"σ","\\sigma",!0);A(D,Q,St,"τ","\\tau",!0);A(D,Q,St,"υ","\\upsilon",!0);A(D,Q,St,"ϕ","\\phi",!0);A(D,Q,St,"χ","\\chi",!0);A(D,Q,St,"ψ","\\psi",!0);A(D,Q,St,"ω","\\omega",!0);A(D,Q,St,"ε","\\varepsilon",!0);A(D,Q,St,"ϑ","\\vartheta",!0);A(D,Q,St,"ϖ","\\varpi",!0);A(D,Q,St,"ϱ","\\varrho",!0);A(D,Q,St,"ς","\\varsigma",!0);A(D,Q,St,"φ","\\varphi",!0);A(D,Q,nt,"∗","*",!0);A(D,Q,nt,"+","+");A(D,Q,nt,"−","-",!0);A(D,Q,nt,"⋅","\\cdot",!0);A(D,Q,nt,"∘","\\circ",!0);A(D,Q,nt,"÷","\\div",!0);A(D,Q,nt,"±","\\pm",!0);A(D,Q,nt,"×","\\times",!0);A(D,Q,nt,"∩","\\cap",!0);A(D,Q,nt,"∪","\\cup",!0);A(D,Q,nt,"∖","\\setminus",!0);A(D,Q,nt,"∧","\\land");A(D,Q,nt,"∨","\\lor");A(D,Q,nt,"∧","\\wedge",!0);A(D,Q,nt,"∨","\\vee",!0);A(D,Q,pe,"√","\\surd");A(D,Q,Ri,"⟨","\\langle",!0);A(D,Q,Ri,"∣","\\lvert");A(D,Q,Ri,"∥","\\lVert");A(D,Q,Ps,"?","?");A(D,Q,Ps,"!","!");A(D,Q,Ps,"⟩","\\rangle",!0);A(D,Q,Ps,"∣","\\rvert");A(D,Q,Ps,"∥","\\rVert");A(D,Q,ce,"=","=");A(D,Q,ce,":",":");A(D,Q,ce,"≈","\\approx",!0);A(D,Q,ce,"≅","\\cong",!0);A(D,Q,ce,"≥","\\ge");A(D,Q,ce,"≥","\\geq",!0);A(D,Q,ce,"←","\\gets");A(D,Q,ce,">","\\gt",!0);A(D,Q,ce,"∈","\\in",!0);A(D,Q,ce,"","\\@not");A(D,Q,ce,"⊂","\\subset",!0);A(D,Q,ce,"⊃","\\supset",!0);A(D,Q,ce,"⊆","\\subseteq",!0);A(D,Q,ce,"⊇","\\supseteq",!0);A(D,le,ce,"⊈","\\nsubseteq",!0);A(D,le,ce,"⊉","\\nsupseteq",!0);A(D,Q,ce,"⊨","\\models");A(D,Q,ce,"←","\\leftarrow",!0);A(D,Q,ce,"≤","\\le");A(D,Q,ce,"≤","\\leq",!0);A(D,Q,ce,"<","\\lt",!0);A(D,Q,ce,"→","\\rightarrow",!0);A(D,Q,ce,"→","\\to");A(D,le,ce,"≱","\\ngeq",!0);A(D,le,ce,"≰","\\nleq",!0);A(D,Q,wl," ","\\ ");A(D,Q,wl," ","\\space");A(D,Q,wl," ","\\nobreakspace");A(Le,Q,wl," ","\\ ");A(Le,Q,wl," "," ");A(Le,Q,wl," ","\\space");A(Le,Q,wl," ","\\nobreakspace");A(D,Q,wl,null,"\\nobreak");A(D,Q,wl,null,"\\allowbreak");A(D,Q,my,",",",");A(D,Q,my,";",";");A(D,le,nt,"⊼","\\barwedge",!0);A(D,le,nt,"⊻","\\veebar",!0);A(D,Q,nt,"⊙","\\odot",!0);A(D,Q,nt,"⊕","\\oplus",!0);A(D,Q,nt,"⊗","\\otimes",!0);A(D,Q,pe,"∂","\\partial",!0);A(D,Q,nt,"⊘","\\oslash",!0);A(D,le,nt,"⊚","\\circledcirc",!0);A(D,le,nt,"⊡","\\boxdot",!0);A(D,Q,nt,"△","\\bigtriangleup");A(D,Q,nt,"▽","\\bigtriangledown");A(D,Q,nt,"†","\\dagger");A(D,Q,nt,"⋄","\\diamond");A(D,Q,nt,"⋆","\\star");A(D,Q,nt,"◃","\\triangleleft");A(D,Q,nt,"▹","\\triangleright");A(D,Q,Ri,"{","\\{");A(Le,Q,pe,"{","\\{");A(Le,Q,pe,"{","\\textbraceleft");A(D,Q,Ps,"}","\\}");A(Le,Q,pe,"}","\\}");A(Le,Q,pe,"}","\\textbraceright");A(D,Q,Ri,"{","\\lbrace");A(D,Q,Ps,"}","\\rbrace");A(D,Q,Ri,"[","\\lbrack",!0);A(Le,Q,pe,"[","\\lbrack",!0);A(D,Q,Ps,"]","\\rbrack",!0);A(Le,Q,pe,"]","\\rbrack",!0);A(D,Q,Ri,"(","\\lparen",!0);A(D,Q,Ps,")","\\rparen",!0);A(Le,Q,pe,"<","\\textless",!0);A(Le,Q,pe,">","\\textgreater",!0);A(D,Q,Ri,"⌊","\\lfloor",!0);A(D,Q,Ps,"⌋","\\rfloor",!0);A(D,Q,Ri,"⌈","\\lceil",!0);A(D,Q,Ps,"⌉","\\rceil",!0);A(D,Q,pe,"\\","\\backslash");A(D,Q,pe,"∣","|");A(D,Q,pe,"∣","\\vert");A(Le,Q,pe,"|","\\textbar",!0);A(D,Q,pe,"∥","\\|");A(D,Q,pe,"∥","\\Vert");A(Le,Q,pe,"∥","\\textbardbl");A(Le,Q,pe,"~","\\textasciitilde");A(Le,Q,pe,"\\","\\textbackslash");A(Le,Q,pe,"^","\\textasciicircum");A(D,Q,ce,"↑","\\uparrow",!0);A(D,Q,ce,"⇑","\\Uparrow",!0);A(D,Q,ce,"↓","\\downarrow",!0);A(D,Q,ce,"⇓","\\Downarrow",!0);A(D,Q,ce,"↕","\\updownarrow",!0);A(D,Q,ce,"⇕","\\Updownarrow",!0);A(D,Q,Lr,"∐","\\coprod");A(D,Q,Lr,"⋁","\\bigvee");A(D,Q,Lr,"⋀","\\bigwedge");A(D,Q,Lr,"⨄","\\biguplus");A(D,Q,Lr,"⋂","\\bigcap");A(D,Q,Lr,"⋃","\\bigcup");A(D,Q,Lr,"∫","\\int");A(D,Q,Lr,"∫","\\intop");A(D,Q,Lr,"∬","\\iint");A(D,Q,Lr,"∭","\\iiint");A(D,Q,Lr,"∏","\\prod");A(D,Q,Lr,"∑","\\sum");A(D,Q,Lr,"⨂","\\bigotimes");A(D,Q,Lr,"⨁","\\bigoplus");A(D,Q,Lr,"⨀","\\bigodot");A(D,Q,Lr,"∮","\\oint");A(D,Q,Lr,"∯","\\oiint");A(D,Q,Lr,"∰","\\oiiint");A(D,Q,Lr,"⨆","\\bigsqcup");A(D,Q,Lr,"∫","\\smallint");A(Le,Q,Kh,"…","\\textellipsis");A(D,Q,Kh,"…","\\mathellipsis");A(Le,Q,Kh,"…","\\ldots",!0);A(D,Q,Kh,"…","\\ldots",!0);A(D,Q,Kh,"⋯","\\@cdots",!0);A(D,Q,Kh,"⋱","\\ddots",!0);A(D,Q,pe,"⋮","\\varvdots");A(Le,Q,pe,"⋮","\\varvdots");A(D,Q,sr,"ˊ","\\acute");A(D,Q,sr,"ˋ","\\grave");A(D,Q,sr,"¨","\\ddot");A(D,Q,sr,"~","\\tilde");A(D,Q,sr,"ˉ","\\bar");A(D,Q,sr,"˘","\\breve");A(D,Q,sr,"ˇ","\\check");A(D,Q,sr,"^","\\hat");A(D,Q,sr,"⃗","\\vec");A(D,Q,sr,"˙","\\dot");A(D,Q,sr,"˚","\\mathring");A(D,Q,St,"","\\@imath");A(D,Q,St,"","\\@jmath");A(D,Q,pe,"ı","ı");A(D,Q,pe,"ȷ","ȷ");A(Le,Q,pe,"ı","\\i",!0);A(Le,Q,pe,"ȷ","\\j",!0);A(Le,Q,pe,"ß","\\ss",!0);A(Le,Q,pe,"æ","\\ae",!0);A(Le,Q,pe,"œ","\\oe",!0);A(Le,Q,pe,"ø","\\o",!0);A(Le,Q,pe,"Æ","\\AE",!0);A(Le,Q,pe,"Œ","\\OE",!0);A(Le,Q,pe,"Ø","\\O",!0);A(Le,Q,sr,"ˊ","\\'");A(Le,Q,sr,"ˋ","\\`");A(Le,Q,sr,"ˆ","\\^");A(Le,Q,sr,"˜","\\~");A(Le,Q,sr,"ˉ","\\=");A(Le,Q,sr,"˘","\\u");A(Le,Q,sr,"˙","\\.");A(Le,Q,sr,"¸","\\c");A(Le,Q,sr,"˚","\\r");A(Le,Q,sr,"ˇ","\\v");A(Le,Q,sr,"¨",'\\"');A(Le,Q,sr,"˝","\\H");A(Le,Q,sr,"◯","\\textcircled");var H$={"--":!0,"---":!0,"``":!0,"''":!0};A(Le,Q,pe,"–","--",!0);A(Le,Q,pe,"–","\\textendash");A(Le,Q,pe,"—","---",!0);A(Le,Q,pe,"—","\\textemdash");A(Le,Q,pe,"‘","`",!0);A(Le,Q,pe,"‘","\\textquoteleft");A(Le,Q,pe,"’","'",!0);A(Le,Q,pe,"’","\\textquoteright");A(Le,Q,pe,"“","``",!0);A(Le,Q,pe,"“","\\textquotedblleft");A(Le,Q,pe,"”","''",!0);A(Le,Q,pe,"”","\\textquotedblright");A(D,Q,pe,"°","\\degree",!0);A(Le,Q,pe,"°","\\degree");A(Le,Q,pe,"°","\\textdegree",!0);A(D,Q,pe,"£","\\pounds");A(D,Q,pe,"£","\\mathsterling",!0);A(Le,Q,pe,"£","\\pounds");A(Le,Q,pe,"£","\\textsterling",!0);A(D,le,pe,"✠","\\maltese");A(Le,le,pe,"✠","\\maltese");var V_='0123456789/@."';for(var h4=0;h40)return va(i,h,s,n,a.concat(f));if(c){var m,g;if(c==="boldsymbol"){var x=ebe(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else l?(m=W$[c].fontName,g=[c]):(m=Tx(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if(py(i,m,s).metrics)return va(i,m,s,n,a.concat(g));if(H$.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Sc(t.classes)!==Sc(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},rbe=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Gs=function(e,n,r,s){var i=new lp(e,n,r,s);return QO(i),i},V$=(t,e,n,r)=>new lp(t,e,n,r),sbe=function(e,n,r){var s=Gs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ve(s.height),s.maxFontSize=1,s},ibe=function(e,n,r,s){var i=new $O(e,n,r,s);return QO(i),i},U$=function(e){var n=new op(e);return QO(n),n},abe=function(e,n){return e instanceof op?Gs([],[e],n):e},obe=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=Gs(["mspace"],[],e),r=cr(t,e);return n.style.marginRight=Ve(r),n},Tx=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},W$={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"}},G$={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},ube=function(e,n){var[r,s,i]=G$[e],a=new kc(r),l=new ml([a],{width:Ve(s),height:Ve(i),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=V$(["overlay"],[l],n);return c.height=i,c.style.height=Ve(i),c.style.width=Ve(s),c},we={fontMap:W$,makeSymbol:va,mathsym:Jye,makeSpan:Gs,makeSvgSpan:V$,makeLineSpan:sbe,makeAnchor:ibe,makeFragment:U$,wrapFragment:abe,makeVList:lbe,makeOrd:tbe,makeGlue:cbe,staticSvg:ube,svgData:G$,tryCombineChars:rbe},or={number:3,unit:"mu"},iu={number:4,unit:"mu"},Fo={number:5,unit:"mu"},dbe={mord:{mop:or,mbin:iu,mrel:Fo,minner:or},mop:{mord:or,mop:or,mrel:Fo,minner:or},mbin:{mord:iu,mop:iu,mopen:iu,minner:iu},mrel:{mord:Fo,mop:Fo,mopen:Fo,minner:Fo},mopen:{},mclose:{mop:or,mbin:iu,mrel:Fo,minner:or},mpunct:{mord:or,mop:or,mrel:Fo,mopen:or,mclose:or,mpunct:or,minner:or},minner:{mord:or,mop:or,mbin:iu,mrel:Fo,mopen:or,mpunct:or,minner:or}},hbe={mord:{mop:or},mop:{mord:or,mop:or},mbin:{},mrel:{},mopen:{},mclose:{mop:or},mpunct:{},minner:{mop:or}},X$={},ov={},lv={};function Ke(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c{var S=w.classes[0],k=y.classes[0];S==="mbin"&&mbe.includes(k)?w.classes[0]="mord":k==="mbin"&&fbe.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),Y_(i,(y,w)=>{var S=sk(w),k=sk(y),N=S&&k?y.hasClass("mtight")?hbe[S][k]:dbe[S][k]:null;if(N)return we.makeGlue(N,h)},{node:m},g,x),i},Y_=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},Y$=function(e){return e instanceof op||e instanceof $O||e instanceof lp&&e.hasClass("enclosing")?e:null},xbe=function t(e,n){var r=Y$(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},sk=function(e,n){return e?(n&&(e=xbe(e,n)),gbe[e.classes[0]]||null):null},x0=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return pl(n.concat(r))},gn=function(e,n,r){if(!e)return pl();if(ov[e.type]){var s=ov[e.type](e,n);if(r&&n.size!==r.size){s=pl(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Be("Got group of unknown type: '"+e.type+"'")};function Ex(t,e){var n=pl(["base"],t,e),r=pl(["strut"]);return r.style.height=Ve(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ve(-n.depth)),n.children.unshift(r),n}function ik(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Ur(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],l=0;l0&&(i.push(Ex(a,e)),a=[]),i.push(r[l]));a.length>0&&i.push(Ex(a,e));var h;n?(h=Ex(Ur(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var f=pl(["katex-html"],i);if(f.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=Ve(f.height+f.depth),f.depth&&(m.style.verticalAlign=Ve(-f.depth))}return f}function K$(t){return new op(t)}class Ni{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=Sc(this.classes));for(var r=0;r0&&(e+=' class ="'+On.escape(Sc(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class eo{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return On.escape(this.toText())}toText(){return this.text}}class vbe{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Ve(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Ie={MathNode:Ni,TextNode:eo,SpaceNode:vbe,newDocumentFragment:K$},oa=function(e,n,r){return Gn[n][e]&&Gn[n][e].replace&&e.charCodeAt(0)!==55349&&!(H$.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Gn[n][e].replace),new Ie.TextNode(e)},HO=function(e){return e.length===1?e[0]:new Ie.MathNode("mrow",e)},VO=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Gn[s][i]&&Gn[s][i].replace&&(i=Gn[s][i].replace);var a=we.fontMap[r].fontName;return FO(i,a,s)?we.fontMap[r].variant:null};function g4(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof eo&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof eo&&n.text===","}else return!1}var ui=function(e,n,r){if(e.length===1){var s=Un(e[0],n);return r&&s instanceof Ni&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,l=0;l=1&&(a.type==="mn"||g4(a))){var h=c.children[0];h instanceof Ni&&h.type==="mn"&&(h.children=[...a.children,...h.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var f=a.children[0];if(f instanceof eo&&f.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof eo&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},Oc=function(e,n,r){return HO(ui(e,n,r))},Un=function(e,n){if(!e)return new Ie.MathNode("mrow");if(lv[e.type]){var r=lv[e.type](e,n);return r}else throw new Be("Got group of unknown type: '"+e.type+"'")};function K_(t,e,n,r,s){var i=ui(t,n),a;i.length===1&&i[0]instanceof Ni&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Ie.MathNode("mrow",i);var l=new Ie.MathNode("annotation",[new Ie.TextNode(e)]);l.setAttribute("encoding","application/x-tex");var c=new Ie.MathNode("semantics",[a,l]),h=new Ie.MathNode("math",[c]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var f=s?"katex":"katex-mathml";return we.makeSpan([f],[h])}var Z$=function(e){return new Xo({style:e.displayMode?kt.DISPLAY:kt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},J$=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=we.makeSpan(r,[e])}return e},ybe=function(e,n,r){var s=Z$(r),i;if(r.output==="mathml")return K_(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=ik(e,s);i=we.makeSpan(["katex"],[a])}else{var l=K_(e,n,s,r.displayMode,!1),c=ik(e,s);i=we.makeSpan(["katex"],[l,c])}return J$(i,r)},bbe=function(e,n,r){var s=Z$(r),i=ik(e,s),a=we.makeSpan(["katex"],[i]);return J$(a,r)},wbe={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":"="},Sbe=function(e){var n=new Ie.MathNode("mo",[new Ie.TextNode(wbe[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},kbe={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]},Obe=function(e){return e.type==="ordgroup"?e.body.length:1},jbe=function(e,n){function r(){var l=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var h=e,f=Obe(h.base),m,g,x;if(f>5)c==="widehat"||c==="widecheck"?(m=420,l=2364,x=.42,g=c+"4"):(m=312,l=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][f];c==="widehat"||c==="widecheck"?(l=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(l=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new kc(g),S=new ml([w],{width:"100%",height:Ve(x),viewBox:"0 0 "+l+" "+m,preserveAspectRatio:"none"});return{span:we.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],N=kbe[c],[C,T,_]=N,E=_/1e3,M=C.length,q,L;if(M===1){var I=N[3];q=["hide-tail"],L=[I]}else if(M===2)q=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(M===3)q=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support - `+M+" children.");for(var $=0;$0&&(s.style.minWidth=Ve(i)),s},Nbe=function(e,n,r,s,i){var a,l=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=we.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new nk({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new nk({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new ml(h,{width:"100%",height:Ve(l)});a=we.makeSvgSpan([],[f],i)}return a.height=l,a.style.height=Ve(l),a},gl={encloseSpan:Nbe,mathMLnode:Sbe,svgSpan:jbe};function Ft(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function UO(t){var e=gy(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function gy(t){return t&&(t.type==="atom"||Kye.hasOwnProperty(t.type))?t:null}var WO=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=Ft(t.base,"accent"),n=r.base,t.base=n,s=Xye(gn(t,e)),t.base=r):(r=Ft(t,"accent"),n=r.base);var i=gn(n,e.havingCrampedStyle()),a=r.isShifty&&On.isCharacterBox(n),l=0;if(a){var c=On.getBaseElem(n),h=gn(c,e.havingCrampedStyle());l=H_(h).skew}var f=r.label==="\\c",m=f?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=gl.svgSpan(r,e),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:l>0?{width:"calc(100% - "+Ve(2*l)+")",marginLeft:Ve(2*l)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=we.staticSvg("vec",e),y=we.svgData.vec[1]):(x=we.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=H_(x),x.italic=0,y=x.width,f&&(m+=x.depth)),g=we.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=l;w||(S-=y/2),g.style.left=Ve(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=we.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},eQ=(t,e)=>{var n=t.isStretchy?gl.mathMLnode(t.label):new Ie.MathNode("mo",[oa(t.label,t.mode)]),r=new Ie.MathNode("mover",[Un(t.base,e),n]);return r.setAttribute("accent","true"),r},Cbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Ke({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:(t,e)=>{var n=cv(e[0]),r=!Cbe.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:WO,mathmlBuilder:eQ});Ke({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:WO,mathmlBuilder:eQ});Ke({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=gn(t.base,e),r=gl.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=gl.mathMLnode(t.label),r=new Ie.MathNode("munder",[Un(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var _x=t=>{var e=new Ie.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Ke({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(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=we.wrapFragment(gn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=we.wrapFragment(gn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var l=gl.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*l.height,h=-e.fontMetrics().axisHeight-.5*l.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var f;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*l.height+.111;f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:l,shift:c},{type:"elem",elem:a,shift:m}]},e)}else f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:l,shift:c}]},e);return f.children[0].children[0].children[1].classes.push("svg-align"),we.makeSpan(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=gl.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=_x(Un(t.body,e));if(t.below){var i=_x(Un(t.below,e));r=new Ie.MathNode("munderover",[n,i,s])}else r=new Ie.MathNode("mover",[n,s])}else if(t.below){var a=_x(Un(t.below,e));r=new Ie.MathNode("munder",[n,a])}else r=_x(),r=new Ie.MathNode("mover",[n,r]);return r}});var Tbe=we.makeSpan;function tQ(t,e){var n=Ur(t.body,e,!0);return Tbe([t.mclass],n,e)}function nQ(t,e){var n,r=ui(t.body,e);return t.mclass==="minner"?n=new Ie.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Ie.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Ie.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Ke({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:wr(s),isCharacterBox:On.isCharacterBox(s)}},htmlBuilder:tQ,mathmlBuilder:nQ});var xy=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Ke({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:xy(e[0]),body:wr(e[1]),isCharacterBox:On.isCharacterBox(e[1])}}});Ke({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=xy(s):a="mrel";var l={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:wr(s)},c={type:"supsub",mode:i.mode,base:l,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:On.isCharacterBox(c)}},htmlBuilder:tQ,mathmlBuilder:nQ});Ke({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:xy(e[0]),body:wr(e[0])}},htmlBuilder(t,e){var n=Ur(t.body,e,!0),r=we.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=ui(t.body,e),r=new Ie.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Ebe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},Z_=()=>({type:"styling",body:[],mode:"math",style:"display"}),J_=t=>t.type==="textord"&&t.text==="@",_be=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Mbe(t,e,n){var r=Ebe[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),l=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,l]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Abe(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Be("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;xAV=|." after @',a[c]);var y=Mbe(h,f,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),l=Z_()}i%2===0?r.push(l):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=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:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Ke({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=we.wrapFragment(gn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Ve(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Ie.MathNode("mrow",[Un(t.label,e)]);return n=new Ie.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ie.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Ke({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=we.wrapFragment(gn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Ie.MathNode("mrow",[Un(t.fragment,e)])}});Ke({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=Ft(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new Be("\\@char with invalid code point "+i);return c<=65535?h=String.fromCharCode(c):(c-=65536,h=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var rQ=(t,e)=>{var n=Ur(t.body,e.withColor(t.color),!1);return we.makeFragment(n)},sQ=(t,e)=>{var n=ui(t.body,e.withColor(t.color)),r=new Ie.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Ke({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=Ft(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:wr(s)}},htmlBuilder:rQ,mathmlBuilder:sQ});Ke({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=Ft(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:rQ,mathmlBuilder:sQ});Ke({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&Ft(s,"size").value}},htmlBuilder(t,e){var n=we.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Ve(cr(t.size,e)))),n},mathmlBuilder(t,e){var n=new Ie.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Ve(cr(t.size,e)))),n}});var ak={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},iQ=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Be("Expected a control sequence",t);return e},Rbe=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},aQ=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Ke({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(ak[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=ak[r.text]),Ft(e.parseFunction(),"internal");throw new Be("Invalid token after macro prefix",r)}});Ke({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Be("Expected a control sequence",r);for(var i=0,a,l=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),l[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Be('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Be('Argument number "'+r.text+'" out of order');i++,l.push([])}else{if(r.text==="EOF")throw new Be("Expected a macro definition");l[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:l},n===ak[n]),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=iQ(e.gullet.popToken());e.gullet.consumeSpaces();var s=Rbe(e);return aQ(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=iQ(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return aQ(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var gm=function(e,n,r){var s=Gn.math[e]&&Gn.math[e].replace,i=FO(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},GO=function(e,n,r,s){var i=r.havingBaseStyle(n),a=we.makeSpan(s.concat(i.sizingClasses(r)),[e],r),l=i.sizeMultiplier/r.sizeMultiplier;return a.height*=l,a.depth*=l,a.maxFontSize=i.sizeMultiplier,a},oQ=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Ve(i),e.height-=i,e.depth+=i},Dbe=function(e,n,r,s,i,a){var l=we.makeSymbol(e,"Main-Regular",i,s),c=GO(l,n,s,a);return r&&oQ(c,s,n),c},zbe=function(e,n,r,s){return we.makeSymbol(e,"Size"+n+"-Regular",r,s)},lQ=function(e,n,r,s,i,a){var l=zbe(e,n,i,s),c=GO(we.makeSpan(["delimsizing","size"+n],[l],s),kt.TEXT,s,a);return r&&oQ(c,s,kt.TEXT),c},x4=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=we.makeSpan(["delimsizinginner",s],[we.makeSpan([],[we.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},v4=function(e,n,r){var s=Ja["Size4-Regular"][e.charCodeAt(0)]?Ja["Size4-Regular"][e.charCodeAt(0)][4]:Ja["Size1-Regular"][e.charCodeAt(0)][4],i=new kc("inner",qye(e,Math.round(1e3*n))),a=new ml([i],{width:Ve(s),height:Ve(n),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),l=we.makeSvgSpan([],[a],r);return l.height=n,l.style.height=Ve(n),l.style.width=Ve(s),{type:"elem",elem:l}},ok=.008,Mx={type:"kern",size:-1*ok},Pbe=["|","\\lvert","\\rvert","\\vert"],Lbe=["\\|","\\lVert","\\rVert","\\Vert"],cQ=function(e,n,r,s,i,a){var l,c,h,f,m="",g=0;l=h=f=e,c=null;var x="Size1-Regular";e==="\\uparrow"?h=f="⏐":e==="\\Uparrow"?h=f="‖":e==="\\downarrow"?l=h="⏐":e==="\\Downarrow"?l=h="‖":e==="\\updownarrow"?(l="\\uparrow",h="⏐",f="\\downarrow"):e==="\\Updownarrow"?(l="\\Uparrow",h="‖",f="\\Downarrow"):Pbe.includes(e)?(h="∣",m="vert",g=333):Lbe.includes(e)?(h="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(l="⎡",h="⎢",f="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(l="⎤",h="⎥",f="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(h=l="⎢",f="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(l="⎡",h=f="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(h=l="⎥",f="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(l="⎤",h=f="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(l="⎛",h="⎜",f="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(l="⎞",h="⎟",f="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(l="⎧",c="⎨",f="⎩",h="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(l="⎫",c="⎬",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(l="⎧",f="⎩",h="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(l="⎫",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(l="⎧",f="⎭",h="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(l="⎫",f="⎩",h="⎪",x="Size4-Regular");var y=gm(l,x,i),w=y.height+y.depth,S=gm(h,x,i),k=S.height+S.depth,N=gm(f,x,i),C=N.height+N.depth,T=0,_=1;if(c!==null){var E=gm(c,x,i);T=E.height+E.depth,_=2}var M=w+C+T,q=Math.max(0,Math.ceil((n-M)/(_*k))),L=M+q*_*k,I=s.fontMetrics().axisHeight;r&&(I*=s.sizeMultiplier);var $=L/2-I,V=[];if(m.length>0){var ee=L-w-C,z=Math.round(L*1e3),H=Fye(m,Math.round(ee*1e3)),P=new kc(m,H),W=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",X=new ml([P],{width:W,height:J,viewBox:"0 0 "+g+" "+z}),R=we.makeSvgSpan([],[X],s);R.height=z/1e3,R.style.width=W,R.style.height=J,V.push({type:"elem",elem:R})}else{if(V.push(x4(f,x,i)),V.push(Mx),c===null){var se=L-w-C+2*ok;V.push(v4(h,se,s))}else{var G=(L-w-C-T)/2+2*ok;V.push(v4(h,G,s)),V.push(Mx),V.push(x4(c,x,i)),V.push(Mx),V.push(v4(h,G,s))}V.push(Mx),V.push(x4(l,x,i))}var F=s.havingBaseStyle(kt.TEXT),U=we.makeVList({positionType:"bottom",positionData:$,children:V},F);return GO(we.makeSpan(["delimsizing","mult"],[U],F),kt.TEXT,s,a)},y4=80,b4=.08,w4=function(e,n,r,s,i){var a=Bye(e,s,r),l=new kc(e,a),c=new ml([l],{width:"400em",height:Ve(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return we.makeSvgSpan(["hide-tail"],[c],i)},Ibe=function(e,n){var r=n.havingBaseSizing(),s=fQ("\\surd",e*r.sizeMultiplier,hQ,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),l,c=0,h=0,f=0,m;return s.type==="small"?(f=1e3+1e3*a+y4,e<1?i=1:e<1.4&&(i=.7),c=(1+a+b4)/i,h=(1+a)/i,l=w4("sqrtMain",c,f,a,n),l.style.minWidth="0.853em",m=.833/i):s.type==="large"?(f=(1e3+y4)*Lm[s.size],h=(Lm[s.size]+a)/i,c=(Lm[s.size]+a+b4)/i,l=w4("sqrtSize"+s.size,c,f,a,n),l.style.minWidth="1.02em",m=1/i):(c=e+a+b4,h=e+a,f=Math.floor(1e3*e+a)+y4,l=w4("sqrtTall",c,f,a,n),l.style.minWidth="0.742em",m=1.056),l.height=h,l.style.height=Ve(c),{span:l,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},uQ=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],Bbe=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],dQ=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Lm=[0,1.2,1.8,2.4,3],qbe=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),uQ.includes(e)||dQ.includes(e))return lQ(e,n,!1,r,s,i);if(Bbe.includes(e))return cQ(e,Lm[n],!1,r,s,i);throw new Be("Illegal delimiter: '"+e+"'")},Fbe=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],$be=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"stack"}],hQ=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],Qbe=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},fQ=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},mQ=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var l;dQ.includes(e)?l=Fbe:uQ.includes(e)?l=hQ:l=$be;var c=fQ(e,n,l,s);return c.type==="small"?Dbe(e,c.style,r,s,i,a):c.type==="large"?lQ(e,c.size,r,s,i,a):cQ(e,n,r,s,i,a)},Hbe=function(e,n,r,s,i,a){var l=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,h=5/s.fontMetrics().ptPerEm,f=Math.max(n-l,r+l),m=Math.max(f/500*c,2*f-h);return mQ(e,m,!0,s,i,a)},al={sqrtImage:Ibe,sizedDelim:qbe,sizeToMaxHeight:Lm,customSizedDelim:mQ,leftRightDelim:Hbe},eM={"\\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}},Vbe=["(","\\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 vy(t,e){var n=gy(t);if(n&&Vbe.includes(n.text))return n;throw n?new Be("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Be("Invalid delimiter type '"+t.type+"'",t)}Ke({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:(t,e)=>{var n=vy(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:eM[t.funcName].size,mclass:eM[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?we.makeSpan([t.mclass]):al.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(oa(t.delim,t.mode));var n=new Ie.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ve(al.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function tM(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ke({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Be("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:vy(e[0],t).text,color:n}}});Ke({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=vy(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=Ft(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{tM(t);for(var n=Ur(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{tM(t);var n=ui(t.body,e);if(t.left!=="."){var r=new Ie.MathNode("mo",[oa(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Ie.MathNode("mo",[oa(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return HO(n)}});Ke({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=vy(e[0],t);if(!t.parser.leftrightDepth)throw new Be("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=x0(e,[]);else{n=al.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?oa("|","text"):oa(t.delim,t.mode),r=new Ie.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var XO=(t,e)=>{var n=we.wrapFragment(gn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,l=On.isCharacterBox(t.body);if(r==="sout")i=we.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=cr({number:.6,unit:"pt"},e),h=cr({number:.35,unit:"ex"},e),f=e.havingBaseSizing();s=s/f.sizeMultiplier;var m=n.height+n.depth+c+h;n.style.paddingLeft=Ve(m/2+c);var g=Math.floor(1e3*m*s),x=Lye(g),y=new ml([new kc("phase",x)],{width:"400em",height:Ve(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=we.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Ve(m),a=n.depth+c+h}else{/cancel/.test(r)?l||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=l?.2:0,S=w),i=gl.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ve(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Ve(k),i.style.borderRightWidth=Ve(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var N;if(t.backgroundColor)N=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var C=/cancel|phase/.test(r)?["svg-align"]:[];N=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:C}]},e)}return/cancel/.test(r)&&(N.height=n.height,N.depth=n.depth),/cancel/.test(r)&&!l?we.makeSpan(["mord","cancel-lap"],[N],e):we.makeSpan(["mord"],[N],e)},YO=(t,e)=>{var n=0,r=new Ie.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Un(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Ke({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Ft(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:XO,mathmlBuilder:YO});Ke({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=Ft(e[0],"color-token").color,a=Ft(e[1],"color-token").color,l=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:l}},htmlBuilder:XO,mathmlBuilder:YO});Ke({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Ke({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:XO,mathmlBuilder:YO});Ke({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var pQ={};function fo(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,l={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c{var e=t.parser.settings;if(!e.displayMode)throw new Be("{"+t.envName+"} can be used only in display mode.")};function KO(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function Dc(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:l,autoTag:c,singleRow:h,emptySingleRow:f,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new Be("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],S=[],k=[],N=c!=null?[]:void 0;function C(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){N&&(t.gullet.macros.get("\\df@tag")?(N.push(t.subparse([new _i("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):N.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),k.push(nM(t));;){var _=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),_={type:"ordgroup",mode:t.mode,body:_},n&&(_={type:"styling",mode:t.mode,style:n,body:[_]}),y.push(_);var E=t.fetch().text;if(E==="&"){if(m&&y.length===m){if(h||l)throw new Be("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){T(),y.length===1&&_.type==="styling"&&_.body[0].body.length===0&&(w.length>1||!f)&&w.pop(),k.length0&&(C+=.25),h.push({pos:C,isDashed:$e[bt]})}for(T(a[0]),r=0;r0&&($+=N,M<$&&(M=$),$=0)),e.addJot&&(M+=w),q.height=E,q.depth=M,C+=E,q.pos=C,C+=M+$,c[r]=q,T(a[r+1])}var V=C/2+n.fontMetrics().axisHeight,ee=e.cols||[],z=[],H,P,W=[];if(e.tags&&e.tags.some($e=>$e))for(r=0;r=l)){var Y=void 0;(s>0||e.hskipBeforeAndAfter)&&(Y=On.deflt(G.pregap,g),Y!==0&&(H=we.makeSpan(["arraycolsep"],[]),H.style.width=Ve(Y),z.push(H)));var ae=[];for(r=0;r0){for(var Ge=we.makeLineSpan("hline",n,f),tt=we.makeLineSpan("hdashline",n,f),Xe=[{type:"elem",elem:c,shift:0}];h.length>0;){var je=h.pop(),Qe=je.pos-V;je.isDashed?Xe.push({type:"elem",elem:tt,shift:Qe}):Xe.push({type:"elem",elem:Ge,shift:Qe})}c=we.makeVList({positionType:"individualShift",children:Xe},n)}if(W.length===0)return we.makeSpan(["mord"],[c],n);var He=we.makeVList({positionType:"individualShift",children:W},n);return He=we.makeSpan(["tag"],[He],n),we.makeFragment([c,He])},Ube={c:"center ",l:"left ",r:"right "},po=function(e,n){for(var r=[],s=new Ie.MathNode("mtd",[],["mtr-glue"]),i=new Ie.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",S=!1,k=0,N=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",N-=1);for(var C=k;C0?"left ":"",g+=q[q.length-1].length>0?"right ":"";for(var L=1;L-1?"alignat":"align",i=e.envName==="split",a=Dc(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:KO(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),l,c=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var f="",m=0;m0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};fo({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=gy(e[0]),r=n?[e[0]]:Ft(e[0],"ordgroup").body,s=r.map(function(a){var l=UO(a),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 Be("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return Dc(t.parser,i,ZO(t.envName))},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new Be("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=Dc(t.parser,r,ZO(t.envName)),a=Math.max(0,...i.body.map(l=>l.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=Dc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=gy(e[0]),r=n?[e[0]]:Ft(e[0],"ordgroup").body,s=r.map(function(a){var l=UO(a),c=l.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new Be("Unknown column alignment: "+c,a)});if(s.length>1)throw new Be("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=Dc(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new Be("{subarray} can contain only one column");return i},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=Dc(t.parser,e,ZO(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:xQ,htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&yy(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:KO(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return Dc(t.parser,e,"display")},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:xQ,htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){yy(t);var e={autoTag:KO(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return Dc(t.parser,e,"display")},htmlBuilder:mo,mathmlBuilder:po});fo({type:"array",names:["CD"],props:{numArgs:0},handler(t){return yy(t),Abe(t.parser)},htmlBuilder:mo,mathmlBuilder:po});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");Ke({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Be(t.funcName+" valid only within array environment")}});var rM=pQ;Ke({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new Be("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return gn(t.body,r)},yQ=(t,e)=>{var n=t.font,r=e.withFont(n);return Un(t.body,r)},sM={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Ke({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=cv(e[0]),i=r;return i in sM&&(i=sM[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:vQ,mathmlBuilder:yQ});Ke({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=On.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:xy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Ke({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),l="math"+r.slice(1);return{type:"font",mode:i,font:l,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:vQ,mathmlBuilder:yQ});var bQ=(t,e)=>{var n=e;return t==="display"?n=n.id>=kt.SCRIPT.id?n.text():kt.DISPLAY:t==="text"&&n.size===kt.DISPLAY.size?n=kt.TEXT:t==="script"?n=kt.SCRIPT:t==="scriptscript"&&(n=kt.SCRIPTSCRIPT),n},JO=(t,e)=>{var n=bQ(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=gn(t.numer,i,e);if(t.continued){var l=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var S;if(f){var N=e.fontMetrics().axisHeight;x-a.depth-(N+.5*m){var n=new Ie.MathNode("mfrac",[Un(t.numer,e),Un(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=cr(t.barSize,e);n.setAttribute("linethickness",Ve(r))}var s=bQ(t.size,e.style);if(s.size!==e.style.size){n=new Ie.MathNode("mstyle",[n]);var i=s.size===kt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var a=[];if(t.leftDelim!=null){var l=new Ie.MathNode("mo",[new Ie.TextNode(t.leftDelim.replace("\\",""))]);l.setAttribute("fence","true"),a.push(l)}if(a.push(n),t.rightDelim!=null){var c=new Ie.MathNode("mo",[new Ie.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return HO(a)}return n};Ke({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,l=null,c=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,l="(",c=")";break;case"\\\\bracefrac":a=!1,l="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,l="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:l,rightDelim:c,size:h,barSize:null}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Ke({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){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:e.mode,replaceWith:s,token:r}}});var iM=["display","text","script","scriptscript"],aM=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Ke({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=cv(e[0]),a=i.type==="atom"&&i.family==="open"?aM(i.text):null,l=cv(e[1]),c=l.type==="atom"&&l.family==="close"?aM(l.text):null,h=Ft(e[2],"size"),f,m=null;h.isBlank?f=!0:(m=h.value,f=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=Ft(x.body[0],"textord");g=iM[Number(y.text)]}}else x=Ft(x,"textord"),g=iM[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:f,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:Ft(e[0],"size").value,token:s}}});Ke({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Sye(Ft(e[1],"infix").size),a=e[2],l=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:l,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:JO,mathmlBuilder:ej});var wQ=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?gn(t.sup,e.havingStyle(n.sup()),e):gn(t.sub,e.havingStyle(n.sub()),e),s=Ft(t.base,"horizBrace")):s=Ft(t,"horizBrace");var i=gn(s.base,e.havingBaseStyle(kt.DISPLAY)),a=gl.svgSpan(s,e),l;if(s.isOver?(l=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),l.children[0].children[0].children[1].classes.push("svg-align")):(l=we.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),l.children[0].children[0].children[0].classes.push("svg-align")),r){var c=we.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e);s.isOver?l=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):l=we.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return we.makeSpan(["mord",s.isOver?"mover":"munder"],[l],e)},Wbe=(t,e)=>{var n=gl.mathMLnode(t.label);return new Ie.MathNode(t.isOver?"mover":"munder",[Un(t.base,e),n])};Ke({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:wQ,mathmlBuilder:Wbe});Ke({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=Ft(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:wr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Ur(t.body,e,!1);return we.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=Oc(t.body,e);return n instanceof Ni||(n=new Ni("mrow",[n])),n.setAttribute("href",t.href),n}});Ke({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=Ft(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=Ft(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var l,c={};switch(r){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 h=i.split(","),f=0;f{var n=Ur(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=we.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>Oc(t.body,e)});Ke({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:wr(e[0]),mathml:wr(e[1])}},htmlBuilder:(t,e)=>{var n=Ur(t.html,e,!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>Oc(t.mathml,e)});var S4=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Be("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!q$(r))throw new Be("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ke({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},l="";if(n[0])for(var c=Ft(n[0],"raw").string,h=c.split(","),f=0;f{var n=cr(t.height,e),r=0;t.totalheight.number>0&&(r=cr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=cr(t.width,e));var i={height:Ve(n+r)};s>0&&(i.width=Ve(s)),r>0&&(i.verticalAlign=Ve(-r));var a=new Wye(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=cr(t.height,e),s=0;if(t.totalheight.number>0&&(s=cr(t.totalheight,e)-r,n.setAttribute("valign",Ve(-s))),n.setAttribute("height",Ve(r+s)),t.width.number>0){var i=cr(t.width,e);n.setAttribute("width",Ve(i))}return n.setAttribute("src",t.src),n}});Ke({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=Ft(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return we.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=cr(t.dimension,e);return new Ie.SpaceNode(n)}});Ke({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=we.makeSpan([],[gn(t.body,e)]),n=we.makeSpan(["inner"],[n],e)):n=we.makeSpan(["inner"],[gn(t.body,e)]);var r=we.makeSpan(["fix"],[]),s=we.makeSpan([t.alignment],[n,r],e),i=we.makeSpan(["strut"]);return i.style.height=Ve(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ve(-s.depth)),s.children.unshift(i),s=we.makeSpan(["thinbox"],[s],e),we.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Ke({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});Ke({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Be("Mismatched "+t.funcName)}});var oM=(t,e)=>{switch(e.style.size){case kt.DISPLAY.size:return t.display;case kt.TEXT.size:return t.text;case kt.SCRIPT.size:return t.script;case kt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Ke({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:wr(e[0]),text:wr(e[1]),script:wr(e[2]),scriptscript:wr(e[3])}},htmlBuilder:(t,e)=>{var n=oM(t,e),r=Ur(n,e,!1);return we.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=oM(t,e);return Oc(n,e)}});var SQ=(t,e,n,r,s,i,a)=>{t=we.makeSpan([],[t]);var l=n&&On.isCharacterBox(n),c,h;if(e){var f=gn(e,r.havingStyle(s.sup()),r);h={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var m=gn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(h&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=we.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=we.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(h){var w=t.depth+a;g=we.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!l){var k=we.makeSpan(["mspace"],[],r);k.style.marginRight=Ve(i),S.unshift(k)}return we.makeSpan(["mop","op-limits"],S,r)},kQ=["\\smallint"],Zh=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Ft(t.base,"op"),s=!0):i=Ft(t,"op");var a=e.style,l=!1;a.size===kt.DISPLAY.size&&i.symbol&&!kQ.includes(i.name)&&(l=!0);var c;if(i.symbol){var h=l?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=we.makeSymbol(i.name,h,"math",e,["mop","op-symbol",l?"large-op":"small-op"]),f.length>0){var m=c.italic,g=we.staticSvg(f+"Size"+(l?"2":"1"),e);c=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:l?.08:0}]},e),i.name="\\"+f,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=Ur(i.body,e,!0);x.length===1&&x[0]instanceof aa?(c=x[0],c.classes[0]="mop"):c=we.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new Ni("mo",[oa(t.name,t.mode)]),kQ.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ni("mo",ui(t.body,e));else{n=new Ni("mi",[new eo(t.name.slice(1))]);var r=new Ni("mo",[oa("⁡","text")]);t.parentIsSupSub?n=new Ni("mrow",[n,r]):n=K$([n,r])}return n},Gbe={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Ke({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=Gbe[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:Zh,mathmlBuilder:cp});Ke({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:wr(r)}},htmlBuilder:Zh,mathmlBuilder:cp});var Xbe={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Ke({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(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Zh,mathmlBuilder:cp});Ke({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:Zh,mathmlBuilder:cp});Ke({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=Xbe[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:Zh,mathmlBuilder:cp});var OQ=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=Ft(t.base,"operatorname"),s=!0):i=Ft(t,"operatorname");var a;if(i.body.length>0){for(var l=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=Ur(l,e.withFont("mathrm"),!0),h=0;h{for(var n=ui(t.body,e.withFont("mathrm")),r=!0,s=0;sf.toText()).join("");n=[new Ie.TextNode(l)]}var c=new Ie.MathNode("mi",n);c.setAttribute("mathvariant","normal");var h=new Ie.MathNode("mo",[oa("⁡","text")]);return t.parentIsSupSub?new Ie.MathNode("mrow",[c,h]):Ie.newDocumentFragment([c,h])};Ke({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:wr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:OQ,mathmlBuilder:Ybe});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Fu({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?we.makeFragment(Ur(t.body,e,!1)):we.makeSpan(["mord"],Ur(t.body,e,!0),e)},mathmlBuilder(t,e){return Oc(t.body,e,!0)}});Ke({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=gn(t.body,e.havingCrampedStyle()),r=we.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return we.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("mover",[Un(t.body,e),n]);return r.setAttribute("accent","true"),r}});Ke({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:wr(r)}},htmlBuilder:(t,e)=>{var n=Ur(t.body,e.withPhantom(),!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=ui(t.body,e);return new Ie.MathNode("mphantom",n)}});Ke({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan([],[gn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=ui(wr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Ke({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan(["inner"],[gn(t.body,e.withPhantom())]),r=we.makeSpan(["fix"],[]);return we.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=ui(wr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Ke({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=Ft(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=gn(t.body,e),r=cr(t.dy,e);return we.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mpadded",[Un(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Ke({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Ke({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=Ft(e[0],"size"),a=Ft(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&Ft(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=we.makeSpan(["mord","rule"],[],e),r=cr(t.width,e),s=cr(t.height,e),i=t.shift?cr(t.shift,e):0;return n.style.borderRightWidth=Ve(r),n.style.borderTopWidth=Ve(s),n.style.bottom=Ve(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=cr(t.width,e),r=cr(t.height,e),s=t.shift?cr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Ie.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Ve(n)),a.setAttribute("height",Ve(r));var l=new Ie.MathNode("mpadded",[a]);return s>=0?l.setAttribute("height",Ve(s)):(l.setAttribute("height",Ve(s)),l.setAttribute("depth",Ve(-s))),l.setAttribute("voffset",Ve(s)),l}});function jQ(t,e,n){for(var r=Ur(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return jQ(t.body,n,e)};Ke({type:"sizing",names:lM,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:lM.indexOf(r)+1,body:i}},htmlBuilder:Kbe,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=ui(t.body,n),s=new Ie.MathNode("mstyle",r);return s.setAttribute("mathsize",Ve(n.sizeMultiplier)),s}});Ke({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&Ft(n[0],"ordgroup");if(a)for(var l="",c=0;c{var n=we.makeSpan([],[gn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Ke({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=gn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=we.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-h;n.style.paddingLeft=Ve(f);var x=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:h}]},e);if(t.index){var y=e.havingStyle(kt.SCRIPTSCRIPT),w=gn(t.index,y,e),S=.6*(x.height-x.depth),k=we.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),N=we.makeSpan(["root"],[k]);return we.makeSpan(["mord","sqrt"],[N,x],e)}else return we.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Ie.MathNode("mroot",[Un(n,e),Un(r,e)]):new Ie.MathNode("msqrt",[Un(n,e)])}});var cM={display:kt.DISPLAY,text:kt.TEXT,script:kt.SCRIPT,scriptscript:kt.SCRIPTSCRIPT};Ke({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=cM[t.style],r=e.havingStyle(n).withFont("");return jQ(t.body,r,e)},mathmlBuilder(t,e){var n=cM[t.style],r=e.havingStyle(n),s=ui(t.body,r),i=new Ie.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},l=a[t.style];return i.setAttribute("scriptlevel",l[0]),i.setAttribute("displaystyle",l[1]),i}});var Zbe=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===kt.DISPLAY.size||r.alwaysHandleSupSub);return s?Zh:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===kt.DISPLAY.size||r.limits);return i?OQ:null}else{if(r.type==="accent")return On.isCharacterBox(r.base)?WO:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?wQ:null}else return null}else return null};Fu({type:"supsub",htmlBuilder(t,e){var n=Zbe(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=gn(r,e),l,c,h=e.fontMetrics(),f=0,m=0,g=r&&On.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());l=gn(s,x,e),g||(f=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=gn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===kt.DISPLAY?w=h.sup1:e.style.cramped?w=h.sup3:w=h.sup2;var S=e.sizeMultiplier,k=Ve(.5/h.ptPerEm/S),N=null;if(c){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof aa||C)&&(N=Ve(-a.italic))}var T;if(l&&c){f=Math.max(f,w,l.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var _=h.defaultRuleThickness,E=4*_;if(f-l.depth-(c.height-m)0&&(f+=M,m-=M)}var q=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:N},{type:"elem",elem:l,shift:-f,marginRight:k}];T=we.makeVList({positionType:"individualShift",children:q},e)}else if(c){m=Math.max(m,h.sub1,c.height-.8*h.xHeight);var L=[{type:"elem",elem:c,marginLeft:N,marginRight:k}];T=we.makeVList({positionType:"shift",positionData:m,children:L},e)}else if(l)f=Math.max(f,w,l.depth+.25*h.xHeight),T=we.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:l,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var I=sk(a,"right")||"mord";return we.makeSpan([I],[a,we.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[Un(t.base,e)];t.sub&&i.push(Un(t.sub,e)),t.sup&&i.push(Un(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===kt.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===kt.DISPLAY||h.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===kt.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===kt.DISPLAY)?a="munder":a="msub"}else{var l=t.base;l&&l.type==="op"&&l.limits&&(e.style===kt.DISPLAY||l.alwaysHandleSupSub)||l&&l.type==="operatorname"&&l.alwaysHandleSupSub&&(l.limits||e.style===kt.DISPLAY)?a="mover":a="msup"}return new Ie.MathNode(a,i)}});Fu({type:"atom",htmlBuilder(t,e){return we.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[oa(t.text,t.mode)]);if(t.family==="bin"){var r=VO(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var NQ={mi:"italic",mn:"normal",mtext:"normal"};Fu({type:"mathord",htmlBuilder(t,e){return we.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Ie.MathNode("mi",[oa(t.text,t.mode,e)]),r=VO(t,e)||"italic";return r!==NQ[n.type]&&n.setAttribute("mathvariant",r),n}});Fu({type:"textord",htmlBuilder(t,e){return we.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=oa(t.text,t.mode,e),r=VO(t,e)||"normal",s;return t.mode==="text"?s=new Ie.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Ie.MathNode("mn",[n]):t.text==="\\prime"?s=new Ie.MathNode("mo",[n]):s=new Ie.MathNode("mi",[n]),r!==NQ[s.type]&&s.setAttribute("mathvariant",r),s}});var k4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},O4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Fu({type:"spacing",htmlBuilder(t,e){if(O4.hasOwnProperty(t.text)){var n=O4[t.text].className||"";if(t.mode==="text"){var r=we.makeOrd(t,e,"textord");return r.classes.push(n),r}else return we.makeSpan(["mspace",n],[we.mathsym(t.text,t.mode,e)],e)}else{if(k4.hasOwnProperty(t.text))return we.makeSpan(["mspace",k4[t.text]],[],e);throw new Be('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(O4.hasOwnProperty(t.text))n=new Ie.MathNode("mtext",[new Ie.TextNode(" ")]);else{if(k4.hasOwnProperty(t.text))return new Ie.MathNode("mspace");throw new Be('Unknown type of space "'+t.text+'"')}return n}});var uM=()=>{var t=new Ie.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Fu({type:"tag",mathmlBuilder(t,e){var n=new Ie.MathNode("mtable",[new Ie.MathNode("mtr",[uM(),new Ie.MathNode("mtd",[Oc(t.body,e)]),uM(),new Ie.MathNode("mtd",[Oc(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var dM={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},hM={"\\textbf":"textbf","\\textmd":"textmd"},Jbe={"\\textit":"textit","\\textup":"textup"},fM=(t,e)=>{var n=t.font;if(n){if(dM[n])return e.withTextFontFamily(dM[n]);if(hM[n])return e.withTextFontWeight(hM[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(Jbe[n])};Ke({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:wr(s),font:r}},htmlBuilder(t,e){var n=fM(t,e),r=Ur(t.body,n,!0);return we.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=fM(t,e);return Oc(t.body,n)}});Ke({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=gn(t.body,e),r=we.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("munder",[Un(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Ke({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=gn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return we.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Ie.MathNode("mpadded",[Un(t.body,e)],["vcenter"])}});Ke({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Be("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=mM(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),uc=X$,CQ=`[ \r - ]`,e2e="\\\\[a-zA-Z@]+",t2e="\\\\[^\uD800-\uDFFF]",n2e="("+e2e+")"+CQ+"*",r2e=`\\\\( +-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 up{constructor(e){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=e,this.classes=[],this.height=0,this.depth=0,this.maxFontSize=0,this.style={}}hasClass(e){return this.classes.includes(e)}toNode(){for(var e=document.createDocumentFragment(),n=0;nn.toText();return this.children.map(e).join("")}}var nl={"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]}},Cx={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]},G_={Å:"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 sbe(t,e){nl[t]=e}function VO(t,e,n){if(!nl[e])throw new Error("Font metrics not found for font: "+e+".");var r=t.charCodeAt(0),s=nl[e][r];if(!s&&t[0]in G_&&(r=G_[t[0]].charCodeAt(0),s=nl[e][r]),!s&&n==="text"&&G$(r)&&(s=nl[e][77]),s)return{depth:s[0],height:s[1],italic:s[2],skew:s[3],width:s[4]}}var x4={};function ibe(t){var e;if(t>=5?e=0:t>=3?e=1:e=2,!x4[e]){var n=x4[e]={cssEmPerMu:Cx.quad[e]/18};for(var r in Cx)Cx.hasOwnProperty(r)&&(n[r]=Cx[r][e])}return x4[e]}var abe=[[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]],X_=[.5,.6,.7,.8,.9,1,1.2,1.44,1.728,2.074,2.488],Y_=function(e,n){return n.size<2?e:abe[e-1][n.size-1]};class Zl{constructor(e){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=e.style,this.color=e.color,this.size=e.size||Zl.BASESIZE,this.textSize=e.textSize||this.size,this.phantom=!!e.phantom,this.font=e.font||"",this.fontFamily=e.fontFamily||"",this.fontWeight=e.fontWeight||"",this.fontShape=e.fontShape||"",this.sizeMultiplier=X_[this.size-1],this.maxSize=e.maxSize,this.minRuleThickness=e.minRuleThickness,this._fontMetrics=void 0}extend(e){var n={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 r in e)e.hasOwnProperty(r)&&(n[r]=e[r]);return new Zl(n)}havingStyle(e){return this.style===e?this:this.extend({style:e,size:Y_(this.textSize,e)})}havingCrampedStyle(){return this.havingStyle(this.style.cramp())}havingSize(e){return this.size===e&&this.textSize===e?this:this.extend({style:this.style.text(),size:e,textSize:e,sizeMultiplier:X_[e-1]})}havingBaseStyle(e){e=e||this.style.text();var n=Y_(Zl.BASESIZE,e);return this.size===n&&this.textSize===Zl.BASESIZE&&this.style===e?this:this.extend({style:e,size:n})}havingBaseSizing(){var e;switch(this.style.id){case 4:case 5:e=3;break;case 6:case 7:e=1;break;default:e=6}return this.extend({style:this.style.text(),size:e})}withColor(e){return this.extend({color:e})}withPhantom(){return this.extend({phantom:!0})}withFont(e){return this.extend({font:e})}withTextFontFamily(e){return this.extend({fontFamily:e,font:""})}withTextFontWeight(e){return this.extend({fontWeight:e,font:""})}withTextFontShape(e){return this.extend({fontShape:e,font:""})}sizingClasses(e){return e.size!==this.size?["sizing","reset-size"+e.size,"size"+this.size]:[]}baseSizingClasses(){return this.size!==Zl.BASESIZE?["sizing","reset-size"+this.size,"size"+Zl.BASESIZE]:[]}fontMetrics(){return this._fontMetrics||(this._fontMetrics=ibe(this.size)),this._fontMetrics}getColor(){return this.phantom?"transparent":this.color}}Zl.BASESIZE=6;var ik={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},lbe={ex:!0,em:!0,mu:!0},X$=function(e){return typeof e!="string"&&(e=e.unit),e in ik||e in lbe||e==="ex"},hr=function(e,n){var r;if(e.unit in ik)r=ik[e.unit]/n.fontMetrics().ptPerEm/n.sizeMultiplier;else if(e.unit==="mu")r=n.fontMetrics().cssEmPerMu;else{var s;if(n.style.isTight()?s=n.havingStyle(n.style.text()):s=n,e.unit==="ex")r=s.fontMetrics().xHeight;else if(e.unit==="em")r=s.fontMetrics().quad;else throw new Be("Invalid unit: '"+e.unit+"'");s!==n&&(r*=s.sizeMultiplier/n.sizeMultiplier)}return Math.min(e.number*r,n.maxSize)},Ve=function(e){return+e.toFixed(4)+"em"},Oc=function(e){return e.filter(n=>n).join(" ")},Y$=function(e,n,r){if(this.classes=e||[],this.attributes={},this.height=0,this.depth=0,this.maxFontSize=0,this.style=r||{},n){n.style.isTight()&&this.classes.push("mtight");var s=n.getColor();s&&(this.style.color=s)}},K$=function(e){var n=document.createElement(e);n.className=Oc(this.classes);for(var r in this.style)this.style.hasOwnProperty(r)&&(n.style[r]=this.style[r]);for(var s in this.attributes)this.attributes.hasOwnProperty(s)&&n.setAttribute(s,this.attributes[s]);for(var i=0;i/=\x00-\x1f]/,Z$=function(e){var n="<"+e;this.classes.length&&(n+=' class="'+Nn.escape(Oc(this.classes))+'"');var r="";for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Nn.hyphenate(s)+":"+this.style[s]+";");r&&(n+=' style="'+Nn.escape(r)+'"');for(var i in this.attributes)if(this.attributes.hasOwnProperty(i)){if(obe.test(i))throw new Be("Invalid attribute name '"+i+"'");n+=" "+i+'="'+Nn.escape(this.attributes[i])+'"'}n+=">";for(var a=0;a",n};class dp{constructor(e,n,r,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,Y$.call(this,e,r,s),this.children=n||[]}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return K$.call(this,"span")}toMarkup(){return Z$.call(this,"span")}}class UO{constructor(e,n,r,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,Y$.call(this,n,s),this.children=r||[],this.setAttribute("href",e)}setAttribute(e,n){this.attributes[e]=n}hasClass(e){return this.classes.includes(e)}toNode(){return K$.call(this,"a")}toMarkup(){return Z$.call(this,"a")}}class cbe{constructor(e,n,r){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=n,this.src=e,this.classes=["mord"],this.style=r}hasClass(e){return this.classes.includes(e)}toNode(){var e=document.createElement("img");e.src=this.src,e.alt=this.alt,e.className="mord";for(var n in this.style)this.style.hasOwnProperty(n)&&(e.style[n]=this.style[n]);return e}toMarkup(){var e=''+Nn.escape(this.alt)+'0&&(n=document.createElement("span"),n.style.marginRight=Ve(this.italic)),this.classes.length>0&&(n=n||document.createElement("span"),n.className=Oc(this.classes));for(var r in this.style)this.style.hasOwnProperty(r)&&(n=n||document.createElement("span"),n.style[r]=this.style[r]);return n?(n.appendChild(e),n):e}toMarkup(){var e=!1,n="0&&(r+="margin-right:"+this.italic+"em;");for(var s in this.style)this.style.hasOwnProperty(s)&&(r+=Nn.hyphenate(s)+":"+this.style[s]+";");r&&(e=!0,n+=' style="'+Nn.escape(r)+'"');var i=Nn.escape(this.text);return e?(n+=">",n+=i,n+="",n):i}}class go{constructor(e,n){this.children=void 0,this.attributes=void 0,this.children=e||[],this.attributes=n||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"svg");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);for(var s=0;s':''}}class ak{constructor(e){this.attributes=void 0,this.attributes=e||{}}toNode(){var e="http://www.w3.org/2000/svg",n=document.createElementNS(e,"line");for(var r in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,r)&&n.setAttribute(r,this.attributes[r]);return n}toMarkup(){var e=" but got "+String(t)+".")}var hbe={bin:1,close:1,inner:1,open:1,punct:1,rel:1},fbe={"accent-token":1,mathord:1,"op-token":1,spacing:1,textord:1},Gn={math:{},text:{}};function A(t,e,n,r,s,i){Gn[t][s]={font:e,group:n,replace:r},i&&r&&(Gn[t][r]=Gn[t][s])}var D="math",Le="text",Q="main",oe="ams",ar="accent-token",nt="bin",Ls="close",Jh="inner",St="mathord",qr="op-token",zi="open",yy="punct",ce="rel",Oo="spacing",pe="textord";A(D,Q,ce,"≡","\\equiv",!0);A(D,Q,ce,"≺","\\prec",!0);A(D,Q,ce,"≻","\\succ",!0);A(D,Q,ce,"∼","\\sim",!0);A(D,Q,ce,"⊥","\\perp");A(D,Q,ce,"⪯","\\preceq",!0);A(D,Q,ce,"⪰","\\succeq",!0);A(D,Q,ce,"≃","\\simeq",!0);A(D,Q,ce,"∣","\\mid",!0);A(D,Q,ce,"≪","\\ll",!0);A(D,Q,ce,"≫","\\gg",!0);A(D,Q,ce,"≍","\\asymp",!0);A(D,Q,ce,"∥","\\parallel");A(D,Q,ce,"⋈","\\bowtie",!0);A(D,Q,ce,"⌣","\\smile",!0);A(D,Q,ce,"⊑","\\sqsubseteq",!0);A(D,Q,ce,"⊒","\\sqsupseteq",!0);A(D,Q,ce,"≐","\\doteq",!0);A(D,Q,ce,"⌢","\\frown",!0);A(D,Q,ce,"∋","\\ni",!0);A(D,Q,ce,"∝","\\propto",!0);A(D,Q,ce,"⊢","\\vdash",!0);A(D,Q,ce,"⊣","\\dashv",!0);A(D,Q,ce,"∋","\\owns");A(D,Q,yy,".","\\ldotp");A(D,Q,yy,"⋅","\\cdotp");A(D,Q,pe,"#","\\#");A(Le,Q,pe,"#","\\#");A(D,Q,pe,"&","\\&");A(Le,Q,pe,"&","\\&");A(D,Q,pe,"ℵ","\\aleph",!0);A(D,Q,pe,"∀","\\forall",!0);A(D,Q,pe,"ℏ","\\hbar",!0);A(D,Q,pe,"∃","\\exists",!0);A(D,Q,pe,"∇","\\nabla",!0);A(D,Q,pe,"♭","\\flat",!0);A(D,Q,pe,"ℓ","\\ell",!0);A(D,Q,pe,"♮","\\natural",!0);A(D,Q,pe,"♣","\\clubsuit",!0);A(D,Q,pe,"℘","\\wp",!0);A(D,Q,pe,"♯","\\sharp",!0);A(D,Q,pe,"♢","\\diamondsuit",!0);A(D,Q,pe,"ℜ","\\Re",!0);A(D,Q,pe,"♡","\\heartsuit",!0);A(D,Q,pe,"ℑ","\\Im",!0);A(D,Q,pe,"♠","\\spadesuit",!0);A(D,Q,pe,"§","\\S",!0);A(Le,Q,pe,"§","\\S");A(D,Q,pe,"¶","\\P",!0);A(Le,Q,pe,"¶","\\P");A(D,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\dag");A(Le,Q,pe,"†","\\textdagger");A(D,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\ddag");A(Le,Q,pe,"‡","\\textdaggerdbl");A(D,Q,Ls,"⎱","\\rmoustache",!0);A(D,Q,zi,"⎰","\\lmoustache",!0);A(D,Q,Ls,"⟯","\\rgroup",!0);A(D,Q,zi,"⟮","\\lgroup",!0);A(D,Q,nt,"∓","\\mp",!0);A(D,Q,nt,"⊖","\\ominus",!0);A(D,Q,nt,"⊎","\\uplus",!0);A(D,Q,nt,"⊓","\\sqcap",!0);A(D,Q,nt,"∗","\\ast");A(D,Q,nt,"⊔","\\sqcup",!0);A(D,Q,nt,"◯","\\bigcirc",!0);A(D,Q,nt,"∙","\\bullet",!0);A(D,Q,nt,"‡","\\ddagger");A(D,Q,nt,"≀","\\wr",!0);A(D,Q,nt,"⨿","\\amalg");A(D,Q,nt,"&","\\And");A(D,Q,ce,"⟵","\\longleftarrow",!0);A(D,Q,ce,"⇐","\\Leftarrow",!0);A(D,Q,ce,"⟸","\\Longleftarrow",!0);A(D,Q,ce,"⟶","\\longrightarrow",!0);A(D,Q,ce,"⇒","\\Rightarrow",!0);A(D,Q,ce,"⟹","\\Longrightarrow",!0);A(D,Q,ce,"↔","\\leftrightarrow",!0);A(D,Q,ce,"⟷","\\longleftrightarrow",!0);A(D,Q,ce,"⇔","\\Leftrightarrow",!0);A(D,Q,ce,"⟺","\\Longleftrightarrow",!0);A(D,Q,ce,"↦","\\mapsto",!0);A(D,Q,ce,"⟼","\\longmapsto",!0);A(D,Q,ce,"↗","\\nearrow",!0);A(D,Q,ce,"↩","\\hookleftarrow",!0);A(D,Q,ce,"↪","\\hookrightarrow",!0);A(D,Q,ce,"↘","\\searrow",!0);A(D,Q,ce,"↼","\\leftharpoonup",!0);A(D,Q,ce,"⇀","\\rightharpoonup",!0);A(D,Q,ce,"↙","\\swarrow",!0);A(D,Q,ce,"↽","\\leftharpoondown",!0);A(D,Q,ce,"⇁","\\rightharpoondown",!0);A(D,Q,ce,"↖","\\nwarrow",!0);A(D,Q,ce,"⇌","\\rightleftharpoons",!0);A(D,oe,ce,"≮","\\nless",!0);A(D,oe,ce,"","\\@nleqslant");A(D,oe,ce,"","\\@nleqq");A(D,oe,ce,"⪇","\\lneq",!0);A(D,oe,ce,"≨","\\lneqq",!0);A(D,oe,ce,"","\\@lvertneqq");A(D,oe,ce,"⋦","\\lnsim",!0);A(D,oe,ce,"⪉","\\lnapprox",!0);A(D,oe,ce,"⊀","\\nprec",!0);A(D,oe,ce,"⋠","\\npreceq",!0);A(D,oe,ce,"⋨","\\precnsim",!0);A(D,oe,ce,"⪹","\\precnapprox",!0);A(D,oe,ce,"≁","\\nsim",!0);A(D,oe,ce,"","\\@nshortmid");A(D,oe,ce,"∤","\\nmid",!0);A(D,oe,ce,"⊬","\\nvdash",!0);A(D,oe,ce,"⊭","\\nvDash",!0);A(D,oe,ce,"⋪","\\ntriangleleft");A(D,oe,ce,"⋬","\\ntrianglelefteq",!0);A(D,oe,ce,"⊊","\\subsetneq",!0);A(D,oe,ce,"","\\@varsubsetneq");A(D,oe,ce,"⫋","\\subsetneqq",!0);A(D,oe,ce,"","\\@varsubsetneqq");A(D,oe,ce,"≯","\\ngtr",!0);A(D,oe,ce,"","\\@ngeqslant");A(D,oe,ce,"","\\@ngeqq");A(D,oe,ce,"⪈","\\gneq",!0);A(D,oe,ce,"≩","\\gneqq",!0);A(D,oe,ce,"","\\@gvertneqq");A(D,oe,ce,"⋧","\\gnsim",!0);A(D,oe,ce,"⪊","\\gnapprox",!0);A(D,oe,ce,"⊁","\\nsucc",!0);A(D,oe,ce,"⋡","\\nsucceq",!0);A(D,oe,ce,"⋩","\\succnsim",!0);A(D,oe,ce,"⪺","\\succnapprox",!0);A(D,oe,ce,"≆","\\ncong",!0);A(D,oe,ce,"","\\@nshortparallel");A(D,oe,ce,"∦","\\nparallel",!0);A(D,oe,ce,"⊯","\\nVDash",!0);A(D,oe,ce,"⋫","\\ntriangleright");A(D,oe,ce,"⋭","\\ntrianglerighteq",!0);A(D,oe,ce,"","\\@nsupseteqq");A(D,oe,ce,"⊋","\\supsetneq",!0);A(D,oe,ce,"","\\@varsupsetneq");A(D,oe,ce,"⫌","\\supsetneqq",!0);A(D,oe,ce,"","\\@varsupsetneqq");A(D,oe,ce,"⊮","\\nVdash",!0);A(D,oe,ce,"⪵","\\precneqq",!0);A(D,oe,ce,"⪶","\\succneqq",!0);A(D,oe,ce,"","\\@nsubseteqq");A(D,oe,nt,"⊴","\\unlhd");A(D,oe,nt,"⊵","\\unrhd");A(D,oe,ce,"↚","\\nleftarrow",!0);A(D,oe,ce,"↛","\\nrightarrow",!0);A(D,oe,ce,"⇍","\\nLeftarrow",!0);A(D,oe,ce,"⇏","\\nRightarrow",!0);A(D,oe,ce,"↮","\\nleftrightarrow",!0);A(D,oe,ce,"⇎","\\nLeftrightarrow",!0);A(D,oe,ce,"△","\\vartriangle");A(D,oe,pe,"ℏ","\\hslash");A(D,oe,pe,"▽","\\triangledown");A(D,oe,pe,"◊","\\lozenge");A(D,oe,pe,"Ⓢ","\\circledS");A(D,oe,pe,"®","\\circledR");A(Le,oe,pe,"®","\\circledR");A(D,oe,pe,"∡","\\measuredangle",!0);A(D,oe,pe,"∄","\\nexists");A(D,oe,pe,"℧","\\mho");A(D,oe,pe,"Ⅎ","\\Finv",!0);A(D,oe,pe,"⅁","\\Game",!0);A(D,oe,pe,"‵","\\backprime");A(D,oe,pe,"▲","\\blacktriangle");A(D,oe,pe,"▼","\\blacktriangledown");A(D,oe,pe,"■","\\blacksquare");A(D,oe,pe,"⧫","\\blacklozenge");A(D,oe,pe,"★","\\bigstar");A(D,oe,pe,"∢","\\sphericalangle",!0);A(D,oe,pe,"∁","\\complement",!0);A(D,oe,pe,"ð","\\eth",!0);A(Le,Q,pe,"ð","ð");A(D,oe,pe,"╱","\\diagup");A(D,oe,pe,"╲","\\diagdown");A(D,oe,pe,"□","\\square");A(D,oe,pe,"□","\\Box");A(D,oe,pe,"◊","\\Diamond");A(D,oe,pe,"¥","\\yen",!0);A(Le,oe,pe,"¥","\\yen",!0);A(D,oe,pe,"✓","\\checkmark",!0);A(Le,oe,pe,"✓","\\checkmark");A(D,oe,pe,"ℶ","\\beth",!0);A(D,oe,pe,"ℸ","\\daleth",!0);A(D,oe,pe,"ℷ","\\gimel",!0);A(D,oe,pe,"ϝ","\\digamma",!0);A(D,oe,pe,"ϰ","\\varkappa");A(D,oe,zi,"┌","\\@ulcorner",!0);A(D,oe,Ls,"┐","\\@urcorner",!0);A(D,oe,zi,"└","\\@llcorner",!0);A(D,oe,Ls,"┘","\\@lrcorner",!0);A(D,oe,ce,"≦","\\leqq",!0);A(D,oe,ce,"⩽","\\leqslant",!0);A(D,oe,ce,"⪕","\\eqslantless",!0);A(D,oe,ce,"≲","\\lesssim",!0);A(D,oe,ce,"⪅","\\lessapprox",!0);A(D,oe,ce,"≊","\\approxeq",!0);A(D,oe,nt,"⋖","\\lessdot");A(D,oe,ce,"⋘","\\lll",!0);A(D,oe,ce,"≶","\\lessgtr",!0);A(D,oe,ce,"⋚","\\lesseqgtr",!0);A(D,oe,ce,"⪋","\\lesseqqgtr",!0);A(D,oe,ce,"≑","\\doteqdot");A(D,oe,ce,"≓","\\risingdotseq",!0);A(D,oe,ce,"≒","\\fallingdotseq",!0);A(D,oe,ce,"∽","\\backsim",!0);A(D,oe,ce,"⋍","\\backsimeq",!0);A(D,oe,ce,"⫅","\\subseteqq",!0);A(D,oe,ce,"⋐","\\Subset",!0);A(D,oe,ce,"⊏","\\sqsubset",!0);A(D,oe,ce,"≼","\\preccurlyeq",!0);A(D,oe,ce,"⋞","\\curlyeqprec",!0);A(D,oe,ce,"≾","\\precsim",!0);A(D,oe,ce,"⪷","\\precapprox",!0);A(D,oe,ce,"⊲","\\vartriangleleft");A(D,oe,ce,"⊴","\\trianglelefteq");A(D,oe,ce,"⊨","\\vDash",!0);A(D,oe,ce,"⊪","\\Vvdash",!0);A(D,oe,ce,"⌣","\\smallsmile");A(D,oe,ce,"⌢","\\smallfrown");A(D,oe,ce,"≏","\\bumpeq",!0);A(D,oe,ce,"≎","\\Bumpeq",!0);A(D,oe,ce,"≧","\\geqq",!0);A(D,oe,ce,"⩾","\\geqslant",!0);A(D,oe,ce,"⪖","\\eqslantgtr",!0);A(D,oe,ce,"≳","\\gtrsim",!0);A(D,oe,ce,"⪆","\\gtrapprox",!0);A(D,oe,nt,"⋗","\\gtrdot");A(D,oe,ce,"⋙","\\ggg",!0);A(D,oe,ce,"≷","\\gtrless",!0);A(D,oe,ce,"⋛","\\gtreqless",!0);A(D,oe,ce,"⪌","\\gtreqqless",!0);A(D,oe,ce,"≖","\\eqcirc",!0);A(D,oe,ce,"≗","\\circeq",!0);A(D,oe,ce,"≜","\\triangleq",!0);A(D,oe,ce,"∼","\\thicksim");A(D,oe,ce,"≈","\\thickapprox");A(D,oe,ce,"⫆","\\supseteqq",!0);A(D,oe,ce,"⋑","\\Supset",!0);A(D,oe,ce,"⊐","\\sqsupset",!0);A(D,oe,ce,"≽","\\succcurlyeq",!0);A(D,oe,ce,"⋟","\\curlyeqsucc",!0);A(D,oe,ce,"≿","\\succsim",!0);A(D,oe,ce,"⪸","\\succapprox",!0);A(D,oe,ce,"⊳","\\vartriangleright");A(D,oe,ce,"⊵","\\trianglerighteq");A(D,oe,ce,"⊩","\\Vdash",!0);A(D,oe,ce,"∣","\\shortmid");A(D,oe,ce,"∥","\\shortparallel");A(D,oe,ce,"≬","\\between",!0);A(D,oe,ce,"⋔","\\pitchfork",!0);A(D,oe,ce,"∝","\\varpropto");A(D,oe,ce,"◀","\\blacktriangleleft");A(D,oe,ce,"∴","\\therefore",!0);A(D,oe,ce,"∍","\\backepsilon");A(D,oe,ce,"▶","\\blacktriangleright");A(D,oe,ce,"∵","\\because",!0);A(D,oe,ce,"⋘","\\llless");A(D,oe,ce,"⋙","\\gggtr");A(D,oe,nt,"⊲","\\lhd");A(D,oe,nt,"⊳","\\rhd");A(D,oe,ce,"≂","\\eqsim",!0);A(D,Q,ce,"⋈","\\Join");A(D,oe,ce,"≑","\\Doteq",!0);A(D,oe,nt,"∔","\\dotplus",!0);A(D,oe,nt,"∖","\\smallsetminus");A(D,oe,nt,"⋒","\\Cap",!0);A(D,oe,nt,"⋓","\\Cup",!0);A(D,oe,nt,"⩞","\\doublebarwedge",!0);A(D,oe,nt,"⊟","\\boxminus",!0);A(D,oe,nt,"⊞","\\boxplus",!0);A(D,oe,nt,"⋇","\\divideontimes",!0);A(D,oe,nt,"⋉","\\ltimes",!0);A(D,oe,nt,"⋊","\\rtimes",!0);A(D,oe,nt,"⋋","\\leftthreetimes",!0);A(D,oe,nt,"⋌","\\rightthreetimes",!0);A(D,oe,nt,"⋏","\\curlywedge",!0);A(D,oe,nt,"⋎","\\curlyvee",!0);A(D,oe,nt,"⊝","\\circleddash",!0);A(D,oe,nt,"⊛","\\circledast",!0);A(D,oe,nt,"⋅","\\centerdot");A(D,oe,nt,"⊺","\\intercal",!0);A(D,oe,nt,"⋒","\\doublecap");A(D,oe,nt,"⋓","\\doublecup");A(D,oe,nt,"⊠","\\boxtimes",!0);A(D,oe,ce,"⇢","\\dashrightarrow",!0);A(D,oe,ce,"⇠","\\dashleftarrow",!0);A(D,oe,ce,"⇇","\\leftleftarrows",!0);A(D,oe,ce,"⇆","\\leftrightarrows",!0);A(D,oe,ce,"⇚","\\Lleftarrow",!0);A(D,oe,ce,"↞","\\twoheadleftarrow",!0);A(D,oe,ce,"↢","\\leftarrowtail",!0);A(D,oe,ce,"↫","\\looparrowleft",!0);A(D,oe,ce,"⇋","\\leftrightharpoons",!0);A(D,oe,ce,"↶","\\curvearrowleft",!0);A(D,oe,ce,"↺","\\circlearrowleft",!0);A(D,oe,ce,"↰","\\Lsh",!0);A(D,oe,ce,"⇈","\\upuparrows",!0);A(D,oe,ce,"↿","\\upharpoonleft",!0);A(D,oe,ce,"⇃","\\downharpoonleft",!0);A(D,Q,ce,"⊶","\\origof",!0);A(D,Q,ce,"⊷","\\imageof",!0);A(D,oe,ce,"⊸","\\multimap",!0);A(D,oe,ce,"↭","\\leftrightsquigarrow",!0);A(D,oe,ce,"⇉","\\rightrightarrows",!0);A(D,oe,ce,"⇄","\\rightleftarrows",!0);A(D,oe,ce,"↠","\\twoheadrightarrow",!0);A(D,oe,ce,"↣","\\rightarrowtail",!0);A(D,oe,ce,"↬","\\looparrowright",!0);A(D,oe,ce,"↷","\\curvearrowright",!0);A(D,oe,ce,"↻","\\circlearrowright",!0);A(D,oe,ce,"↱","\\Rsh",!0);A(D,oe,ce,"⇊","\\downdownarrows",!0);A(D,oe,ce,"↾","\\upharpoonright",!0);A(D,oe,ce,"⇂","\\downharpoonright",!0);A(D,oe,ce,"⇝","\\rightsquigarrow",!0);A(D,oe,ce,"⇝","\\leadsto");A(D,oe,ce,"⇛","\\Rrightarrow",!0);A(D,oe,ce,"↾","\\restriction");A(D,Q,pe,"‘","`");A(D,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\$");A(Le,Q,pe,"$","\\textdollar");A(D,Q,pe,"%","\\%");A(Le,Q,pe,"%","\\%");A(D,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\_");A(Le,Q,pe,"_","\\textunderscore");A(D,Q,pe,"∠","\\angle",!0);A(D,Q,pe,"∞","\\infty",!0);A(D,Q,pe,"′","\\prime");A(D,Q,pe,"△","\\triangle");A(D,Q,pe,"Γ","\\Gamma",!0);A(D,Q,pe,"Δ","\\Delta",!0);A(D,Q,pe,"Θ","\\Theta",!0);A(D,Q,pe,"Λ","\\Lambda",!0);A(D,Q,pe,"Ξ","\\Xi",!0);A(D,Q,pe,"Π","\\Pi",!0);A(D,Q,pe,"Σ","\\Sigma",!0);A(D,Q,pe,"Υ","\\Upsilon",!0);A(D,Q,pe,"Φ","\\Phi",!0);A(D,Q,pe,"Ψ","\\Psi",!0);A(D,Q,pe,"Ω","\\Omega",!0);A(D,Q,pe,"A","Α");A(D,Q,pe,"B","Β");A(D,Q,pe,"E","Ε");A(D,Q,pe,"Z","Ζ");A(D,Q,pe,"H","Η");A(D,Q,pe,"I","Ι");A(D,Q,pe,"K","Κ");A(D,Q,pe,"M","Μ");A(D,Q,pe,"N","Ν");A(D,Q,pe,"O","Ο");A(D,Q,pe,"P","Ρ");A(D,Q,pe,"T","Τ");A(D,Q,pe,"X","Χ");A(D,Q,pe,"¬","\\neg",!0);A(D,Q,pe,"¬","\\lnot");A(D,Q,pe,"⊤","\\top");A(D,Q,pe,"⊥","\\bot");A(D,Q,pe,"∅","\\emptyset");A(D,oe,pe,"∅","\\varnothing");A(D,Q,St,"α","\\alpha",!0);A(D,Q,St,"β","\\beta",!0);A(D,Q,St,"γ","\\gamma",!0);A(D,Q,St,"δ","\\delta",!0);A(D,Q,St,"ϵ","\\epsilon",!0);A(D,Q,St,"ζ","\\zeta",!0);A(D,Q,St,"η","\\eta",!0);A(D,Q,St,"θ","\\theta",!0);A(D,Q,St,"ι","\\iota",!0);A(D,Q,St,"κ","\\kappa",!0);A(D,Q,St,"λ","\\lambda",!0);A(D,Q,St,"μ","\\mu",!0);A(D,Q,St,"ν","\\nu",!0);A(D,Q,St,"ξ","\\xi",!0);A(D,Q,St,"ο","\\omicron",!0);A(D,Q,St,"π","\\pi",!0);A(D,Q,St,"ρ","\\rho",!0);A(D,Q,St,"σ","\\sigma",!0);A(D,Q,St,"τ","\\tau",!0);A(D,Q,St,"υ","\\upsilon",!0);A(D,Q,St,"ϕ","\\phi",!0);A(D,Q,St,"χ","\\chi",!0);A(D,Q,St,"ψ","\\psi",!0);A(D,Q,St,"ω","\\omega",!0);A(D,Q,St,"ε","\\varepsilon",!0);A(D,Q,St,"ϑ","\\vartheta",!0);A(D,Q,St,"ϖ","\\varpi",!0);A(D,Q,St,"ϱ","\\varrho",!0);A(D,Q,St,"ς","\\varsigma",!0);A(D,Q,St,"φ","\\varphi",!0);A(D,Q,nt,"∗","*",!0);A(D,Q,nt,"+","+");A(D,Q,nt,"−","-",!0);A(D,Q,nt,"⋅","\\cdot",!0);A(D,Q,nt,"∘","\\circ",!0);A(D,Q,nt,"÷","\\div",!0);A(D,Q,nt,"±","\\pm",!0);A(D,Q,nt,"×","\\times",!0);A(D,Q,nt,"∩","\\cap",!0);A(D,Q,nt,"∪","\\cup",!0);A(D,Q,nt,"∖","\\setminus",!0);A(D,Q,nt,"∧","\\land");A(D,Q,nt,"∨","\\lor");A(D,Q,nt,"∧","\\wedge",!0);A(D,Q,nt,"∨","\\vee",!0);A(D,Q,pe,"√","\\surd");A(D,Q,zi,"⟨","\\langle",!0);A(D,Q,zi,"∣","\\lvert");A(D,Q,zi,"∥","\\lVert");A(D,Q,Ls,"?","?");A(D,Q,Ls,"!","!");A(D,Q,Ls,"⟩","\\rangle",!0);A(D,Q,Ls,"∣","\\rvert");A(D,Q,Ls,"∥","\\rVert");A(D,Q,ce,"=","=");A(D,Q,ce,":",":");A(D,Q,ce,"≈","\\approx",!0);A(D,Q,ce,"≅","\\cong",!0);A(D,Q,ce,"≥","\\ge");A(D,Q,ce,"≥","\\geq",!0);A(D,Q,ce,"←","\\gets");A(D,Q,ce,">","\\gt",!0);A(D,Q,ce,"∈","\\in",!0);A(D,Q,ce,"","\\@not");A(D,Q,ce,"⊂","\\subset",!0);A(D,Q,ce,"⊃","\\supset",!0);A(D,Q,ce,"⊆","\\subseteq",!0);A(D,Q,ce,"⊇","\\supseteq",!0);A(D,oe,ce,"⊈","\\nsubseteq",!0);A(D,oe,ce,"⊉","\\nsupseteq",!0);A(D,Q,ce,"⊨","\\models");A(D,Q,ce,"←","\\leftarrow",!0);A(D,Q,ce,"≤","\\le");A(D,Q,ce,"≤","\\leq",!0);A(D,Q,ce,"<","\\lt",!0);A(D,Q,ce,"→","\\rightarrow",!0);A(D,Q,ce,"→","\\to");A(D,oe,ce,"≱","\\ngeq",!0);A(D,oe,ce,"≰","\\nleq",!0);A(D,Q,Oo," ","\\ ");A(D,Q,Oo," ","\\space");A(D,Q,Oo," ","\\nobreakspace");A(Le,Q,Oo," ","\\ ");A(Le,Q,Oo," "," ");A(Le,Q,Oo," ","\\space");A(Le,Q,Oo," ","\\nobreakspace");A(D,Q,Oo,null,"\\nobreak");A(D,Q,Oo,null,"\\allowbreak");A(D,Q,yy,",",",");A(D,Q,yy,";",";");A(D,oe,nt,"⊼","\\barwedge",!0);A(D,oe,nt,"⊻","\\veebar",!0);A(D,Q,nt,"⊙","\\odot",!0);A(D,Q,nt,"⊕","\\oplus",!0);A(D,Q,nt,"⊗","\\otimes",!0);A(D,Q,pe,"∂","\\partial",!0);A(D,Q,nt,"⊘","\\oslash",!0);A(D,oe,nt,"⊚","\\circledcirc",!0);A(D,oe,nt,"⊡","\\boxdot",!0);A(D,Q,nt,"△","\\bigtriangleup");A(D,Q,nt,"▽","\\bigtriangledown");A(D,Q,nt,"†","\\dagger");A(D,Q,nt,"⋄","\\diamond");A(D,Q,nt,"⋆","\\star");A(D,Q,nt,"◃","\\triangleleft");A(D,Q,nt,"▹","\\triangleright");A(D,Q,zi,"{","\\{");A(Le,Q,pe,"{","\\{");A(Le,Q,pe,"{","\\textbraceleft");A(D,Q,Ls,"}","\\}");A(Le,Q,pe,"}","\\}");A(Le,Q,pe,"}","\\textbraceright");A(D,Q,zi,"{","\\lbrace");A(D,Q,Ls,"}","\\rbrace");A(D,Q,zi,"[","\\lbrack",!0);A(Le,Q,pe,"[","\\lbrack",!0);A(D,Q,Ls,"]","\\rbrack",!0);A(Le,Q,pe,"]","\\rbrack",!0);A(D,Q,zi,"(","\\lparen",!0);A(D,Q,Ls,")","\\rparen",!0);A(Le,Q,pe,"<","\\textless",!0);A(Le,Q,pe,">","\\textgreater",!0);A(D,Q,zi,"⌊","\\lfloor",!0);A(D,Q,Ls,"⌋","\\rfloor",!0);A(D,Q,zi,"⌈","\\lceil",!0);A(D,Q,Ls,"⌉","\\rceil",!0);A(D,Q,pe,"\\","\\backslash");A(D,Q,pe,"∣","|");A(D,Q,pe,"∣","\\vert");A(Le,Q,pe,"|","\\textbar",!0);A(D,Q,pe,"∥","\\|");A(D,Q,pe,"∥","\\Vert");A(Le,Q,pe,"∥","\\textbardbl");A(Le,Q,pe,"~","\\textasciitilde");A(Le,Q,pe,"\\","\\textbackslash");A(Le,Q,pe,"^","\\textasciicircum");A(D,Q,ce,"↑","\\uparrow",!0);A(D,Q,ce,"⇑","\\Uparrow",!0);A(D,Q,ce,"↓","\\downarrow",!0);A(D,Q,ce,"⇓","\\Downarrow",!0);A(D,Q,ce,"↕","\\updownarrow",!0);A(D,Q,ce,"⇕","\\Updownarrow",!0);A(D,Q,qr,"∐","\\coprod");A(D,Q,qr,"⋁","\\bigvee");A(D,Q,qr,"⋀","\\bigwedge");A(D,Q,qr,"⨄","\\biguplus");A(D,Q,qr,"⋂","\\bigcap");A(D,Q,qr,"⋃","\\bigcup");A(D,Q,qr,"∫","\\int");A(D,Q,qr,"∫","\\intop");A(D,Q,qr,"∬","\\iint");A(D,Q,qr,"∭","\\iiint");A(D,Q,qr,"∏","\\prod");A(D,Q,qr,"∑","\\sum");A(D,Q,qr,"⨂","\\bigotimes");A(D,Q,qr,"⨁","\\bigoplus");A(D,Q,qr,"⨀","\\bigodot");A(D,Q,qr,"∮","\\oint");A(D,Q,qr,"∯","\\oiint");A(D,Q,qr,"∰","\\oiiint");A(D,Q,qr,"⨆","\\bigsqcup");A(D,Q,qr,"∫","\\smallint");A(Le,Q,Jh,"…","\\textellipsis");A(D,Q,Jh,"…","\\mathellipsis");A(Le,Q,Jh,"…","\\ldots",!0);A(D,Q,Jh,"…","\\ldots",!0);A(D,Q,Jh,"⋯","\\@cdots",!0);A(D,Q,Jh,"⋱","\\ddots",!0);A(D,Q,pe,"⋮","\\varvdots");A(Le,Q,pe,"⋮","\\varvdots");A(D,Q,ar,"ˊ","\\acute");A(D,Q,ar,"ˋ","\\grave");A(D,Q,ar,"¨","\\ddot");A(D,Q,ar,"~","\\tilde");A(D,Q,ar,"ˉ","\\bar");A(D,Q,ar,"˘","\\breve");A(D,Q,ar,"ˇ","\\check");A(D,Q,ar,"^","\\hat");A(D,Q,ar,"⃗","\\vec");A(D,Q,ar,"˙","\\dot");A(D,Q,ar,"˚","\\mathring");A(D,Q,St,"","\\@imath");A(D,Q,St,"","\\@jmath");A(D,Q,pe,"ı","ı");A(D,Q,pe,"ȷ","ȷ");A(Le,Q,pe,"ı","\\i",!0);A(Le,Q,pe,"ȷ","\\j",!0);A(Le,Q,pe,"ß","\\ss",!0);A(Le,Q,pe,"æ","\\ae",!0);A(Le,Q,pe,"œ","\\oe",!0);A(Le,Q,pe,"ø","\\o",!0);A(Le,Q,pe,"Æ","\\AE",!0);A(Le,Q,pe,"Œ","\\OE",!0);A(Le,Q,pe,"Ø","\\O",!0);A(Le,Q,ar,"ˊ","\\'");A(Le,Q,ar,"ˋ","\\`");A(Le,Q,ar,"ˆ","\\^");A(Le,Q,ar,"˜","\\~");A(Le,Q,ar,"ˉ","\\=");A(Le,Q,ar,"˘","\\u");A(Le,Q,ar,"˙","\\.");A(Le,Q,ar,"¸","\\c");A(Le,Q,ar,"˚","\\r");A(Le,Q,ar,"ˇ","\\v");A(Le,Q,ar,"¨",'\\"');A(Le,Q,ar,"˝","\\H");A(Le,Q,ar,"◯","\\textcircled");var J$={"--":!0,"---":!0,"``":!0,"''":!0};A(Le,Q,pe,"–","--",!0);A(Le,Q,pe,"–","\\textendash");A(Le,Q,pe,"—","---",!0);A(Le,Q,pe,"—","\\textemdash");A(Le,Q,pe,"‘","`",!0);A(Le,Q,pe,"‘","\\textquoteleft");A(Le,Q,pe,"’","'",!0);A(Le,Q,pe,"’","\\textquoteright");A(Le,Q,pe,"“","``",!0);A(Le,Q,pe,"“","\\textquotedblleft");A(Le,Q,pe,"”","''",!0);A(Le,Q,pe,"”","\\textquotedblright");A(D,Q,pe,"°","\\degree",!0);A(Le,Q,pe,"°","\\degree");A(Le,Q,pe,"°","\\textdegree",!0);A(D,Q,pe,"£","\\pounds");A(D,Q,pe,"£","\\mathsterling",!0);A(Le,Q,pe,"£","\\pounds");A(Le,Q,pe,"£","\\textsterling",!0);A(D,oe,pe,"✠","\\maltese");A(Le,oe,pe,"✠","\\maltese");var Z_='0123456789/@."';for(var v4=0;v40)return wa(i,h,s,n,a.concat(f));if(c){var m,g;if(c==="boldsymbol"){var x=gbe(i,s,n,a,r);m=x.fontName,g=[x.fontClass]}else o?(m=nQ[c].fontName,g=[c]):(m=Mx(c,n.fontWeight,n.fontShape),g=[c,n.fontWeight,n.fontShape]);if(by(i,m,s).metrics)return wa(i,m,s,n,a.concat(g));if(J$.hasOwnProperty(i)&&m.slice(0,10)==="Typewriter"){for(var y=[],w=0;w{if(Oc(t.classes)!==Oc(e.classes)||t.skew!==e.skew||t.maxFontSize!==e.maxFontSize)return!1;if(t.classes.length===1){var n=t.classes[0];if(n==="mbin"||n==="mord")return!1}for(var r in t.style)if(t.style.hasOwnProperty(r)&&t.style[r]!==e.style[r])return!1;for(var s in e.style)if(e.style.hasOwnProperty(s)&&t.style[s]!==e.style[s])return!1;return!0},ybe=t=>{for(var e=0;en&&(n=a.height),a.depth>r&&(r=a.depth),a.maxFontSize>s&&(s=a.maxFontSize)}e.height=n,e.depth=r,e.maxFontSize=s},Xs=function(e,n,r,s){var i=new dp(e,n,r,s);return WO(i),i},eQ=(t,e,n,r)=>new dp(t,e,n,r),bbe=function(e,n,r){var s=Xs([e],[],n);return s.height=Math.max(r||n.fontMetrics().defaultRuleThickness,n.minRuleThickness),s.style.borderBottomWidth=Ve(s.height),s.maxFontSize=1,s},wbe=function(e,n,r,s){var i=new UO(e,n,r,s);return WO(i),i},tQ=function(e){var n=new up(e);return WO(n),n},Sbe=function(e,n){return e instanceof up?Xs([],[e],n):e},kbe=function(e){if(e.positionType==="individualShift"){for(var n=e.children,r=[n[0]],s=-n[0].shift-n[0].elem.depth,i=s,a=1;a{var n=Xs(["mspace"],[],e),r=hr(t,e);return n.style.marginRight=Ve(r),n},Mx=function(e,n,r){var s="";switch(e){case"amsrm":s="AMS";break;case"textrm":s="Main";break;case"textsf":s="SansSerif";break;case"texttt":s="Typewriter";break;default:s=e}var i;return n==="textbf"&&r==="textit"?i="BoldItalic":n==="textbf"?i="Bold":n==="textit"?i="Italic":i="Regular",s+"-"+i},nQ={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"}},rQ={vec:["vec",.471,.714],oiintSize1:["oiintSize1",.957,.499],oiintSize2:["oiintSize2",1.472,.659],oiiintSize1:["oiiintSize1",1.304,.499],oiiintSize2:["oiiintSize2",1.98,.659]},Nbe=function(e,n){var[r,s,i]=rQ[e],a=new jc(r),o=new go([a],{width:Ve(s),height:Ve(i),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+1e3*i,preserveAspectRatio:"xMinYMin"}),c=eQ(["overlay"],[o],n);return c.height=i,c.style.height=Ve(i),c.style.width=Ve(s),c},we={fontMap:nQ,makeSymbol:wa,mathsym:pbe,makeSpan:Xs,makeSvgSpan:eQ,makeLineSpan:bbe,makeAnchor:wbe,makeFragment:tQ,wrapFragment:Sbe,makeVList:Obe,makeOrd:xbe,makeGlue:jbe,staticSvg:Nbe,svgData:rQ,tryCombineChars:ybe},cr={number:3,unit:"mu"},au={number:4,unit:"mu"},Hl={number:5,unit:"mu"},Cbe={mord:{mop:cr,mbin:au,mrel:Hl,minner:cr},mop:{mord:cr,mop:cr,mrel:Hl,minner:cr},mbin:{mord:au,mop:au,mopen:au,minner:au},mrel:{mord:Hl,mop:Hl,mopen:Hl,minner:Hl},mopen:{},mclose:{mop:cr,mbin:au,mrel:Hl,minner:cr},mpunct:{mord:cr,mop:cr,mrel:Hl,mopen:cr,mclose:cr,mpunct:cr,minner:cr},minner:{mord:cr,mop:cr,mbin:au,mrel:Hl,mopen:cr,mpunct:cr,minner:cr}},Tbe={mord:{mop:cr},mop:{mord:cr,mop:cr},mbin:{},mrel:{},mopen:{},mclose:{mop:cr},mpunct:{},minner:{mop:cr}},sQ={},uv={},dv={};function Ke(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs,argTypes:r.argTypes,allowedInArgument:!!r.allowedInArgument,allowedInText:!!r.allowedInText,allowedInMath:r.allowedInMath===void 0?!0:r.allowedInMath,numOptionalArgs:r.numOptionalArgs||0,infix:!!r.infix,primitive:!!r.primitive,handler:s},c=0;c{var S=w.classes[0],k=y.classes[0];S==="mbin"&&_be.includes(k)?w.classes[0]="mord":k==="mbin"&&Ebe.includes(S)&&(y.classes[0]="mord")},{node:m},g,x),rM(i,(y,w)=>{var S=ok(w),k=ok(y),N=S&&k?y.hasClass("mtight")?Tbe[S][k]:Cbe[S][k]:null;if(N)return we.makeGlue(N,h)},{node:m},g,x),i},rM=function t(e,n,r,s,i){s&&e.push(s);for(var a=0;ag=>{e.splice(m+1,0,g),a++})(a)}s&&e.pop()},iQ=function(e){return e instanceof up||e instanceof UO||e instanceof dp&&e.hasClass("enclosing")?e:null},Rbe=function t(e,n){var r=iQ(e);if(r){var s=r.children;if(s.length){if(n==="right")return t(s[s.length-1],"right");if(n==="left")return t(s[0],"left")}}return e},ok=function(e,n){return e?(n&&(e=Rbe(e,n)),Abe[e.classes[0]]||null):null},b0=function(e,n){var r=["nulldelimiter"].concat(e.baseSizingClasses());return xo(n.concat(r))},Sn=function(e,n,r){if(!e)return xo();if(uv[e.type]){var s=uv[e.type](e,n);if(r&&n.size!==r.size){s=xo(n.sizingClasses(r),[s],n);var i=n.sizeMultiplier/r.sizeMultiplier;s.height*=i,s.depth*=i}return s}else throw new Be("Got group of unknown type: '"+e.type+"'")};function Ax(t,e){var n=xo(["base"],t,e),r=xo(["strut"]);return r.style.height=Ve(n.height+n.depth),n.depth&&(r.style.verticalAlign=Ve(-n.depth)),n.children.unshift(r),n}function ck(t,e){var n=null;t.length===1&&t[0].type==="tag"&&(n=t[0].tag,t=t[0].body);var r=Wr(t,e,"root"),s;r.length===2&&r[1].hasClass("tag")&&(s=r.pop());for(var i=[],a=[],o=0;o0&&(i.push(Ax(a,e)),a=[]),i.push(r[o]));a.length>0&&i.push(Ax(a,e));var h;n?(h=Ax(Wr(n,e,!0)),h.classes=["tag"],i.push(h)):s&&i.push(s);var f=xo(["katex-html"],i);if(f.setAttribute("aria-hidden","true"),h){var m=h.children[0];m.style.height=Ve(f.height+f.depth),f.depth&&(m.style.verticalAlign=Ve(-f.depth))}return f}function aQ(t){return new up(t)}class Ci{constructor(e,n,r){this.type=void 0,this.attributes=void 0,this.children=void 0,this.classes=void 0,this.type=e,this.attributes={},this.children=n||[],this.classes=r||[]}setAttribute(e,n){this.attributes[e]=n}getAttribute(e){return this.attributes[e]}toNode(){var e=document.createElementNS("http://www.w3.org/1998/Math/MathML",this.type);for(var n in this.attributes)Object.prototype.hasOwnProperty.call(this.attributes,n)&&e.setAttribute(n,this.attributes[n]);this.classes.length>0&&(e.className=Oc(this.classes));for(var r=0;r0&&(e+=' class ="'+Nn.escape(Oc(this.classes))+'"'),e+=">";for(var r=0;r",e}toText(){return this.children.map(e=>e.toText()).join("")}}class rl{constructor(e){this.text=void 0,this.text=e}toNode(){return document.createTextNode(this.text)}toMarkup(){return Nn.escape(this.toText())}toText(){return this.text}}class Dbe{constructor(e){this.width=void 0,this.character=void 0,this.width=e,e>=.05555&&e<=.05556?this.character=" ":e>=.1666&&e<=.1667?this.character=" ":e>=.2222&&e<=.2223?this.character=" ":e>=.2777&&e<=.2778?this.character="  ":e>=-.05556&&e<=-.05555?this.character=" ⁣":e>=-.1667&&e<=-.1666?this.character=" ⁣":e>=-.2223&&e<=-.2222?this.character=" ⁣":e>=-.2778&&e<=-.2777?this.character=" ⁣":this.character=null}toNode(){if(this.character)return document.createTextNode(this.character);var e=document.createElementNS("http://www.w3.org/1998/Math/MathML","mspace");return e.setAttribute("width",Ve(this.width)),e}toMarkup(){return this.character?""+this.character+"":''}toText(){return this.character?this.character:" "}}var Ie={MathNode:Ci,TextNode:rl,SpaceNode:Dbe,newDocumentFragment:aQ},ca=function(e,n,r){return Gn[n][e]&&Gn[n][e].replace&&e.charCodeAt(0)!==55349&&!(J$.hasOwnProperty(e)&&r&&(r.fontFamily&&r.fontFamily.slice(4,6)==="tt"||r.font&&r.font.slice(4,6)==="tt"))&&(e=Gn[n][e].replace),new Ie.TextNode(e)},GO=function(e){return e.length===1?e[0]:new Ie.MathNode("mrow",e)},XO=function(e,n){if(n.fontFamily==="texttt")return"monospace";if(n.fontFamily==="textsf")return n.fontShape==="textit"&&n.fontWeight==="textbf"?"sans-serif-bold-italic":n.fontShape==="textit"?"sans-serif-italic":n.fontWeight==="textbf"?"bold-sans-serif":"sans-serif";if(n.fontShape==="textit"&&n.fontWeight==="textbf")return"bold-italic";if(n.fontShape==="textit")return"italic";if(n.fontWeight==="textbf")return"bold";var r=n.font;if(!r||r==="mathnormal")return null;var s=e.mode;if(r==="mathit")return"italic";if(r==="boldsymbol")return e.type==="textord"?"bold":"bold-italic";if(r==="mathbf")return"bold";if(r==="mathbb")return"double-struck";if(r==="mathsfit")return"sans-serif-italic";if(r==="mathfrak")return"fraktur";if(r==="mathscr"||r==="mathcal")return"script";if(r==="mathsf")return"sans-serif";if(r==="mathtt")return"monospace";var i=e.text;if(["\\imath","\\jmath"].includes(i))return null;Gn[s][i]&&Gn[s][i].replace&&(i=Gn[s][i].replace);var a=we.fontMap[r].fontName;return VO(i,a,s)?we.fontMap[r].variant:null};function S4(t){if(!t)return!1;if(t.type==="mi"&&t.children.length===1){var e=t.children[0];return e instanceof rl&&e.text==="."}else if(t.type==="mo"&&t.children.length===1&&t.getAttribute("separator")==="true"&&t.getAttribute("lspace")==="0em"&&t.getAttribute("rspace")==="0em"){var n=t.children[0];return n instanceof rl&&n.text===","}else return!1}var di=function(e,n,r){if(e.length===1){var s=Un(e[0],n);return r&&s instanceof Ci&&s.type==="mo"&&(s.setAttribute("lspace","0em"),s.setAttribute("rspace","0em")),[s]}for(var i=[],a,o=0;o=1&&(a.type==="mn"||S4(a))){var h=c.children[0];h instanceof Ci&&h.type==="mn"&&(h.children=[...a.children,...h.children],i.pop())}else if(a.type==="mi"&&a.children.length===1){var f=a.children[0];if(f instanceof rl&&f.text==="̸"&&(c.type==="mo"||c.type==="mi"||c.type==="mn")){var m=c.children[0];m instanceof rl&&m.text.length>0&&(m.text=m.text.slice(0,1)+"̸"+m.text.slice(1),i.pop())}}}i.push(c),a=c}return i},Nc=function(e,n,r){return GO(di(e,n,r))},Un=function(e,n){if(!e)return new Ie.MathNode("mrow");if(dv[e.type]){var r=dv[e.type](e,n);return r}else throw new Be("Got group of unknown type: '"+e.type+"'")};function sM(t,e,n,r,s){var i=di(t,n),a;i.length===1&&i[0]instanceof Ci&&["mrow","mtable"].includes(i[0].type)?a=i[0]:a=new Ie.MathNode("mrow",i);var o=new Ie.MathNode("annotation",[new Ie.TextNode(e)]);o.setAttribute("encoding","application/x-tex");var c=new Ie.MathNode("semantics",[a,o]),h=new Ie.MathNode("math",[c]);h.setAttribute("xmlns","http://www.w3.org/1998/Math/MathML"),r&&h.setAttribute("display","block");var f=s?"katex":"katex-mathml";return we.makeSpan([f],[h])}var lQ=function(e){return new Zl({style:e.displayMode?kt.DISPLAY:kt.TEXT,maxSize:e.maxSize,minRuleThickness:e.minRuleThickness})},oQ=function(e,n){if(n.displayMode){var r=["katex-display"];n.leqno&&r.push("leqno"),n.fleqn&&r.push("fleqn"),e=we.makeSpan(r,[e])}return e},zbe=function(e,n,r){var s=lQ(r),i;if(r.output==="mathml")return sM(e,n,s,r.displayMode,!0);if(r.output==="html"){var a=ck(e,s);i=we.makeSpan(["katex"],[a])}else{var o=sM(e,n,s,r.displayMode,!1),c=ck(e,s);i=we.makeSpan(["katex"],[o,c])}return oQ(i,r)},Pbe=function(e,n,r){var s=lQ(r),i=ck(e,s),a=we.makeSpan(["katex"],[i]);return oQ(a,r)},Lbe={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":"="},Ibe=function(e){var n=new Ie.MathNode("mo",[new Ie.TextNode(Lbe[e.replace(/^\\/,"")])]);return n.setAttribute("stretchy","true"),n},Bbe={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]},qbe=function(e){return e.type==="ordgroup"?e.body.length:1},Fbe=function(e,n){function r(){var o=4e5,c=e.label.slice(1);if(["widehat","widecheck","widetilde","utilde"].includes(c)){var h=e,f=qbe(h.base),m,g,x;if(f>5)c==="widehat"||c==="widecheck"?(m=420,o=2364,x=.42,g=c+"4"):(m=312,o=2340,x=.34,g="tilde4");else{var y=[1,1,2,2,3,3][f];c==="widehat"||c==="widecheck"?(o=[0,1062,2364,2364,2364][y],m=[0,239,300,360,420][y],x=[0,.24,.3,.3,.36,.42][y],g=c+y):(o=[0,600,1033,2339,2340][y],m=[0,260,286,306,312][y],x=[0,.26,.286,.3,.306,.34][y],g="tilde"+y)}var w=new jc(g),S=new go([w],{width:"100%",height:Ve(x),viewBox:"0 0 "+o+" "+m,preserveAspectRatio:"none"});return{span:we.makeSvgSpan([],[S],n),minWidth:0,height:x}}else{var k=[],N=Bbe[c],[C,T,_]=N,E=_/1e3,M=C.length,q,L;if(M===1){var I=N[3];q=["hide-tail"],L=[I]}else if(M===2)q=["halfarrow-left","halfarrow-right"],L=["xMinYMin","xMaxYMin"];else if(M===3)q=["brace-left","brace-center","brace-right"],L=["xMinYMin","xMidYMin","xMaxYMin"];else throw new Error(`Correct katexImagesData or update code here to support + `+M+" children.");for(var $=0;$0&&(s.style.minWidth=Ve(i)),s},$be=function(e,n,r,s,i){var a,o=e.height+e.depth+r+s;if(/fbox|color|angl/.test(n)){if(a=we.makeSpan(["stretchy",n],[],i),n==="fbox"){var c=i.color&&i.getColor();c&&(a.style.borderColor=c)}}else{var h=[];/^[bx]cancel$/.test(n)&&h.push(new ak({x1:"0",y1:"0",x2:"100%",y2:"100%","stroke-width":"0.046em"})),/^x?cancel$/.test(n)&&h.push(new ak({x1:"0",y1:"100%",x2:"100%",y2:"0","stroke-width":"0.046em"}));var f=new go(h,{width:"100%",height:Ve(o)});a=we.makeSvgSpan([],[f],i)}return a.height=o,a.style.height=Ve(o),a},vo={encloseSpan:$be,mathMLnode:Ibe,svgSpan:Fbe};function $t(t,e){if(!t||t.type!==e)throw new Error("Expected node of type "+e+", but got "+(t?"node of type "+t.type:String(t)));return t}function YO(t){var e=wy(t);if(!e)throw new Error("Expected node of symbol group type, but got "+(t?"node of type "+t.type:String(t)));return e}function wy(t){return t&&(t.type==="atom"||fbe.hasOwnProperty(t.type))?t:null}var KO=(t,e)=>{var n,r,s;t&&t.type==="supsub"?(r=$t(t.base,"accent"),n=r.base,t.base=n,s=dbe(Sn(t,e)),t.base=r):(r=$t(t,"accent"),n=r.base);var i=Sn(n,e.havingCrampedStyle()),a=r.isShifty&&Nn.isCharacterBox(n),o=0;if(a){var c=Nn.getBaseElem(n),h=Sn(c,e.havingCrampedStyle());o=K_(h).skew}var f=r.label==="\\c",m=f?i.height+i.depth:Math.min(i.height,e.fontMetrics().xHeight),g;if(r.isStretchy)g=vo.svgSpan(r,e),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"elem",elem:g,wrapperClasses:["svg-align"],wrapperStyle:o>0?{width:"calc(100% - "+Ve(2*o)+")",marginLeft:Ve(2*o)}:void 0}]},e);else{var x,y;r.label==="\\vec"?(x=we.staticSvg("vec",e),y=we.svgData.vec[1]):(x=we.makeOrd({mode:r.mode,text:r.label},e,"textord"),x=K_(x),x.italic=0,y=x.width,f&&(m+=x.depth)),g=we.makeSpan(["accent-body"],[x]);var w=r.label==="\\textcircled";w&&(g.classes.push("accent-full"),m=i.height);var S=o;w||(S-=y/2),g.style.left=Ve(S),r.label==="\\textcircled"&&(g.style.top=".2em"),g=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:-m},{type:"elem",elem:g}]},e)}var k=we.makeSpan(["mord","accent"],[g],e);return s?(s.children[0]=k,s.height=Math.max(k.height,s.height),s.classes[0]="mord",s):k},cQ=(t,e)=>{var n=t.isStretchy?vo.mathMLnode(t.label):new Ie.MathNode("mo",[ca(t.label,t.mode)]),r=new Ie.MathNode("mover",[Un(t.base,e),n]);return r.setAttribute("accent","true"),r},Qbe=new RegExp(["\\acute","\\grave","\\ddot","\\tilde","\\bar","\\breve","\\check","\\hat","\\vec","\\dot","\\mathring"].map(t=>"\\"+t).join("|"));Ke({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:(t,e)=>{var n=hv(e[0]),r=!Qbe.test(t.funcName),s=!r||t.funcName==="\\widehat"||t.funcName==="\\widetilde"||t.funcName==="\\widecheck";return{type:"accent",mode:t.parser.mode,label:t.funcName,isStretchy:r,isShifty:s,base:n}},htmlBuilder:KO,mathmlBuilder:cQ});Ke({type:"accent",names:["\\'","\\`","\\^","\\~","\\=","\\u","\\.",'\\"',"\\c","\\r","\\H","\\v","\\textcircled"],props:{numArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["primitive"]},handler:(t,e)=>{var n=e[0],r=t.parser.mode;return r==="math"&&(t.parser.settings.reportNonstrict("mathVsTextAccents","LaTeX's accent "+t.funcName+" works only in text mode"),r="text"),{type:"accent",mode:r,label:t.funcName,isStretchy:!1,isShifty:!0,base:n}},htmlBuilder:KO,mathmlBuilder:cQ});Ke({type:"accentUnder",names:["\\underleftarrow","\\underrightarrow","\\underleftrightarrow","\\undergroup","\\underlinesegment","\\utilde"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"accentUnder",mode:n.mode,label:r,base:s}},htmlBuilder:(t,e)=>{var n=Sn(t.base,e),r=vo.svgSpan(t,e),s=t.label==="\\utilde"?.12:0,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"elem",elem:r,wrapperClasses:["svg-align"]},{type:"kern",size:s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","accentunder"],[i],e)},mathmlBuilder:(t,e)=>{var n=vo.mathMLnode(t.label),r=new Ie.MathNode("munder",[Un(t.base,e),n]);return r.setAttribute("accentunder","true"),r}});var Rx=t=>{var e=new Ie.MathNode("mpadded",t?[t]:[]);return e.setAttribute("width","+0.6em"),e.setAttribute("lspace","0.3em"),e};Ke({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(t,e,n){var{parser:r,funcName:s}=t;return{type:"xArrow",mode:r.mode,label:s,body:e[0],below:n[0]}},htmlBuilder(t,e){var n=e.style,r=e.havingStyle(n.sup()),s=we.wrapFragment(Sn(t.body,r,e),e),i=t.label.slice(0,2)==="\\x"?"x":"cd";s.classes.push(i+"-arrow-pad");var a;t.below&&(r=e.havingStyle(n.sub()),a=we.wrapFragment(Sn(t.below,r,e),e),a.classes.push(i+"-arrow-pad"));var o=vo.svgSpan(t,e),c=-e.fontMetrics().axisHeight+.5*o.height,h=-e.fontMetrics().axisHeight-.5*o.height-.111;(s.depth>.25||t.label==="\\xleftequilibrium")&&(h-=s.depth);var f;if(a){var m=-e.fontMetrics().axisHeight+a.height+.5*o.height+.111;f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:c},{type:"elem",elem:a,shift:m}]},e)}else f=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:s,shift:h},{type:"elem",elem:o,shift:c}]},e);return f.children[0].children[0].children[1].classes.push("svg-align"),we.makeSpan(["mrel","x-arrow"],[f],e)},mathmlBuilder(t,e){var n=vo.mathMLnode(t.label);n.setAttribute("minsize",t.label.charAt(0)==="x"?"1.75em":"3.0em");var r;if(t.body){var s=Rx(Un(t.body,e));if(t.below){var i=Rx(Un(t.below,e));r=new Ie.MathNode("munderover",[n,i,s])}else r=new Ie.MathNode("mover",[n,s])}else if(t.below){var a=Rx(Un(t.below,e));r=new Ie.MathNode("munder",[n,a])}else r=Rx(),r=new Ie.MathNode("mover",[n,r]);return r}});var Hbe=we.makeSpan;function uQ(t,e){var n=Wr(t.body,e,!0);return Hbe([t.mclass],n,e)}function dQ(t,e){var n,r=di(t.body,e);return t.mclass==="minner"?n=new Ie.MathNode("mpadded",r):t.mclass==="mord"?t.isCharacterBox?(n=r[0],n.type="mi"):n=new Ie.MathNode("mi",r):(t.isCharacterBox?(n=r[0],n.type="mo"):n=new Ie.MathNode("mo",r),t.mclass==="mbin"?(n.attributes.lspace="0.22em",n.attributes.rspace="0.22em"):t.mclass==="mpunct"?(n.attributes.lspace="0em",n.attributes.rspace="0.17em"):t.mclass==="mopen"||t.mclass==="mclose"?(n.attributes.lspace="0em",n.attributes.rspace="0em"):t.mclass==="minner"&&(n.attributes.lspace="0.0556em",n.attributes.width="+0.1111em")),n}Ke({type:"mclass",names:["\\mathord","\\mathbin","\\mathrel","\\mathopen","\\mathclose","\\mathpunct","\\mathinner"],props:{numArgs:1,primitive:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"mclass",mode:n.mode,mclass:"m"+r.slice(5),body:jr(s),isCharacterBox:Nn.isCharacterBox(s)}},htmlBuilder:uQ,mathmlBuilder:dQ});var Sy=t=>{var e=t.type==="ordgroup"&&t.body.length?t.body[0]:t;return e.type==="atom"&&(e.family==="bin"||e.family==="rel")?"m"+e.family:"mord"};Ke({type:"mclass",names:["\\@binrel"],props:{numArgs:2},handler(t,e){var{parser:n}=t;return{type:"mclass",mode:n.mode,mclass:Sy(e[0]),body:jr(e[1]),isCharacterBox:Nn.isCharacterBox(e[1])}}});Ke({type:"mclass",names:["\\stackrel","\\overset","\\underset"],props:{numArgs:2},handler(t,e){var{parser:n,funcName:r}=t,s=e[1],i=e[0],a;r!=="\\stackrel"?a=Sy(s):a="mrel";var o={type:"op",mode:s.mode,limits:!0,alwaysHandleSupSub:!0,parentIsSupSub:!1,symbol:!1,suppressBaseShift:r!=="\\stackrel",body:jr(s)},c={type:"supsub",mode:i.mode,base:o,sup:r==="\\underset"?null:i,sub:r==="\\underset"?i:null};return{type:"mclass",mode:n.mode,mclass:a,body:[c],isCharacterBox:Nn.isCharacterBox(c)}},htmlBuilder:uQ,mathmlBuilder:dQ});Ke({type:"pmb",names:["\\pmb"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"pmb",mode:n.mode,mclass:Sy(e[0]),body:jr(e[0])}},htmlBuilder(t,e){var n=Wr(t.body,e,!0),r=we.makeSpan([t.mclass],n,e);return r.style.textShadow="0.02em 0.01em 0.04px",r},mathmlBuilder(t,e){var n=di(t.body,e),r=new Ie.MathNode("mstyle",n);return r.setAttribute("style","text-shadow: 0.02em 0.01em 0.04px"),r}});var Vbe={">":"\\\\cdrightarrow","<":"\\\\cdleftarrow","=":"\\\\cdlongequal",A:"\\uparrow",V:"\\downarrow","|":"\\Vert",".":"no arrow"},iM=()=>({type:"styling",body:[],mode:"math",style:"display"}),aM=t=>t.type==="textord"&&t.text==="@",Ube=(t,e)=>(t.type==="mathord"||t.type==="atom")&&t.text===e;function Wbe(t,e,n){var r=Vbe[t];switch(r){case"\\\\cdrightarrow":case"\\\\cdleftarrow":return n.callFunction(r,[e[0]],[e[1]]);case"\\uparrow":case"\\downarrow":{var s=n.callFunction("\\\\cdleft",[e[0]],[]),i={type:"atom",text:r,mode:"math",family:"rel"},a=n.callFunction("\\Big",[i],[]),o=n.callFunction("\\\\cdright",[e[1]],[]),c={type:"ordgroup",mode:"math",body:[s,a,o]};return n.callFunction("\\\\cdparent",[c],[])}case"\\\\cdlongequal":return n.callFunction("\\\\cdlongequal",[],[]);case"\\Vert":{var h={type:"textord",text:"\\Vert",mode:"math"};return n.callFunction("\\Big",[h],[])}default:return{type:"textord",text:" ",mode:"math"}}}function Gbe(t){var e=[];for(t.gullet.beginGroup(),t.gullet.macros.set("\\cr","\\\\\\relax"),t.gullet.beginGroup();;){e.push(t.parseExpression(!1,"\\\\")),t.gullet.endGroup(),t.gullet.beginGroup();var n=t.fetch().text;if(n==="&"||n==="\\\\")t.consume();else if(n==="\\end"){e[e.length-1].length===0&&e.pop();break}else throw new Be("Expected \\\\ or \\cr or \\end",t.nextToken)}for(var r=[],s=[r],i=0;i-1))if("<>AV".indexOf(h)>-1)for(var m=0;m<2;m++){for(var g=!0,x=c+1;xAV=|." after @',a[c]);var y=Wbe(h,f,t),w={type:"styling",body:[y],mode:"math",style:"display"};r.push(w),o=iM()}i%2===0?r.push(o):r.shift(),r=[],s.push(r)}t.gullet.endGroup(),t.gullet.endGroup();var S=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:S,colSeparationType:"CD",hLinesBeforeRow:new Array(s.length+1).fill([])}}Ke({type:"cdlabel",names:["\\\\cdleft","\\\\cdright"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"cdlabel",mode:n.mode,side:r.slice(4),label:e[0]}},htmlBuilder(t,e){var n=e.havingStyle(e.style.sup()),r=we.wrapFragment(Sn(t.label,n,e),e);return r.classes.push("cd-label-"+t.side),r.style.bottom=Ve(.8-r.depth),r.height=0,r.depth=0,r},mathmlBuilder(t,e){var n=new Ie.MathNode("mrow",[Un(t.label,e)]);return n=new Ie.MathNode("mpadded",[n]),n.setAttribute("width","0"),t.side==="left"&&n.setAttribute("lspace","-1width"),n.setAttribute("voffset","0.7em"),n=new Ie.MathNode("mstyle",[n]),n.setAttribute("displaystyle","false"),n.setAttribute("scriptlevel","1"),n}});Ke({type:"cdlabelparent",names:["\\\\cdparent"],props:{numArgs:1},handler(t,e){var{parser:n}=t;return{type:"cdlabelparent",mode:n.mode,fragment:e[0]}},htmlBuilder(t,e){var n=we.wrapFragment(Sn(t.fragment,e),e);return n.classes.push("cd-vert-arrow"),n},mathmlBuilder(t,e){return new Ie.MathNode("mrow",[Un(t.fragment,e)])}});Ke({type:"textord",names:["\\@char"],props:{numArgs:1,allowedInText:!0},handler(t,e){for(var{parser:n}=t,r=$t(e[0],"ordgroup"),s=r.body,i="",a=0;a=1114111)throw new Be("\\@char with invalid code point "+i);return c<=65535?h=String.fromCharCode(c):(c-=65536,h=String.fromCharCode((c>>10)+55296,(c&1023)+56320)),{type:"textord",mode:n.mode,text:h}}});var hQ=(t,e)=>{var n=Wr(t.body,e.withColor(t.color),!1);return we.makeFragment(n)},fQ=(t,e)=>{var n=di(t.body,e.withColor(t.color)),r=new Ie.MathNode("mstyle",n);return r.setAttribute("mathcolor",t.color),r};Ke({type:"color",names:["\\textcolor"],props:{numArgs:2,allowedInText:!0,argTypes:["color","original"]},handler(t,e){var{parser:n}=t,r=$t(e[0],"color-token").color,s=e[1];return{type:"color",mode:n.mode,color:r,body:jr(s)}},htmlBuilder:hQ,mathmlBuilder:fQ});Ke({type:"color",names:["\\color"],props:{numArgs:1,allowedInText:!0,argTypes:["color"]},handler(t,e){var{parser:n,breakOnTokenText:r}=t,s=$t(e[0],"color-token").color;n.gullet.macros.set("\\current@color",s);var i=n.parseExpression(!0,r);return{type:"color",mode:n.mode,color:s,body:i}},htmlBuilder:hQ,mathmlBuilder:fQ});Ke({type:"cr",names:["\\\\"],props:{numArgs:0,numOptionalArgs:0,allowedInText:!0},handler(t,e,n){var{parser:r}=t,s=r.gullet.future().text==="["?r.parseSizeGroup(!0):null,i=!r.settings.displayMode||!r.settings.useStrictBehavior("newLineInDisplayMode","In LaTeX, \\\\ or \\newline does nothing in display mode");return{type:"cr",mode:r.mode,newLine:i,size:s&&$t(s,"size").value}},htmlBuilder(t,e){var n=we.makeSpan(["mspace"],[],e);return t.newLine&&(n.classes.push("newline"),t.size&&(n.style.marginTop=Ve(hr(t.size,e)))),n},mathmlBuilder(t,e){var n=new Ie.MathNode("mspace");return t.newLine&&(n.setAttribute("linebreak","newline"),t.size&&n.setAttribute("height",Ve(hr(t.size,e)))),n}});var uk={"\\global":"\\global","\\long":"\\\\globallong","\\\\globallong":"\\\\globallong","\\def":"\\gdef","\\gdef":"\\gdef","\\edef":"\\xdef","\\xdef":"\\xdef","\\let":"\\\\globallet","\\futurelet":"\\\\globalfuture"},mQ=t=>{var e=t.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(e))throw new Be("Expected a control sequence",t);return e},Xbe=t=>{var e=t.gullet.popToken();return e.text==="="&&(e=t.gullet.popToken(),e.text===" "&&(e=t.gullet.popToken())),e},pQ=(t,e,n,r)=>{var s=t.gullet.macros.get(n.text);s==null&&(n.noexpand=!0,s={tokens:[n],numArgs:0,unexpandable:!t.gullet.isExpandable(n.text)}),t.gullet.macros.set(e,s,r)};Ke({type:"internal",names:["\\global","\\long","\\\\globallong"],props:{numArgs:0,allowedInText:!0},handler(t){var{parser:e,funcName:n}=t;e.consumeSpaces();var r=e.fetch();if(uk[r.text])return(n==="\\global"||n==="\\\\globallong")&&(r.text=uk[r.text]),$t(e.parseFunction(),"internal");throw new Be("Invalid token after macro prefix",r)}});Ke({type:"internal",names:["\\def","\\gdef","\\edef","\\xdef"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=e.gullet.popToken(),s=r.text;if(/^(?:[\\{}$&#^_]|EOF)$/.test(s))throw new Be("Expected a control sequence",r);for(var i=0,a,o=[[]];e.gullet.future().text!=="{";)if(r=e.gullet.popToken(),r.text==="#"){if(e.gullet.future().text==="{"){a=e.gullet.future(),o[i].push("{");break}if(r=e.gullet.popToken(),!/^[1-9]$/.test(r.text))throw new Be('Invalid argument number "'+r.text+'"');if(parseInt(r.text)!==i+1)throw new Be('Argument number "'+r.text+'" out of order');i++,o.push([])}else{if(r.text==="EOF")throw new Be("Expected a macro definition");o[i].push(r.text)}var{tokens:c}=e.gullet.consumeArg();return a&&c.unshift(a),(n==="\\edef"||n==="\\xdef")&&(c=e.gullet.expandTokens(c),c.reverse()),e.gullet.macros.set(s,{tokens:c,numArgs:i,delimiters:o},n===uk[n]),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\let","\\\\globallet"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=mQ(e.gullet.popToken());e.gullet.consumeSpaces();var s=Xbe(e);return pQ(e,r,s,n==="\\\\globallet"),{type:"internal",mode:e.mode}}});Ke({type:"internal",names:["\\futurelet","\\\\globalfuture"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t){var{parser:e,funcName:n}=t,r=mQ(e.gullet.popToken()),s=e.gullet.popToken(),i=e.gullet.popToken();return pQ(e,r,i,n==="\\\\globalfuture"),e.gullet.pushToken(i),e.gullet.pushToken(s),{type:"internal",mode:e.mode}}});var vm=function(e,n,r){var s=Gn.math[e]&&Gn.math[e].replace,i=VO(s||e,n,r);if(!i)throw new Error("Unsupported symbol "+e+" and font size "+n+".");return i},ZO=function(e,n,r,s){var i=r.havingBaseStyle(n),a=we.makeSpan(s.concat(i.sizingClasses(r)),[e],r),o=i.sizeMultiplier/r.sizeMultiplier;return a.height*=o,a.depth*=o,a.maxFontSize=i.sizeMultiplier,a},gQ=function(e,n,r){var s=n.havingBaseStyle(r),i=(1-n.sizeMultiplier/s.sizeMultiplier)*n.fontMetrics().axisHeight;e.classes.push("delimcenter"),e.style.top=Ve(i),e.height-=i,e.depth+=i},Ybe=function(e,n,r,s,i,a){var o=we.makeSymbol(e,"Main-Regular",i,s),c=ZO(o,n,s,a);return r&&gQ(c,s,n),c},Kbe=function(e,n,r,s){return we.makeSymbol(e,"Size"+n+"-Regular",r,s)},xQ=function(e,n,r,s,i,a){var o=Kbe(e,n,i,s),c=ZO(we.makeSpan(["delimsizing","size"+n],[o],s),kt.TEXT,s,a);return r&&gQ(c,s,kt.TEXT),c},k4=function(e,n,r){var s;n==="Size1-Regular"?s="delim-size1":s="delim-size4";var i=we.makeSpan(["delimsizinginner",s],[we.makeSpan([],[we.makeSymbol(e,n,r)])]);return{type:"elem",elem:i}},O4=function(e,n,r){var s=nl["Size4-Regular"][e.charCodeAt(0)]?nl["Size4-Regular"][e.charCodeAt(0)][4]:nl["Size1-Regular"][e.charCodeAt(0)][4],i=new jc("inner",nbe(e,Math.round(1e3*n))),a=new go([i],{width:Ve(s),height:Ve(n),style:"width:"+Ve(s),viewBox:"0 0 "+1e3*s+" "+Math.round(1e3*n),preserveAspectRatio:"xMinYMin"}),o=we.makeSvgSpan([],[a],r);return o.height=n,o.style.height=Ve(n),o.style.width=Ve(s),{type:"elem",elem:o}},dk=.008,Dx={type:"kern",size:-1*dk},Zbe=["|","\\lvert","\\rvert","\\vert"],Jbe=["\\|","\\lVert","\\rVert","\\Vert"],vQ=function(e,n,r,s,i,a){var o,c,h,f,m="",g=0;o=h=f=e,c=null;var x="Size1-Regular";e==="\\uparrow"?h=f="⏐":e==="\\Uparrow"?h=f="‖":e==="\\downarrow"?o=h="⏐":e==="\\Downarrow"?o=h="‖":e==="\\updownarrow"?(o="\\uparrow",h="⏐",f="\\downarrow"):e==="\\Updownarrow"?(o="\\Uparrow",h="‖",f="\\Downarrow"):Zbe.includes(e)?(h="∣",m="vert",g=333):Jbe.includes(e)?(h="∥",m="doublevert",g=556):e==="["||e==="\\lbrack"?(o="⎡",h="⎢",f="⎣",x="Size4-Regular",m="lbrack",g=667):e==="]"||e==="\\rbrack"?(o="⎤",h="⎥",f="⎦",x="Size4-Regular",m="rbrack",g=667):e==="\\lfloor"||e==="⌊"?(h=o="⎢",f="⎣",x="Size4-Regular",m="lfloor",g=667):e==="\\lceil"||e==="⌈"?(o="⎡",h=f="⎢",x="Size4-Regular",m="lceil",g=667):e==="\\rfloor"||e==="⌋"?(h=o="⎥",f="⎦",x="Size4-Regular",m="rfloor",g=667):e==="\\rceil"||e==="⌉"?(o="⎤",h=f="⎥",x="Size4-Regular",m="rceil",g=667):e==="("||e==="\\lparen"?(o="⎛",h="⎜",f="⎝",x="Size4-Regular",m="lparen",g=875):e===")"||e==="\\rparen"?(o="⎞",h="⎟",f="⎠",x="Size4-Regular",m="rparen",g=875):e==="\\{"||e==="\\lbrace"?(o="⎧",c="⎨",f="⎩",h="⎪",x="Size4-Regular"):e==="\\}"||e==="\\rbrace"?(o="⎫",c="⎬",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lgroup"||e==="⟮"?(o="⎧",f="⎩",h="⎪",x="Size4-Regular"):e==="\\rgroup"||e==="⟯"?(o="⎫",f="⎭",h="⎪",x="Size4-Regular"):e==="\\lmoustache"||e==="⎰"?(o="⎧",f="⎭",h="⎪",x="Size4-Regular"):(e==="\\rmoustache"||e==="⎱")&&(o="⎫",f="⎩",h="⎪",x="Size4-Regular");var y=vm(o,x,i),w=y.height+y.depth,S=vm(h,x,i),k=S.height+S.depth,N=vm(f,x,i),C=N.height+N.depth,T=0,_=1;if(c!==null){var E=vm(c,x,i);T=E.height+E.depth,_=2}var M=w+C+T,q=Math.max(0,Math.ceil((n-M)/(_*k))),L=M+q*_*k,I=s.fontMetrics().axisHeight;r&&(I*=s.sizeMultiplier);var $=L/2-I,V=[];if(m.length>0){var ee=L-w-C,z=Math.round(L*1e3),H=rbe(m,Math.round(ee*1e3)),P=new jc(m,H),W=(g/1e3).toFixed(3)+"em",J=(z/1e3).toFixed(3)+"em",X=new go([P],{width:W,height:J,viewBox:"0 0 "+g+" "+z}),R=we.makeSvgSpan([],[X],s);R.height=z/1e3,R.style.width=W,R.style.height=J,V.push({type:"elem",elem:R})}else{if(V.push(k4(f,x,i)),V.push(Dx),c===null){var se=L-w-C+2*dk;V.push(O4(h,se,s))}else{var G=(L-w-C-T)/2+2*dk;V.push(O4(h,G,s)),V.push(Dx),V.push(k4(c,x,i)),V.push(Dx),V.push(O4(h,G,s))}V.push(Dx),V.push(k4(o,x,i))}var F=s.havingBaseStyle(kt.TEXT),U=we.makeVList({positionType:"bottom",positionData:$,children:V},F);return ZO(we.makeSpan(["delimsizing","mult"],[U],F),kt.TEXT,s,a)},j4=80,N4=.08,C4=function(e,n,r,s,i){var a=tbe(e,s,r),o=new jc(e,a),c=new go([o],{width:"400em",height:Ve(n),viewBox:"0 0 400000 "+r,preserveAspectRatio:"xMinYMin slice"});return we.makeSvgSpan(["hide-tail"],[c],i)},e2e=function(e,n){var r=n.havingBaseSizing(),s=SQ("\\surd",e*r.sizeMultiplier,wQ,r),i=r.sizeMultiplier,a=Math.max(0,n.minRuleThickness-n.fontMetrics().sqrtRuleThickness),o,c=0,h=0,f=0,m;return s.type==="small"?(f=1e3+1e3*a+j4,e<1?i=1:e<1.4&&(i=.7),c=(1+a+N4)/i,h=(1+a)/i,o=C4("sqrtMain",c,f,a,n),o.style.minWidth="0.853em",m=.833/i):s.type==="large"?(f=(1e3+j4)*Bm[s.size],h=(Bm[s.size]+a)/i,c=(Bm[s.size]+a+N4)/i,o=C4("sqrtSize"+s.size,c,f,a,n),o.style.minWidth="1.02em",m=1/i):(c=e+a+N4,h=e+a,f=Math.floor(1e3*e+a)+j4,o=C4("sqrtTall",c,f,a,n),o.style.minWidth="0.742em",m=1.056),o.height=h,o.style.height=Ve(c),{span:o,advanceWidth:m,ruleWidth:(n.fontMetrics().sqrtRuleThickness+a)*i}},yQ=["(","\\lparen",")","\\rparen","[","\\lbrack","]","\\rbrack","\\{","\\lbrace","\\}","\\rbrace","\\lfloor","\\rfloor","⌊","⌋","\\lceil","\\rceil","⌈","⌉","\\surd"],t2e=["\\uparrow","\\downarrow","\\updownarrow","\\Uparrow","\\Downarrow","\\Updownarrow","|","\\|","\\vert","\\Vert","\\lvert","\\rvert","\\lVert","\\rVert","\\lgroup","\\rgroup","⟮","⟯","\\lmoustache","\\rmoustache","⎰","⎱"],bQ=["<",">","\\langle","\\rangle","/","\\backslash","\\lt","\\gt"],Bm=[0,1.2,1.8,2.4,3],n2e=function(e,n,r,s,i){if(e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle"),yQ.includes(e)||bQ.includes(e))return xQ(e,n,!1,r,s,i);if(t2e.includes(e))return vQ(e,Bm[n],!1,r,s,i);throw new Be("Illegal delimiter: '"+e+"'")},r2e=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4}],s2e=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"stack"}],wQ=[{type:"small",style:kt.SCRIPTSCRIPT},{type:"small",style:kt.SCRIPT},{type:"small",style:kt.TEXT},{type:"large",size:1},{type:"large",size:2},{type:"large",size:3},{type:"large",size:4},{type:"stack"}],i2e=function(e){if(e.type==="small")return"Main-Regular";if(e.type==="large")return"Size"+e.size+"-Regular";if(e.type==="stack")return"Size4-Regular";throw new Error("Add support for delim type '"+e.type+"' here.")},SQ=function(e,n,r,s){for(var i=Math.min(2,3-s.style.size),a=i;an)return r[a]}return r[r.length-1]},kQ=function(e,n,r,s,i,a){e==="<"||e==="\\lt"||e==="⟨"?e="\\langle":(e===">"||e==="\\gt"||e==="⟩")&&(e="\\rangle");var o;bQ.includes(e)?o=r2e:yQ.includes(e)?o=wQ:o=s2e;var c=SQ(e,n,o,s);return c.type==="small"?Ybe(e,c.style,r,s,i,a):c.type==="large"?xQ(e,c.size,r,s,i,a):vQ(e,n,r,s,i,a)},a2e=function(e,n,r,s,i,a){var o=s.fontMetrics().axisHeight*s.sizeMultiplier,c=901,h=5/s.fontMetrics().ptPerEm,f=Math.max(n-o,r+o),m=Math.max(f/500*c,2*f-h);return kQ(e,m,!0,s,i,a)},oo={sqrtImage:e2e,sizedDelim:n2e,sizeToMaxHeight:Bm,customSizedDelim:kQ,leftRightDelim:a2e},lM={"\\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}},l2e=["(","\\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 ky(t,e){var n=wy(t);if(n&&l2e.includes(n.text))return n;throw n?new Be("Invalid delimiter '"+n.text+"' after '"+e.funcName+"'",t):new Be("Invalid delimiter type '"+t.type+"'",t)}Ke({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:(t,e)=>{var n=ky(e[0],t);return{type:"delimsizing",mode:t.parser.mode,size:lM[t.funcName].size,mclass:lM[t.funcName].mclass,delim:n.text}},htmlBuilder:(t,e)=>t.delim==="."?we.makeSpan([t.mclass]):oo.sizedDelim(t.delim,t.size,e,t.mode,[t.mclass]),mathmlBuilder:t=>{var e=[];t.delim!=="."&&e.push(ca(t.delim,t.mode));var n=new Ie.MathNode("mo",e);t.mclass==="mopen"||t.mclass==="mclose"?n.setAttribute("fence","true"):n.setAttribute("fence","false"),n.setAttribute("stretchy","true");var r=Ve(oo.sizeToMaxHeight[t.size]);return n.setAttribute("minsize",r),n.setAttribute("maxsize",r),n}});function oM(t){if(!t.body)throw new Error("Bug: The leftright ParseNode wasn't fully parsed.")}Ke({type:"leftright-right",names:["\\right"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=t.parser.gullet.macros.get("\\current@color");if(n&&typeof n!="string")throw new Be("\\current@color set to non-string in \\right");return{type:"leftright-right",mode:t.parser.mode,delim:ky(e[0],t).text,color:n}}});Ke({type:"leftright",names:["\\left"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=ky(e[0],t),r=t.parser;++r.leftrightDepth;var s=r.parseExpression(!1);--r.leftrightDepth,r.expect("\\right",!1);var i=$t(r.parseFunction(),"leftright-right");return{type:"leftright",mode:r.mode,body:s,left:n.text,right:i.delim,rightColor:i.color}},htmlBuilder:(t,e)=>{oM(t);for(var n=Wr(t.body,e,!0,["mopen","mclose"]),r=0,s=0,i=!1,a=0;a{oM(t);var n=di(t.body,e);if(t.left!=="."){var r=new Ie.MathNode("mo",[ca(t.left,t.mode)]);r.setAttribute("fence","true"),n.unshift(r)}if(t.right!=="."){var s=new Ie.MathNode("mo",[ca(t.right,t.mode)]);s.setAttribute("fence","true"),t.rightColor&&s.setAttribute("mathcolor",t.rightColor),n.push(s)}return GO(n)}});Ke({type:"middle",names:["\\middle"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var n=ky(e[0],t);if(!t.parser.leftrightDepth)throw new Be("\\middle without preceding \\left",n);return{type:"middle",mode:t.parser.mode,delim:n.text}},htmlBuilder:(t,e)=>{var n;if(t.delim===".")n=b0(e,[]);else{n=oo.sizedDelim(t.delim,1,e,t.mode,[]);var r={delim:t.delim,options:e};n.isMiddle=r}return n},mathmlBuilder:(t,e)=>{var n=t.delim==="\\vert"||t.delim==="|"?ca("|","text"):ca(t.delim,t.mode),r=new Ie.MathNode("mo",[n]);return r.setAttribute("fence","true"),r.setAttribute("lspace","0.05em"),r.setAttribute("rspace","0.05em"),r}});var JO=(t,e)=>{var n=we.wrapFragment(Sn(t.body,e),e),r=t.label.slice(1),s=e.sizeMultiplier,i,a=0,o=Nn.isCharacterBox(t.body);if(r==="sout")i=we.makeSpan(["stretchy","sout"]),i.height=e.fontMetrics().defaultRuleThickness/s,a=-.5*e.fontMetrics().xHeight;else if(r==="phase"){var c=hr({number:.6,unit:"pt"},e),h=hr({number:.35,unit:"ex"},e),f=e.havingBaseSizing();s=s/f.sizeMultiplier;var m=n.height+n.depth+c+h;n.style.paddingLeft=Ve(m/2+c);var g=Math.floor(1e3*m*s),x=Jye(g),y=new go([new jc("phase",x)],{width:"400em",height:Ve(g/1e3),viewBox:"0 0 400000 "+g,preserveAspectRatio:"xMinYMin slice"});i=we.makeSvgSpan(["hide-tail"],[y],e),i.style.height=Ve(m),a=n.depth+c+h}else{/cancel/.test(r)?o||n.classes.push("cancel-pad"):r==="angl"?n.classes.push("anglpad"):n.classes.push("boxpad");var w=0,S=0,k=0;/box/.test(r)?(k=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness),w=e.fontMetrics().fboxsep+(r==="colorbox"?0:k),S=w):r==="angl"?(k=Math.max(e.fontMetrics().defaultRuleThickness,e.minRuleThickness),w=4*k,S=Math.max(0,.25-n.depth)):(w=o?.2:0,S=w),i=vo.encloseSpan(n,r,w,S,e),/fbox|boxed|fcolorbox/.test(r)?(i.style.borderStyle="solid",i.style.borderWidth=Ve(k)):r==="angl"&&k!==.049&&(i.style.borderTopWidth=Ve(k),i.style.borderRightWidth=Ve(k)),a=n.depth+S,t.backgroundColor&&(i.style.backgroundColor=t.backgroundColor,t.borderColor&&(i.style.borderColor=t.borderColor))}var N;if(t.backgroundColor)N=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:i,shift:a},{type:"elem",elem:n,shift:0}]},e);else{var C=/cancel|phase/.test(r)?["svg-align"]:[];N=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:n,shift:0},{type:"elem",elem:i,shift:a,wrapperClasses:C}]},e)}return/cancel/.test(r)&&(N.height=n.height,N.depth=n.depth),/cancel/.test(r)&&!o?we.makeSpan(["mord","cancel-lap"],[N],e):we.makeSpan(["mord"],[N],e)},ej=(t,e)=>{var n=0,r=new Ie.MathNode(t.label.indexOf("colorbox")>-1?"mpadded":"menclose",[Un(t.body,e)]);switch(t.label){case"\\cancel":r.setAttribute("notation","updiagonalstrike");break;case"\\bcancel":r.setAttribute("notation","downdiagonalstrike");break;case"\\phase":r.setAttribute("notation","phasorangle");break;case"\\sout":r.setAttribute("notation","horizontalstrike");break;case"\\fbox":r.setAttribute("notation","box");break;case"\\angl":r.setAttribute("notation","actuarial");break;case"\\fcolorbox":case"\\colorbox":if(n=e.fontMetrics().fboxsep*e.fontMetrics().ptPerEm,r.setAttribute("width","+"+2*n+"pt"),r.setAttribute("height","+"+2*n+"pt"),r.setAttribute("lspace",n+"pt"),r.setAttribute("voffset",n+"pt"),t.label==="\\fcolorbox"){var s=Math.max(e.fontMetrics().fboxrule,e.minRuleThickness);r.setAttribute("style","border: "+s+"em solid "+String(t.borderColor))}break;case"\\xcancel":r.setAttribute("notation","updiagonalstrike downdiagonalstrike");break}return t.backgroundColor&&r.setAttribute("mathbackground",t.backgroundColor),r};Ke({type:"enclose",names:["\\colorbox"],props:{numArgs:2,allowedInText:!0,argTypes:["color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=$t(e[0],"color-token").color,a=e[1];return{type:"enclose",mode:r.mode,label:s,backgroundColor:i,body:a}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"enclose",names:["\\fcolorbox"],props:{numArgs:3,allowedInText:!0,argTypes:["color","color","text"]},handler(t,e,n){var{parser:r,funcName:s}=t,i=$t(e[0],"color-token").color,a=$t(e[1],"color-token").color,o=e[2];return{type:"enclose",mode:r.mode,label:s,backgroundColor:a,borderColor:i,body:o}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"enclose",names:["\\fbox"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\fbox",body:e[0]}}});Ke({type:"enclose",names:["\\cancel","\\bcancel","\\xcancel","\\sout","\\phase"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"enclose",mode:n.mode,label:r,body:s}},htmlBuilder:JO,mathmlBuilder:ej});Ke({type:"enclose",names:["\\angl"],props:{numArgs:1,argTypes:["hbox"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"enclose",mode:n.mode,label:"\\angl",body:e[0]}}});var OQ={};function gl(t){for(var{type:e,names:n,props:r,handler:s,htmlBuilder:i,mathmlBuilder:a}=t,o={type:e,numArgs:r.numArgs||0,allowedInText:!1,numOptionalArgs:0,handler:s},c=0;c{var e=t.parser.settings;if(!e.displayMode)throw new Be("{"+t.envName+"} can be used only in display mode.")};function tj(t){if(t.indexOf("ed")===-1)return t.indexOf("*")===-1}function zc(t,e,n){var{hskipBeforeAndAfter:r,addJot:s,cols:i,arraystretch:a,colSeparationType:o,autoTag:c,singleRow:h,emptySingleRow:f,maxNumCols:m,leqno:g}=e;if(t.gullet.beginGroup(),h||t.gullet.macros.set("\\cr","\\\\\\relax"),!a){var x=t.gullet.expandMacroAsText("\\arraystretch");if(x==null)a=1;else if(a=parseFloat(x),!a||a<0)throw new Be("Invalid \\arraystretch: "+x)}t.gullet.beginGroup();var y=[],w=[y],S=[],k=[],N=c!=null?[]:void 0;function C(){c&&t.gullet.macros.set("\\@eqnsw","1",!0)}function T(){N&&(t.gullet.macros.get("\\df@tag")?(N.push(t.subparse([new Ai("\\df@tag")])),t.gullet.macros.set("\\df@tag",void 0,!0)):N.push(!!c&&t.gullet.macros.get("\\@eqnsw")==="1"))}for(C(),k.push(cM(t));;){var _=t.parseExpression(!1,h?"\\end":"\\\\");t.gullet.endGroup(),t.gullet.beginGroup(),_={type:"ordgroup",mode:t.mode,body:_},n&&(_={type:"styling",mode:t.mode,style:n,body:[_]}),y.push(_);var E=t.fetch().text;if(E==="&"){if(m&&y.length===m){if(h||o)throw new Be("Too many tab characters: &",t.nextToken);t.settings.reportNonstrict("textEnv","Too few columns specified in the {array} column argument.")}t.consume()}else if(E==="\\end"){T(),y.length===1&&_.type==="styling"&&_.body[0].body.length===0&&(w.length>1||!f)&&w.pop(),k.length0&&(C+=.25),h.push({pos:C,isDashed:$e[bt]})}for(T(a[0]),r=0;r0&&($+=N,M<$&&(M=$),$=0)),e.addJot&&(M+=w),q.height=E,q.depth=M,C+=E,q.pos=C,C+=M+$,c[r]=q,T(a[r+1])}var V=C/2+n.fontMetrics().axisHeight,ee=e.cols||[],z=[],H,P,W=[];if(e.tags&&e.tags.some($e=>$e))for(r=0;r=o)){var Y=void 0;(s>0||e.hskipBeforeAndAfter)&&(Y=Nn.deflt(G.pregap,g),Y!==0&&(H=we.makeSpan(["arraycolsep"],[]),H.style.width=Ve(Y),z.push(H)));var ae=[];for(r=0;r0){for(var Ge=we.makeLineSpan("hline",n,f),tt=we.makeLineSpan("hdashline",n,f),Xe=[{type:"elem",elem:c,shift:0}];h.length>0;){var je=h.pop(),Qe=je.pos-V;je.isDashed?Xe.push({type:"elem",elem:tt,shift:Qe}):Xe.push({type:"elem",elem:Ge,shift:Qe})}c=we.makeVList({positionType:"individualShift",children:Xe},n)}if(W.length===0)return we.makeSpan(["mord"],[c],n);var He=we.makeVList({positionType:"individualShift",children:W},n);return He=we.makeSpan(["tag"],[He],n),we.makeFragment([c,He])},o2e={c:"center ",l:"left ",r:"right "},vl=function(e,n){for(var r=[],s=new Ie.MathNode("mtd",[],["mtr-glue"]),i=new Ie.MathNode("mtd",[],["mml-eqn-num"]),a=0;a0){var y=e.cols,w="",S=!1,k=0,N=y.length;y[0].type==="separator"&&(g+="top ",k=1),y[y.length-1].type==="separator"&&(g+="bottom ",N-=1);for(var C=k;C0?"left ":"",g+=q[q.length-1].length>0?"right ":"";for(var L=1;L-1?"alignat":"align",i=e.envName==="split",a=zc(e.parser,{cols:r,addJot:!0,autoTag:i?void 0:tj(e.envName),emptySingleRow:!0,colSeparationType:s,maxNumCols:i?2:void 0,leqno:e.parser.settings.leqno},"display"),o,c=0,h={type:"ordgroup",mode:e.mode,body:[]};if(n[0]&&n[0].type==="ordgroup"){for(var f="",m=0;m0&&x&&(S=1),r[y]={type:"align",align:w,pregap:S,postgap:0}}return a.colSeparationType=x?"align":"alignat",a};gl({type:"array",names:["array","darray"],props:{numArgs:1},handler(t,e){var n=wy(e[0]),r=n?[e[0]]:$t(e[0],"ordgroup").body,s=r.map(function(a){var o=YO(a),c=o.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 Be("Unknown column alignment: "+c,a)}),i={cols:s,hskipBeforeAndAfter:!0,maxNumCols:s.length};return zc(t.parser,i,nj(t.envName))},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["matrix","pmatrix","bmatrix","Bmatrix","vmatrix","Vmatrix","matrix*","pmatrix*","bmatrix*","Bmatrix*","vmatrix*","Vmatrix*"],props:{numArgs:0},handler(t){var e={matrix:null,pmatrix:["(",")"],bmatrix:["[","]"],Bmatrix:["\\{","\\}"],vmatrix:["|","|"],Vmatrix:["\\Vert","\\Vert"]}[t.envName.replace("*","")],n="c",r={hskipBeforeAndAfter:!1,cols:[{type:"align",align:n}]};if(t.envName.charAt(t.envName.length-1)==="*"){var s=t.parser;if(s.consumeSpaces(),s.fetch().text==="["){if(s.consume(),s.consumeSpaces(),n=s.fetch().text,"lcr".indexOf(n)===-1)throw new Be("Expected l or c or r",s.nextToken);s.consume(),s.consumeSpaces(),s.expect("]"),s.consume(),r.cols=[{type:"align",align:n}]}}var i=zc(t.parser,r,nj(t.envName)),a=Math.max(0,...i.body.map(o=>o.length));return i.cols=new Array(a).fill({type:"align",align:n}),e?{type:"leftright",mode:t.mode,body:[i],left:e[0],right:e[1],rightColor:void 0}:i},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["smallmatrix"],props:{numArgs:0},handler(t){var e={arraystretch:.5},n=zc(t.parser,e,"script");return n.colSeparationType="small",n},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["subarray"],props:{numArgs:1},handler(t,e){var n=wy(e[0]),r=n?[e[0]]:$t(e[0],"ordgroup").body,s=r.map(function(a){var o=YO(a),c=o.text;if("lc".indexOf(c)!==-1)return{type:"align",align:c};throw new Be("Unknown column alignment: "+c,a)});if(s.length>1)throw new Be("{subarray} can contain only one column");var i={cols:s,hskipBeforeAndAfter:!1,arraystretch:.5};if(i=zc(t.parser,i,"script"),i.body.length>0&&i.body[0].length>1)throw new Be("{subarray} can contain only one column");return i},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["cases","dcases","rcases","drcases"],props:{numArgs:0},handler(t){var e={arraystretch:1.2,cols:[{type:"align",align:"l",pregap:0,postgap:1},{type:"align",align:"l",pregap:0,postgap:0}]},n=zc(t.parser,e,nj(t.envName));return{type:"leftright",mode:t.mode,body:[n],left:t.envName.indexOf("r")>-1?".":"\\{",right:t.envName.indexOf("r")>-1?"\\}":".",rightColor:void 0}},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["align","align*","aligned","split"],props:{numArgs:0},handler:NQ,htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["gathered","gather","gather*"],props:{numArgs:0},handler(t){["gather","gather*"].includes(t.envName)&&Oy(t);var e={cols:[{type:"align",align:"c"}],addJot:!0,colSeparationType:"gather",autoTag:tj(t.envName),emptySingleRow:!0,leqno:t.parser.settings.leqno};return zc(t.parser,e,"display")},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["alignat","alignat*","alignedat"],props:{numArgs:1},handler:NQ,htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["equation","equation*"],props:{numArgs:0},handler(t){Oy(t);var e={autoTag:tj(t.envName),emptySingleRow:!0,singleRow:!0,maxNumCols:1,leqno:t.parser.settings.leqno};return zc(t.parser,e,"display")},htmlBuilder:xl,mathmlBuilder:vl});gl({type:"array",names:["CD"],props:{numArgs:0},handler(t){return Oy(t),Gbe(t.parser)},htmlBuilder:xl,mathmlBuilder:vl});Z("\\nonumber","\\gdef\\@eqnsw{0}");Z("\\notag","\\nonumber");Ke({type:"text",names:["\\hline","\\hdashline"],props:{numArgs:0,allowedInText:!0,allowedInMath:!0},handler(t,e){throw new Be(t.funcName+" valid only within array environment")}});var uM=OQ;Ke({type:"environment",names:["\\begin","\\end"],props:{numArgs:1,argTypes:["text"]},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];if(s.type!=="ordgroup")throw new Be("Invalid environment name",s);for(var i="",a=0;a{var n=t.font,r=e.withFont(n);return Sn(t.body,r)},TQ=(t,e)=>{var n=t.font,r=e.withFont(n);return Un(t.body,r)},dM={"\\Bbb":"\\mathbb","\\bold":"\\mathbf","\\frak":"\\mathfrak","\\bm":"\\boldsymbol"};Ke({type:"font",names:["\\mathrm","\\mathit","\\mathbf","\\mathnormal","\\mathsfit","\\mathbb","\\mathcal","\\mathfrak","\\mathscr","\\mathsf","\\mathtt","\\Bbb","\\bold","\\frak"],props:{numArgs:1,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=hv(e[0]),i=r;return i in dM&&(i=dM[i]),{type:"font",mode:n.mode,font:i.slice(1),body:s}},htmlBuilder:CQ,mathmlBuilder:TQ});Ke({type:"mclass",names:["\\boldsymbol","\\bm"],props:{numArgs:1},handler:(t,e)=>{var{parser:n}=t,r=e[0],s=Nn.isCharacterBox(r);return{type:"mclass",mode:n.mode,mclass:Sy(r),body:[{type:"font",mode:n.mode,font:"boldsymbol",body:r}],isCharacterBox:s}}});Ke({type:"font",names:["\\rm","\\sf","\\tt","\\bf","\\it","\\cal"],props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r,breakOnTokenText:s}=t,{mode:i}=n,a=n.parseExpression(!0,s),o="math"+r.slice(1);return{type:"font",mode:i,font:o,body:{type:"ordgroup",mode:n.mode,body:a}}},htmlBuilder:CQ,mathmlBuilder:TQ});var EQ=(t,e)=>{var n=e;return t==="display"?n=n.id>=kt.SCRIPT.id?n.text():kt.DISPLAY:t==="text"&&n.size===kt.DISPLAY.size?n=kt.TEXT:t==="script"?n=kt.SCRIPT:t==="scriptscript"&&(n=kt.SCRIPTSCRIPT),n},rj=(t,e)=>{var n=EQ(t.size,e.style),r=n.fracNum(),s=n.fracDen(),i;i=e.havingStyle(r);var a=Sn(t.numer,i,e);if(t.continued){var o=8.5/e.fontMetrics().ptPerEm,c=3.5/e.fontMetrics().ptPerEm;a.height=a.height0?y=3*g:y=7*g,w=e.fontMetrics().denom1):(m>0?(x=e.fontMetrics().num2,y=g):(x=e.fontMetrics().num3,y=3*g),w=e.fontMetrics().denom2);var S;if(f){var N=e.fontMetrics().axisHeight;x-a.depth-(N+.5*m){var n=new Ie.MathNode("mfrac",[Un(t.numer,e),Un(t.denom,e)]);if(!t.hasBarLine)n.setAttribute("linethickness","0px");else if(t.barSize){var r=hr(t.barSize,e);n.setAttribute("linethickness",Ve(r))}var s=EQ(t.size,e.style);if(s.size!==e.style.size){n=new Ie.MathNode("mstyle",[n]);var i=s.size===kt.DISPLAY.size?"true":"false";n.setAttribute("displaystyle",i),n.setAttribute("scriptlevel","0")}if(t.leftDelim!=null||t.rightDelim!=null){var a=[];if(t.leftDelim!=null){var o=new Ie.MathNode("mo",[new Ie.TextNode(t.leftDelim.replace("\\",""))]);o.setAttribute("fence","true"),a.push(o)}if(a.push(n),t.rightDelim!=null){var c=new Ie.MathNode("mo",[new Ie.TextNode(t.rightDelim.replace("\\",""))]);c.setAttribute("fence","true"),a.push(c)}return GO(a)}return n};Ke({type:"genfrac",names:["\\dfrac","\\frac","\\tfrac","\\dbinom","\\binom","\\tbinom","\\\\atopfrac","\\\\bracefrac","\\\\brackfrac"],props:{numArgs:2,allowedInArgument:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1],a,o=null,c=null,h="auto";switch(r){case"\\dfrac":case"\\frac":case"\\tfrac":a=!0;break;case"\\\\atopfrac":a=!1;break;case"\\dbinom":case"\\binom":case"\\tbinom":a=!1,o="(",c=")";break;case"\\\\bracefrac":a=!1,o="\\{",c="\\}";break;case"\\\\brackfrac":a=!1,o="[",c="]";break;default:throw new Error("Unrecognized genfrac command")}switch(r){case"\\dfrac":case"\\dbinom":h="display";break;case"\\tfrac":case"\\tbinom":h="text";break}return{type:"genfrac",mode:n.mode,continued:!1,numer:s,denom:i,hasBarLine:a,leftDelim:o,rightDelim:c,size:h,barSize:null}},htmlBuilder:rj,mathmlBuilder:sj});Ke({type:"genfrac",names:["\\cfrac"],props:{numArgs:2},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=e[1];return{type:"genfrac",mode:n.mode,continued:!0,numer:s,denom:i,hasBarLine:!0,leftDelim:null,rightDelim:null,size:"display",barSize:null}}});Ke({type:"infix",names:["\\over","\\choose","\\atop","\\brace","\\brack"],props:{numArgs:0,infix:!0},handler(t){var{parser:e,funcName:n,token:r}=t,s;switch(n){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:e.mode,replaceWith:s,token:r}}});var hM=["display","text","script","scriptscript"],fM=function(e){var n=null;return e.length>0&&(n=e,n=n==="."?null:n),n};Ke({type:"genfrac",names:["\\genfrac"],props:{numArgs:6,allowedInArgument:!0,argTypes:["math","math","size","text","math","math"]},handler(t,e){var{parser:n}=t,r=e[4],s=e[5],i=hv(e[0]),a=i.type==="atom"&&i.family==="open"?fM(i.text):null,o=hv(e[1]),c=o.type==="atom"&&o.family==="close"?fM(o.text):null,h=$t(e[2],"size"),f,m=null;h.isBlank?f=!0:(m=h.value,f=m.number>0);var g="auto",x=e[3];if(x.type==="ordgroup"){if(x.body.length>0){var y=$t(x.body[0],"textord");g=hM[Number(y.text)]}}else x=$t(x,"textord"),g=hM[Number(x.text)];return{type:"genfrac",mode:n.mode,numer:r,denom:s,continued:!1,hasBarLine:f,barSize:m,leftDelim:a,rightDelim:c,size:g}},htmlBuilder:rj,mathmlBuilder:sj});Ke({type:"infix",names:["\\above"],props:{numArgs:1,argTypes:["size"],infix:!0},handler(t,e){var{parser:n,funcName:r,token:s}=t;return{type:"infix",mode:n.mode,replaceWith:"\\\\abovefrac",size:$t(e[0],"size").value,token:s}}});Ke({type:"genfrac",names:["\\\\abovefrac"],props:{numArgs:3,argTypes:["math","size","math"]},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0],i=Iye($t(e[1],"infix").size),a=e[2],o=i.number>0;return{type:"genfrac",mode:n.mode,numer:s,denom:a,continued:!1,hasBarLine:o,barSize:i,leftDelim:null,rightDelim:null,size:"auto"}},htmlBuilder:rj,mathmlBuilder:sj});var _Q=(t,e)=>{var n=e.style,r,s;t.type==="supsub"?(r=t.sup?Sn(t.sup,e.havingStyle(n.sup()),e):Sn(t.sub,e.havingStyle(n.sub()),e),s=$t(t.base,"horizBrace")):s=$t(t,"horizBrace");var i=Sn(s.base,e.havingBaseStyle(kt.DISPLAY)),a=vo.svgSpan(s,e),o;if(s.isOver?(o=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:i},{type:"kern",size:.1},{type:"elem",elem:a}]},e),o.children[0].children[0].children[1].classes.push("svg-align")):(o=we.makeVList({positionType:"bottom",positionData:i.depth+.1+a.height,children:[{type:"elem",elem:a},{type:"kern",size:.1},{type:"elem",elem:i}]},e),o.children[0].children[0].children[0].classes.push("svg-align")),r){var c=we.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e);s.isOver?o=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:c},{type:"kern",size:.2},{type:"elem",elem:r}]},e):o=we.makeVList({positionType:"bottom",positionData:c.depth+.2+r.height+r.depth,children:[{type:"elem",elem:r},{type:"kern",size:.2},{type:"elem",elem:c}]},e)}return we.makeSpan(["mord",s.isOver?"mover":"munder"],[o],e)},c2e=(t,e)=>{var n=vo.mathMLnode(t.label);return new Ie.MathNode(t.isOver?"mover":"munder",[Un(t.base,e),n])};Ke({type:"horizBrace",names:["\\overbrace","\\underbrace"],props:{numArgs:1},handler(t,e){var{parser:n,funcName:r}=t;return{type:"horizBrace",mode:n.mode,label:r,isOver:/^\\over/.test(r),base:e[0]}},htmlBuilder:_Q,mathmlBuilder:c2e});Ke({type:"href",names:["\\href"],props:{numArgs:2,argTypes:["url","original"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[1],s=$t(e[0],"url").url;return n.settings.isTrusted({command:"\\href",url:s})?{type:"href",mode:n.mode,href:s,body:jr(r)}:n.formatUnsupportedCmd("\\href")},htmlBuilder:(t,e)=>{var n=Wr(t.body,e,!1);return we.makeAnchor(t.href,[],n,e)},mathmlBuilder:(t,e)=>{var n=Nc(t.body,e);return n instanceof Ci||(n=new Ci("mrow",[n])),n.setAttribute("href",t.href),n}});Ke({type:"href",names:["\\url"],props:{numArgs:1,argTypes:["url"],allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=$t(e[0],"url").url;if(!n.settings.isTrusted({command:"\\url",url:r}))return n.formatUnsupportedCmd("\\url");for(var s=[],i=0;i{var{parser:n,funcName:r,token:s}=t,i=$t(e[0],"raw").string,a=e[1];n.settings.strict&&n.settings.reportNonstrict("htmlExtension","HTML extension is disabled on strict mode");var o,c={};switch(r){case"\\htmlClass":c.class=i,o={command:"\\htmlClass",class:i};break;case"\\htmlId":c.id=i,o={command:"\\htmlId",id:i};break;case"\\htmlStyle":c.style=i,o={command:"\\htmlStyle",style:i};break;case"\\htmlData":{for(var h=i.split(","),f=0;f{var n=Wr(t.body,e,!1),r=["enclosing"];t.attributes.class&&r.push(...t.attributes.class.trim().split(/\s+/));var s=we.makeSpan(r,n,e);for(var i in t.attributes)i!=="class"&&t.attributes.hasOwnProperty(i)&&s.setAttribute(i,t.attributes[i]);return s},mathmlBuilder:(t,e)=>Nc(t.body,e)});Ke({type:"htmlmathml",names:["\\html@mathml"],props:{numArgs:2,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"htmlmathml",mode:n.mode,html:jr(e[0]),mathml:jr(e[1])}},htmlBuilder:(t,e)=>{var n=Wr(t.html,e,!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>Nc(t.mathml,e)});var T4=function(e){if(/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e))return{number:+e,unit:"bp"};var n=/([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e);if(!n)throw new Be("Invalid size: '"+e+"' in \\includegraphics");var r={number:+(n[1]+n[2]),unit:n[3]};if(!X$(r))throw new Be("Invalid unit: '"+r.unit+"' in \\includegraphics.");return r};Ke({type:"includegraphics",names:["\\includegraphics"],props:{numArgs:1,numOptionalArgs:1,argTypes:["raw","url"],allowedInText:!1},handler:(t,e,n)=>{var{parser:r}=t,s={number:0,unit:"em"},i={number:.9,unit:"em"},a={number:0,unit:"em"},o="";if(n[0])for(var c=$t(n[0],"raw").string,h=c.split(","),f=0;f{var n=hr(t.height,e),r=0;t.totalheight.number>0&&(r=hr(t.totalheight,e)-n);var s=0;t.width.number>0&&(s=hr(t.width,e));var i={height:Ve(n+r)};s>0&&(i.width=Ve(s)),r>0&&(i.verticalAlign=Ve(-r));var a=new cbe(t.src,t.alt,i);return a.height=n,a.depth=r,a},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mglyph",[]);n.setAttribute("alt",t.alt);var r=hr(t.height,e),s=0;if(t.totalheight.number>0&&(s=hr(t.totalheight,e)-r,n.setAttribute("valign",Ve(-s))),n.setAttribute("height",Ve(r+s)),t.width.number>0){var i=hr(t.width,e);n.setAttribute("width",Ve(i))}return n.setAttribute("src",t.src),n}});Ke({type:"kern",names:["\\kern","\\mkern","\\hskip","\\mskip"],props:{numArgs:1,argTypes:["size"],primitive:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=$t(e[0],"size");if(n.settings.strict){var i=r[1]==="m",a=s.value.unit==="mu";i?(a||n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" supports only mu units, "+("not "+s.value.unit+" units")),n.mode!=="math"&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" works only in math mode")):a&&n.settings.reportNonstrict("mathVsTextUnits","LaTeX's "+r+" doesn't support mu units")}return{type:"kern",mode:n.mode,dimension:s.value}},htmlBuilder(t,e){return we.makeGlue(t.dimension,e)},mathmlBuilder(t,e){var n=hr(t.dimension,e);return new Ie.SpaceNode(n)}});Ke({type:"lap",names:["\\mathllap","\\mathrlap","\\mathclap"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"lap",mode:n.mode,alignment:r.slice(5),body:s}},htmlBuilder:(t,e)=>{var n;t.alignment==="clap"?(n=we.makeSpan([],[Sn(t.body,e)]),n=we.makeSpan(["inner"],[n],e)):n=we.makeSpan(["inner"],[Sn(t.body,e)]);var r=we.makeSpan(["fix"],[]),s=we.makeSpan([t.alignment],[n,r],e),i=we.makeSpan(["strut"]);return i.style.height=Ve(s.height+s.depth),s.depth&&(i.style.verticalAlign=Ve(-s.depth)),s.children.unshift(i),s=we.makeSpan(["thinbox"],[s],e),we.makeSpan(["mord","vbox"],[s],e)},mathmlBuilder:(t,e)=>{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);if(t.alignment!=="rlap"){var r=t.alignment==="llap"?"-1":"-0.5";n.setAttribute("lspace",r+"width")}return n.setAttribute("width","0px"),n}});Ke({type:"styling",names:["\\(","$"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){var{funcName:n,parser:r}=t,s=r.mode;r.switchMode("math");var i=n==="\\("?"\\)":"$",a=r.parseExpression(!1,i);return r.expect(i),r.switchMode(s),{type:"styling",mode:r.mode,style:"text",body:a}}});Ke({type:"text",names:["\\)","\\]"],props:{numArgs:0,allowedInText:!0,allowedInMath:!1},handler(t,e){throw new Be("Mismatched "+t.funcName)}});var mM=(t,e)=>{switch(e.style.size){case kt.DISPLAY.size:return t.display;case kt.TEXT.size:return t.text;case kt.SCRIPT.size:return t.script;case kt.SCRIPTSCRIPT.size:return t.scriptscript;default:return t.text}};Ke({type:"mathchoice",names:["\\mathchoice"],props:{numArgs:4,primitive:!0},handler:(t,e)=>{var{parser:n}=t;return{type:"mathchoice",mode:n.mode,display:jr(e[0]),text:jr(e[1]),script:jr(e[2]),scriptscript:jr(e[3])}},htmlBuilder:(t,e)=>{var n=mM(t,e),r=Wr(n,e,!1);return we.makeFragment(r)},mathmlBuilder:(t,e)=>{var n=mM(t,e);return Nc(n,e)}});var MQ=(t,e,n,r,s,i,a)=>{t=we.makeSpan([],[t]);var o=n&&Nn.isCharacterBox(n),c,h;if(e){var f=Sn(e,r.havingStyle(s.sup()),r);h={elem:f,kern:Math.max(r.fontMetrics().bigOpSpacing1,r.fontMetrics().bigOpSpacing3-f.depth)}}if(n){var m=Sn(n,r.havingStyle(s.sub()),r);c={elem:m,kern:Math.max(r.fontMetrics().bigOpSpacing2,r.fontMetrics().bigOpSpacing4-m.height)}}var g;if(h&&c){var x=r.fontMetrics().bigOpSpacing5+c.elem.height+c.elem.depth+c.kern+t.depth+a;g=we.makeVList({positionType:"bottom",positionData:x,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else if(c){var y=t.height-a;g=we.makeVList({positionType:"top",positionData:y,children:[{type:"kern",size:r.fontMetrics().bigOpSpacing5},{type:"elem",elem:c.elem,marginLeft:Ve(-i)},{type:"kern",size:c.kern},{type:"elem",elem:t}]},r)}else if(h){var w=t.depth+a;g=we.makeVList({positionType:"bottom",positionData:w,children:[{type:"elem",elem:t},{type:"kern",size:h.kern},{type:"elem",elem:h.elem,marginLeft:Ve(i)},{type:"kern",size:r.fontMetrics().bigOpSpacing5}]},r)}else return t;var S=[g];if(c&&i!==0&&!o){var k=we.makeSpan(["mspace"],[],r);k.style.marginRight=Ve(i),S.unshift(k)}return we.makeSpan(["mop","op-limits"],S,r)},AQ=["\\smallint"],ef=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=$t(t.base,"op"),s=!0):i=$t(t,"op");var a=e.style,o=!1;a.size===kt.DISPLAY.size&&i.symbol&&!AQ.includes(i.name)&&(o=!0);var c;if(i.symbol){var h=o?"Size2-Regular":"Size1-Regular",f="";if((i.name==="\\oiint"||i.name==="\\oiiint")&&(f=i.name.slice(1),i.name=f==="oiint"?"\\iint":"\\iiint"),c=we.makeSymbol(i.name,h,"math",e,["mop","op-symbol",o?"large-op":"small-op"]),f.length>0){var m=c.italic,g=we.staticSvg(f+"Size"+(o?"2":"1"),e);c=we.makeVList({positionType:"individualShift",children:[{type:"elem",elem:c,shift:0},{type:"elem",elem:g,shift:o?.08:0}]},e),i.name="\\"+f,c.classes.unshift("mop"),c.italic=m}}else if(i.body){var x=Wr(i.body,e,!0);x.length===1&&x[0]instanceof oa?(c=x[0],c.classes[0]="mop"):c=we.makeSpan(["mop"],x,e)}else{for(var y=[],w=1;w{var n;if(t.symbol)n=new Ci("mo",[ca(t.name,t.mode)]),AQ.includes(t.name)&&n.setAttribute("largeop","false");else if(t.body)n=new Ci("mo",di(t.body,e));else{n=new Ci("mi",[new rl(t.name.slice(1))]);var r=new Ci("mo",[ca("⁡","text")]);t.parentIsSupSub?n=new Ci("mrow",[n,r]):n=aQ([n,r])}return n},u2e={"∏":"\\prod","∐":"\\coprod","∑":"\\sum","⋀":"\\bigwedge","⋁":"\\bigvee","⋂":"\\bigcap","⋃":"\\bigcup","⨀":"\\bigodot","⨁":"\\bigoplus","⨂":"\\bigotimes","⨄":"\\biguplus","⨆":"\\bigsqcup"};Ke({type:"op",names:["\\coprod","\\bigvee","\\bigwedge","\\biguplus","\\bigcap","\\bigcup","\\intop","\\prod","\\sum","\\bigotimes","\\bigoplus","\\bigodot","\\bigsqcup","\\smallint","∏","∐","∑","⋀","⋁","⋂","⋃","⨀","⨁","⨂","⨄","⨆"],props:{numArgs:0},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=r;return s.length===1&&(s=u2e[s]),{type:"op",mode:n.mode,limits:!0,parentIsSupSub:!1,symbol:!0,name:s}},htmlBuilder:ef,mathmlBuilder:hp});Ke({type:"op",names:["\\mathop"],props:{numArgs:1,primitive:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"op",mode:n.mode,limits:!1,parentIsSupSub:!1,symbol:!1,body:jr(r)}},htmlBuilder:ef,mathmlBuilder:hp});var d2e={"∫":"\\int","∬":"\\iint","∭":"\\iiint","∮":"\\oint","∯":"\\oiint","∰":"\\oiiint"};Ke({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(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ef,mathmlBuilder:hp});Ke({type:"op",names:["\\det","\\gcd","\\inf","\\lim","\\max","\\min","\\Pr","\\sup"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t;return{type:"op",mode:e.mode,limits:!0,parentIsSupSub:!1,symbol:!1,name:n}},htmlBuilder:ef,mathmlBuilder:hp});Ke({type:"op",names:["\\int","\\iint","\\iiint","\\oint","\\oiint","\\oiiint","∫","∬","∭","∮","∯","∰"],props:{numArgs:0},handler(t){var{parser:e,funcName:n}=t,r=n;return r.length===1&&(r=d2e[r]),{type:"op",mode:e.mode,limits:!1,parentIsSupSub:!1,symbol:!0,name:r}},htmlBuilder:ef,mathmlBuilder:hp});var RQ=(t,e)=>{var n,r,s=!1,i;t.type==="supsub"?(n=t.sup,r=t.sub,i=$t(t.base,"operatorname"),s=!0):i=$t(t,"operatorname");var a;if(i.body.length>0){for(var o=i.body.map(m=>{var g=m.text;return typeof g=="string"?{type:"textord",mode:m.mode,text:g}:m}),c=Wr(o,e.withFont("mathrm"),!0),h=0;h{for(var n=di(t.body,e.withFont("mathrm")),r=!0,s=0;sf.toText()).join("");n=[new Ie.TextNode(o)]}var c=new Ie.MathNode("mi",n);c.setAttribute("mathvariant","normal");var h=new Ie.MathNode("mo",[ca("⁡","text")]);return t.parentIsSupSub?new Ie.MathNode("mrow",[c,h]):Ie.newDocumentFragment([c,h])};Ke({type:"operatorname",names:["\\operatorname@","\\operatornamewithlimits"],props:{numArgs:1},handler:(t,e)=>{var{parser:n,funcName:r}=t,s=e[0];return{type:"operatorname",mode:n.mode,body:jr(s),alwaysHandleSupSub:r==="\\operatornamewithlimits",limits:!1,parentIsSupSub:!1}},htmlBuilder:RQ,mathmlBuilder:h2e});Z("\\operatorname","\\@ifstar\\operatornamewithlimits\\operatorname@");Qu({type:"ordgroup",htmlBuilder(t,e){return t.semisimple?we.makeFragment(Wr(t.body,e,!1)):we.makeSpan(["mord"],Wr(t.body,e,!0),e)},mathmlBuilder(t,e){return Nc(t.body,e,!0)}});Ke({type:"overline",names:["\\overline"],props:{numArgs:1},handler(t,e){var{parser:n}=t,r=e[0];return{type:"overline",mode:n.mode,body:r}},htmlBuilder(t,e){var n=Sn(t.body,e.havingCrampedStyle()),r=we.makeLineSpan("overline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n},{type:"kern",size:3*s},{type:"elem",elem:r},{type:"kern",size:s}]},e);return we.makeSpan(["mord","overline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("mover",[Un(t.body,e),n]);return r.setAttribute("accent","true"),r}});Ke({type:"phantom",names:["\\phantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"phantom",mode:n.mode,body:jr(r)}},htmlBuilder:(t,e)=>{var n=Wr(t.body,e.withPhantom(),!1);return we.makeFragment(n)},mathmlBuilder:(t,e)=>{var n=di(t.body,e);return new Ie.MathNode("mphantom",n)}});Ke({type:"hphantom",names:["\\hphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"hphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan([],[Sn(t.body,e.withPhantom())]);if(n.height=0,n.depth=0,n.children)for(var r=0;r{var n=di(jr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("height","0px"),s.setAttribute("depth","0px"),s}});Ke({type:"vphantom",names:["\\vphantom"],props:{numArgs:1,allowedInText:!0},handler:(t,e)=>{var{parser:n}=t,r=e[0];return{type:"vphantom",mode:n.mode,body:r}},htmlBuilder:(t,e)=>{var n=we.makeSpan(["inner"],[Sn(t.body,e.withPhantom())]),r=we.makeSpan(["fix"],[]);return we.makeSpan(["mord","rlap"],[n,r],e)},mathmlBuilder:(t,e)=>{var n=di(jr(t.body),e),r=new Ie.MathNode("mphantom",n),s=new Ie.MathNode("mpadded",[r]);return s.setAttribute("width","0px"),s}});Ke({type:"raisebox",names:["\\raisebox"],props:{numArgs:2,argTypes:["size","hbox"],allowedInText:!0},handler(t,e){var{parser:n}=t,r=$t(e[0],"size").value,s=e[1];return{type:"raisebox",mode:n.mode,dy:r,body:s}},htmlBuilder(t,e){var n=Sn(t.body,e),r=hr(t.dy,e);return we.makeVList({positionType:"shift",positionData:-r,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mpadded",[Un(t.body,e)]),r=t.dy.number+t.dy.unit;return n.setAttribute("voffset",r),n}});Ke({type:"internal",names:["\\relax"],props:{numArgs:0,allowedInText:!0,allowedInArgument:!0},handler(t){var{parser:e}=t;return{type:"internal",mode:e.mode}}});Ke({type:"rule",names:["\\rule"],props:{numArgs:2,numOptionalArgs:1,allowedInText:!0,allowedInMath:!0,argTypes:["size","size","size"]},handler(t,e,n){var{parser:r}=t,s=n[0],i=$t(e[0],"size"),a=$t(e[1],"size");return{type:"rule",mode:r.mode,shift:s&&$t(s,"size").value,width:i.value,height:a.value}},htmlBuilder(t,e){var n=we.makeSpan(["mord","rule"],[],e),r=hr(t.width,e),s=hr(t.height,e),i=t.shift?hr(t.shift,e):0;return n.style.borderRightWidth=Ve(r),n.style.borderTopWidth=Ve(s),n.style.bottom=Ve(i),n.width=r,n.height=s+i,n.depth=-i,n.maxFontSize=s*1.125*e.sizeMultiplier,n},mathmlBuilder(t,e){var n=hr(t.width,e),r=hr(t.height,e),s=t.shift?hr(t.shift,e):0,i=e.color&&e.getColor()||"black",a=new Ie.MathNode("mspace");a.setAttribute("mathbackground",i),a.setAttribute("width",Ve(n)),a.setAttribute("height",Ve(r));var o=new Ie.MathNode("mpadded",[a]);return s>=0?o.setAttribute("height",Ve(s)):(o.setAttribute("height",Ve(s)),o.setAttribute("depth",Ve(-s))),o.setAttribute("voffset",Ve(s)),o}});function DQ(t,e,n){for(var r=Wr(t,e,!1),s=e.sizeMultiplier/n.sizeMultiplier,i=0;i{var n=e.havingSize(t.size);return DQ(t.body,n,e)};Ke({type:"sizing",names:pM,props:{numArgs:0,allowedInText:!0},handler:(t,e)=>{var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!1,n);return{type:"sizing",mode:s.mode,size:pM.indexOf(r)+1,body:i}},htmlBuilder:f2e,mathmlBuilder:(t,e)=>{var n=e.havingSize(t.size),r=di(t.body,n),s=new Ie.MathNode("mstyle",r);return s.setAttribute("mathsize",Ve(n.sizeMultiplier)),s}});Ke({type:"smash",names:["\\smash"],props:{numArgs:1,numOptionalArgs:1,allowedInText:!0},handler:(t,e,n)=>{var{parser:r}=t,s=!1,i=!1,a=n[0]&&$t(n[0],"ordgroup");if(a)for(var o="",c=0;c{var n=we.makeSpan([],[Sn(t.body,e)]);if(!t.smashHeight&&!t.smashDepth)return n;if(t.smashHeight&&(n.height=0,n.children))for(var r=0;r{var n=new Ie.MathNode("mpadded",[Un(t.body,e)]);return t.smashHeight&&n.setAttribute("height","0px"),t.smashDepth&&n.setAttribute("depth","0px"),n}});Ke({type:"sqrt",names:["\\sqrt"],props:{numArgs:1,numOptionalArgs:1},handler(t,e,n){var{parser:r}=t,s=n[0],i=e[0];return{type:"sqrt",mode:r.mode,body:i,index:s}},htmlBuilder(t,e){var n=Sn(t.body,e.havingCrampedStyle());n.height===0&&(n.height=e.fontMetrics().xHeight),n=we.wrapFragment(n,e);var r=e.fontMetrics(),s=r.defaultRuleThickness,i=s;e.style.idn.height+n.depth+a&&(a=(a+m-n.height-n.depth)/2);var g=c.height-n.height-a-h;n.style.paddingLeft=Ve(f);var x=we.makeVList({positionType:"firstBaseline",children:[{type:"elem",elem:n,wrapperClasses:["svg-align"]},{type:"kern",size:-(n.height+g)},{type:"elem",elem:c},{type:"kern",size:h}]},e);if(t.index){var y=e.havingStyle(kt.SCRIPTSCRIPT),w=Sn(t.index,y,e),S=.6*(x.height-x.depth),k=we.makeVList({positionType:"shift",positionData:-S,children:[{type:"elem",elem:w}]},e),N=we.makeSpan(["root"],[k]);return we.makeSpan(["mord","sqrt"],[N,x],e)}else return we.makeSpan(["mord","sqrt"],[x],e)},mathmlBuilder(t,e){var{body:n,index:r}=t;return r?new Ie.MathNode("mroot",[Un(n,e),Un(r,e)]):new Ie.MathNode("msqrt",[Un(n,e)])}});var gM={display:kt.DISPLAY,text:kt.TEXT,script:kt.SCRIPT,scriptscript:kt.SCRIPTSCRIPT};Ke({type:"styling",names:["\\displaystyle","\\textstyle","\\scriptstyle","\\scriptscriptstyle"],props:{numArgs:0,allowedInText:!0,primitive:!0},handler(t,e){var{breakOnTokenText:n,funcName:r,parser:s}=t,i=s.parseExpression(!0,n),a=r.slice(1,r.length-5);return{type:"styling",mode:s.mode,style:a,body:i}},htmlBuilder(t,e){var n=gM[t.style],r=e.havingStyle(n).withFont("");return DQ(t.body,r,e)},mathmlBuilder(t,e){var n=gM[t.style],r=e.havingStyle(n),s=di(t.body,r),i=new Ie.MathNode("mstyle",s),a={display:["0","true"],text:["0","false"],script:["1","false"],scriptscript:["2","false"]},o=a[t.style];return i.setAttribute("scriptlevel",o[0]),i.setAttribute("displaystyle",o[1]),i}});var m2e=function(e,n){var r=e.base;if(r)if(r.type==="op"){var s=r.limits&&(n.style.size===kt.DISPLAY.size||r.alwaysHandleSupSub);return s?ef:null}else if(r.type==="operatorname"){var i=r.alwaysHandleSupSub&&(n.style.size===kt.DISPLAY.size||r.limits);return i?RQ:null}else{if(r.type==="accent")return Nn.isCharacterBox(r.base)?KO:null;if(r.type==="horizBrace"){var a=!e.sub;return a===r.isOver?_Q:null}else return null}else return null};Qu({type:"supsub",htmlBuilder(t,e){var n=m2e(t,e);if(n)return n(t,e);var{base:r,sup:s,sub:i}=t,a=Sn(r,e),o,c,h=e.fontMetrics(),f=0,m=0,g=r&&Nn.isCharacterBox(r);if(s){var x=e.havingStyle(e.style.sup());o=Sn(s,x,e),g||(f=a.height-x.fontMetrics().supDrop*x.sizeMultiplier/e.sizeMultiplier)}if(i){var y=e.havingStyle(e.style.sub());c=Sn(i,y,e),g||(m=a.depth+y.fontMetrics().subDrop*y.sizeMultiplier/e.sizeMultiplier)}var w;e.style===kt.DISPLAY?w=h.sup1:e.style.cramped?w=h.sup3:w=h.sup2;var S=e.sizeMultiplier,k=Ve(.5/h.ptPerEm/S),N=null;if(c){var C=t.base&&t.base.type==="op"&&t.base.name&&(t.base.name==="\\oiint"||t.base.name==="\\oiiint");(a instanceof oa||C)&&(N=Ve(-a.italic))}var T;if(o&&c){f=Math.max(f,w,o.depth+.25*h.xHeight),m=Math.max(m,h.sub2);var _=h.defaultRuleThickness,E=4*_;if(f-o.depth-(c.height-m)0&&(f+=M,m-=M)}var q=[{type:"elem",elem:c,shift:m,marginRight:k,marginLeft:N},{type:"elem",elem:o,shift:-f,marginRight:k}];T=we.makeVList({positionType:"individualShift",children:q},e)}else if(c){m=Math.max(m,h.sub1,c.height-.8*h.xHeight);var L=[{type:"elem",elem:c,marginLeft:N,marginRight:k}];T=we.makeVList({positionType:"shift",positionData:m,children:L},e)}else if(o)f=Math.max(f,w,o.depth+.25*h.xHeight),T=we.makeVList({positionType:"shift",positionData:-f,children:[{type:"elem",elem:o,marginRight:k}]},e);else throw new Error("supsub must have either sup or sub.");var I=ok(a,"right")||"mord";return we.makeSpan([I],[a,we.makeSpan(["msupsub"],[T])],e)},mathmlBuilder(t,e){var n=!1,r,s;t.base&&t.base.type==="horizBrace"&&(s=!!t.sup,s===t.base.isOver&&(n=!0,r=t.base.isOver)),t.base&&(t.base.type==="op"||t.base.type==="operatorname")&&(t.base.parentIsSupSub=!0);var i=[Un(t.base,e)];t.sub&&i.push(Un(t.sub,e)),t.sup&&i.push(Un(t.sup,e));var a;if(n)a=r?"mover":"munder";else if(t.sub)if(t.sup){var h=t.base;h&&h.type==="op"&&h.limits&&e.style===kt.DISPLAY||h&&h.type==="operatorname"&&h.alwaysHandleSupSub&&(e.style===kt.DISPLAY||h.limits)?a="munderover":a="msubsup"}else{var c=t.base;c&&c.type==="op"&&c.limits&&(e.style===kt.DISPLAY||c.alwaysHandleSupSub)||c&&c.type==="operatorname"&&c.alwaysHandleSupSub&&(c.limits||e.style===kt.DISPLAY)?a="munder":a="msub"}else{var o=t.base;o&&o.type==="op"&&o.limits&&(e.style===kt.DISPLAY||o.alwaysHandleSupSub)||o&&o.type==="operatorname"&&o.alwaysHandleSupSub&&(o.limits||e.style===kt.DISPLAY)?a="mover":a="msup"}return new Ie.MathNode(a,i)}});Qu({type:"atom",htmlBuilder(t,e){return we.mathsym(t.text,t.mode,e,["m"+t.family])},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[ca(t.text,t.mode)]);if(t.family==="bin"){var r=XO(t,e);r==="bold-italic"&&n.setAttribute("mathvariant",r)}else t.family==="punct"?n.setAttribute("separator","true"):(t.family==="open"||t.family==="close")&&n.setAttribute("stretchy","false");return n}});var zQ={mi:"italic",mn:"normal",mtext:"normal"};Qu({type:"mathord",htmlBuilder(t,e){return we.makeOrd(t,e,"mathord")},mathmlBuilder(t,e){var n=new Ie.MathNode("mi",[ca(t.text,t.mode,e)]),r=XO(t,e)||"italic";return r!==zQ[n.type]&&n.setAttribute("mathvariant",r),n}});Qu({type:"textord",htmlBuilder(t,e){return we.makeOrd(t,e,"textord")},mathmlBuilder(t,e){var n=ca(t.text,t.mode,e),r=XO(t,e)||"normal",s;return t.mode==="text"?s=new Ie.MathNode("mtext",[n]):/[0-9]/.test(t.text)?s=new Ie.MathNode("mn",[n]):t.text==="\\prime"?s=new Ie.MathNode("mo",[n]):s=new Ie.MathNode("mi",[n]),r!==zQ[s.type]&&s.setAttribute("mathvariant",r),s}});var E4={"\\nobreak":"nobreak","\\allowbreak":"allowbreak"},_4={" ":{},"\\ ":{},"~":{className:"nobreak"},"\\space":{},"\\nobreakspace":{className:"nobreak"}};Qu({type:"spacing",htmlBuilder(t,e){if(_4.hasOwnProperty(t.text)){var n=_4[t.text].className||"";if(t.mode==="text"){var r=we.makeOrd(t,e,"textord");return r.classes.push(n),r}else return we.makeSpan(["mspace",n],[we.mathsym(t.text,t.mode,e)],e)}else{if(E4.hasOwnProperty(t.text))return we.makeSpan(["mspace",E4[t.text]],[],e);throw new Be('Unknown type of space "'+t.text+'"')}},mathmlBuilder(t,e){var n;if(_4.hasOwnProperty(t.text))n=new Ie.MathNode("mtext",[new Ie.TextNode(" ")]);else{if(E4.hasOwnProperty(t.text))return new Ie.MathNode("mspace");throw new Be('Unknown type of space "'+t.text+'"')}return n}});var xM=()=>{var t=new Ie.MathNode("mtd",[]);return t.setAttribute("width","50%"),t};Qu({type:"tag",mathmlBuilder(t,e){var n=new Ie.MathNode("mtable",[new Ie.MathNode("mtr",[xM(),new Ie.MathNode("mtd",[Nc(t.body,e)]),xM(),new Ie.MathNode("mtd",[Nc(t.tag,e)])])]);return n.setAttribute("width","100%"),n}});var vM={"\\text":void 0,"\\textrm":"textrm","\\textsf":"textsf","\\texttt":"texttt","\\textnormal":"textrm"},yM={"\\textbf":"textbf","\\textmd":"textmd"},p2e={"\\textit":"textit","\\textup":"textup"},bM=(t,e)=>{var n=t.font;if(n){if(vM[n])return e.withTextFontFamily(vM[n]);if(yM[n])return e.withTextFontWeight(yM[n]);if(n==="\\emph")return e.fontShape==="textit"?e.withTextFontShape("textup"):e.withTextFontShape("textit")}else return e;return e.withTextFontShape(p2e[n])};Ke({type:"text",names:["\\text","\\textrm","\\textsf","\\texttt","\\textnormal","\\textbf","\\textmd","\\textit","\\textup","\\emph"],props:{numArgs:1,argTypes:["text"],allowedInArgument:!0,allowedInText:!0},handler(t,e){var{parser:n,funcName:r}=t,s=e[0];return{type:"text",mode:n.mode,body:jr(s),font:r}},htmlBuilder(t,e){var n=bM(t,e),r=Wr(t.body,n,!0);return we.makeSpan(["mord","text"],r,n)},mathmlBuilder(t,e){var n=bM(t,e);return Nc(t.body,n)}});Ke({type:"underline",names:["\\underline"],props:{numArgs:1,allowedInText:!0},handler(t,e){var{parser:n}=t;return{type:"underline",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Sn(t.body,e),r=we.makeLineSpan("underline-line",e),s=e.fontMetrics().defaultRuleThickness,i=we.makeVList({positionType:"top",positionData:n.height,children:[{type:"kern",size:s},{type:"elem",elem:r},{type:"kern",size:3*s},{type:"elem",elem:n}]},e);return we.makeSpan(["mord","underline"],[i],e)},mathmlBuilder(t,e){var n=new Ie.MathNode("mo",[new Ie.TextNode("‾")]);n.setAttribute("stretchy","true");var r=new Ie.MathNode("munder",[Un(t.body,e),n]);return r.setAttribute("accentunder","true"),r}});Ke({type:"vcenter",names:["\\vcenter"],props:{numArgs:1,argTypes:["original"],allowedInText:!1},handler(t,e){var{parser:n}=t;return{type:"vcenter",mode:n.mode,body:e[0]}},htmlBuilder(t,e){var n=Sn(t.body,e),r=e.fontMetrics().axisHeight,s=.5*(n.height-r-(n.depth+r));return we.makeVList({positionType:"shift",positionData:s,children:[{type:"elem",elem:n}]},e)},mathmlBuilder(t,e){return new Ie.MathNode("mpadded",[Un(t.body,e)],["vcenter"])}});Ke({type:"verb",names:["\\verb"],props:{numArgs:0,allowedInText:!0},handler(t,e,n){throw new Be("\\verb ended by end of line instead of matching delimiter")},htmlBuilder(t,e){for(var n=wM(t),r=[],s=e.havingStyle(e.style.text()),i=0;it.body.replace(/ /g,t.star?"␣":" "),fc=sQ,PQ=`[ \r + ]`,g2e="\\\\[a-zA-Z@]+",x2e="\\\\[^\uD800-\uDFFF]",v2e="("+g2e+")"+PQ+"*",y2e=`\\\\( |[ \r ]+ -?)[ \r ]*`,lk="[̀-ͯ]",s2e=new RegExp(lk+"+$"),i2e="("+CQ+"+)|"+(r2e+"|")+"([!-\\[\\]-‧‪-퟿豈-￿]"+(lk+"*")+"|[\uD800-\uDBFF][\uDC00-\uDFFF]"+(lk+"*")+"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5"+("|"+n2e)+("|"+t2e+")");class pM{constructor(e,n){this.input=void 0,this.settings=void 0,this.tokenRegex=void 0,this.catcodes=void 0,this.input=e,this.settings=n,this.tokenRegex=new RegExp(i2e,"g"),this.catcodes={"%":14,"~":13}}setCatcode(e,n){this.catcodes[e]=n}lex(){var e=this.input,n=this.tokenRegex.lastIndex;if(n===e.length)return new _i("EOF",new Xs(this,n,n));var r=this.tokenRegex.exec(e);if(r===null||r.index!==n)throw new Be("Unexpected character: '"+e[n]+"'",new _i(e[n],new Xs(this,n,n+1)));var s=r[6]||r[3]||(r[2]?"\\ ":" ");if(this.catcodes[s]===14){var i=e.indexOf(` -`,this.tokenRegex.lastIndex);return i===-1?(this.tokenRegex.lastIndex=e.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 _i(s,new Xs(this,n,this.tokenRegex.lastIndex))}}class a2e{constructor(e,n){e===void 0&&(e={}),n===void 0&&(n={}),this.current=void 0,this.builtins=void 0,this.undefStack=void 0,this.current=n,this.builtins=e,this.undefStack=[]}beginGroup(){this.undefStack.push({})}endGroup(){if(this.undefStack.length===0)throw new Be("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug");var e=this.undefStack.pop();for(var n in e)e.hasOwnProperty(n)&&(e[n]==null?delete this.current[n]:this.current[n]=e[n])}endGroups(){for(;this.undefStack.length>0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var o2e=gQ;Z("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Z("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Z("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Z("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Z("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});Z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Z("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var gM={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};Z("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Be("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=gM[e.text],r==null||r>=n)throw new Be("Invalid base-"+n+" digit "+e.text);for(var s;(s=gM[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new Be("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new Be("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new Be("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var l=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)c+=h.text,h=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new Be("Invalid number of arguments: "+c);l=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:l}),""};Z("\\newcommand",t=>tj(t,!1,!0,!1));Z("\\renewcommand",t=>tj(t,!0,!1,!1));Z("\\providecommand",t=>tj(t,!0,!0,!0));Z("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Z("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Z("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),uc[n],Gn.math[n],Gn.text[n]),""});Z("\\bgroup","{");Z("\\egroup","}");Z("~","\\nobreakspace");Z("\\lq","`");Z("\\rq","'");Z("\\aa","\\r a");Z("\\AA","\\r A");Z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Z("ℬ","\\mathscr{B}");Z("ℰ","\\mathscr{E}");Z("ℱ","\\mathscr{F}");Z("ℋ","\\mathscr{H}");Z("ℐ","\\mathscr{I}");Z("ℒ","\\mathscr{L}");Z("ℳ","\\mathscr{M}");Z("ℛ","\\mathscr{R}");Z("ℭ","\\mathfrak{C}");Z("ℌ","\\mathfrak{H}");Z("ℨ","\\mathfrak{Z}");Z("\\Bbbk","\\Bbb{k}");Z("·","\\cdotp");Z("\\llap","\\mathllap{\\textrm{#1}}");Z("\\rlap","\\mathrlap{\\textrm{#1}}");Z("\\clap","\\mathclap{\\textrm{#1}}");Z("\\mathstrut","\\vphantom{(}");Z("\\underbar","\\underline{\\text{#1}}");Z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Z("\\ne","\\neq");Z("≠","\\neq");Z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Z("∉","\\notin");Z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Z("⟂","\\perp");Z("‼","\\mathclose{!\\mkern-0.8mu!}");Z("∌","\\notni");Z("⌜","\\ulcorner");Z("⌝","\\urcorner");Z("⌞","\\llcorner");Z("⌟","\\lrcorner");Z("©","\\copyright");Z("®","\\textregistered");Z("️","\\textregistered");Z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Z("⋮","\\vdots");Z("\\varGamma","\\mathit{\\Gamma}");Z("\\varDelta","\\mathit{\\Delta}");Z("\\varTheta","\\mathit{\\Theta}");Z("\\varLambda","\\mathit{\\Lambda}");Z("\\varXi","\\mathit{\\Xi}");Z("\\varPi","\\mathit{\\Pi}");Z("\\varSigma","\\mathit{\\Sigma}");Z("\\varUpsilon","\\mathit{\\Upsilon}");Z("\\varPhi","\\mathit{\\Phi}");Z("\\varPsi","\\mathit{\\Psi}");Z("\\varOmega","\\mathit{\\Omega}");Z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Z("\\boxed","\\fbox{$\\displaystyle{#1}$}");Z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var xM={",":"\\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"};Z("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in xM?e=xM[n]:(n.slice(0,4)==="\\not"||n in Gn.math&&["bin","rel"].includes(Gn.math[n].group))&&(e="\\dotsb"),e});var nj={")":!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};Z("\\dotso",function(t){var e=t.future().text;return e in nj?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in nj&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in nj?"\\@cdots\\,":"\\@cdots"});Z("\\dotsb","\\cdots");Z("\\dotsm","\\cdots");Z("\\dotsi","\\!\\cdots");Z("\\dotsx","\\ldots\\,");Z("\\DOTSI","\\relax");Z("\\DOTSB","\\relax");Z("\\DOTSX","\\relax");Z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Z("\\,","\\tmspace+{3mu}{.1667em}");Z("\\thinspace","\\,");Z("\\>","\\mskip{4mu}");Z("\\:","\\tmspace+{4mu}{.2222em}");Z("\\medspace","\\:");Z("\\;","\\tmspace+{5mu}{.2777em}");Z("\\thickspace","\\;");Z("\\!","\\tmspace-{3mu}{.1667em}");Z("\\negthinspace","\\!");Z("\\negmedspace","\\tmspace-{4mu}{.2222em}");Z("\\negthickspace","\\tmspace-{5mu}{.277em}");Z("\\enspace","\\kern.5em ");Z("\\enskip","\\hskip.5em\\relax");Z("\\quad","\\hskip1em\\relax");Z("\\qquad","\\hskip2em\\relax");Z("\\tag","\\@ifstar\\tag@literal\\tag@paren");Z("\\tag@paren","\\tag@literal{({#1})}");Z("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Be("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Z("\\newline","\\\\\\relax");Z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var TQ=Ve(Ja["Main-Regular"][84][1]-.7*Ja["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+TQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+TQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Z("\\hspace","\\@ifstar\\@hspacer\\@hspace");Z("\\@hspace","\\hskip #1\\relax");Z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Z("\\ordinarycolon",":");Z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Z("∷","\\dblcolon");Z("∹","\\eqcolon");Z("≔","\\coloneqq");Z("≕","\\eqqcolon");Z("⩴","\\Coloneqq");Z("\\ratio","\\vcentcolon");Z("\\coloncolon","\\dblcolon");Z("\\colonequals","\\coloneqq");Z("\\coloncolonequals","\\Coloneqq");Z("\\equalscolon","\\eqqcolon");Z("\\equalscoloncolon","\\Eqqcolon");Z("\\colonminus","\\coloneq");Z("\\coloncolonminus","\\Coloneq");Z("\\minuscolon","\\eqcolon");Z("\\minuscoloncolon","\\Eqcolon");Z("\\coloncolonapprox","\\Colonapprox");Z("\\coloncolonsim","\\Colonsim");Z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Z("\\imath","\\html@mathml{\\@imath}{ı}");Z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Z("⟦","\\llbracket");Z("⟧","\\rrbracket");Z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Z("⦃","\\lBrace");Z("⦄","\\rBrace");Z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Z("⦵","\\minuso");Z("\\darr","\\downarrow");Z("\\dArr","\\Downarrow");Z("\\Darr","\\Downarrow");Z("\\lang","\\langle");Z("\\rang","\\rangle");Z("\\uarr","\\uparrow");Z("\\uArr","\\Uparrow");Z("\\Uarr","\\Uparrow");Z("\\N","\\mathbb{N}");Z("\\R","\\mathbb{R}");Z("\\Z","\\mathbb{Z}");Z("\\alef","\\aleph");Z("\\alefsym","\\aleph");Z("\\Alpha","\\mathrm{A}");Z("\\Beta","\\mathrm{B}");Z("\\bull","\\bullet");Z("\\Chi","\\mathrm{X}");Z("\\clubs","\\clubsuit");Z("\\cnums","\\mathbb{C}");Z("\\Complex","\\mathbb{C}");Z("\\Dagger","\\ddagger");Z("\\diamonds","\\diamondsuit");Z("\\empty","\\emptyset");Z("\\Epsilon","\\mathrm{E}");Z("\\Eta","\\mathrm{H}");Z("\\exist","\\exists");Z("\\harr","\\leftrightarrow");Z("\\hArr","\\Leftrightarrow");Z("\\Harr","\\Leftrightarrow");Z("\\hearts","\\heartsuit");Z("\\image","\\Im");Z("\\infin","\\infty");Z("\\Iota","\\mathrm{I}");Z("\\isin","\\in");Z("\\Kappa","\\mathrm{K}");Z("\\larr","\\leftarrow");Z("\\lArr","\\Leftarrow");Z("\\Larr","\\Leftarrow");Z("\\lrarr","\\leftrightarrow");Z("\\lrArr","\\Leftrightarrow");Z("\\Lrarr","\\Leftrightarrow");Z("\\Mu","\\mathrm{M}");Z("\\natnums","\\mathbb{N}");Z("\\Nu","\\mathrm{N}");Z("\\Omicron","\\mathrm{O}");Z("\\plusmn","\\pm");Z("\\rarr","\\rightarrow");Z("\\rArr","\\Rightarrow");Z("\\Rarr","\\Rightarrow");Z("\\real","\\Re");Z("\\reals","\\mathbb{R}");Z("\\Reals","\\mathbb{R}");Z("\\Rho","\\mathrm{P}");Z("\\sdot","\\cdot");Z("\\sect","\\S");Z("\\spades","\\spadesuit");Z("\\sub","\\subset");Z("\\sube","\\subseteq");Z("\\supe","\\supseteq");Z("\\Tau","\\mathrm{T}");Z("\\thetasym","\\vartheta");Z("\\weierp","\\wp");Z("\\Zeta","\\mathrm{Z}");Z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Z("\\bra","\\mathinner{\\langle{#1}|}");Z("\\ket","\\mathinner{|{#1}\\rangle}");Z("\\braket","\\mathinner{\\langle{#1}\\rangle}");Z("\\Bra","\\left\\langle#1\\right|");Z("\\Ket","\\left|#1\\right\\rangle");var EQ=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),l=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",l));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var h=e.consumeArg().tokens,f=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Z("\\bra@ket",EQ(!1));Z("\\bra@set",EQ(!0));Z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Z("\\angln","{\\angl n}");Z("\\blue","\\textcolor{##6495ed}{#1}");Z("\\orange","\\textcolor{##ffa500}{#1}");Z("\\pink","\\textcolor{##ff00af}{#1}");Z("\\red","\\textcolor{##df0030}{#1}");Z("\\green","\\textcolor{##28ae7b}{#1}");Z("\\gray","\\textcolor{gray}{#1}");Z("\\purple","\\textcolor{##9d38bd}{#1}");Z("\\blueA","\\textcolor{##ccfaff}{#1}");Z("\\blueB","\\textcolor{##80f6ff}{#1}");Z("\\blueC","\\textcolor{##63d9ea}{#1}");Z("\\blueD","\\textcolor{##11accd}{#1}");Z("\\blueE","\\textcolor{##0c7f99}{#1}");Z("\\tealA","\\textcolor{##94fff5}{#1}");Z("\\tealB","\\textcolor{##26edd5}{#1}");Z("\\tealC","\\textcolor{##01d1c1}{#1}");Z("\\tealD","\\textcolor{##01a995}{#1}");Z("\\tealE","\\textcolor{##208170}{#1}");Z("\\greenA","\\textcolor{##b6ffb0}{#1}");Z("\\greenB","\\textcolor{##8af281}{#1}");Z("\\greenC","\\textcolor{##74cf70}{#1}");Z("\\greenD","\\textcolor{##1fab54}{#1}");Z("\\greenE","\\textcolor{##0d923f}{#1}");Z("\\goldA","\\textcolor{##ffd0a9}{#1}");Z("\\goldB","\\textcolor{##ffbb71}{#1}");Z("\\goldC","\\textcolor{##ff9c39}{#1}");Z("\\goldD","\\textcolor{##e07d10}{#1}");Z("\\goldE","\\textcolor{##a75a05}{#1}");Z("\\redA","\\textcolor{##fca9a9}{#1}");Z("\\redB","\\textcolor{##ff8482}{#1}");Z("\\redC","\\textcolor{##f9685d}{#1}");Z("\\redD","\\textcolor{##e84d39}{#1}");Z("\\redE","\\textcolor{##bc2612}{#1}");Z("\\maroonA","\\textcolor{##ffbde0}{#1}");Z("\\maroonB","\\textcolor{##ff92c6}{#1}");Z("\\maroonC","\\textcolor{##ed5fa6}{#1}");Z("\\maroonD","\\textcolor{##ca337c}{#1}");Z("\\maroonE","\\textcolor{##9e034e}{#1}");Z("\\purpleA","\\textcolor{##ddd7ff}{#1}");Z("\\purpleB","\\textcolor{##c6b9fc}{#1}");Z("\\purpleC","\\textcolor{##aa87ff}{#1}");Z("\\purpleD","\\textcolor{##7854ab}{#1}");Z("\\purpleE","\\textcolor{##543b78}{#1}");Z("\\mintA","\\textcolor{##f5f9e8}{#1}");Z("\\mintB","\\textcolor{##edf2df}{#1}");Z("\\mintC","\\textcolor{##e0e5cc}{#1}");Z("\\grayA","\\textcolor{##f6f7f7}{#1}");Z("\\grayB","\\textcolor{##f0f1f2}{#1}");Z("\\grayC","\\textcolor{##e3e5e6}{#1}");Z("\\grayD","\\textcolor{##d6d8da}{#1}");Z("\\grayE","\\textcolor{##babec2}{#1}");Z("\\grayF","\\textcolor{##888d93}{#1}");Z("\\grayG","\\textcolor{##626569}{#1}");Z("\\grayH","\\textcolor{##3b3e40}{#1}");Z("\\grayI","\\textcolor{##21242c}{#1}");Z("\\kaBlue","\\textcolor{##314453}{#1}");Z("\\kaGreen","\\textcolor{##71B307}{#1}");var _Q={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class l2e{constructor(e,n,r){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=n,this.expansionCount=0,this.feed(e),this.macros=new a2e(o2e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new pM(e,this.settings)}switchMode(e){this.mode=e}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(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new _i("EOF",r.loc)),this.pushTokens(s),new _i("",Xs.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,l=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Be("Extra }",i)}else if(i.text==="EOF")throw new Be("Unexpected end of input in a macro argument, expected '"+(e&&r?e[l]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[l]==="{")&&i.text===e[l]){if(++l,l===e.length){n.splice(-l,l);break}}else l=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Be("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new Be("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Be("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=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 Be("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,...a[+c.text-1]);else throw new Be("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 e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new _i(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var l=new pM(s,this.settings),c=[],h=l.lex();h.text!=="EOF";)c.push(h),h=l.lex();c.reverse();var f={tokens:c,numArgs:i};return f}return s}isDefined(e){return this.macros.has(e)||uc.hasOwnProperty(e)||Gn.math.hasOwnProperty(e)||Gn.text.hasOwnProperty(e)||_Q.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:uc.hasOwnProperty(e)&&!uc[e].primitive}}var vM=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,Ax=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),j4={"́":{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"}},yM={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class by{constructor(e,n){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 l2e(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Be("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new _i("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(by.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&uc[s.text]&&uc[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var l=Gn[this.mode][n].group,c=Xs.range(e),h;if(Yye.hasOwnProperty(l)){var f=l;h={type:"atom",mode:this.mode,family:f,loc:c,text:n}}else h={type:l,mode:this.mode,loc:c,text:n};a=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(B$(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:Xs.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;mh&&(h=f):f&&(h!==void 0&&h>-1&&c.push(` -`.repeat(h)||" "),h=-1,c.push(f))}return c.join("")}function LQ(t,e,n){return t.type==="element"?B2e(t,e,n):t.type==="text"?n.whitespace==="normal"?IQ(t,n):q2e(t):[]}function B2e(t,e,n){const r=BQ(t,n),s=t.children||[];let i=-1,a=[];if(L2e(t))return a;let l,c;for(uk(t)||TM(t)&&OM(e,t,TM)?c=` -`:P2e(t)?(l=2,c=2):PQ(t)&&(l=1,c=1);++i{try{i(!0);const je=await Y2e({page:a,page_size:f,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:N,sort_order:T});e(je.data),h(je.total)}catch(je){const Qe=je instanceof Error?je.message:"加载表情包列表失败";G({title:"错误",description:Qe,variant:"destructive"})}finally{i(!1)}},[a,f,g,y,S,N,T,G]),U=async()=>{try{const je=await ewe();r(je.data)}catch(je){console.error("加载统计数据失败:",je)}};b.useEffect(()=>{F()},[F]),b.useEffect(()=>{U()},[]);const te=async je=>{try{const Qe=await K2e(je.id);M(Qe.data),L(!0)}catch(Qe){const He=Qe instanceof Error?Qe.message:"加载详情失败";G({title:"错误",description:He,variant:"destructive"})}},ne=je=>{M(je),$(!0)},Y=je=>{M(je),ee(!0)},ae=async()=>{if(E)try{await J2e(E.id),G({title:"成功",description:"表情包已删除"}),ee(!1),M(null),F(),U()}catch(je){const Qe=je instanceof Error?je.message:"删除失败";G({title:"错误",description:Qe,variant:"destructive"})}},re=async je=>{try{await twe(je.id),G({title:"成功",description:"表情包已注册"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"注册失败";G({title:"错误",description:He,variant:"destructive"})}},oe=async je=>{try{await nwe(je.id),G({title:"成功",description:"表情包已封禁"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"封禁失败";G({title:"错误",description:He,variant:"destructive"})}},_e=je=>{const Qe=new Set(z);Qe.has(je)?Qe.delete(je):Qe.add(je),H(Qe)},Ge=async()=>{try{const je=await rwe(Array.from(z));G({title:"批量删除完成",description:je.message}),H(new Set),W(!1),F(),U()}catch(je){G({title:"批量删除失败",description:je instanceof Error?je.message:"批量删除失败",variant:"destructive"})}},tt=()=>{const je=parseInt(J),Qe=Math.ceil(c/f);je>=1&&je<=Qe?(l(je),X("")):G({title:"无效的页码",description:`请输入1-${Qe}之间的页码`,variant:"destructive"})},Xe=n?.formats?Object.keys(n.formats):[];return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsxs("div",{className:"mb-4 sm:mb-6",children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),o.jsx(kn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&o.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"总数"}),o.jsx(Sn,{className:"text-2xl",children:n.total})]})}),o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"已注册"}),o.jsx(Sn,{className:"text-2xl text-green-600",children:n.registered})]})}),o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"已封禁"}),o.jsx(Sn,{className:"text-2xl text-red-600",children:n.banned})]})}),o.jsx(_t,{children:o.jsxs(wn,{className:"pb-2",children:[o.jsx(Fr,{children:"未注册"}),o.jsx(Sn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),o.jsxs(_t,{children:[o.jsx(wn,{children:o.jsxs(Sn,{className:"flex items-center gap-2",children:[o.jsx(N3,{className:"h-5 w-5"}),"筛选和排序"]})}),o.jsxs(An,{className:"space-y-4",children:[o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"排序方式"}),o.jsxs(Dt,{value:`${N}-${T}`,onValueChange:je=>{const[Qe,He]=je.split("-");C(Qe),_(He),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"usage_count-desc",children:"使用次数 (多→少)"}),o.jsx(ze,{value:"usage_count-asc",children:"使用次数 (少→多)"}),o.jsx(ze,{value:"register_time-desc",children:"注册时间 (新→旧)"}),o.jsx(ze,{value:"register_time-asc",children:"注册时间 (旧→新)"}),o.jsx(ze,{value:"record_time-desc",children:"记录时间 (新→旧)"}),o.jsx(ze,{value:"record_time-asc",children:"记录时间 (旧→新)"}),o.jsx(ze,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),o.jsx(ze,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"注册状态"}),o.jsxs(Dt,{value:g,onValueChange:je=>{x(je),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),o.jsx(ze,{value:"registered",children:"已注册"}),o.jsx(ze,{value:"unregistered",children:"未注册"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"封禁状态"}),o.jsxs(Dt,{value:y,onValueChange:je=>{w(je),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),o.jsx(ze,{value:"banned",children:"已封禁"}),o.jsx(ze,{value:"unbanned",children:"未封禁"})]})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"格式"}),o.jsxs(Dt,{value:S,onValueChange:je=>{k(je),l(1)},children:[o.jsx(Mt,{children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),Xe.map(je=>o.jsxs(ze,{value:je,children:[je.toUpperCase()," (",n?.formats[je],")"]},je))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&o.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),o.jsxs(Dt,{value:R,onValueChange:je=>se(je),children:[o.jsx(Mt,{className:"w-24",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"small",children:"小"}),o.jsx(ze,{value:"medium",children:"中"}),o.jsx(ze,{value:"large",children:"大"})]})]})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:f.toString(),onValueChange:je=>{m(parseInt(je)),l(1),H(new Set)},children:[o.jsx(Mt,{id:"emoji-page-size",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"40",children:"40"}),o.jsx(ze,{value:"60",children:"60"}),o.jsx(ze,{value:"100",children:"100"})]})]}),z.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),o.jsxs(me,{variant:"destructive",size:"sm",onClick:()=>W(!0),children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),o.jsx("div",{className:"flex justify-end pt-4 border-t",children:o.jsxs(me,{variant:"outline",size:"sm",onClick:F,disabled:s,children:[o.jsx(Ti,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"表情包列表"}),o.jsxs(Fr,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),o.jsxs(An,{children:[t.length===0?o.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):o.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(je=>o.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${z.has(je.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>_e(je.id),children:[o.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${z.has(je.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:o.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${z.has(je.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:z.has(je.id)&&o.jsx(pc,{className:"h-3 w-3"})})}),o.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[je.is_registered&&o.jsx(Ln,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),je.is_banned&&o.jsx(Ln,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),o.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:o.jsx("img",{src:qQ(je.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Qe=>{const He=Qe.target;He.style.display="none";const $e=He.parentElement;$e&&($e.innerHTML='')}})}),o.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[o.jsx(Ln,{variant:"outline",className:"text-[10px] px-1 py-0",children:je.format.toUpperCase()}),o.jsxs("span",{className:"font-mono",children:[je.usage_count,"次"]})]}),o.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),ne(je)},title:"编辑",children:o.jsx(Bm,{className:"h-3 w-3"})}),o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),te(je)},title:"详情",children:o.jsx(wa,{className:"h-3 w-3"})}),!je.is_registered&&o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Qe=>{Qe.stopPropagation(),re(je)},title:"注册",children:o.jsx(pc,{className:"h-3 w-3"})}),!je.is_banned&&o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Qe=>{Qe.stopPropagation(),oe(je)},title:"封禁",children:o.jsx(TK,{className:"h-3 w-3"})}),o.jsx(me,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Qe=>{Qe.stopPropagation(),Y(je)},title:"删除",children:o.jsx(sn,{className:"h-3 w-3"})})]})]})]},je.id))}),c>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*f+1," 到"," ",Math.min(a*f,c)," 条,共 ",c," 条"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(je=>Math.max(1,je-1)),disabled:a===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:J,onChange:je=>X(je.target.value),onKeyDown:je=>je.key==="Enter"&&tt(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/f)}),o.jsx(me,{variant:"outline",size:"sm",onClick:tt,disabled:!J,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(je=>je+1),disabled:a>=Math.ceil(c/f),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(c/f)),disabled:a>=Math.ceil(c/f),className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]})]}),o.jsx(iwe,{emoji:E,open:q,onOpenChange:L}),o.jsx(awe,{emoji:E,open:I,onOpenChange:$,onSuccess:()=>{F(),U()}})]})}),o.jsx(jn,{open:P,onOpenChange:W,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:Ge,children:"确认删除"})]})]})}),o.jsx(zr,{open:V,onOpenChange:ee,children:o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"确认删除"}),o.jsx(ps,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>ee(!1),children:"取消"}),o.jsx(me,{variant:"destructive",onClick:ae,children:"删除"})]})]})})]})}function iwe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[90vh]",children:[o.jsx(kr,{children:o.jsx(Or,{children:"表情包详情"})}),o.jsx(kn,{className:"max-h-[calc(90vh-8rem)] pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex justify-center",children:o.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:o.jsx("img",{src:qQ(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"ID"}),o.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"格式"}),o.jsx("div",{className:"mt-1",children:o.jsx(Ln,{variant:"outline",children:t.format.toUpperCase()})})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"文件路径"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"哈希值"}),o.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"描述"}),t.description?o.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:o.jsx(X2e,{className:"prose-sm",children:t.description})}):o.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"情绪"}),o.jsx("div",{className:"mt-1",children:t.emotion?o.jsx("span",{className:"text-sm",children:t.emotion}):o.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"状态"}),o.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&o.jsx(Ln,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&o.jsx(Ln,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&o.jsx(Ln,{variant:"outline",children:"未注册"})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"使用次数"}),o.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"记录时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"注册时间"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),o.jsxs("div",{children:[o.jsx(de,{className:"text-muted-foreground",children:"最后使用"}),o.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function awe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,l]=b.useState(""),[c,h]=b.useState(!1),[f,m]=b.useState(!1),[g,x]=b.useState(!1),{toast:y}=Wr();b.useEffect(()=>{t&&(i(t.description||""),l(t.emotion||""),h(t.is_registered),m(t.is_banned))},[t]);const w=async()=>{if(t)try{x(!0);const S=a.split(/[,,]/).map(k=>k.trim()).filter(Boolean).join(",");await Z2e(t.id,{description:s||void 0,emotion:S||void 0,is_registered:c,is_banned:f}),y({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(S){const k=S instanceof Error?S.message:"保存失败";y({title:"错误",description:k,variant:"destructive"})}finally{x(!1)}};return t?o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表情包"}),o.jsx(ps,{children:"修改表情包的描述和标签信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{children:[o.jsx(de,{children:"描述"}),o.jsx(nr,{value:s,onChange:S=>i(S.target.value),placeholder:"输入表情包描述...",rows:3,className:"mt-1"})]}),o.jsxs("div",{children:[o.jsx(de,{children:"情绪"}),o.jsx(nr,{value:a,onChange:S=>l(S.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ri,{id:"is_registered",checked:c,onCheckedChange:S=>{S===!0?(h(!0),m(!1)):h(!1)}}),o.jsx(de,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ri,{id:"is_banned",checked:f,onCheckedChange:S=>{S===!0?(m(!0),h(!1)):m(!1)}}),o.jsx(de,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(me,{onClick:w,disabled:g,children:g?"保存中...":"保存"})]})]})}):null}const zc="/api/webui/expression";async function owe(){const t=await mt(`${zc}/chats`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function lwe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await mt(`${zc}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function cwe(t){const e=await mt(`${zc}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function uwe(t){const e=await mt(`${zc}/`,{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function dwe(t,e){const n=await mt(`${zc}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function hwe(t){const e=await mt(`${zc}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function fwe(t){const e=await mt(`${zc}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function mwe(){const t=await mt(`${zc}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function pwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),[E,M]=b.useState(new Set),[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,H]=b.useState([]),[P,W]=b.useState(new Map),{toast:J}=Wr(),X=async()=>{try{r(!0);const oe=await lwe({page:a,page_size:c,search:f||void 0});e(oe.data),i(oe.total)}catch(oe){J({title:"加载失败",description:oe instanceof Error?oe.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const oe=await mwe();oe?.data&&ee(oe.data)}catch(oe){console.error("加载统计数据失败:",oe)}},se=async()=>{try{const oe=await owe();if(oe?.data){H(oe.data);const _e=new Map;oe.data.forEach(Ge=>{_e.set(Ge.chat_id,Ge.chat_name)}),W(_e)}}catch(oe){console.error("加载聊天列表失败:",oe)}},G=oe=>P.get(oe)||oe;b.useEffect(()=>{X(),R(),se()},[a,c,f]);const F=async oe=>{try{const _e=await cwe(oe.id);x(_e.data),w(!0)}catch(_e){J({title:"加载详情失败",description:_e instanceof Error?_e.message:"无法加载表达方式详情",variant:"destructive"})}},U=oe=>{x(oe),k(!0)},te=async oe=>{try{await hwe(oe.id),J({title:"删除成功",description:`已删除表达方式: ${oe.situation}`}),_(null),X(),R()}catch(_e){J({title:"删除失败",description:_e instanceof Error?_e.message:"无法删除表达方式",variant:"destructive"})}},ne=oe=>{const _e=new Set(E);_e.has(oe)?_e.delete(oe):_e.add(oe),M(_e)},Y=()=>{E.size===t.length&&t.length>0?M(new Set):M(new Set(t.map(oe=>oe.id)))},ae=async()=>{try{await fwe(Array.from(E)),J({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),M(new Set),L(!1),X(),R()}catch(oe){J({title:"批量删除失败",description:oe instanceof Error?oe.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const oe=parseInt(I),_e=Math.ceil(s/c);oe>=1&&oe<=_e?(l(oe),$("")):J({title:"无效的页码",description:`请输入1-${_e}之间的页码`,variant:"destructive"})};return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(E0,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),o.jsxs(me,{onClick:()=>C(!0),className:"gap-2",children:[o.jsx(ms,{className:"h-4 w-4"}),"新增表达方式"]})]})}),o.jsx(kn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx(de,{htmlFor:"search",children:"搜索"}),o.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:oe=>m(oe.target.value),className:"pl-9"})]})}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&o.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:c.toString(),onValueChange:oe=>{h(parseInt(oe)),l(1),M(new Set)},children:[o.jsx(Mt,{id:"page-size",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),E.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>M(new Set),children:"取消选择"}),o.jsxs(me,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:E.size===t.length&&t.length>0,onCheckedChange:Y})}),o.jsx(en,{children:"情境"}),o.jsx(en,{children:"风格"}),o.jsx(en,{children:"聊天"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:n?o.jsx(fs,{children:o.jsx(Lt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(oe=>o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:E.has(oe.id),onCheckedChange:()=>ne(oe.id)})}),o.jsx(Lt,{className:"font-medium max-w-xs truncate",children:oe.situation}),o.jsx(Lt,{className:"max-w-xs truncate",children:oe.style}),o.jsx(Lt,{className:"max-w-[200px] truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:o.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(oe.chat_id)})}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>U(oe),children:[o.jsx(Bm,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(me,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>F(oe),title:"查看详情",children:o.jsx(sa,{className:"h-4 w-4"})}),o.jsxs(me,{size:"sm",onClick:()=>_(oe),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},oe.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(oe=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ri,{checked:E.has(oe.id),onCheckedChange:()=>ne(oe.id),className:"mt-1"}),o.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:oe.situation,children:oe.situation})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),o.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:oe.style,children:oe.style})]})]})]}),o.jsxs("div",{className:"text-sm",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),o.jsx("p",{className:"text-sm truncate",title:G(oe.chat_id),style:{wordBreak:"keep-all"},children:G(oe.chat_id)})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>U(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Bm,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>F(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:o.jsx(sa,{className:"h-3 w-3"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>_(oe),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},oe.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:I,onChange:oe=>$(oe.target.value),onKeyDown:oe=>oe.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(me,{variant:"outline",size:"sm",onClick:re,disabled:!I,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(gwe,{expression:g,open:y,onOpenChange:w,chatNameMap:P}),o.jsx(xwe,{open:N,onOpenChange:C,chatList:z,onSuccess:()=>{X(),R(),C(!1)}}),o.jsx(vwe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{X(),R(),k(!1)}}),o.jsx(jn,{open:!!T,onOpenChange:()=>_(null),children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>T&&te(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(ywe,{open:q,onOpenChange:L,onConfirm:ae,count:E.size})]})}function gwe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"表达方式详情"}),o.jsx(ps,{children:"查看表达方式的完整信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx(am,{label:"情境",value:t.situation}),o.jsx(am,{label:"风格",value:t.style}),o.jsx(am,{label:"聊天",value:i(t.chat_id)}),o.jsx(am,{icon:C3,label:"记录ID",value:t.id.toString(),mono:!0})]}),o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsx(am,{icon:Gd,label:"创建时间",value:s(t.create_date)})})]}),o.jsx(Ds,{children:o.jsx(me,{onClick:()=>n(!1),children:"关闭"})})]})})}function am({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function xwe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,l]=b.useState(!1),{toast:c}=Wr(),h=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{l(!0),await uwe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(f){c({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{l(!1)}};return o.jsx(zr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"新增表达方式"}),o.jsx(ps,{children:"创建新的表达方式记录"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{htmlFor:"situation",children:["情境 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(Pe,{id:"situation",value:s.situation,onChange:f=>i({...s,situation:f.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{htmlFor:"style",children:["风格 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsx(Pe,{id:"style",value:s.style,onChange:f=>i({...s,style:f.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsxs(de,{htmlFor:"chat_id",children:["聊天 ",o.jsx("span",{className:"text-destructive",children:"*"})]}),o.jsxs(Dt,{value:s.chat_id,onValueChange:f=>i({...s,chat_id:f}),children:[o.jsx(Mt,{children:o.jsx(zt,{placeholder:"选择关联的聊天"})}),o.jsx(At,{children:n.map(f=>o.jsx(ze,{value:f.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[f.chat_name,f.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},f.chat_id))})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>e(!1),children:"取消"}),o.jsx(me,{onClick:h,disabled:a,children:a?"创建中...":"创建"})]})]})})}function vwe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[l,c]=b.useState(!1),{toast:h}=Wr();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const f=async()=>{if(t)try{c(!0),await dwe(t.id,i),h({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){h({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑表达方式"}),o.jsx(ps,{children:"修改表达方式的信息"})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit_situation",children:"情境"}),o.jsx(Pe,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit_style",children:"风格"}),o.jsx(Pe,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit_chat_id",children:"聊天"}),o.jsxs(Dt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[o.jsx(Mt,{children:o.jsx(zt,{placeholder:"选择关联的聊天"})}),o.jsx(At,{children:r.map(m=>o.jsx(ze,{value:m.chat_id,children:o.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&o.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(me,{onClick:f,disabled:l,children:l?"保存中...":"保存"})]})]})}):null}function ywe({open:t,onOpenChange:e,onConfirm:n,count:r}){return o.jsx(jn,{open:t,onOpenChange:e,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const Jh="/api/webui/person";async function bwe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await mt(`${Jh}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function wwe(t){const e=await mt(`${Jh}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Swe(t,e){const n=await mt(`${Jh}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function kwe(t){const e=await mt(`${Jh}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function Owe(){const t=await mt(`${Jh}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function jwe(t){const e=await mt(`${Jh}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function Nwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,l]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[I,$]=b.useState(new Set),[V,ee]=b.useState(!1),[z,H]=b.useState(""),{toast:P}=Wr(),W=async()=>{try{r(!0);const re=await bwe({page:a,page_size:c,search:f||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){P({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await Owe();re?.data&&L(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{W(),J()},[a,c,f,g,y]);const X=async re=>{try{const oe=await wwe(re.person_id);k(oe.data),C(!0)}catch(oe){P({title:"加载详情失败",description:oe instanceof Error?oe.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),_(!0)},se=async re=>{try{await kwe(re.person_id),P({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),M(null),W(),J()}catch(oe){P({title:"删除失败",description:oe instanceof Error?oe.message:"无法删除人物信息",variant:"destructive"})}},G=b.useMemo(()=>Object.keys(q.platforms),[q.platforms]),F=re=>{const oe=new Set(I);oe.has(re)?oe.delete(re):oe.add(re),$(oe)},U=()=>{I.size===t.length&&t.length>0?$(new Set):$(new Set(t.map(re=>re.person_id)))},te=()=>{if(I.size===0){P({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ee(!0)},ne=async()=>{try{const re=await jwe(Array.from(I));P({title:"批量删除完成",description:re.message}),$(new Set),ee(!1),W(),J()}catch(re){P({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},Y=()=>{const re=parseInt(z),oe=Math.ceil(s/c);re>=1&&re<=oe?(l(re),H("")):P({title:"无效的页码",description:`请输入1-${oe}之间的页码`,variant:"destructive"})},ae=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return o.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[o.jsx("div",{className:"mb-4 sm:mb-6",children:o.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:o.jsxs("div",{children:[o.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[o.jsx(EK,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),o.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),o.jsx(kn,{className:"flex-1",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),o.jsx("div",{className:"text-2xl font-bold mt-1",children:q.total})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:q.known})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),o.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:q.unknown})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[o.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"sm:col-span-2",children:[o.jsx(de,{htmlFor:"search",children:"搜索"}),o.jsxs("div",{className:"relative mt-1.5",children:[o.jsx(ii,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),o.jsxs("div",{children:[o.jsx(de,{htmlFor:"filter-known",children:"认识状态"}),o.jsxs(Dt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),l(1)},children:[o.jsx(Mt,{id:"filter-known",className:"mt-1.5",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部"}),o.jsx(ze,{value:"true",children:"已认识"}),o.jsx(ze,{value:"false",children:"未认识"})]})]})]}),o.jsxs("div",{children:[o.jsx(de,{htmlFor:"filter-platform",children:"平台"}),o.jsxs(Dt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),l(1)},children:[o.jsx(Mt,{id:"filter-platform",className:"mt-1.5",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部平台"}),G.map(re=>o.jsxs(ze,{value:re,children:[re," (",q.platforms[re],")"]},re))]})]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[o.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&o.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),o.jsxs(Dt,{value:c.toString(),onValueChange:re=>{h(parseInt(re)),l(1),$(new Set)},children:[o.jsx(Mt,{id:"page-size",className:"w-20",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"10",children:"10"}),o.jsx(ze,{value:"20",children:"20"}),o.jsx(ze,{value:"50",children:"50"}),o.jsx(ze,{value:"100",children:"100"})]})]}),I.size>0&&o.jsxs(o.Fragment,{children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>$(new Set),children:"取消选择"}),o.jsxs(me,{variant:"destructive",size:"sm",onClick:te,children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),o.jsxs("div",{className:"rounded-lg border bg-card",children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{className:"w-12",children:o.jsx(ri,{checked:t.length>0&&I.size===t.length,onCheckedChange:U,"aria-label":"全选"})}),o.jsx(en,{children:"状态"}),o.jsx(en,{children:"名称"}),o.jsx(en,{children:"昵称"}),o.jsx(en,{children:"平台"}),o.jsx(en,{children:"用户ID"}),o.jsx(en,{children:"最后更新"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:n?o.jsx(fs,{children:o.jsx(Lt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?o.jsx(fs,{children:o.jsx(Lt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(ri,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),o.jsx(Lt,{children:o.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"})}),o.jsx(Lt,{className:"font-medium",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"-"})}),o.jsx(Lt,{children:re.nickname||"-"}),o.jsx(Lt,{children:re.platform}),o.jsx(Lt,{className:"font-mono text-sm",children:re.user_id}),o.jsx(Lt,{className:"text-sm text-muted-foreground",children:ae(re.last_know)}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsxs(me,{variant:"default",size:"sm",onClick:()=>X(re),children:[o.jsx(sa,{className:"h-4 w-4 mr-1"}),"详情"]}),o.jsxs(me,{variant:"default",size:"sm",onClick:()=>R(re),children:[o.jsx(Bm,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsxs(me,{size:"sm",onClick:()=>M(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),o.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?o.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>o.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(ri,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),className:"mt-1"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"}),o.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||o.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&o.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),o.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),o.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),o.jsx("p",{className:"text-xs",children:ae(re.last_know)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>X(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(sa,{className:"h-3 w-3 mr-1"}),"查看"]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[o.jsx(Bm,{className:"h-3 w-3 mr-1"}),"编辑"]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>M(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[o.jsx(sn,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&o.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[o.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(1),disabled:a===1,className:"hidden sm:flex",children:o.jsx(M0,{className:"h-4 w-4"})}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a-1),disabled:a===1,children:[o.jsx(Iu,{className:"h-4 w-4 sm:mr-1"}),o.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{type:"number",value:z,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&Y(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),o.jsx(me,{variant:"outline",size:"sm",onClick:Y,disabled:!z,className:"h-8",children:"跳转"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:()=>l(a+1),disabled:a>=Math.ceil(s/c),children:[o.jsx("span",{className:"hidden sm:inline",children:"下一页"}),o.jsx(Bu,{className:"h-4 w-4 sm:ml-1"})]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>l(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:o.jsx(A0,{className:"h-4 w-4"})})]})]})]})]})}),o.jsx(Cwe,{person:S,open:N,onOpenChange:C}),o.jsx(Twe,{person:S,open:T,onOpenChange:_,onSuccess:()=>{W(),J(),_(!1)}}),o.jsx(jn,{open:!!E,onOpenChange:()=>M(null),children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认删除"}),o.jsxs(fn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:()=>E&&se(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),o.jsx(jn,{open:V,onOpenChange:ee,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"确认批量删除"}),o.jsxs(fn,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{children:"取消"}),o.jsx(mn,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Cwe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"人物详情"}),o.jsxs(ps,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsx($o,{icon:GD,label:"人物名称",value:t.person_name}),o.jsx($o,{icon:E0,label:"昵称",value:t.nickname}),o.jsx($o,{icon:C3,label:"用户ID",value:t.user_id,mono:!0}),o.jsx($o,{icon:C3,label:"人物ID",value:t.person_id,mono:!0}),o.jsx($o,{label:"平台",value:t.platform}),o.jsx($o,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(de,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),o.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(de,{className:"text-xs text-muted-foreground",children:"个人印象"}),o.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&o.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[o.jsx(de,{className:"text-xs text-muted-foreground",children:"群昵称"}),o.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>o.jsxs("div",{className:"text-sm flex items-center gap-2",children:[o.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),o.jsx("span",{children:"→"}),o.jsx("span",{children:s.group_nick_name})]},i))})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[o.jsx($o,{icon:Gd,label:"认识时间",value:r(t.know_times)}),o.jsx($o,{icon:Gd,label:"首次记录",value:r(t.know_since)}),o.jsx($o,{icon:Gd,label:"最后更新",value:r(t.last_know)})]})]}),o.jsx(Ds,{children:o.jsx(me,{onClick:()=>n(!1),children:"关闭"})})]})})}function $o({icon:t,label:e,value:n,mono:r=!1}){return o.jsxs("div",{className:"space-y-1",children:[o.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&o.jsx(t,{className:"h-3 w-3"}),e]}),o.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Twe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,l]=b.useState(!1),{toast:c}=Wr();b.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{l(!0),await Swe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(f){c({title:"保存失败",description:f instanceof Error?f.message:"无法更新人物信息",variant:"destructive"})}finally{l(!1)}};return t?o.jsx(zr,{open:e,onOpenChange:n,children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑人物信息"}),o.jsxs(ps,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"person_name",children:"人物名称"}),o.jsx(Pe,{id:"person_name",value:s.person_name||"",onChange:f=>i({...s,person_name:f.target.value}),placeholder:"为这个人设置一个名称"})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"nickname",children:"昵称"}),o.jsx(Pe,{id:"nickname",value:s.nickname||"",onChange:f=>i({...s,nickname:f.target.value}),placeholder:"昵称"})]})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"name_reason",children:"名称设定原因"}),o.jsx(nr,{id:"name_reason",value:s.name_reason||"",onChange:f=>i({...s,name_reason:f.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"memory_points",children:"个人印象"}),o.jsx(nr,{id:"memory_points",value:s.memory_points||"",onChange:f=>i({...s,memory_points:f.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[o.jsxs("div",{children:[o.jsx(de,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),o.jsx(Tt,{id:"is_known",checked:s.is_known,onCheckedChange:f=>i({...s,is_known:f})})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>n(!1),children:"取消"}),o.jsx(me,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function gs(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(f,m)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Ewe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=e=t(r,s,c);return c},_we=t=>t?EM(t):EM,{useDebugValue:Mwe}=he,{useSyncExternalStoreWithSelector:Awe}=HX,Rwe=t=>t;function FQ(t,e=Rwe,n){const r=Awe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Mwe(r),r}const _M=(t,e)=>{const n=_we(t),r=(s,i=e)=>FQ(n,s,i);return Object.assign(r,n),r},Dwe=(t,e)=>t?_M(t,e):_M;function ts(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var zwe={value:()=>{}};function wy(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}p1.prototype=wy.prototype={constructor:p1,on:function(t,e){var n=this._,r=Pwe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),AM.hasOwnProperty(e)?{space:AM[e],local:t}:t}function Iwe(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===dk&&e.documentElement.namespaceURI===dk?e.createElement(t):e.createElementNS(n,t)}}function Bwe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $Q(t){var e=Sy(t);return(e.local?Bwe:Iwe)(e)}function qwe(){}function aj(t){return t==null?qwe:function(){return this.querySelector(t)}}function Fwe(t){typeof t!="function"&&(t=aj(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=C&&(C=N+1);!(_=S[C])&&++C=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function h4e(t){t||(t=f4e);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function m4e(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function p4e(){return Array.from(this)}function g4e(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?C4e:typeof e=="function"?E4e:T4e)(t,e,n??"")):Th(this.node(),t)}function Th(t,e){return t.style.getPropertyValue(e)||WQ(t).getComputedStyle(t,null).getPropertyValue(e)}function M4e(t){return function(){delete this[t]}}function A4e(t,e){return function(){this[t]=e}}function R4e(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function D4e(t,e){return arguments.length>1?this.each((e==null?M4e:typeof e=="function"?R4e:A4e)(t,e)):this.node()[t]}function GQ(t){return t.trim().split(/^|\s+/)}function oj(t){return t.classList||new XQ(t)}function XQ(t){this._node=t,this._names=GQ(t.getAttribute("class")||"")}XQ.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function YQ(t,e){for(var n=oj(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function l5e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function hk(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:l,dx:c,dy:h,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:f}})}hk.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function v5e(t){return!t.ctrlKey&&!t.button}function y5e(){return this.parentNode}function b5e(t,e){return e??{x:t.x,y:t.y}}function w5e(){return navigator.maxTouchPoints||"ontouchstart"in this}function S5e(){var t=v5e,e=y5e,n=b5e,r=w5e,s={},i=wy("start","drag","end"),a=0,l,c,h,f,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,x5e).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,_){if(!(f||!t.call(this,T,_))){var E=C(this,e.call(this,T,_),T,_,"mouse");E&&(Gi(T.view).on("mousemove.drag",y,v0).on("mouseup.drag",w,v0),eH(T.view),C4(T),h=!1,l=T.clientX,c=T.clientY,E("start",T))}}function y(T){if(lh(T),!h){var _=T.clientX-l,E=T.clientY-c;h=_*_+E*E>m}s.mouse("drag",T)}function w(T){Gi(T.view).on("mousemove.drag mouseup.drag",null),tH(T.view,h),lh(T),s.mouse("end",T)}function S(T,_){if(t.call(this,T,_)){var E=T.changedTouches,M=e.call(this,T,_),q=E.length,L,I;for(L=0;L=0&&t._call.call(void 0,e),t=t._next;--Eh}function RM(){zu=(hv=y0.now())+ky,Eh=xm=0;try{O5e()}finally{Eh=0,N5e(),zu=0}}function j5e(){var t=y0.now(),e=t-hv;e>nH&&(ky-=e,hv=t)}function N5e(){for(var t,e=dv,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:dv=n);vm=t,fk(r)}function fk(t){if(!Eh){xm&&(xm=clearTimeout(xm));var e=t-zu;e>24?(t<1/0&&(xm=setTimeout(RM,t-y0.now()-ky)),om&&(om=clearInterval(om))):(om||(hv=y0.now(),om=setInterval(j5e,nH)),Eh=1,rH(RM))}}function DM(t,e,n){var r=new fv;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var C5e=wy("start","end","cancel","interrupt"),T5e=[],iH=0,zM=1,mk=2,g1=3,PM=4,pk=5,x1=6;function Oy(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;E5e(t,n,{name:e,index:r,group:s,on:C5e,tween:T5e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:iH})}function cj(t,e){var n=Aa(t,e);if(n.state>iH)throw new Error("too late; already scheduled");return n}function go(t,e){var n=Aa(t,e);if(n.state>g1)throw new Error("too late; already running");return n}function Aa(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function E5e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=sH(i,0,n.time);function i(h){n.state=zM,n.timer.restart(a,n.delay,n.time),n.delay<=h&&a(h-n.delay)}function a(h){var f,m,g,x;if(n.state!==zM)return c();for(f in r)if(x=r[f],x.name===n.name){if(x.state===g1)return DM(a);x.state===PM?(x.state=x1,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[f]):+fmk&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function i3e(t,e,n){var r,s,i=s3e(e)?cj:go;return function(){var a=i(this,t),l=a.on;l!==r&&(s=(r=l).copy()).on(e,n),a.on=s}}function a3e(t,e){var n=this._id;return arguments.length<2?Aa(this.node(),n).on.on(t):this.each(i3e(n,t,e))}function o3e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function l3e(){return this.on("end.remove",o3e(this._id))}function c3e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=aj(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function D3e(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function Zo(t,e,n){this.k=t,this.x=e,this.y=n}Zo.prototype={constructor:Zo,scale:function(t){return t===1?this:new Zo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Zo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ol=new Zo(1,0,0);Zo.prototype;function T4(t){t.stopImmediatePropagation()}function lm(t){t.preventDefault(),t.stopImmediatePropagation()}function z3e(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function P3e(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function LM(){return this.__zoom||ol}function L3e(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function I3e(){return navigator.maxTouchPoints||"ontouchstart"in this}function B3e(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function cH(){var t=z3e,e=P3e,n=B3e,r=L3e,s=I3e,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],l=250,c=fY,h=wy("start","zoom","end"),f,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",LM).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,H,P,W){var J=z.selection?z.selection():z;J.property("__zoom",LM),z!==J?_(z,H,P,W):J.interrupt().each(function(){E(this,arguments).event(W).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},k.scaleBy=function(z,H,P,W){k.scaleTo(z,function(){var J=this.__zoom.k,X=typeof H=="function"?H.apply(this,arguments):H;return J*X},P,W)},k.scaleTo=function(z,H,P,W){k.transform(z,function(){var J=e.apply(this,arguments),X=this.__zoom,R=P==null?T(J):typeof P=="function"?P.apply(this,arguments):P,se=X.invert(R),G=typeof H=="function"?H.apply(this,arguments):H;return n(C(N(X,G),R,se),J,a)},P,W)},k.translateBy=function(z,H,P,W){k.transform(z,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof P=="function"?P.apply(this,arguments):P),e.apply(this,arguments),a)},null,W)},k.translateTo=function(z,H,P,W,J){k.transform(z,function(){var X=e.apply(this,arguments),R=this.__zoom,se=W==null?T(X):typeof W=="function"?W.apply(this,arguments):W;return n(ol.translate(se[0],se[1]).scale(R.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof P=="function"?-P.apply(this,arguments):-P),X,a)},W,J)};function N(z,H){return H=Math.max(i[0],Math.min(i[1],H)),H===z.k?z:new Zo(H,z.x,z.y)}function C(z,H,P){var W=H[0]-P[0]*z.k,J=H[1]-P[1]*z.k;return W===z.x&&J===z.y?z:new Zo(z.k,W,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function _(z,H,P,W){z.on("start.zoom",function(){E(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(W).end()}).tween("zoom",function(){var J=this,X=arguments,R=E(J,X).event(W),se=e.apply(J,X),G=P==null?T(se):typeof P=="function"?P.apply(J,X):P,F=Math.max(se[1][0]-se[0][0],se[1][1]-se[0][1]),U=J.__zoom,te=typeof H=="function"?H.apply(J,X):H,ne=c(U.invert(G).concat(F/U.k),te.invert(G).concat(F/te.k));return function(Y){if(Y===1)Y=te;else{var ae=ne(Y),re=F/ae[2];Y=new Zo(re,G[0]-ae[0]*re,G[1]-ae[1]*re)}R.zoom(null,Y)}})}function E(z,H,P){return!P&&z.__zooming||new M(z,H)}function M(z,H){this.that=z,this.args=H,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,H),this.taps=0}M.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,H){return this.mouse&&z!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var H=Gi(this.that).datum();h.call(z,this.that,new D3e(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:h}),H)}};function q(z,...H){if(!t.apply(this,arguments))return;var P=E(this,H).event(z),W=this.__zoom,J=Math.max(i[0],Math.min(i[1],W.k*Math.pow(2,r.apply(this,arguments)))),X=ya(z);if(P.wheel)(P.mouse[0][0]!==X[0]||P.mouse[0][1]!==X[1])&&(P.mouse[1]=W.invert(P.mouse[0]=X)),clearTimeout(P.wheel);else{if(W.k===J)return;P.mouse=[X,W.invert(X)],v1(this),P.start()}lm(z),P.wheel=setTimeout(R,y),P.zoom("mouse",n(C(N(W,J),P.mouse[0],P.mouse[1]),P.extent,a));function R(){P.wheel=null,P.end()}}function L(z,...H){if(g||!t.apply(this,arguments))return;var P=z.currentTarget,W=E(this,H,!0).event(z),J=Gi(z.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",F,!0),X=ya(z,P),R=z.clientX,se=z.clientY;eH(z.view),T4(z),W.mouse=[X,this.__zoom.invert(X)],v1(this),W.start();function G(U){if(lm(U),!W.moved){var te=U.clientX-R,ne=U.clientY-se;W.moved=te*te+ne*ne>w}W.event(U).zoom("mouse",n(C(W.that.__zoom,W.mouse[0]=ya(U,P),W.mouse[1]),W.extent,a))}function F(U){J.on("mousemove.zoom mouseup.zoom",null),tH(U.view,W.moved),lm(U),W.event(U).end()}}function I(z,...H){if(t.apply(this,arguments)){var P=this.__zoom,W=ya(z.changedTouches?z.changedTouches[0]:z,this),J=P.invert(W),X=P.k*(z.shiftKey?.5:2),R=n(C(N(P,X),W,J),e.apply(this,H),a);lm(z),l>0?Gi(this).transition().duration(l).call(_,R,W,z):Gi(this).call(k.transform,R,W,z)}}function $(z,...H){if(t.apply(this,arguments)){var P=z.touches,W=P.length,J=E(this,H,z.changedTouches.length===W).event(z),X,R,se,G;for(T4(z),R=0;R"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},uH=vl.error001();function Xn(t,e){const n=b.useContext(jy);if(n===null)throw new Error(uH);return FQ(n,t,e)}const Gr=()=>{const t=b.useContext(jy);if(t===null)throw new Error(uH);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},F3e=t=>t.userSelectionActive?"none":"all";function Ny({position:t,children:e,className:n,style:r,...s}){const i=Xn(F3e),a=`${t}`.split("-");return he.createElement("div",{className:gs(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function $3e({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:he.createElement(Ny,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const Q3e=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:l=2,children:c,className:h,...f})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=gs(["react-flow__edge-textwrapper",h]);return b.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...f},s&&he.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),he.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var H3e=b.memo(Q3e);const dj=t=>({width:t.offsetWidth,height:t.offsetHeight}),_h=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),hj=(t={x:0,y:0},e)=>({x:_h(t.x,e[0][0],e[1][0]),y:_h(t.y,e[0][1],e[1][1])}),IM=(t,e,n)=>tn?-_h(Math.abs(t-n),1,50)/50:0,dH=(t,e)=>{const n=IM(t.x,35,e.width-35)*20,r=IM(t.y,35,e.height-35)*20;return[n,r]},hH=t=>t.getRootNode?.()||window?.document,fH=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),b0=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),mH=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),BM=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),V3e=(t,e)=>mH(fH(b0(t),b0(e))),gk=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},U3e=t=>Ji(t.width)&&Ji(t.height)&&Ji(t.x)&&Ji(t.y),Ji=t=>!isNaN(t)&&isFinite(t),pr=Symbol.for("internals"),pH=["Enter"," ","Escape"],W3e=(t,e)=>{},G3e=t=>"nativeEvent"in t;function xk(t){const n=(G3e(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const gH=t=>"clientX"in t,fc=(t,e)=>{const n=gH(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},mv=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,dp=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:t,style:f,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&he.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&Ji(n)&&Ji(r)?he.createElement(H3e,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h}):null);dp.displayName="BaseEdge";function cm(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function xH({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[S,k,N]=yH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return he.createElement(dp,{path:S,labelX:k,labelY:N,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});fj.displayName="SimpleBezierEdge";const FM={[ht.Left]:{x:-1,y:0},[ht.Right]:{x:1,y:0},[ht.Top]:{x:0,y:-1},[ht.Bottom]:{x:0,y:1}},X3e=({source:t,sourcePosition:e=ht.Bottom,target:n})=>e===ht.Left||e===ht.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function Y3e({source:t,sourcePosition:e=ht.Bottom,target:n,targetPosition:r=ht.Top,center:s,offset:i}){const a=FM[e],l=FM[r],c={x:t.x+a.x*i,y:t.y+a.y*i},h={x:n.x+l.x*i,y:n.y+l.y*i},f=X3e({source:c,sourcePosition:e,target:h}),m=f.x!==0?"x":"y",g=f[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[N,C,T,_]=xH({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*l[m]===-1){y=s.x??N,w=s.y??C;const M=[{x:y,y:c.y},{x:y,y:h.y}],q=[{x:c.x,y:w},{x:h.x,y:w}];a[m]===g?x=m==="x"?M:q:x=m==="x"?q:M}else{const M=[{x:c.x,y:h.y}],q=[{x:h.x,y:c.y}];if(m==="x"?x=a.x===g?q:M:x=a.y===g?M:q,e===r){const ee=Math.abs(t[m]-n[m]);if(ee<=i){const z=Math.min(i-1,i-ee);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(h[m]>n[m]?-1:1)*z}}if(e!==r){const ee=m==="x"?"y":"x",z=a[m]===l[ee],H=c[ee]>h[ee],P=c[ee]=V?(y=(L.x+I.x)/2,w=x[0].y):(y=x[0].x,w=(L.y+I.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:h.x+k.x,y:h.y+k.y},n],y,w,T,_]}function K3e(t,e,n,r){const s=Math.min($M(t,e)/2,$M(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const h=t.x{let C="";return N>0&&N{const[k,N,C]=vk({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return he.createElement(dp,{path:k,labelX:N,labelY:C,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:y,interactionWidth:S})});Cy.displayName="SmoothStepEdge";const mj=b.memo(t=>he.createElement(Cy,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));mj.displayName="StepEdge";function Z3e({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,l]=xH({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,l]}const pj=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=Z3e({sourceX:t,sourceY:e,targetX:n,targetY:r});return he.createElement(dp,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});pj.displayName="StraightEdge";function zx(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function QM({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case ht.Left:return[e-zx(e-r,i),n];case ht.Right:return[e+zx(r-e,i),n];case ht.Top:return[e,n-zx(n-s,i)];case ht.Bottom:return[e,n+zx(s-n,i)]}}function bH({sourceX:t,sourceY:e,sourcePosition:n=ht.Bottom,targetX:r,targetY:s,targetPosition:i=ht.Top,curvature:a=.25}){const[l,c]=QM({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[h,f]=QM({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=vH({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:h,targetControlY:f});return[`M${t},${e} C${l},${c} ${h},${f} ${r},${s}`,m,g,x,y]}const gv=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=ht.Bottom,targetPosition:i=ht.Top,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,N,C]=bH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return he.createElement(dp,{path:k,labelX:N,labelY:C,label:a,labelStyle:l,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});gv.displayName="BezierEdge";const gj=b.createContext(null),J3e=gj.Provider;gj.Consumer;const eSe=()=>b.useContext(gj),tSe=t=>"id"in t&&"source"in t&&"target"in t,nSe=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,yk=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,rSe=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),sSe=(t,e)=>{if(!t.source||!t.target)return e;let n;return tSe(t)?n={...t}:n={...t,id:nSe(t)},rSe(n,e)?e:e.concat(n)},bk=({x:t,y:e},[n,r,s],i,[a,l])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:l*Math.round(c.y/l)}:c},wH=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),ku=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},Ty=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=ku(s,e).positionAbsolute;return fH(r,b0({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return mH(n)},SH=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,l=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},h=[];return t.forEach(f=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=f;if(a&&!x||y)return!1;const{positionAbsolute:w}=ku(f,l),S={x:w.x,y:w.y,width:m||0,height:g||0},k=gk(c,S),N=typeof m>"u"||typeof g>"u"||m===null||g===null,C=i&&k>0,T=(m||0)*(g||0);(N||C||k>=T||f.dragging)&&h.push(f)}),h},kH=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},OH=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),l=n/(t.height*(1+i)),c=Math.min(a,l),h=_h(c,r,s),f=t.x+t.width/2,m=t.y+t.height/2,g=e/2-f*h,x=n/2-m*h;return{x:g,y:x,zoom:h}},ou=(t,e=0)=>t.transition().duration(e);function HM(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function iSe(t,e,n,r,s,i){const{x:a,y:l}=fc(t),h=e.elementsFromPoint(a,l).find(y=>y.classList.contains("react-flow__handle"));if(h){const y=h.getAttribute("data-nodeid");if(y){const w=xj(void 0,h),S=h.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const N=s.find(C=>C.nodeId===y&&C.type===w&&C.id===S);return{handle:{id:S,type:w,nodeId:y,x:N?.x||n.x,y:N?.y||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const S=i(y);w<=m&&(wy.isValid),x=f.some(({handle:y})=>y.type==="target");return f.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||f[0]}const aSe={source:null,target:null,sourceHandle:null,targetHandle:null},jH=()=>({handleDomNode:null,isValid:!1,connection:aSe,endHandle:null});function NH(t,e,n,r,s,i,a){const l=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...jH(),handleDomNode:c};if(c){const f=xj(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:l?m:n,sourceHandle:l?g:r,target:l?n:m,targetHandle:l?r:g};h.connection=w,x&&y&&(e===Pu.Strict?l&&f==="source"||!l&&f==="target":m!==n||g!==r)&&(h.endHandle={nodeId:m,handleId:g,type:f},h.isValid=i(w))}return h}function oSe({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[pr]){const{handleBounds:a}=i[pr];let l=[],c=[];a&&(l=HM(i,a,"source",`${e}-${n}-${r}`),c=HM(i,a,"target",`${e}-${n}-${r}`)),s.push(...l,...c)}return s},[])}function xj(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function E4(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function lSe(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function CH({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:l,edgeUpdaterType:c,onReconnectEnd:h}){const f=hH(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:N}=i();let C=0,T;const{x:_,y:E}=fc(t),M=f?.elementFromPoint(_,E),q=xj(c,M),L=g?.getBoundingClientRect();if(!L||!q)return;let I,$=fc(t,L),V=!1,ee=null,z=!1,H=null;const P=oSe({nodes:k(),nodeId:n,handleId:e,handleType:q}),W=()=>{if(!x)return;const[R,se]=dH($,L);S({x:R,y:se}),C=requestAnimationFrame(W)};a({connectionPosition:$,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:e,type:q},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:q});function J(R){const{transform:se}=i();$=fc(R,L);const{handle:G,validHandleResult:F}=iSe(R,f,bk($,se,!1,[1,1]),y,P,U=>NH(U,m,n,e,s?"target":"source",l,f));if(T=G,V||(W(),V=!0),H=F.handleDomNode,ee=F.connection,z=F.isValid,a({connectionPosition:T&&z?wH({x:T.x,y:T.y},se):$,connectionStatus:lSe(!!T,z),connectionEndHandle:F.endHandle}),!T&&!z&&!H)return E4(I);ee.source!==ee.target&&H&&(E4(I),I=H,H.classList.add("connecting","react-flow__handle-connecting"),H.classList.toggle("valid",z),H.classList.toggle("react-flow__handle-valid",z))}function X(R){(T||H)&&ee&&z&&r?.(ee),i().onConnectEnd?.(R),c&&h?.(R),E4(I),N(),cancelAnimationFrame(C),V=!1,z=!1,ee=null,H=null,f.removeEventListener("mousemove",J),f.removeEventListener("mouseup",X),f.removeEventListener("touchmove",J),f.removeEventListener("touchend",X)}f.addEventListener("mousemove",J),f.addEventListener("mouseup",X),f.addEventListener("touchmove",J),f.addEventListener("touchend",X)}const VM=()=>!0,cSe=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),uSe=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},TH=b.forwardRef(({type:t="source",position:e=ht.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:l,children:c,className:h,onMouseDown:f,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=Gr(),k=eSe(),{connectOnClick:N,noPanClassName:C}=Xn(cSe,ts),{connecting:T,clickConnecting:_}=Xn(uSe(k,y,t),ts);k||S.getState().onError?.("010",vl.error010());const E=L=>{const{defaultEdgeOptions:I,onConnect:$,hasDefaultEdges:V}=S.getState(),ee={...I,...L};if(V){const{edges:z,setEdges:H}=S.getState();H(sSe(ee,z))}$?.(ee),l?.(ee)},M=L=>{if(!k)return;const I=gH(L);s&&(I&&L.button===0||!I)&&CH({event:L,handleId:y,nodeId:k,onConnect:E,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||VM}),I?f?.(L):m?.(L)},q=L=>{const{onClickConnectStart:I,onClickConnectEnd:$,connectionClickStartHandle:V,connectionMode:ee,isValidConnection:z}=S.getState();if(!k||!V&&!s)return;if(!V){I?.(L,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const H=hH(L.target),P=n||z||VM,{connection:W,isValid:J}=NH({nodeId:k,id:y,type:t},ee,V.nodeId,V.handleId||null,V.type,P,H);J&&E(W),$?.(L),S.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:gs(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:_,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:M,onTouchStart:M,onClick:N?q:void 0,ref:x,...g},c)});TH.displayName="Handle";var jc=b.memo(TH);const EH=({data:t,isConnectable:e,targetPosition:n=ht.Top,sourcePosition:r=ht.Bottom})=>he.createElement(he.Fragment,null,he.createElement(jc,{type:"target",position:n,isConnectable:e}),t?.label,he.createElement(jc,{type:"source",position:r,isConnectable:e}));EH.displayName="DefaultNode";var wk=b.memo(EH);const _H=({data:t,isConnectable:e,sourcePosition:n=ht.Bottom})=>he.createElement(he.Fragment,null,t?.label,he.createElement(jc,{type:"source",position:n,isConnectable:e}));_H.displayName="InputNode";var MH=b.memo(_H);const AH=({data:t,isConnectable:e,targetPosition:n=ht.Top})=>he.createElement(he.Fragment,null,he.createElement(jc,{type:"target",position:n,isConnectable:e}),t?.label);AH.displayName="OutputNode";var RH=b.memo(AH);const vj=()=>null;vj.displayName="GroupNode";const dSe=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Px=t=>t.id;function hSe(t,e){return ts(t.selectedNodes.map(Px),e.selectedNodes.map(Px))&&ts(t.selectedEdges.map(Px),e.selectedEdges.map(Px))}const DH=b.memo(({onSelectionChange:t})=>{const e=Gr(),{selectedNodes:n,selectedEdges:r}=Xn(dSe,hSe);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});DH.displayName="SelectionListener";const fSe=t=>!!t.onSelectionChange;function mSe({onSelectionChange:t}){const e=Xn(fSe);return t||e?he.createElement(DH,{onSelectionChange:t}):null}const pSe=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function Td(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function Vt(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const gSe=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:l,onClickConnectEnd:c,nodesDraggable:h,nodesConnectable:f,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:N,onEdgesChange:C,elementsSelectable:T,connectionMode:_,snapGrid:E,snapToGrid:M,translateExtent:q,connectOnClick:L,defaultEdgeOptions:I,fitView:$,fitViewOptions:V,onNodesDelete:ee,onEdgesDelete:z,onNodeDrag:H,onNodeDragStart:P,onNodeDragStop:W,onSelectionDrag:J,onSelectionDragStart:X,onSelectionDragStop:R,noPanClassName:se,nodeOrigin:G,rfId:F,autoPanOnConnect:U,autoPanOnNodeDrag:te,onError:ne,connectionRadius:Y,isValidConnection:ae,nodeDragThreshold:re})=>{const{setNodes:oe,setEdges:_e,setDefaultNodesAndEdges:Ge,setMinZoom:tt,setMaxZoom:Xe,setTranslateExtent:je,setNodeExtent:Qe,reset:He}=Xn(pSe,ts),$e=Gr();return b.useEffect(()=>{const bt=r?.map(ot=>({...ot,...I}));return Ge(n,bt),()=>{He()}},[]),Vt("defaultEdgeOptions",I,$e.setState),Vt("connectionMode",_,$e.setState),Vt("onConnect",s,$e.setState),Vt("onConnectStart",i,$e.setState),Vt("onConnectEnd",a,$e.setState),Vt("onClickConnectStart",l,$e.setState),Vt("onClickConnectEnd",c,$e.setState),Vt("nodesDraggable",h,$e.setState),Vt("nodesConnectable",f,$e.setState),Vt("nodesFocusable",m,$e.setState),Vt("edgesFocusable",g,$e.setState),Vt("edgesUpdatable",x,$e.setState),Vt("elementsSelectable",T,$e.setState),Vt("elevateNodesOnSelect",y,$e.setState),Vt("snapToGrid",M,$e.setState),Vt("snapGrid",E,$e.setState),Vt("onNodesChange",N,$e.setState),Vt("onEdgesChange",C,$e.setState),Vt("connectOnClick",L,$e.setState),Vt("fitViewOnInit",$,$e.setState),Vt("fitViewOnInitOptions",V,$e.setState),Vt("onNodesDelete",ee,$e.setState),Vt("onEdgesDelete",z,$e.setState),Vt("onNodeDrag",H,$e.setState),Vt("onNodeDragStart",P,$e.setState),Vt("onNodeDragStop",W,$e.setState),Vt("onSelectionDrag",J,$e.setState),Vt("onSelectionDragStart",X,$e.setState),Vt("onSelectionDragStop",R,$e.setState),Vt("noPanClassName",se,$e.setState),Vt("nodeOrigin",G,$e.setState),Vt("rfId",F,$e.setState),Vt("autoPanOnConnect",U,$e.setState),Vt("autoPanOnNodeDrag",te,$e.setState),Vt("onError",ne,$e.setState),Vt("connectionRadius",Y,$e.setState),Vt("isValidConnection",ae,$e.setState),Vt("nodeDragThreshold",re,$e.setState),Td(t,oe),Td(e,_e),Td(w,tt),Td(S,Xe),Td(q,je),Td(k,Qe),null},UM={display:"none"},xSe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},zH="react-flow__node-desc",PH="react-flow__edge-desc",vSe="react-flow__aria-live",ySe=t=>t.ariaLiveMessage;function bSe({rfId:t}){const e=Xn(ySe);return he.createElement("div",{id:`${vSe}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:xSe},e)}function wSe({rfId:t,disableKeyboardA11y:e}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${zH}-${t}`,style:UM},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),he.createElement("div",{id:`${PH}-${t}`,style:UM},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&he.createElement(bSe,{rfId:t}))}var S0=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,l]=b.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=h.reduce((m,g)=>m.concat(...g),[]);return[h,f]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,h=e?.target||c;if(t!==null){const f=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&xk(x))return!1;const w=GM(x.code,l);i.current.add(x[w]),WM(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&xk(x))return!1;const w=GM(x.code,l);WM(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return h?.addEventListener("keydown",f),h?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{h?.removeEventListener("keydown",f),h?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function WM(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function GM(t,e){return e.includes(t)?"code":"key"}function LH(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=ku(i,r);return LH(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[pr]?.z??0)>(n.z??0)?i[pr]?.z??0:n.z??0},r)}function IH(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:l}=LH(r,t,{...r.position,z:r[pr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[pr].z=l,n?.[r.id]&&(r[pr].isParent=!0)}})}function _4(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(l=>{const c=(Ji(l.zIndex)?l.zIndex:0)+(l.selected?a:0),h=e.get(l.id),f={...l,positionAbsolute:{x:l.position.x,y:l.position.y}},m=l.parentNode||l.parentId;m&&(i[m]=!0);const g=h?.type&&h?.type!==l.type;Object.defineProperty(f,pr,{enumerable:!1,value:{handleBounds:g?void 0:h?.[pr]?.handleBounds,z:c}}),s.set(l.id,f)}),IH(s,n,i),s}function BH(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:l,d3Selection:c,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:m}=t(),g=e.initial&&!h&&f;if(l&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(N=>N.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=Ty(y,m),{x:k,y:N,zoom:C}=OH(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=ol.translate(k,N).scale(C);return typeof e.duration=="number"&&e.duration>0?l.transform(ou(c,e.duration),T):l.transform(c,T),!0}}return!1}function SSe(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[pr]:r[pr],selected:n.selected})}),new Map(e)}function kSe(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function Lx({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:l,hasDefaultNodes:c,hasDefaultEdges:h}=n();t?.length&&(c&&r({nodeInternals:SSe(t,s)}),a?.(t)),e?.length&&(h&&r({edges:kSe(e,i)}),l?.(e))}const Ed=()=>{},OSe={zoomIn:Ed,zoomOut:Ed,zoomTo:Ed,getZoom:()=>1,setViewport:Ed,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Ed,fitBounds:Ed,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},jSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),NSe=()=>{const t=Gr(),{d3Zoom:e,d3Selection:n}=Xn(jSe,ts);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(ou(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(ou(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(ou(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,l,c]=t.getState().transform,h=ol.translate(s.x??a,s.y??l).scale(s.zoom??c);e.transform(ou(n,i?.duration),h)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>BH(t.getState,s),setCenter:(s,i,a)=>{const{width:l,height:c,maxZoom:h}=t.getState(),f=typeof a?.zoom<"u"?a.zoom:h,m=l/2-s*f,g=c/2-i*f,x=ol.translate(m,g).scale(f);e.transform(ou(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:l,minZoom:c,maxZoom:h}=t.getState(),{x:f,y:m,zoom:g}=OH(s,a,l,c,h,i?.padding??.1),x=ol.translate(f,m).scale(g);e.transform(ou(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:l}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),bk(s,i,a,l)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:l,domNode:c}=t.getState();if(!c)return s;const{x:h,y:f}=c.getBoundingClientRect(),m={x:s.x-h,y:s.y-f};return bk(m,i,a,l)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:l,y:c}=a.getBoundingClientRect(),h=wH(s,i);return{x:h.x+l,y:h.y+c}},viewportInitialized:!0}:OSe,[e,n])};function yj(){const t=NSe(),e=Gr(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:N,onNodesChange:C}=e.getState(),T=S(),_=typeof w=="function"?w(T):w;if(N)k(_);else if(C){const E=_.length===0?T.map(M=>({type:"remove",id:M.id})):_.map(M=>({item:M,type:"reset"}));C(E)}},[]),l=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:C}=e.getState(),T=typeof w=="function"?w(S):w;if(N)k(T);else if(C){const _=T.length===0?S.map(E=>({type:"remove",id:E.id})):T.map(E=>({item:E,type:"reset"}));C(_)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:N,hasDefaultNodes:C,onNodesChange:T}=e.getState();if(C){const E=[...k(),...S];N(E)}else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),h=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:T}=e.getState();if(C)N([...k,...S]);else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),f=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[N,C,T]=k;return{nodes:w().map(_=>({..._})),edges:S.map(_=>({..._})),viewport:{x:N,y:C,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:N,edges:C,hasDefaultNodes:T,hasDefaultEdges:_,onNodesDelete:E,onEdgesDelete:M,onNodesChange:q,onEdgesChange:L}=e.getState(),I=(w||[]).map(H=>H.id),$=(S||[]).map(H=>H.id),V=N().reduce((H,P)=>{const W=P.parentNode||P.parentId,J=!I.includes(P.id)&&W&&H.find(R=>R.id===W);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(I.includes(P.id)||J)&&H.push(P),H},[]),ee=C.filter(H=>typeof H.deletable=="boolean"?H.deletable:!0),z=ee.filter(H=>$.includes(H.id));if(V||z){const H=kH(V,ee),P=[...z,...H],W=P.reduce((J,X)=>(J.includes(X.id)||J.push(X.id),J),[]);if((_||T)&&(_&&e.setState({edges:C.filter(J=>!W.includes(J.id))}),T&&(V.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),W.length>0&&(M?.(P),L&&L(W.map(J=>({id:J,type:"remove"})))),V.length>0&&(E?.(V),q)){const J=V.map(X=>({id:X.id,type:"remove"}));q(J)}}},[]),g=b.useCallback(w=>{const S=U3e(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:BM(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[N,C,T]=g(w);return N?(k||e.getState().getNodes()).filter(_=>{if(!T&&(_.id===C.id||!_.positionAbsolute))return!1;const E=BM(_),M=gk(E,N);return S&&M>0||M>=N.width*N.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[N]=g(w);if(!N)return!1;const C=gk(N,S);return k&&C>0||C>=N.width*N.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:l,addNodes:c,addEdges:h,toObject:f,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,l,c,h,f,m,x,y])}const CSe={actInsideInputWithModifier:!1};var TSe=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=Gr(),{deleteElements:r}=yj(),s=S0(t,CSe),i=S0(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:l}=n.getState(),c=l().filter(f=>f.selected),h=a.filter(f=>f.selected);r({nodes:c,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function ESe(t){const e=Gr();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=dj(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",vl.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const bj={position:"absolute",width:"100%",height:"100%",top:0,left:0},_Se=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Ix=t=>({x:t.x,y:t.y,zoom:t.k}),_d=(t,e)=>t.target.closest(`.${e}`),XM=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),YM=t=>{const e=t.ctrlKey&&mv()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},MSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),ASe=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:l=.5,panOnScrollMode:c=gu.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:N,noWheelClassName:C,noPanClassName:T})=>{const _=b.useRef(),E=Gr(),M=b.useRef(!1),q=b.useRef(!1),L=b.useRef(null),I=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:$,d3Selection:V,d3ZoomHandler:ee,userSelectionActive:z}=Xn(MSe,ts),H=S0(S),P=b.useRef(0),W=b.useRef(!1),J=b.useRef();return ESe(L),b.useEffect(()=>{if(L.current){const X=L.current.getBoundingClientRect(),R=cH().scaleExtent([y,w]).translateExtent(x),se=Gi(L.current).call(R),G=ol.translate(g.x,g.y).scale(_h(g.zoom,y,w)),F=[[0,0],[X.width,X.height]],U=R.constrain()(G,F,x);R.transform(se,U),R.wheelDelta(YM),E.setState({d3Zoom:R,d3Selection:se,d3ZoomHandler:se.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:L.current.closest(".react-flow")})}},[]),b.useEffect(()=>{V&&$&&(a&&!H&&!z?V.on("wheel.zoom",X=>{if(_d(X,C))return!1;X.preventDefault(),X.stopImmediatePropagation();const R=V.property("__zoom").k||1;if(X.ctrlKey&&i){const ae=ya(X),re=YM(X),oe=R*Math.pow(2,re);$.scaleTo(V,oe,ae,X);return}const se=X.deltaMode===1?20:1;let G=c===gu.Vertical?0:X.deltaX*se,F=c===gu.Horizontal?0:X.deltaY*se;!mv()&&X.shiftKey&&c!==gu.Vertical&&(G=X.deltaY*se,F=0),$.translateBy(V,-(G/R)*l,-(F/R)*l,{internal:!0});const U=Ix(V.property("__zoom")),{onViewportChangeStart:te,onViewportChange:ne,onViewportChangeEnd:Y}=E.getState();clearTimeout(J.current),W.current||(W.current=!0,e?.(X,U),te?.(U)),W.current&&(t?.(X,U),ne?.(U),J.current=setTimeout(()=>{n?.(X,U),Y?.(U),W.current=!1},150))},{passive:!1}):typeof ee<"u"&&V.on("wheel.zoom",function(X,R){if(!k&&X.type==="wheel"&&!X.ctrlKey||_d(X,C))return null;X.preventDefault(),ee.call(this,X,R)},{passive:!1}))},[z,a,c,V,$,ee,H,i,k,C,e,t,n]),b.useEffect(()=>{$&&$.on("start",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;P.current=X.sourceEvent?.button;const{onViewportChangeStart:R}=E.getState(),se=Ix(X.transform);M.current=!0,I.current=se,X.sourceEvent?.type==="mousedown"&&E.setState({paneDragging:!0}),R?.(se),e?.(X.sourceEvent,se)})},[$,e]),b.useEffect(()=>{$&&(z&&!M.current?$.on("zoom",null):z||$.on("zoom",X=>{const{onViewportChange:R}=E.getState();if(E.setState({transform:[X.transform.x,X.transform.y,X.transform.k]}),q.current=!!(r&&XM(m,P.current??0)),(t||R)&&!X.sourceEvent?.internal){const se=Ix(X.transform);R?.(se),t?.(X.sourceEvent,se)}}))},[z,$,t,m,r]),b.useEffect(()=>{$&&$.on("end",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=E.getState();if(M.current=!1,E.setState({paneDragging:!1}),r&&XM(m,P.current??0)&&!q.current&&r(X.sourceEvent),q.current=!1,(n||R)&&_Se(I.current,X.transform)){const se=Ix(X.transform);I.current=se,clearTimeout(_.current),_.current=setTimeout(()=>{R?.(se),n?.(X.sourceEvent,se)},a?150:0)}})},[$,a,m,n,r]),b.useEffect(()=>{$&&$.filter(X=>{const R=H||s,se=i&&X.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&X.button===1&&X.type==="mousedown"&&(_d(X,"react-flow__node")||_d(X,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!h&&!i||z||!h&&X.type==="dblclick"||_d(X,C)&&X.type==="wheel"||_d(X,T)&&(X.type!=="wheel"||a&&X.type==="wheel"&&!H)||!i&&X.ctrlKey&&X.type==="wheel"||!R&&!a&&!se&&X.type==="wheel"||!m&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(m)&&!m.includes(X.button)&&X.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||X.type==="wheel")&&G})},[z,$,s,i,a,h,m,f,H]),he.createElement("div",{className:"react-flow__renderer",ref:L,style:bj},N)},RSe=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function DSe(){const{userSelectionActive:t,userSelectionRect:e}=Xn(RSe,ts);return t&&e?he.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function KM(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function qH(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(l=>l.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const l of i)if(l)switch(l.type){case"select":{a.selected=l.selected;break}case"position":{typeof l.position<"u"&&(a.position=l.position),typeof l.positionAbsolute<"u"&&(a.positionAbsolute=l.positionAbsolute),typeof l.dragging<"u"&&(a.dragging=l.dragging),a.expandParent&&KM(r,a);break}case"dimensions":{typeof l.dimensions<"u"&&(a.width=l.dimensions.width,a.height=l.dimensions.height),typeof l.updateStyle<"u"&&(a.style={...a.style||{},...l.dimensions}),typeof l.resizing=="boolean"&&(a.resizing=l.resizing),a.expandParent&&KM(r,a);break}case"remove":return r}return r.push(a),r},n)}function FH(t,e){return qH(t,e)}function zSe(t,e){return qH(t,e)}const ic=(t,e)=>({id:t,type:"select",selected:e});function Wd(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(ic(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(ic(r.id,!1))),n},[])}const M4=(t,e)=>n=>{n.target===e.current&&t?.(n)},PSe=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),$H=b.memo(({isSelecting:t,selectionMode:e=w0.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:l,onPaneMouseEnter:c,onPaneMouseMove:h,onPaneMouseLeave:f,children:m})=>{const g=b.useRef(null),x=Gr(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:N,dragging:C}=Xn(PSe,ts),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},_=ee=>{i?.(ee),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},E=ee=>{if(Array.isArray(n)&&n?.includes(2)){ee.preventDefault();return}a?.(ee)},M=l?ee=>l(ee):void 0,q=ee=>{const{resetSelectedElements:z,domNode:H}=x.getState();if(S.current=H?.getBoundingClientRect(),!N||!t||ee.button!==0||ee.target!==g.current||!S.current)return;const{x:P,y:W}=fc(ee,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:P,startY:W,x:P,y:W}}),r?.(ee)},L=ee=>{const{userSelectionRect:z,nodeInternals:H,edges:P,transform:W,onNodesChange:J,onEdgesChange:X,nodeOrigin:R,getNodes:se}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=fc(ee,S.current),F=z.startX??0,U=z.startY??0,te={...z,x:G.xoe.id),re=Y.map(oe=>oe.id);if(y.current!==re.length){y.current=re.length;const oe=Wd(ne,re);oe.length&&J?.(oe)}if(w.current!==ae.length){w.current=ae.length;const oe=Wd(P,ae);oe.length&&X?.(oe)}x.setState({userSelectionRect:te})},I=ee=>{if(ee.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&ee.target===g.current&&_?.(ee),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(ee)},$=ee=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(ee)),T()},V=N&&(t||k);return he.createElement("div",{className:gs(["react-flow__pane",{dragging:C,selection:t}]),onClick:V?void 0:M4(_,g),onContextMenu:M4(E,g),onWheel:M4(M,g),onMouseEnter:V?void 0:c,onMouseDown:V?q:void 0,onMouseMove:V?L:h,onMouseUp:V?I:void 0,onMouseLeave:V?$:f,ref:g,style:bj},m,he.createElement(DSe,null))});$H.displayName="Pane";function QH(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:QH(r,e):!1}function ZM(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function LSe(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!QH(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function ISe(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function HH(t,e,n,r,s=[0,0],i){const a=ISe(t,t.extent||r);let l=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=ku(m,s).positionAbsolute;l=m&&Ji(g)&&Ji(x)&&Ji(m.width)&&Ji(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:l}else i?.("005",vl.error005()),l=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=ku(m,s).positionAbsolute;l=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let h={x:0,y:0};if(c){const m=n.get(c);h=ku(m,s).positionAbsolute}const f=l&&l!=="parent"?hj(e,l):e;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function A4({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const JM=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),l={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(h.left-a.left-l.x)/n,y:(h.top-a.top-l.y)/n,...dj(c)}})};function um(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function Sk({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:l,onError:c}=e.getState(),h=l.get(t);if(!h){c?.("012",vl.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&a)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function BSe(){const t=Gr();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,l=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(l-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function R4(t){return(e,n,r)=>t?.(e,r)}function VH({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const l=Gr(),[c,h]=b.useState(!1),f=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),N=b.useRef(!1),C=BSe();return b.useEffect(()=>{if(t?.current){const T=Gi(t.current),_=({x:q,y:L})=>{const{nodeInternals:I,onNodeDrag:$,onSelectionDrag:V,updateNodePositions:ee,nodeExtent:z,snapGrid:H,snapToGrid:P,nodeOrigin:W,onError:J}=l.getState();m.current={x:q,y:L};let X=!1,R={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&z){const G=Ty(f.current,W);R=b0(G)}if(f.current=f.current.map(G=>{const F={x:q-G.distance.x,y:L-G.distance.y};P&&(F.x=H[0]*Math.round(F.x/H[0]),F.y=H[1]*Math.round(F.y/H[1]));const U=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];f.current.length>1&&z&&!G.extent&&(U[0][0]=G.positionAbsolute.x-R.x+z[0][0],U[1][0]=G.positionAbsolute.x+(G.width??0)-R.x2+z[1][0],U[0][1]=G.positionAbsolute.y-R.y+z[0][1],U[1][1]=G.positionAbsolute.y+(G.height??0)-R.y2+z[1][1]);const te=HH(G,F,I,U,W,J);return X=X||G.position.x!==te.position.x||G.position.y!==te.position.y,G.position=te.position,G.positionAbsolute=te.positionAbsolute,G}),!X)return;ee(f.current,!0,!0),h(!0);const se=s?$:R4(V);if(se&&w.current){const[G,F]=A4({nodeId:s,dragItems:f.current,nodeInternals:I});se(w.current,G,F)}},E=()=>{if(!x.current)return;const[q,L]=dH(y.current,x.current);if(q!==0||L!==0){const{transform:I,panBy:$}=l.getState();m.current.x=(m.current.x??0)-q/I[2],m.current.y=(m.current.y??0)-L/I[2],$({x:q,y:L})&&_(m.current)}g.current=requestAnimationFrame(E)},M=q=>{const{nodeInternals:L,multiSelectionActive:I,nodesDraggable:$,unselectNodesAndEdges:V,onNodeDragStart:ee,onSelectionDragStart:z}=l.getState();k.current=!0;const H=s?ee:R4(z);(!a||!i)&&!I&&s&&(L.get(s)?.selected||V()),s&&i&&a&&Sk({id:s,store:l,nodeRef:t});const P=C(q);if(m.current=P,f.current=LSe(L,$,P,s),H&&f.current){const[W,J]=A4({nodeId:s,dragItems:f.current,nodeInternals:L});H(q.sourceEvent,W,J)}};if(e)T.on(".drag",null);else{const q=S5e().on("start",L=>{const{domNode:I,nodeDragThreshold:$}=l.getState();$===0&&M(L),N.current=!1;const V=C(L);m.current=V,x.current=I?.getBoundingClientRect()||null,y.current=fc(L.sourceEvent,x.current)}).on("drag",L=>{const I=C(L),{autoPanOnNodeDrag:$,nodeDragThreshold:V}=l.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&k.current&&$&&(S.current=!0,E()),!k.current){const ee=I.xSnapped-(m?.current?.x??0),z=I.ySnapped-(m?.current?.y??0);Math.sqrt(ee*ee+z*z)>V&&M(L)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&f.current&&k.current&&(w.current=L.sourceEvent,y.current=fc(L.sourceEvent,x.current),_(I))}}).on("end",L=>{if(!(!k.current||N.current)&&(h(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:I,nodeInternals:$,onNodeDragStop:V,onSelectionDragStop:ee}=l.getState(),z=s?V:R4(ee);if(I(f.current,!1,!1),z){const[H,P]=A4({nodeId:s,dragItems:f.current,nodeInternals:$});z(L.sourceEvent,H,P)}}}).filter(L=>{const I=L.target;return!L.button&&(!n||!ZM(I,`.${n}`,t))&&(!r||ZM(I,r,t))});return T.call(q),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,l,s,a,C]),c}function UH(){const t=Gr();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:l,snapGrid:c,onError:h,nodesDraggable:f}=t.getState(),m=a().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),g=l?c[0]:5,x=l?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+w,y:N.positionAbsolute.y+S};l&&(C.x=c[0]*Math.round(C.x/c[0]),C.y=c[1]*Math.round(C.y/c[1]));const{positionAbsolute:T,position:_}=HH(N,C,r,s,void 0,h);N.position=_,N.positionAbsolute=T}return N});i(k,!0,!1)},[])}const ch={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var dm=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:l,yPosOrigin:c,selected:h,onClick:f,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:N,isSelectable:C,isConnectable:T,isFocusable:_,selectNodesOnDrag:E,sourcePosition:M,targetPosition:q,hidden:L,resizeObserver:I,dragHandle:$,zIndex:V,isParent:ee,noDragClassName:z,noPanClassName:H,initialized:P,disableKeyboardA11y:W,ariaLabel:J,rfId:X,hasHandleBounds:R})=>{const se=Gr(),G=b.useRef(null),F=b.useRef(null),U=b.useRef(M),te=b.useRef(q),ne=b.useRef(r),Y=C||N||f||m||g||x,ae=UH(),re=um(n,se.getState,m),oe=um(n,se.getState,g),_e=um(n,se.getState,x),Ge=um(n,se.getState,y),tt=um(n,se.getState,w),Xe=He=>{const{nodeDragThreshold:$e}=se.getState();if(C&&(!E||!N||$e>0)&&Sk({id:n,store:se,nodeRef:G}),f){const bt=se.getState().nodeInternals.get(n);bt&&f(He,{...bt})}},je=He=>{if(!xk(He)&&!W)if(pH.includes(He.key)&&C){const $e=He.key==="Escape";Sk({id:n,store:se,unselect:$e,nodeRef:G})}else N&&h&&Object.prototype.hasOwnProperty.call(ch,He.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${He.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ae({x:ch[He.key].x,y:ch[He.key].y,isShiftPressed:He.shiftKey}))};b.useEffect(()=>()=>{F.current&&(I?.unobserve(F.current),F.current=null)},[]),b.useEffect(()=>{if(G.current&&!L){const He=G.current;(!P||!R||F.current!==He)&&(F.current&&I?.unobserve(F.current),I?.observe(He),F.current=He)}},[L,P,R]),b.useEffect(()=>{const He=ne.current!==r,$e=U.current!==M,bt=te.current!==q;G.current&&(He||$e||bt)&&(He&&(ne.current=r),$e&&(U.current=M),bt&&(te.current=q),se.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,M,q]);const Qe=VH({nodeRef:G,disabled:L||!N,noDragClassName:z,handleSelector:$,nodeId:n,isSelectable:C,selectNodesOnDrag:E});return L?null:he.createElement("div",{className:gs(["react-flow__node",`react-flow__node-${r}`,{[H]:N},k,{selected:h,selectable:C,parent:ee,dragging:Qe}]),ref:G,style:{zIndex:V,transform:`translate(${l}px,${c}px)`,pointerEvents:Y?"all":"none",visibility:P?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:oe,onMouseLeave:_e,onContextMenu:Ge,onClick:Xe,onDoubleClick:tt,onKeyDown:_?je:void 0,tabIndex:_?0:void 0,role:_?"button":void 0,"aria-describedby":W?void 0:`${zH}-${X}`,"aria-label":J},he.createElement(J3e,{value:n},he.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:h,isConnectable:T,sourcePosition:M,targetPosition:q,dragging:Qe,dragHandle:$,zIndex:V})))};return e.displayName="NodeWrapper",b.memo(e)};const qSe=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Ty(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function FSe({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Gr(),{width:s,height:i,x:a,y:l,transformString:c,userSelectionActive:h}=Xn(qSe,ts),f=UH(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),VH({nodeRef:m}),h||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(ch,y.key)&&f({x:ch[y.key].x,y:ch[y.key].y,isShiftPressed:y.shiftKey})};return he.createElement("div",{className:gs(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},he.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:l,left:a}}))}var $Se=b.memo(FSe);const QSe=t=>t.nodesSelectionActive,WH=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:l,onMove:c,onMoveStart:h,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:I,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,preventScrolling:H,onSelectionContextMenu:P,noWheelClassName:W,noPanClassName:J,disableKeyboardA11y:X})=>{const R=Xn(QSe),se=S0(m),G=S0(k),F=G||I,U=G||E,te=se||g&&F!==!0;return TSe({deleteKeyCode:l,multiSelectionKeyCode:S}),he.createElement(ASe,{onMove:c,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:U,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:!se&&F,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,zoomActivationKeyCode:N,preventScrolling:H,noWheelClassName:W,noPanClassName:J},he.createElement($H,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:F,isSelecting:!!te,selectionMode:x},t,R&&he.createElement($Se,{onSelectionContextMenu:P,noPanClassName:J,disableKeyboardA11y:X})))};WH.displayName="FlowRenderer";var HSe=b.memo(WH);function VSe(t){return Xn(b.useCallback(n=>t?SH(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function USe(t){const e={input:dm(t.input||MH),default:dm(t.default||wk),output:dm(t.output||RH),group:dm(t.group||vj)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=dm(t[i]||wk),s),n);return{...e,...r}}const WSe=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},GSe=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),GH=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=Xn(GSe,ts),l=VSe(t.onlyRenderVisibleElements),c=b.useRef(),h=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=f,f},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:bj},l.map(f=>{let m=f.type||"default";t.nodeTypes[m]||(a?.("003",vl.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(f.draggable||e&&typeof f.draggable>"u"),y=!!(f.selectable||s&&typeof f.selectable>"u"),w=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||r&&typeof f.focusable>"u"),k=t.nodeExtent?hj(f.positionAbsolute,t.nodeExtent):f.positionAbsolute,N=k?.x??0,C=k?.y??0,T=WSe({x:N,y:C,width:f.width??0,height:f.height??0,origin:t.nodeOrigin});return he.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||ht.Bottom,targetPosition:f.targetPosition||ht.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!f.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:h,dragHandle:f.dragHandle,zIndex:f[pr]?.z??0,isParent:!!f[pr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!f.width&&!!f.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!f[pr]?.handleBounds})}))};GH.displayName="NodeRenderer";var XSe=b.memo(GH);const YSe=(t,e,n)=>n===ht.Left?t-e:n===ht.Right?t+e:t,KSe=(t,e,n)=>n===ht.Top?t-e:n===ht.Bottom?t+e:t,eA="react-flow__edgeupdater",tA=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:l})=>he.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:gs([eA,`${eA}-${l}`]),cx:YSe(e,r,t),cy:KSe(n,r,t),r,stroke:"transparent",fill:"transparent"}),ZSe=()=>!0;var Md=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:l,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:N,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,elementsSelectable:L,hidden:I,sourceHandleId:$,targetHandleId:V,onContextMenu:ee,onMouseEnter:z,onMouseMove:H,onMouseLeave:P,reconnectRadius:W,onReconnect:J,onReconnectStart:X,onReconnectEnd:R,markerEnd:se,markerStart:G,rfId:F,ariaLabel:U,isFocusable:te,isReconnectable:ne,pathOptions:Y,interactionWidth:ae,disableKeyboardA11y:re})=>{const oe=b.useRef(null),[_e,Ge]=b.useState(!1),[tt,Xe]=b.useState(!1),je=Gr(),Qe=b.useMemo(()=>`url('#${yk(G,F)}')`,[G,F]),He=b.useMemo(()=>`url('#${yk(se,F)}')`,[se,F]);if(I)return null;const $e=jt=>{const{edges:Ne,addSelectedEdges:ie,unselectNodesAndEdges:xe,multiSelectionActive:Je}=je.getState(),dt=Ne.find(er=>er.id===n);dt&&(L&&(je.setState({nodesSelectionActive:!1}),dt.selected&&Je?(xe({nodes:[],edges:[dt]}),oe.current?.blur()):ie([n])),a&&a(jt,dt))},bt=cm(n,je.getState,l),ot=cm(n,je.getState,ee),on=cm(n,je.getState,z),Tn=cm(n,je.getState,H),Nn=cm(n,je.getState,P),Rt=(jt,Ne)=>{if(jt.button!==0)return;const{edges:ie,isValidConnection:xe}=je.getState(),Je=Ne?N:k,dt=(Ne?V:$)||null,er=Ne?"target":"source",pt=xe||ZSe,vn=Ne,vt=ie.find(lt=>lt.id===n);Xe(!0),X?.(jt,vt,er);const Wt=lt=>{Xe(!1),R?.(lt,vt,er)};CH({event:jt,handleId:dt,nodeId:Je,onConnect:lt=>J?.(vt,lt),isTarget:vn,getState:je.getState,setState:je.setState,isValidConnection:pt,edgeUpdaterType:er,onReconnectEnd:Wt})},xt=jt=>Rt(jt,!0),Te=jt=>Rt(jt,!1),Re=()=>Ge(!0),qe=()=>Ge(!1),rt=!L&&!a,wt=jt=>{if(!re&&pH.includes(jt.key)&&L){const{unselectNodesAndEdges:Ne,addSelectedEdges:ie,edges:xe}=je.getState();jt.key==="Escape"?(oe.current?.blur(),Ne({edges:[xe.find(dt=>dt.id===n)]})):ie([n])}};return he.createElement("g",{className:gs(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:h,inactive:rt,updating:_e}]),onClick:$e,onDoubleClick:bt,onContextMenu:ot,onMouseEnter:on,onMouseMove:Tn,onMouseLeave:Nn,onKeyDown:te?wt:void 0,tabIndex:te?0:void 0,role:te?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${k} to ${N}`,"aria-describedby":te?`${PH}-${F}`:void 0,ref:oe},!tt&&he.createElement(t,{id:n,source:k,target:N,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,sourceHandleId:$,targetHandleId:V,markerStart:Qe,markerEnd:He,pathOptions:Y,interactionWidth:ae}),ne&&he.createElement(he.Fragment,null,(ne==="source"||ne===!0)&&he.createElement(tA,{position:M,centerX:C,centerY:T,radius:W,onMouseDown:xt,onMouseEnter:Re,onMouseOut:qe,type:"source"}),(ne==="target"||ne===!0)&&he.createElement(tA,{position:q,centerX:_,centerY:E,radius:W,onMouseDown:Te,onMouseEnter:Re,onMouseOut:qe,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function JSe(t){const e={default:Md(t.default||gv),straight:Md(t.bezier||pj),step:Md(t.step||mj),smoothstep:Md(t.step||Cy),simplebezier:Md(t.simplebezier||fj)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=Md(t[i]||gv),s),n);return{...e,...r}}function nA(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case ht.Top:return{x:r+i/2,y:s};case ht.Right:return{x:r+i,y:s+a/2};case ht.Bottom:return{x:r+i/2,y:s+a};case ht.Left:return{x:r,y:s+a/2}}}function rA(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const eke=(t,e,n,r,s,i)=>{const a=nA(n,t,e),l=nA(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:l.x,targetY:l.y}};function tke({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:l,transform:c}){const h={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const f=b0({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:l/c[2]}),m=Math.max(0,Math.min(f.x2,h.x2)-Math.max(f.x,h.x)),g=Math.max(0,Math.min(f.y2,h.y2)-Math.max(f.y,h.y));return Math.ceil(m*g)>0}function sA(t){const e=t?.[pr]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const nke=[{level:0,isMaxLevel:!0,edges:[]}];function rke(t,e,n=!1){let r=-1;const s=t.reduce((a,l)=>{const c=Ji(l.zIndex);let h=c?l.zIndex:0;if(n){const f=e.get(l.target),m=e.get(l.source),g=l.selected||f?.selected||m?.selected,x=Math.max(m?.[pr]?.z||0,f?.[pr]?.z||0,1e3);h=(c?l.zIndex:0)+(g?x:0)}return a[h]?a[h].push(l):a[h]=[l],r=h>r?h:r,a},{}),i=Object.entries(s).map(([a,l])=>{const c=+a;return{edges:l,level:c,isMaxLevel:c===r}});return i.length===0?nke:i}function ske(t,e,n){const r=Xn(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),l=e.get(i.target);return a?.width&&a?.height&&l?.width&&l?.height&&tke({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:l.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:l.width,targetHeight:l.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return rke(r,e,n)}const ike=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),ake=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),iA={[pv.Arrow]:ike,[pv.ArrowClosed]:ake};function oke(t){const e=Gr();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(iA,t)?iA[t]:(e.getState().onError?.("009",vl.error009(t)),null),[t])}const lke=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:l="auto-start-reverse"})=>{const c=oke(e);return c?he.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0"},he.createElement(c,{color:n,strokeWidth:a})):null},cke=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const l=yk(a,e);r.includes(l)||(s.push({id:l,color:a.color||t,...a}),r.push(l))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},XH=({defaultColor:t,rfId:e})=>{const n=Xn(b.useCallback(cke({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return he.createElement("defs",null,n.map(r=>he.createElement(lke,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};XH.displayName="MarkerDefinitions";var uke=b.memo(XH);const dke=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),YH=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:T,width:_,height:E,connectionMode:M,nodeInternals:q,onError:L}=Xn(dke,ts),I=ske(e,q,n);return _?he.createElement(he.Fragment,null,I.map(({level:$,edges:V,isMaxLevel:ee})=>he.createElement("svg",{key:$,style:{zIndex:$},width:_,height:E,className:"react-flow__edges react-flow__container"},ee&&he.createElement(uke,{defaultColor:t,rfId:r}),he.createElement("g",null,V.map(z=>{const[H,P,W]=sA(q.get(z.source)),[J,X,R]=sA(q.get(z.target));if(!W||!R)return null;let se=z.type||"default";s[se]||(L?.("011",vl.error011(se)),se="default");const G=s[se]||s.default,F=M===Pu.Strict?X.target:(X.target??[]).concat(X.source??[]),U=rA(P.source,z.sourceHandle),te=rA(F,z.targetHandle),ne=U?.position||ht.Bottom,Y=te?.position||ht.Top,ae=!!(z.focusable||N&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,oe=typeof g<"u"&&(re||C&&typeof re>"u");if(!U||!te)return L?.("008",vl.error008(U,z)),null;const{sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe}=eke(H,U,ne,J,te,Y);return he.createElement(G,{key:z.id,id:z.id,className:gs([z.className,i]),type:se,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe,sourcePosition:ne,targetPosition:Y,elementsSelectable:T,onContextMenu:a,onMouseEnter:l,onMouseMove:c,onMouseLeave:h,onClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:ae,isReconnectable:oe,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};YH.displayName="EdgeRenderer";var hke=b.memo(YH);const fke=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function mke({children:t}){const e=Xn(fke);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function pke(t){const e=yj(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const gke={[ht.Left]:ht.Right,[ht.Right]:ht.Left,[ht.Top]:ht.Bottom,[ht.Bottom]:ht.Top},KH=({nodeId:t,handleType:e,style:n,type:r=oc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:l,toX:c,toY:h,connectionMode:f}=Xn(b.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),ts),m=a?.[pr]?.handleBounds;let g=m?.[e];if(f===Pu.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=l?g.find(E=>E.id===l):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,N=x?.position,C=N?gke[N]:null;if(!N||!C)return null;if(s)return he.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:h,fromPosition:N,toPosition:C,connectionStatus:i});let T="";const _={sourceX:S,sourceY:k,sourcePosition:N,targetX:c,targetY:h,targetPosition:C};return r===oc.Bezier?[T]=bH(_):r===oc.Step?[T]=vk({..._,borderRadius:0}):r===oc.SmoothStep?[T]=vk(_):r===oc.SimpleBezier?[T]=yH(_):T=`M${S},${k} ${c},${h}`,he.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};KH.displayName="ConnectionLine";const xke=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function vke({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:l,height:c,connectionStatus:h}=Xn(xke,ts);return!(s&&i&&l&&a)?null:he.createElement("svg",{style:t,width:l,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:gs(["react-flow__connection",h])},he.createElement(KH,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:h})))}function aA(t,e){return b.useRef(null),Gr(),b.useMemo(()=>e(t),[t])}const ZH=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:l,onNodeDoubleClick:c,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:T,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,deleteKeyCode:$,onlyRenderVisibleElements:V,elementsSelectable:ee,selectNodesOnDrag:z,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,preventScrolling:X,defaultMarkerColor:R,zoomOnScroll:se,zoomOnPinch:G,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:Y,onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:_e,onPaneScroll:Ge,onPaneContextMenu:tt,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:ot,reconnectRadius:on,noDragClassName:Tn,noWheelClassName:Nn,noPanClassName:Rt,elevateEdgesOnSelect:xt,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})=>{const wt=aA(t,USe),jt=aA(e,JSe);return pke(i),he.createElement(HSe,{onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:oe,onPaneMouseLeave:_e,onPaneContextMenu:tt,onPaneScroll:Ge,deleteKeyCode:$,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:se,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,panOnDrag:Y,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,onSelectionContextMenu:y,preventScrolling:X,noDragClassName:Tn,noWheelClassName:Nn,noPanClassName:Rt,disableKeyboardA11y:Te},he.createElement(mke,null,he.createElement(hke,{edgeTypes:jt,onEdgeClick:l,onEdgeDoubleClick:h,onlyRenderVisibleElements:V,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:ot,reconnectRadius:on,defaultMarkerColor:R,noPanClassName:Rt,elevateEdgesOnSelect:!!xt,disableKeyboardA11y:Te,rfId:rt},he.createElement(vke,{style:N,type:k,component:C,containerStyle:T})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(XSe,{nodeTypes:wt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:V,noPanClassName:Rt,noDragClassName:Tn,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})))};ZH.displayName="GraphView";var yke=b.memo(ZH);const kk=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Jl={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:kk,nodeExtent:kk,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Pu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:W3e,isValidConnection:void 0},bke=()=>Dwe((t,e)=>({...Jl,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:_4(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?_4(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:l,domNode:c,nodeOrigin:h}=e(),f=c?.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[pr]:{...k[pr],handleBounds:void 0}});else if(k){const N=dj(S.nodeElement);!!(N.width&&N.height&&(k.width!==N.width||k.height!==N.height||S.forceUpdate))&&(s.set(k.id,{...k,[pr]:{...k[pr],handleBounds:{source:JM(".source",S.nodeElement,g,h),target:JM(".target",S.nodeElement,g,h)}},...N}),w.push({id:k.id,type:"dimensions",dimensions:N}))}return w},[]);IH(s,h);const y=a||i&&!a&&BH(e,{initial:!0,...l});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(l=>{const c={id:l.id,type:"position",dragging:s};return r&&(c.positionAbsolute=l.positionAbsolute,c.position=l.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:l,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const h=FH(n,l()),f=_4(h,s,a,c);t({nodeInternals:f})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>ic(c,!0)):(a=Wd(i(),n),l=Wd(s,[])),Lx({changedNodes:a,changedEdges:l,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,l=null;r?a=n.map(c=>ic(c,!0)):(a=Wd(s,n),l=Wd(i(),[])),Lx({changedNodes:l,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),l=r||s,c=a.map(f=>(f.selected=!1,ic(f.id,!1))),h=l.map(f=>ic(f.id,!1));Lx({changedNodes:c,changedEdges:h,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(l=>l.selected).map(l=>ic(l.id,!1)),a=n.filter(l=>l.selected).map(l=>ic(l.id,!1));Lx({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=hj(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:l,translateExtent:c}=e();if(!a||!l||!n.x&&!n.y)return!1;const h=ol.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,i]],m=a?.constrain()(h,f,c);return a.transform(l,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:Jl.connectionNodeId,connectionHandleId:Jl.connectionHandleId,connectionHandleType:Jl.connectionHandleType,connectionStatus:Jl.connectionStatus,connectionStartHandle:Jl.connectionStartHandle,connectionEndHandle:Jl.connectionEndHandle}),reset:()=>t({...Jl})}),Object.is),JH=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=bke()),he.createElement(q3e,{value:e.current},t)};JH.displayName="ReactFlowProvider";const eV=({children:t})=>b.useContext(jy)?he.createElement(he.Fragment,null,t):he.createElement(JH,null,t);eV.displayName="ReactFlowWrapper";const wke={input:MH,default:wk,output:RH,group:vj},Ske={default:gv,straight:pj,step:mj,smoothstep:Cy,simplebezier:fj},kke=[0,0],Oke=[15,15],jke={x:0,y:0,zoom:1},Nke={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},tV=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=wke,edgeTypes:a=Ske,onNodeClick:l,onEdgeClick:c,onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onNodesDelete:I,onEdgesDelete:$,onSelectionChange:V,onSelectionDragStart:ee,onSelectionDrag:z,onSelectionDragStop:H,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,connectionMode:X=Pu.Strict,connectionLineType:R=oc.Bezier,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,deleteKeyCode:U="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:ne=!1,selectionMode:Y=w0.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:re=mv()?"Meta":"Control",zoomActivationKeyCode:oe=mv()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ge=Oke,onlyRenderVisibleElements:tt=!1,selectNodesOnDrag:Xe=!0,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,nodeOrigin:$e=kke,edgesFocusable:bt,edgesUpdatable:ot,elementsSelectable:on,defaultViewport:Tn=jke,minZoom:Nn=.5,maxZoom:Rt=2,translateExtent:xt=kk,preventScrolling:Te=!0,nodeExtent:Re,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:rt=!0,zoomOnPinch:wt=!0,panOnScroll:jt=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:ie=gu.Free,zoomOnDoubleClick:xe=!0,panOnDrag:Je=!0,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:vn,onPaneScroll:vt,onPaneContextMenu:Wt,children:Ht,onEdgeContextMenu:lt,onEdgeDoubleClick:ur,onEdgeMouseEnter:Xr,onEdgeMouseMove:Yr,onEdgeMouseLeave:dr,onEdgeUpdate:Nr,onEdgeUpdateStart:Is,onEdgeUpdateEnd:xr,onReconnect:di,onReconnectStart:Ns,onReconnectEnd:Bs,reconnectRadius:da=10,edgeUpdaterRadius:ha=10,onNodesChange:hi,onEdgesChange:Ra,noDragClassName:qs="nodrag",noWheelClassName:Ir="nowheel",noPanClassName:ss="nopan",fitView:kl=!1,fitViewOptions:ef,connectOnClick:Dy=!0,attributionPosition:zy,proOptions:Sp,defaultEdgeOptions:Lc,elevateNodesOnSelect:tf=!0,elevateEdgesOnSelect:Ol=!1,disableKeyboardA11y:vo=!1,autoPanOnConnect:Ic=!0,autoPanOnNodeDrag:jl=!0,connectionRadius:Cr=20,isValidConnection:kp,onError:Op,style:yo,id:bo,nodeDragThreshold:Py,...jp},Np)=>{const nf=bo||"1";return he.createElement("div",{...jp,style:{...yo,...Nke},ref:Np,className:gs(["react-flow",s]),"data-testid":"rf__wrapper",id:bo},he.createElement(eV,null,he.createElement(yke,{onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:Y,deleteKeyCode:U,multiSelectionKeyCode:re,panActivationKeyCode:ae,zoomActivationKeyCode:oe,onlyRenderVisibleElements:tt,selectNodesOnDrag:Xe,defaultViewport:Tn,translateExtent:xt,minZoom:Nn,maxZoom:Rt,preventScrolling:Te,zoomOnScroll:rt,zoomOnPinch:wt,zoomOnDoubleClick:xe,panOnScroll:jt,panOnScrollSpeed:Ne,panOnScrollMode:ie,panOnDrag:Je,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:vn,onPaneScroll:vt,onPaneContextMenu:Wt,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,onEdgeContextMenu:lt,onEdgeDoubleClick:ur,onEdgeMouseEnter:Xr,onEdgeMouseMove:Yr,onEdgeMouseLeave:dr,onReconnect:di??Nr,onReconnectStart:Ns??Is,onReconnectEnd:Bs??xr,reconnectRadius:da??ha,defaultMarkerColor:qe,noDragClassName:qs,noWheelClassName:Ir,noPanClassName:ss,elevateEdgesOnSelect:Ol,rfId:nf,disableKeyboardA11y:vo,nodeOrigin:$e,nodeExtent:Re}),he.createElement(gSe,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,edgesFocusable:bt,edgesUpdatable:ot,elementsSelectable:on,elevateNodesOnSelect:tf,minZoom:Nn,maxZoom:Rt,nodeExtent:Re,onNodesChange:hi,onEdgesChange:Ra,snapToGrid:_e,snapGrid:Ge,connectionMode:X,translateExtent:xt,connectOnClick:Dy,defaultEdgeOptions:Lc,fitView:kl,fitViewOptions:ef,onNodesDelete:I,onEdgesDelete:$,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onSelectionDrag:z,onSelectionDragStart:ee,onSelectionDragStop:H,noPanClassName:ss,nodeOrigin:$e,rfId:nf,autoPanOnConnect:Ic,autoPanOnNodeDrag:jl,onError:Op,connectionRadius:Cr,isValidConnection:kp,nodeDragThreshold:Py}),he.createElement(mSe,{onSelectionChange:V}),Ht,he.createElement($3e,{proOptions:Sp,position:zy}),he.createElement(wSe,{rfId:nf,disableKeyboardA11y:vo})))});tV.displayName="ReactFlow";function nV(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const Cke=nV(FH),Tke=nV(zSe),rV=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:l,strokeWidth:c,className:h,borderRadius:f,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return he.createElement("rect",{className:gs(["react-flow__minimap-node",{selected:x},h]),x:e,y:n,rx:f,ry:f,width:r,height:s,fill:S,stroke:l,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};rV.displayName="MiniMapNode";var Eke=b.memo(rV);const _ke=t=>t.nodeOrigin,Mke=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),D4=t=>t instanceof Function?t:()=>t;function Ake({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=Eke,onClick:a}){const l=Xn(Mke,ts),c=Xn(_ke),h=D4(e),f=D4(t),m=D4(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,l.map(x=>{const{x:y,y:w}=ku(x,c).positionAbsolute;return he.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:h(x),borderRadius:r,strokeColor:f(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var Rke=b.memo(Ake);const Dke=200,zke=150,Pke=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?V3e(Ty(e,t.nodeOrigin),n):n,rfId:t.rfId}},Lke="react-flow__minimap-desc";function sV({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:l,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:N=10,offsetScale:C=5}){const T=Gr(),_=b.useRef(null),{boundingRect:E,viewBB:M,rfId:q}=Xn(Pke,ts),L=t?.width??Dke,I=t?.height??zke,$=E.width/L,V=E.height/I,ee=Math.max($,V),z=ee*L,H=ee*I,P=C*ee,W=E.x-(z-E.width)/2-P,J=E.y-(H-E.height)/2-P,X=z+P*2,R=H+P*2,se=`${Lke}-${q}`,G=b.useRef(0);G.current=ee,b.useEffect(()=>{if(_.current){const te=Gi(_.current),ne=re=>{const{transform:oe,d3Selection:_e,d3Zoom:Ge}=T.getState();if(re.sourceEvent.type!=="wheel"||!_e||!Ge)return;const tt=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*N,Xe=oe[2]*Math.pow(2,tt);Ge.scaleTo(_e,Xe)},Y=re=>{const{transform:oe,d3Selection:_e,d3Zoom:Ge,translateExtent:tt,width:Xe,height:je}=T.getState();if(re.sourceEvent.type!=="mousemove"||!_e||!Ge)return;const Qe=G.current*Math.max(1,oe[2])*(k?-1:1),He={x:oe[0]-re.sourceEvent.movementX*Qe,y:oe[1]-re.sourceEvent.movementY*Qe},$e=[[0,0],[Xe,je]],bt=ol.translate(He.x,He.y).scale(oe[2]),ot=Ge.constrain()(bt,$e,tt);Ge.transform(_e,ot)},ae=cH().on("zoom",y?Y:null).on("zoom.wheel",w?ne:null);return te.call(ae),()=>{te.on("zoom",null)}}},[y,w,k,N]);const F=g?te=>{const ne=ya(te);g(te,{x:ne[0],y:ne[1]})}:void 0,U=x?(te,ne)=>{const Y=T.getState().nodeInternals.get(ne);x(te,Y)}:void 0;return he.createElement(Ny,{position:m,style:t,className:gs(["react-flow__minimap",e]),"data-testid":"rf__minimap"},he.createElement("svg",{width:L,height:I,viewBox:`${W} ${J} ${X} ${R}`,role:"img","aria-labelledby":se,ref:_,onClick:F},S&&he.createElement("title",{id:se},S),he.createElement(Rke,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:l}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${W-P},${J-P}h${X+P*2}v${R+P*2}h${-X-P*2}z - M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fill:c,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}sV.displayName="MiniMap";var Ike=b.memo(sV);function Bke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function qke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function Fke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function $ke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function Qke(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const ym=({children:t,className:e,...n})=>he.createElement("button",{type:"button",className:gs(["react-flow__controls-button",e]),...n},t);ym.displayName="ControlButton";const Hke=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),iV=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:l,onInteractiveChange:c,className:h,children:f,position:m="bottom-left"})=>{const g=Gr(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=Xn(Hke,ts),{zoomIn:N,zoomOut:C,fitView:T}=yj();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const _=()=>{N(),i?.()},E=()=>{C(),a?.()},M=()=>{T(s),l?.()},q=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return he.createElement(Ny,{className:gs(["react-flow__controls",h]),position:m,style:t,"data-testid":"rf__controls"},e&&he.createElement(he.Fragment,null,he.createElement(ym,{onClick:_,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},he.createElement(Bke,null)),he.createElement(ym,{onClick:E,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},he.createElement(qke,null))),n&&he.createElement(ym,{className:"react-flow__controls-fitview",onClick:M,title:"fit view","aria-label":"fit view"},he.createElement(Fke,null)),r&&he.createElement(ym,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},w?he.createElement(Qke,null):he.createElement($ke,null)),f)};iV.displayName="Controls";var Vke=b.memo(iV),na;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(na||(na={}));function Uke({color:t,dimensions:e,lineWidth:n}){return he.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function Wke({color:t,radius:e}){return he.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const Gke={[na.Dots]:"#91919a",[na.Lines]:"#eee",[na.Cross]:"#e2e2e2"},Xke={[na.Dots]:1,[na.Lines]:1,[na.Cross]:6},Yke=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function aV({id:t,variant:e=na.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:l,className:c}){const h=b.useRef(null),{transform:f,patternId:m}=Xn(Yke,ts),g=a||Gke[e],x=r||Xke[e],y=e===na.Dots,w=e===na.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],N=x*f[2],C=w?[N,N]:k,T=y?[N/i,N/i]:[C[0]/i,C[1]/i];return he.createElement("svg",{className:gs(["react-flow__background",c]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},he.createElement("pattern",{id:m+t,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?he.createElement(Wke,{color:g,radius:N/i}):he.createElement(Uke,{dimensions:C,color:g,lineWidth:s})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}aV.displayName="Background";var Kke=b.memo(aV);function wj(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var z4,oA;function Zke(){if(oA)return z4;oA=1;var t=fD(),e=4;function n(r){return t(r,e)}return z4=n,z4}var P4,lA;function oV(){if(lA)return P4;lA=1;var t=mY();function e(n){return typeof n=="function"?n:t}return P4=e,P4}var L4,cA;function lV(){if(cA)return L4;cA=1;var t=mD(),e=Ak(),n=oV(),r=Lu();function s(i,a){var l=r(i)?t:e;return l(i,n(a))}return L4=s,L4}var I4,uA;function cV(){return uA||(uA=1,I4=lV()),I4}var B4,dA;function Jke(){if(dA)return B4;dA=1;var t=Ak();function e(n,r){var s=[];return t(n,function(i,a,l){r(i,a,l)&&s.push(i)}),s}return B4=e,B4}var q4,hA;function uV(){if(hA)return q4;hA=1;var t=pY(),e=Jke(),n=Rk(),r=Lu();function s(i,a){var l=r(i)?t:e;return l(i,n(a,3))}return q4=s,q4}var F4,fA;function e6e(){if(fA)return F4;fA=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return F4=n,F4}var $4,mA;function dV(){if(mA)return $4;mA=1;var t=e6e(),e=gY();function n(r,s){return r!=null&&e(r,s,t)}return $4=n,$4}var Q4,pA;function t6e(){if(pA)return Q4;pA=1;var t=pD(),e=gD(),n=xD(),r=Lu(),s=Dk(),i=zk(),a=xY(),l=Pk(),c="[object Map]",h="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||l(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==h)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return Q4=g,Q4}var H4,gA;function hV(){if(gA)return H4;gA=1;function t(e){return e===void 0}return H4=t,H4}var V4,xA;function n6e(){if(xA)return V4;xA=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(f,m){return t.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},s.prototype.node=function(f){return this._nodes[f]},s.prototype.hasNode=function(f){return t.has(this._nodes,f)},s.prototype.removeNode=function(f){var m=this;if(t.has(this._nodes,f)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],t.each(this.children(f),function(x){m.setParent(x)}),delete this._children[f]),t.each(t.keys(this._in[f]),g),delete this._in[f],delete this._preds[f],t.each(t.keys(this._out[f]),g),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},s.prototype.setParent=function(f,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},s.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},s.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},s.prototype.children=function(f){if(t.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return t.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},s.prototype.predecessors=function(f){var m=this._preds[f];if(m)return t.keys(m)},s.prototype.successors=function(f){var m=this._sucs[f];if(m)return t.keys(m)},s.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return t.union(m,this.successors(f))},s.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},s.prototype.filterNodes=function(f){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,S){f(S)&&m.setNode(S,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(f){return t.isFunction(f)||(f=t.constant(f)),this._defaultEdgeLabelFn=f,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(f,m){var g=this,x=arguments;return t.reduce(f,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var f,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(f=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(f=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),f=""+f,m=""+m,t.isUndefined(g)||(g=""+g);var S=l(this._isDirected,f,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(f,m,g);var k=c(this._isDirected,f,m,g);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],f),i(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},s.prototype.edge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):l(this._isDirected,f,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):l(this._isDirected,f,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):l(this._isDirected,f,m,g),y=this._edgeObjs[x];return y&&(f=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],f),a(this._sucs[f],m),delete this._in[m][x],delete this._out[f][x],this._edgeCount--),this},s.prototype.inEdges=function(f,m){var g=this._in[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(f,m){var g=this._out[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(f,m){var g=this.inEdges(f,m);if(g)return g.concat(this.outEdges(f,m))};function i(f,m){f[m]?f[m]++:f[m]=1}function a(f,m){--f[m]||delete f[m]}function l(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function h(f,m){return l(f,m.v,m.w,m.name)}return s5}var i5,MA;function d6e(){return MA||(MA=1,i5="2.1.8"),i5}var a5,AA;function h6e(){return AA||(AA=1,a5={Graph:Sj(),version:d6e()}),a5}var o5,RA;function f6e(){if(RA)return o5;RA=1;var t=ua(),e=Sj();o5={write:n,read:i};function n(a){var l={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(l.value=t.clone(a.graph())),l}function r(a){return t.map(a.nodes(),function(l){var c=a.node(l),h=a.parent(l),f={v:l};return t.isUndefined(c)||(f.value=c),t.isUndefined(h)||(f.parent=h),f})}function s(a){return t.map(a.edges(),function(l){var c=a.edge(l),h={v:l.v,w:l.w};return t.isUndefined(l.name)||(h.name=l.name),t.isUndefined(c)||(h.value=c),h})}function i(a){var l=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){l.setNode(c.v,c.value),c.parent&&l.setParent(c.v,c.parent)}),t.each(a.edges,function(c){l.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),l}return o5}var l5,DA;function m6e(){if(DA)return l5;DA=1;var t=ua();l5=e;function e(n){var r={},s=[],i;function a(l){t.has(r,l)||(r[l]=!0,i.push(l),t.each(n.successors(l),a),t.each(n.predecessors(l),a))}return t.each(n.nodes(),function(l){i=[],a(l),i.length&&s.push(i)}),s}return l5}var c5,zA;function gV(){if(zA)return c5;zA=1;var t=ua();c5=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=f.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return h}return u5}var d5,LA;function p6e(){if(LA)return d5;LA=1;var t=xV(),e=ua();d5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,l){a[l]=t(r,l,s,i)},{})}return d5}var h5,IA;function vV(){if(IA)return h5;IA=1;var t=ua();h5=e;function e(n){var r=0,s=[],i={},a=[];function l(c){var h=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(h.lowlink=Math.min(h.lowlink,i[g].index)):(l(g),h.lowlink=Math.min(h.lowlink,i[g].lowlink))}),h.lowlink===h.index){var f=[],m;do m=s.pop(),i[m].onStack=!1,f.push(m);while(c!==m);a.push(f)}}return n.nodes().forEach(function(c){t.has(i,c)||l(c)}),a}return h5}var f5,BA;function g6e(){if(BA)return f5;BA=1;var t=ua(),e=vV();f5=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return f5}var m5,qA;function x6e(){if(qA)return m5;qA=1;var t=ua();m5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(l){return s.outEdges(l)})}function r(s,i,a){var l={},c=s.nodes();return c.forEach(function(h){l[h]={},l[h][h]={distance:0},c.forEach(function(f){h!==f&&(l[h][f]={distance:Number.POSITIVE_INFINITY})}),a(h).forEach(function(f){var m=f.v===h?f.w:f.v,g=i(f);l[h][m]={distance:g,predecessor:h}})}),c.forEach(function(h){var f=l[h];c.forEach(function(m){var g=l[m];c.forEach(function(x){var y=g[h],w=f[x],S=g[x],k=y.distance+w.distance;k0;){if(h=c.removeMin(),t.has(l,h))a.setEdge(h,l[h]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(h).forEach(f)}return a}return b5}var w5,WA;function S6e(){return WA||(WA=1,w5={components:m6e(),dijkstra:xV(),dijkstraAll:p6e(),findCycles:g6e(),floydWarshall:x6e(),isAcyclic:v6e(),postorder:y6e(),preorder:b6e(),prim:w6e(),tarjan:vV(),topsort:yV()}),w5}var S5,GA;function k6e(){if(GA)return S5;GA=1;var t=h6e();return S5={Graph:t.Graph,json:f6e(),alg:S6e(),version:t.version},S5}var k5,XA;function Na(){if(XA)return k5;XA=1;var t;if(typeof wj=="function")try{t=k6e()}catch{}return t||(t=window.graphlib),k5=t,k5}var O5,YA;function O6e(){if(YA)return O5;YA=1;var t=fD(),e=1,n=4;function r(s){return t(s,e|n)}return O5=r,O5}var j5,KA;function j6e(){if(KA)return j5;KA=1;var t=Ik(),e=SD(),n=wD(),r=wv(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(l,c){l=Object(l);var h=-1,f=c.length,m=f>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(f=1);++h1?i[l-1]:void 0,h=l>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(l--,c):void 0,h&&e(i[0],i[1],h)&&(c=l<3?void 0:c,l=1),s=Object(s);++a0;--S)if(w=f[S].dequeue(),w){g=g.concat(a(h,f,m,w,!0));break}}}return g}function a(h,f,m,g,x){var y=x?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var S=h.edge(w),k=h.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(f,m,k)}),t.forEach(h.outEdges(g.v),function(w){var S=h.edge(w),k=w.w,N=h.node(k);N.in-=S,c(f,m,N)}),h.removeNode(g.v),y}function l(h,f){var m=new e,g=0,x=0;t.forEach(h.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(h.edges(),function(S){var k=m.edge(S.v,S.w)||0,N=f(S),C=k+N;m.setEdge(S.v,S.w,C),x=Math.max(x,m.node(S.v).out+=N),g=Math.max(g,m.node(S.w).in+=N)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(h,f,m){m.out?m.in?h[m.out-m.in+f].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return Q5}var H5,gR;function F6e(){if(gR)return H5;gR=1;var t=ir(),e=q6e();H5={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,l(i)):r(i);t.forEach(a,function(c){var h=i.edge(c);i.removeEdge(c),h.forwardName=c.name,h.reversed=!0,i.setEdge(c.w,c.v,h,t.uniqueId("rev"))});function l(c){return function(h){return c.edge(h).weight}}}function r(i){var a=[],l={},c={};function h(f){t.has(c,f)||(c[f]=!0,l[f]=!0,t.forEach(i.outEdges(f),function(m){t.has(l,m.w)?a.push(m):h(m.w)}),delete l[f])}return t.forEach(i.nodes(),h),a}function s(i){t.forEach(i.edges(),function(a){var l=i.edge(a);if(l.reversed){i.removeEdge(a);var c=l.forwardName;delete l.reversed,delete l.forwardName,i.setEdge(a.w,a.v,l,c)}})}return H5}var V5,xR;function si(){if(xR)return V5;xR=1;var t=ir(),e=Na().Graph;V5={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:l,buildLayerMatrix:c,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,N,C){var T;do T=t.uniqueId(C);while(S.hasNode(T));return N.dummy=k,S.setNode(T,N),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(N){k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){var C=k.edge(N.v,N.w)||{weight:0,minlen:1},T=S.edge(N);k.setEdge(N.v,N.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(N){S.children(N).length||k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){k.setEdge(N,S.edge(N))}),k}function i(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.outEdges(N),function(T){C[T.w]=(C[T.w]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.inEdges(N),function(T){C[T.v]=(C[T.v]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function l(S,k){var N=S.x,C=S.y,T=k.x-N,_=k.y-C,E=S.width/2,M=S.height/2;if(!T&&!_)throw new Error("Not possible to find intersection inside of the rectangle");var q,L;return Math.abs(_)*E>Math.abs(T)*M?(_<0&&(M=-M),q=M*T/_,L=M):(T<0&&(E=-E),q=E,L=E*_/T),{x:N+q,y:C+L}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(N){var C=S.node(N),T=C.rank;t.isUndefined(T)||(k[T][C.order]=N)}),k}function h(S){var k=t.min(t.map(S.nodes(),function(N){return S.node(N).rank}));t.forEach(S.nodes(),function(N){var C=S.node(N);t.has(C,"rank")&&(C.rank-=k)})}function f(S){var k=t.min(t.map(S.nodes(),function(_){return S.node(_).rank})),N=[];t.forEach(S.nodes(),function(_){var E=S.node(_).rank-k;N[E]||(N[E]=[]),N[E].push(_)});var C=0,T=S.graph().nodeRankFactor;t.forEach(N,function(_,E){t.isUndefined(_)&&E%T!==0?--C:C&&t.forEach(_,function(M){S.node(M).rank+=C})})}function m(S,k,N,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=N,T.order=C),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var N=S.node(k).rank;if(!t.isUndefined(N))return N}))}function x(S,k){var N={lhs:[],rhs:[]};return t.forEach(S,function(C){k(C)?N.lhs.push(C):N.rhs.push(C)}),N}function y(S,k){var N=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-N)+"ms")}}function w(S,k){return k()}return V5}var U5,vR;function $6e(){if(vR)return U5;vR=1;var t=ir(),e=si();U5={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var l=a.v,c=i.node(l).rank,h=a.w,f=i.node(h).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(f!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;cL.lim&&(I=L,$=!0);var V=t.filter(T.edges(),function(ee){return $===N(C,C.node(ee.v),I)&&$!==N(C,C.node(ee.w),I)});return t.minBy(V,function(ee){return n(T,ee)})}function w(C,T,_,E){var M=_.v,q=_.w;C.removeEdge(M,q),C.setEdge(E.v,E.w,{}),m(C),c(C,T),S(C,T)}function S(C,T){var _=t.find(C.nodes(),function(M){return!T.node(M).parent}),E=s(C,_);E=E.slice(1),t.forEach(E,function(M){var q=C.node(M).parent,L=T.edge(M,q),I=!1;L||(L=T.edge(q,M),I=!0),T.node(M).rank=T.node(q).rank+(I?L.minlen:-L.minlen)})}function k(C,T,_){return C.hasEdge(T,_)}function N(C,T,_){return _.low<=T.lim&&T.lim<=_.lim}return X5}var Y5,SR;function H6e(){if(SR)return Y5;SR=1;var t=xv(),e=t.longestPath,n=kV(),r=Q6e();Y5=s;function s(c){switch(c.graph().ranker){case"network-simplex":l(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:l(c)}}var i=e;function a(c){e(c),n(c)}function l(c){r(c)}return Y5}var K5,kR;function V6e(){if(kR)return K5;kR=1;var t=ir();K5=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var l=s.node(a),c=l.edgeObj,h=n(s,i,c.v,c.w),f=h.path,m=h.lca,g=0,x=f[g],y=!0;a!==c.w;){if(l=s.node(a),y){for(;(x=f[g])!==m&&s.node(x).maxRankf||m>i[g].lim));for(x=g,g=l;(g=s.parent(g))!==x;)h.push(g);return{path:c.concat(h.reverse()),lca:x}}function r(s){var i={},a=0;function l(c){var h=a;t.forEach(s.children(c),l),i[c]={low:h,lim:a++}}return t.forEach(s.children(),l),i}return K5}var Z5,OR;function U6e(){if(OR)return Z5;OR=1;var t=ir(),e=si();Z5={run:n,cleanup:a};function n(l){var c=e.addDummyNode(l,"root",{},"_root"),h=s(l),f=t.max(t.values(h))-1,m=2*f+1;l.graph().nestingRoot=c,t.forEach(l.edges(),function(x){l.edge(x).minlen*=m});var g=i(l)+1;t.forEach(l.children(),function(x){r(l,c,m,g,f,h,x)}),l.graph().nodeRankFactor=m}function r(l,c,h,f,m,g,x){var y=l.children(x);if(!y.length){x!==c&&l.setEdge(c,x,{weight:0,minlen:h});return}var w=e.addBorderNode(l,"_bt"),S=e.addBorderNode(l,"_bb"),k=l.node(x);l.setParent(w,x),k.borderTop=w,l.setParent(S,x),k.borderBottom=S,t.forEach(y,function(N){r(l,c,h,f,m,g,N);var C=l.node(N),T=C.borderTop?C.borderTop:N,_=C.borderBottom?C.borderBottom:N,E=C.borderTop?f:2*f,M=T!==_?1:m-g[x]+1;l.setEdge(w,T,{weight:E,minlen:M,nestingEdge:!0}),l.setEdge(_,S,{weight:E,minlen:M,nestingEdge:!0})}),l.parent(x)||l.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(l){var c={};function h(f,m){var g=l.children(f);g&&g.length&&t.forEach(g,function(x){h(x,m+1)}),c[f]=m}return t.forEach(l.children(),function(f){h(f,1)}),c}function i(l){return t.reduce(l.edges(),function(c,h){return c+l.edge(h).weight},0)}function a(l){var c=l.graph();l.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(l.edges(),function(h){var f=l.edge(h);f.nestingEdge&&l.removeEdge(h)})}return Z5}var J5,jR;function W6e(){if(jR)return J5;jR=1;var t=ir(),e=si();J5=n;function n(s){function i(a){var l=s.children(a),c=s.node(a);if(l.length&&t.forEach(l,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var h=c.minRank,f=c.maxRank+1;h0;)x%2&&(y+=f[x+1]),x=x-1>>1,f[x]+=g.weight;m+=g.weight*y})),m}return n3}var r3,ER;function K6e(){if(ER)return r3;ER=1;var t=ir();r3=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(l,c){var h=n.edge(c),f=n.node(c.v);return{sum:l.sum+h.weight*f.order,weight:l.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return r3}var s3,_R;function Z6e(){if(_R)return s3;_R=1;var t=ir();s3=e;function e(s,i){var a={};t.forEach(s,function(c,h){var f=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:h};t.isUndefined(c.barycenter)||(f.barycenter=c.barycenter,f.weight=c.weight)}),t.forEach(i.edges(),function(c){var h=a[c.v],f=a[c.w];!t.isUndefined(h)&&!t.isUndefined(f)&&(f.indegree++,h.out.push(a[c.w]))});var l=t.filter(a,function(c){return!c.indegree});return n(l)}function n(s){var i=[];function a(h){return function(f){f.merged||(t.isUndefined(f.barycenter)||t.isUndefined(h.barycenter)||f.barycenter>=h.barycenter)&&r(h,f)}}function l(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,l(c))}return t.map(t.filter(i,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,l=0;s.weight&&(a+=s.barycenter*s.weight,l+=s.weight),i.weight&&(a+=i.barycenter*i.weight,l+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/l,s.weight=l,s.i=Math.min(i.i,s.i),i.merged=!0}return s3}var i3,MR;function J6e(){if(MR)return i3;MR=1;var t=ir(),e=si();i3=n;function n(i,a){var l=e.partition(i,function(w){return t.has(w,"barycenter")}),c=l.lhs,h=t.sortBy(l.rhs,function(w){return-w.i}),f=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(f,h,x),t.forEach(c,function(w){x+=w.vs.length,f.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(f,h,x)});var y={vs:t.flatten(f,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,l){for(var c;a.length&&(c=t.last(a)).i<=l;)a.pop(),i.push(c.vs),l++;return l}function s(i){return function(a,l){return a.barycenterl.barycenter?1:i?l.i-a.i:a.i-l.i}}return i3}var a3,AR;function eOe(){if(AR)return a3;AR=1;var t=ir(),e=K6e(),n=Z6e(),r=J6e();a3=s;function s(l,c,h,f){var m=l.children(c),g=l.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(_){return _!==x&&_!==y}));var S=e(l,m);t.forEach(S,function(_){if(l.children(_.v).length){var E=s(l,_.v,h,f);w[_.v]=E,t.has(E,"barycenter")&&a(_,E)}});var k=n(S,h);i(k,w);var N=r(k,f);if(x&&(N.vs=t.flatten([x,N.vs,y],!0),l.predecessors(x).length)){var C=l.node(l.predecessors(x)[0]),T=l.node(l.predecessors(y)[0]);t.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+T.order)/(N.weight+2),N.weight+=2}return N}function i(l,c){t.forEach(l,function(h){h.vs=t.flatten(h.vs.map(function(f){return c[f]?c[f].vs:f}),!0)})}function a(l,c){t.isUndefined(l.barycenter)?(l.barycenter=c.barycenter,l.weight=c.weight):(l.barycenter=(l.barycenter*l.weight+c.barycenter*c.weight)/(l.weight+c.weight),l.weight+=c.weight)}return a3}var o3,RR;function tOe(){if(RR)return o3;RR=1;var t=ir(),e=Na().Graph;o3=n;function n(s,i,a){var l=r(s),c=new e({compound:!0}).setGraph({root:l}).setDefaultNodeLabel(function(h){return s.node(h)});return t.forEach(s.nodes(),function(h){var f=s.node(h),m=s.parent(h);(f.rank===i||f.minRank<=i&&i<=f.maxRank)&&(c.setNode(h),c.setParent(h,m||l),t.forEach(s[a](h),function(g){var x=g.v===h?g.w:g.v,y=c.edge(x,h),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,h,{weight:s.edge(g).weight+w})}),t.has(f,"minRank")&&c.setNode(h,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return o3}var l3,DR;function nOe(){if(DR)return l3;DR=1;var t=ir();l3=e;function e(n,r,s){var i={},a;t.forEach(s,function(l){for(var c=n.parent(l),h,f;c;){if(h=n.parent(c),h?(f=i[h],i[h]=c):(f=a,a=c),f&&f!==c){r.setEdge(f,c);return}c=h}})}return l3}var c3,zR;function rOe(){if(zR)return c3;zR=1;var t=ir(),e=X6e(),n=Y6e(),r=eOe(),s=tOe(),i=nOe(),a=Na().Graph,l=si();c3=c;function c(g){var x=l.maxRank(g),y=h(g,t.range(1,x+1),"inEdges"),w=h(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,N,C=0,T=0;T<4;++C,++T){f(C%2?y:w,C%4>=2),S=l.buildLayerMatrix(g);var _=n(g,S);_I)&&a(C,ee,$)})})}function _(E,M){var q=-1,L,I=0;return t.forEach(M,function($,V){if(k.node($).dummy==="border"){var ee=k.predecessors($);ee.length&&(L=k.node(ee[0]).order,T(M,I,V,q,L),I=V,q=L)}T(M,I,M.length,L,E.length)}),M}return t.reduce(N,_),C}function i(k,N){if(k.node(N).dummy)return t.find(k.predecessors(N),function(C){return k.node(C).dummy})}function a(k,N,C){if(N>C){var T=N;N=C,C=T}var _=k[N];_||(k[N]=_={}),_[C]=!0}function l(k,N,C){if(N>C){var T=N;N=C,C=T}return t.has(k[N],C)}function c(k,N,C,T){var _={},E={},M={};return t.forEach(N,function(q){t.forEach(q,function(L,I){_[L]=L,E[L]=L,M[L]=I})}),t.forEach(N,function(q){var L=-1;t.forEach(q,function(I){var $=T(I);if($.length){$=t.sortBy($,function(P){return M[P]});for(var V=($.length-1)/2,ee=Math.floor(V),z=Math.ceil(V);ee<=z;++ee){var H=$[ee];E[I]===I&&Lo.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[o.jsx(jc,{type:"target",position:ht.Top}),o.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),o.jsx(jc,{type:"source",position:ht.Bottom})]}));OV.displayName="EntityNode";const jV=b.memo(({data:t})=>o.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[o.jsx(jc,{type:"target",position:ht.Top}),o.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),o.jsx(jc,{type:"source",position:ht.Bottom})]}));jV.displayName="ParagraphNode";const mOe={entity:OV,paragraph:jV};function pOe(t,e){const n=new $R.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),$R.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const l={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(l.label=`${i.weight.toFixed(0)}`),s.push(l)}),{nodes:r,edges:s}}function gOe(){const t=Ca(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[l,c]=b.useState("all"),[h,f]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,N]=b.useState(!1),[C,T]=b.useState(!1),[_,E,M]=Cke([]),[q,L,I]=Tke([]),[$,V]=b.useState(0),[ee,z]=b.useState(null),[H,P]=b.useState(null),{toast:W}=Wr(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),X=b.useCallback(async(ne=!1)=>{try{if(!ne&&h>200){T(!0);return}n(!0);const[Y,ae]=await Promise.all([dOe(h,l),hOe()]);if(s(ae),Y.nodes.length===0){W({title:"提示",description:"知识库为空,请先导入知识数据"}),E([]),L([]);return}const{nodes:re,edges:oe}=pOe(Y.nodes,Y.edges);E(re),L(oe),V(re.length),ae&&ae.total_nodes>h&&W({title:"提示",description:`知识图谱包含 ${ae.total_nodes} 个节点,当前显示 ${re.length} 个`}),W({title:"加载成功",description:`已加载 ${re.length} 个节点,${oe.length} 条边`})}catch(Y){console.error("加载知识图谱失败:",Y),W({title:"加载失败",description:Y instanceof Error?Y.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[h,l,W]),R=b.useCallback(async()=>{if(!i.trim()){W({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await fOe(i);if(ne.length===0){W({title:"未找到",description:"没有找到匹配的节点"});return}const Y=new Set(ne.map(ae=>ae.id));E(ae=>ae.map(re=>({...re,style:{...re.style,opacity:Y.has(re.id)?1:.3,filter:Y.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),W({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),W({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,W]),se=b.useCallback(()=>{E(ne=>ne.map(Y=>({...Y,style:{...Y.style,opacity:1,filter:"brightness(1)"}})))},[]),G=b.useCallback(()=>{S(!1),N(!0),X()},[X]),F=b.useCallback(()=>{T(!1),setTimeout(()=>{X(!0)},0)},[X]),U=b.useCallback((ne,Y)=>{_.find(re=>re.id===Y.id)&&z({id:Y.id,type:Y.type,content:Y.data.content})},[_]);b.useEffect(()=>{w||k&&X()},[h,l,w,k]);const te=b.useCallback((ne,Y)=>{const ae=_.find(_e=>_e.id===Y.source),re=_.find(_e=>_e.id===Y.target),oe=q.find(_e=>_e.id===Y.id);ae&&re&&oe&&P({source:{id:ae.id,type:ae.type,content:ae.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:Y.source,target:Y.target,weight:parseFloat(Y.label||"0")}})},[_,q]);return o.jsxs("div",{className:"h-full flex flex-col",children:[o.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),o.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(b3,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(KD,{className:"h-3 w-3"}),"边: ",r.total_edges]}),o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(wa,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),o.jsxs(Ln,{variant:"outline",className:"gap-1",children:[o.jsx(tl,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),o.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[o.jsxs("div",{className:"flex-1 flex gap-2",children:[o.jsx(Pe,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),o.jsx(me,{onClick:R,size:"sm",children:o.jsx(ii,{className:"h-4 w-4"})}),o.jsx(me,{onClick:se,variant:"outline",size:"sm",children:"重置"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(Dt,{value:l,onValueChange:ne=>c(ne),children:[o.jsx(Mt,{className:"w-[120px]",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部节点"}),o.jsx(ze,{value:"entity",children:"仅实体"}),o.jsx(ze,{value:"paragraph",children:"仅段落"})]})]}),o.jsxs(Dt,{value:h===1e4?"all":x?"custom":h.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(h.toString())):ne==="all"?(y(!1),f(1e4)):(y(!1),f(Number(ne)))},children:[o.jsx(Mt,{className:"w-[120px]",children:o.jsx(zt,{})}),o.jsxs(At,{children:[o.jsx(ze,{value:"50",children:"50 节点"}),o.jsx(ze,{value:"100",children:"100 节点"}),o.jsx(ze,{value:"200",children:"200 节点"}),o.jsx(ze,{value:"500",children:"500 节点"}),o.jsx(ze,{value:"1000",children:"1000 节点"}),o.jsx(ze,{value:"all",children:"全部 (最多10000)"}),o.jsx(ze,{value:"custom",children:"自定义..."})]})]}),x&&o.jsx(Pe,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?f(ne):(g("50"),f(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const Y=parseInt(m);!isNaN(Y)&&Y>=50?f(Y):(g("50"),f(50))}},placeholder:"最少50个",className:"w-[120px]"}),o.jsx(me,{onClick:()=>X(),variant:"outline",size:"sm",disabled:e,children:o.jsx(Ti,{className:ye("h-4 w-4",e&&"animate-spin")})})]})]})]}),o.jsx("div",{className:"flex-1 relative",children:e?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(Ti,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),o.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):_.length===0?o.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:o.jsxs("div",{className:"text-center",children:[o.jsx(b3,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),o.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):o.jsxs(tV,{nodes:_,edges:q,onNodesChange:M,onEdgesChange:I,onNodeClick:U,onEdgeClick:te,nodeTypes:mOe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:$<=500,nodesDraggable:$<=1e3,attributionPosition:"bottom-left",children:[o.jsx(Kke,{variant:na.Dots,gap:12,size:1}),o.jsx(Vke,{}),$<=500&&o.jsx(Ike,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),o.jsxs(Ny,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[o.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),o.jsxs("div",{className:"space-y-2 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),o.jsx("span",{children:"实体节点"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),o.jsx("span",{children:"段落节点"})]}),$>200&&o.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[o.jsx("div",{className:"font-semibold",children:"性能模式"}),o.jsx("div",{children:"已禁用动画"}),$>500&&o.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),o.jsx(zr,{open:!!ee,onOpenChange:ne=>!ne&&z(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsx(Or,{children:"节点详情"})}),ee&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"grid grid-cols-2 gap-4",children:o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),o.jsx("div",{className:"mt-1",children:o.jsx(Ln,{variant:ee.type==="entity"?"default":"secondary",children:ee.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),o.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ee.id})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),o.jsx(kn,{className:"mt-1 h-40 p-3 bg-muted rounded",children:o.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content})})]})]})]})}),o.jsx(zr,{open:!!H,onOpenChange:ne=>!ne&&P(null),children:o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[o.jsx(kr,{children:o.jsx(Or,{children:"边详情"})}),H&&o.jsx(kn,{className:"flex-1 pr-4",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.source.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.source.id.slice(0,40),"..."]})]}),o.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),o.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[o.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),o.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.target.content}),o.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.target.id.slice(0,40),"..."]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),o.jsx("div",{className:"mt-1",children:o.jsx(Ln,{variant:"outline",className:"text-base font-mono",children:H.edge.weight.toFixed(4)})})]})]})})]})}),o.jsx(jn,{open:w,onOpenChange:S,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"加载知识图谱"}),o.jsxs(fn,{children:["知识图谱的动态展示会消耗较多系统资源。",o.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),o.jsx(mn,{onClick:G,children:"确认加载"})]})]})}),o.jsx(jn,{open:C,onOpenChange:T,children:o.jsxs(cn,{children:[o.jsxs(un,{children:[o.jsx(hn,{children:"⚠️ 节点数量较多"}),o.jsx(fn,{asChild:!0,children:o.jsxs("div",{children:[o.jsxs("p",{children:["您正在尝试加载 ",o.jsx("strong",{className:"text-orange-600",children:h>=1e4?"全部 (最多10000个)":h})," 个节点。"]}),o.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),o.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[o.jsx("li",{children:"页面加载时间较长"}),o.jsx("li",{children:"浏览器卡顿或崩溃"}),o.jsx("li",{children:"系统资源占用过高"})]}),o.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),o.jsxs(dn,{children:[o.jsx(pn,{onClick:()=>{T(!1),h>200&&(f(50),y(!1))},children:"取消"}),o.jsx(mn,{onClick:F,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Ad(t,e,n){let r=n.initialDeps??[],s;function i(){var a,l,c,h;let f;n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((l=n.debug)!=null&&l.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-f)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(N,C)=>{for(N=String(N);N.length0;)this.endGroup()}has(e){return this.current.hasOwnProperty(e)||this.builtins.hasOwnProperty(e)}get(e){return this.current.hasOwnProperty(e)?this.current[e]:this.builtins[e]}set(e,n,r){if(r===void 0&&(r=!1),r){for(var s=0;s0&&(this.undefStack[this.undefStack.length-1][e]=n)}else{var i=this.undefStack[this.undefStack.length-1];i&&!i.hasOwnProperty(e)&&(i[e]=this.current[e])}n==null?delete this.current[e]:this.current[e]=n}}var k2e=jQ;Z("\\noexpand",function(t){var e=t.popToken();return t.isExpandable(e.text)&&(e.noexpand=!0,e.treatAsRelax=!0),{tokens:[e],numArgs:0}});Z("\\expandafter",function(t){var e=t.popToken();return t.expandOnce(!0),{tokens:[e],numArgs:0}});Z("\\@firstoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[0],numArgs:0}});Z("\\@secondoftwo",function(t){var e=t.consumeArgs(2);return{tokens:e[1],numArgs:0}});Z("\\@ifnextchar",function(t){var e=t.consumeArgs(3);t.consumeSpaces();var n=t.future();return e[0].length===1&&e[0][0].text===n.text?{tokens:e[1],numArgs:0}:{tokens:e[2],numArgs:0}});Z("\\@ifstar","\\@ifnextchar *{\\@firstoftwo{#1}}");Z("\\TextOrMath",function(t){var e=t.consumeArgs(2);return t.mode==="text"?{tokens:e[0],numArgs:0}:{tokens:e[1],numArgs:0}});var kM={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};Z("\\char",function(t){var e=t.popToken(),n,r="";if(e.text==="'")n=8,e=t.popToken();else if(e.text==='"')n=16,e=t.popToken();else if(e.text==="`")if(e=t.popToken(),e.text[0]==="\\")r=e.text.charCodeAt(1);else{if(e.text==="EOF")throw new Be("\\char` missing argument");r=e.text.charCodeAt(0)}else n=10;if(n){if(r=kM[e.text],r==null||r>=n)throw new Be("Invalid base-"+n+" digit "+e.text);for(var s;(s=kM[t.future().text])!=null&&s{var s=t.consumeArg().tokens;if(s.length!==1)throw new Be("\\newcommand's first argument must be a macro name");var i=s[0].text,a=t.isDefined(i);if(a&&!e)throw new Be("\\newcommand{"+i+"} attempting to redefine "+(i+"; use \\renewcommand"));if(!a&&!n)throw new Be("\\renewcommand{"+i+"} when command "+i+" does not yet exist; use \\newcommand");var o=0;if(s=t.consumeArg().tokens,s.length===1&&s[0].text==="["){for(var c="",h=t.expandNextToken();h.text!=="]"&&h.text!=="EOF";)c+=h.text,h=t.expandNextToken();if(!c.match(/^\s*[0-9]+\s*$/))throw new Be("Invalid number of arguments: "+c);o=parseInt(c),s=t.consumeArg().tokens}return a&&r||t.macros.set(i,{tokens:s,numArgs:o}),""};Z("\\newcommand",t=>ij(t,!1,!0,!1));Z("\\renewcommand",t=>ij(t,!0,!1,!1));Z("\\providecommand",t=>ij(t,!0,!0,!0));Z("\\message",t=>{var e=t.consumeArgs(1)[0];return console.log(e.reverse().map(n=>n.text).join("")),""});Z("\\errmessage",t=>{var e=t.consumeArgs(1)[0];return console.error(e.reverse().map(n=>n.text).join("")),""});Z("\\show",t=>{var e=t.popToken(),n=e.text;return console.log(e,t.macros.get(n),fc[n],Gn.math[n],Gn.text[n]),""});Z("\\bgroup","{");Z("\\egroup","}");Z("~","\\nobreakspace");Z("\\lq","`");Z("\\rq","'");Z("\\aa","\\r a");Z("\\AA","\\r A");Z("\\textcopyright","\\html@mathml{\\textcircled{c}}{\\char`©}");Z("\\copyright","\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}");Z("\\textregistered","\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}");Z("ℬ","\\mathscr{B}");Z("ℰ","\\mathscr{E}");Z("ℱ","\\mathscr{F}");Z("ℋ","\\mathscr{H}");Z("ℐ","\\mathscr{I}");Z("ℒ","\\mathscr{L}");Z("ℳ","\\mathscr{M}");Z("ℛ","\\mathscr{R}");Z("ℭ","\\mathfrak{C}");Z("ℌ","\\mathfrak{H}");Z("ℨ","\\mathfrak{Z}");Z("\\Bbbk","\\Bbb{k}");Z("·","\\cdotp");Z("\\llap","\\mathllap{\\textrm{#1}}");Z("\\rlap","\\mathrlap{\\textrm{#1}}");Z("\\clap","\\mathclap{\\textrm{#1}}");Z("\\mathstrut","\\vphantom{(}");Z("\\underbar","\\underline{\\text{#1}}");Z("\\not",'\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}');Z("\\neq","\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}");Z("\\ne","\\neq");Z("≠","\\neq");Z("\\notin","\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}");Z("∉","\\notin");Z("≘","\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}");Z("≙","\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}");Z("≚","\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}");Z("≛","\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}");Z("≝","\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}");Z("≞","\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}");Z("≟","\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}");Z("⟂","\\perp");Z("‼","\\mathclose{!\\mkern-0.8mu!}");Z("∌","\\notni");Z("⌜","\\ulcorner");Z("⌝","\\urcorner");Z("⌞","\\llcorner");Z("⌟","\\lrcorner");Z("©","\\copyright");Z("®","\\textregistered");Z("️","\\textregistered");Z("\\ulcorner",'\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}');Z("\\urcorner",'\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}');Z("\\llcorner",'\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}');Z("\\lrcorner",'\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}');Z("\\vdots","{\\varvdots\\rule{0pt}{15pt}}");Z("⋮","\\vdots");Z("\\varGamma","\\mathit{\\Gamma}");Z("\\varDelta","\\mathit{\\Delta}");Z("\\varTheta","\\mathit{\\Theta}");Z("\\varLambda","\\mathit{\\Lambda}");Z("\\varXi","\\mathit{\\Xi}");Z("\\varPi","\\mathit{\\Pi}");Z("\\varSigma","\\mathit{\\Sigma}");Z("\\varUpsilon","\\mathit{\\Upsilon}");Z("\\varPhi","\\mathit{\\Phi}");Z("\\varPsi","\\mathit{\\Psi}");Z("\\varOmega","\\mathit{\\Omega}");Z("\\substack","\\begin{subarray}{c}#1\\end{subarray}");Z("\\colon","\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax");Z("\\boxed","\\fbox{$\\displaystyle{#1}$}");Z("\\iff","\\DOTSB\\;\\Longleftrightarrow\\;");Z("\\implies","\\DOTSB\\;\\Longrightarrow\\;");Z("\\impliedby","\\DOTSB\\;\\Longleftarrow\\;");Z("\\dddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ...}}{#1}}");Z("\\ddddot","{\\overset{\\raisebox{-0.1ex}{\\normalsize ....}}{#1}}");var OM={",":"\\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"};Z("\\dots",function(t){var e="\\dotso",n=t.expandAfterFuture().text;return n in OM?e=OM[n]:(n.slice(0,4)==="\\not"||n in Gn.math&&["bin","rel"].includes(Gn.math[n].group))&&(e="\\dotsb"),e});var aj={")":!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};Z("\\dotso",function(t){var e=t.future().text;return e in aj?"\\ldots\\,":"\\ldots"});Z("\\dotsc",function(t){var e=t.future().text;return e in aj&&e!==","?"\\ldots\\,":"\\ldots"});Z("\\cdots",function(t){var e=t.future().text;return e in aj?"\\@cdots\\,":"\\@cdots"});Z("\\dotsb","\\cdots");Z("\\dotsm","\\cdots");Z("\\dotsi","\\!\\cdots");Z("\\dotsx","\\ldots\\,");Z("\\DOTSI","\\relax");Z("\\DOTSB","\\relax");Z("\\DOTSX","\\relax");Z("\\tmspace","\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax");Z("\\,","\\tmspace+{3mu}{.1667em}");Z("\\thinspace","\\,");Z("\\>","\\mskip{4mu}");Z("\\:","\\tmspace+{4mu}{.2222em}");Z("\\medspace","\\:");Z("\\;","\\tmspace+{5mu}{.2777em}");Z("\\thickspace","\\;");Z("\\!","\\tmspace-{3mu}{.1667em}");Z("\\negthinspace","\\!");Z("\\negmedspace","\\tmspace-{4mu}{.2222em}");Z("\\negthickspace","\\tmspace-{5mu}{.277em}");Z("\\enspace","\\kern.5em ");Z("\\enskip","\\hskip.5em\\relax");Z("\\quad","\\hskip1em\\relax");Z("\\qquad","\\hskip2em\\relax");Z("\\tag","\\@ifstar\\tag@literal\\tag@paren");Z("\\tag@paren","\\tag@literal{({#1})}");Z("\\tag@literal",t=>{if(t.macros.get("\\df@tag"))throw new Be("Multiple \\tag");return"\\gdef\\df@tag{\\text{#1}}"});Z("\\bmod","\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}");Z("\\pod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)");Z("\\pmod","\\pod{{\\rm mod}\\mkern6mu#1}");Z("\\mod","\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1");Z("\\newline","\\\\\\relax");Z("\\TeX","\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}");var LQ=Ve(nl["Main-Regular"][84][1]-.7*nl["Main-Regular"][65][1]);Z("\\LaTeX","\\textrm{\\html@mathml{"+("L\\kern-.36em\\raisebox{"+LQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{LaTeX}}");Z("\\KaTeX","\\textrm{\\html@mathml{"+("K\\kern-.17em\\raisebox{"+LQ+"}{\\scriptstyle A}")+"\\kern-.15em\\TeX}{KaTeX}}");Z("\\hspace","\\@ifstar\\@hspacer\\@hspace");Z("\\@hspace","\\hskip #1\\relax");Z("\\@hspacer","\\rule{0pt}{0pt}\\hskip #1\\relax");Z("\\ordinarycolon",":");Z("\\vcentcolon","\\mathrel{\\mathop\\ordinarycolon}");Z("\\dblcolon",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}');Z("\\coloneqq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}');Z("\\Coloneqq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}');Z("\\coloneq",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}');Z("\\Coloneq",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}');Z("\\eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}');Z("\\Eqqcolon",'\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}');Z("\\eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}');Z("\\Eqcolon",'\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}');Z("\\colonapprox",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}');Z("\\Colonapprox",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}');Z("\\colonsim",'\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}');Z("\\Colonsim",'\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}');Z("∷","\\dblcolon");Z("∹","\\eqcolon");Z("≔","\\coloneqq");Z("≕","\\eqqcolon");Z("⩴","\\Coloneqq");Z("\\ratio","\\vcentcolon");Z("\\coloncolon","\\dblcolon");Z("\\colonequals","\\coloneqq");Z("\\coloncolonequals","\\Coloneqq");Z("\\equalscolon","\\eqqcolon");Z("\\equalscoloncolon","\\Eqqcolon");Z("\\colonminus","\\coloneq");Z("\\coloncolonminus","\\Coloneq");Z("\\minuscolon","\\eqcolon");Z("\\minuscoloncolon","\\Eqcolon");Z("\\coloncolonapprox","\\Colonapprox");Z("\\coloncolonsim","\\Colonsim");Z("\\simcolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\simcoloncolon","\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\approxcolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}");Z("\\approxcoloncolon","\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}");Z("\\notni","\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}");Z("\\limsup","\\DOTSB\\operatorname*{lim\\,sup}");Z("\\liminf","\\DOTSB\\operatorname*{lim\\,inf}");Z("\\injlim","\\DOTSB\\operatorname*{inj\\,lim}");Z("\\projlim","\\DOTSB\\operatorname*{proj\\,lim}");Z("\\varlimsup","\\DOTSB\\operatorname*{\\overline{lim}}");Z("\\varliminf","\\DOTSB\\operatorname*{\\underline{lim}}");Z("\\varinjlim","\\DOTSB\\operatorname*{\\underrightarrow{lim}}");Z("\\varprojlim","\\DOTSB\\operatorname*{\\underleftarrow{lim}}");Z("\\gvertneqq","\\html@mathml{\\@gvertneqq}{≩}");Z("\\lvertneqq","\\html@mathml{\\@lvertneqq}{≨}");Z("\\ngeqq","\\html@mathml{\\@ngeqq}{≱}");Z("\\ngeqslant","\\html@mathml{\\@ngeqslant}{≱}");Z("\\nleqq","\\html@mathml{\\@nleqq}{≰}");Z("\\nleqslant","\\html@mathml{\\@nleqslant}{≰}");Z("\\nshortmid","\\html@mathml{\\@nshortmid}{∤}");Z("\\nshortparallel","\\html@mathml{\\@nshortparallel}{∦}");Z("\\nsubseteqq","\\html@mathml{\\@nsubseteqq}{⊈}");Z("\\nsupseteqq","\\html@mathml{\\@nsupseteqq}{⊉}");Z("\\varsubsetneq","\\html@mathml{\\@varsubsetneq}{⊊}");Z("\\varsubsetneqq","\\html@mathml{\\@varsubsetneqq}{⫋}");Z("\\varsupsetneq","\\html@mathml{\\@varsupsetneq}{⊋}");Z("\\varsupsetneqq","\\html@mathml{\\@varsupsetneqq}{⫌}");Z("\\imath","\\html@mathml{\\@imath}{ı}");Z("\\jmath","\\html@mathml{\\@jmath}{ȷ}");Z("\\llbracket","\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}");Z("\\rrbracket","\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}");Z("⟦","\\llbracket");Z("⟧","\\rrbracket");Z("\\lBrace","\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}");Z("\\rBrace","\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}");Z("⦃","\\lBrace");Z("⦄","\\rBrace");Z("\\minuso","\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}");Z("⦵","\\minuso");Z("\\darr","\\downarrow");Z("\\dArr","\\Downarrow");Z("\\Darr","\\Downarrow");Z("\\lang","\\langle");Z("\\rang","\\rangle");Z("\\uarr","\\uparrow");Z("\\uArr","\\Uparrow");Z("\\Uarr","\\Uparrow");Z("\\N","\\mathbb{N}");Z("\\R","\\mathbb{R}");Z("\\Z","\\mathbb{Z}");Z("\\alef","\\aleph");Z("\\alefsym","\\aleph");Z("\\Alpha","\\mathrm{A}");Z("\\Beta","\\mathrm{B}");Z("\\bull","\\bullet");Z("\\Chi","\\mathrm{X}");Z("\\clubs","\\clubsuit");Z("\\cnums","\\mathbb{C}");Z("\\Complex","\\mathbb{C}");Z("\\Dagger","\\ddagger");Z("\\diamonds","\\diamondsuit");Z("\\empty","\\emptyset");Z("\\Epsilon","\\mathrm{E}");Z("\\Eta","\\mathrm{H}");Z("\\exist","\\exists");Z("\\harr","\\leftrightarrow");Z("\\hArr","\\Leftrightarrow");Z("\\Harr","\\Leftrightarrow");Z("\\hearts","\\heartsuit");Z("\\image","\\Im");Z("\\infin","\\infty");Z("\\Iota","\\mathrm{I}");Z("\\isin","\\in");Z("\\Kappa","\\mathrm{K}");Z("\\larr","\\leftarrow");Z("\\lArr","\\Leftarrow");Z("\\Larr","\\Leftarrow");Z("\\lrarr","\\leftrightarrow");Z("\\lrArr","\\Leftrightarrow");Z("\\Lrarr","\\Leftrightarrow");Z("\\Mu","\\mathrm{M}");Z("\\natnums","\\mathbb{N}");Z("\\Nu","\\mathrm{N}");Z("\\Omicron","\\mathrm{O}");Z("\\plusmn","\\pm");Z("\\rarr","\\rightarrow");Z("\\rArr","\\Rightarrow");Z("\\Rarr","\\Rightarrow");Z("\\real","\\Re");Z("\\reals","\\mathbb{R}");Z("\\Reals","\\mathbb{R}");Z("\\Rho","\\mathrm{P}");Z("\\sdot","\\cdot");Z("\\sect","\\S");Z("\\spades","\\spadesuit");Z("\\sub","\\subset");Z("\\sube","\\subseteq");Z("\\supe","\\supseteq");Z("\\Tau","\\mathrm{T}");Z("\\thetasym","\\vartheta");Z("\\weierp","\\wp");Z("\\Zeta","\\mathrm{Z}");Z("\\argmin","\\DOTSB\\operatorname*{arg\\,min}");Z("\\argmax","\\DOTSB\\operatorname*{arg\\,max}");Z("\\plim","\\DOTSB\\mathop{\\operatorname{plim}}\\limits");Z("\\bra","\\mathinner{\\langle{#1}|}");Z("\\ket","\\mathinner{|{#1}\\rangle}");Z("\\braket","\\mathinner{\\langle{#1}\\rangle}");Z("\\Bra","\\left\\langle#1\\right|");Z("\\Ket","\\left|#1\\right\\rangle");var IQ=t=>e=>{var n=e.consumeArg().tokens,r=e.consumeArg().tokens,s=e.consumeArg().tokens,i=e.consumeArg().tokens,a=e.macros.get("|"),o=e.macros.get("\\|");e.macros.beginGroup();var c=m=>g=>{t&&(g.macros.set("|",a),s.length&&g.macros.set("\\|",o));var x=m;if(!m&&s.length){var y=g.future();y.text==="|"&&(g.popToken(),x=!0)}return{tokens:x?s:r,numArgs:0}};e.macros.set("|",c(!1)),s.length&&e.macros.set("\\|",c(!0));var h=e.consumeArg().tokens,f=e.expandTokens([...i,...h,...n]);return e.macros.endGroup(),{tokens:f.reverse(),numArgs:0}};Z("\\bra@ket",IQ(!1));Z("\\bra@set",IQ(!0));Z("\\Braket","\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}");Z("\\Set","\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}");Z("\\set","\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}");Z("\\angln","{\\angl n}");Z("\\blue","\\textcolor{##6495ed}{#1}");Z("\\orange","\\textcolor{##ffa500}{#1}");Z("\\pink","\\textcolor{##ff00af}{#1}");Z("\\red","\\textcolor{##df0030}{#1}");Z("\\green","\\textcolor{##28ae7b}{#1}");Z("\\gray","\\textcolor{gray}{#1}");Z("\\purple","\\textcolor{##9d38bd}{#1}");Z("\\blueA","\\textcolor{##ccfaff}{#1}");Z("\\blueB","\\textcolor{##80f6ff}{#1}");Z("\\blueC","\\textcolor{##63d9ea}{#1}");Z("\\blueD","\\textcolor{##11accd}{#1}");Z("\\blueE","\\textcolor{##0c7f99}{#1}");Z("\\tealA","\\textcolor{##94fff5}{#1}");Z("\\tealB","\\textcolor{##26edd5}{#1}");Z("\\tealC","\\textcolor{##01d1c1}{#1}");Z("\\tealD","\\textcolor{##01a995}{#1}");Z("\\tealE","\\textcolor{##208170}{#1}");Z("\\greenA","\\textcolor{##b6ffb0}{#1}");Z("\\greenB","\\textcolor{##8af281}{#1}");Z("\\greenC","\\textcolor{##74cf70}{#1}");Z("\\greenD","\\textcolor{##1fab54}{#1}");Z("\\greenE","\\textcolor{##0d923f}{#1}");Z("\\goldA","\\textcolor{##ffd0a9}{#1}");Z("\\goldB","\\textcolor{##ffbb71}{#1}");Z("\\goldC","\\textcolor{##ff9c39}{#1}");Z("\\goldD","\\textcolor{##e07d10}{#1}");Z("\\goldE","\\textcolor{##a75a05}{#1}");Z("\\redA","\\textcolor{##fca9a9}{#1}");Z("\\redB","\\textcolor{##ff8482}{#1}");Z("\\redC","\\textcolor{##f9685d}{#1}");Z("\\redD","\\textcolor{##e84d39}{#1}");Z("\\redE","\\textcolor{##bc2612}{#1}");Z("\\maroonA","\\textcolor{##ffbde0}{#1}");Z("\\maroonB","\\textcolor{##ff92c6}{#1}");Z("\\maroonC","\\textcolor{##ed5fa6}{#1}");Z("\\maroonD","\\textcolor{##ca337c}{#1}");Z("\\maroonE","\\textcolor{##9e034e}{#1}");Z("\\purpleA","\\textcolor{##ddd7ff}{#1}");Z("\\purpleB","\\textcolor{##c6b9fc}{#1}");Z("\\purpleC","\\textcolor{##aa87ff}{#1}");Z("\\purpleD","\\textcolor{##7854ab}{#1}");Z("\\purpleE","\\textcolor{##543b78}{#1}");Z("\\mintA","\\textcolor{##f5f9e8}{#1}");Z("\\mintB","\\textcolor{##edf2df}{#1}");Z("\\mintC","\\textcolor{##e0e5cc}{#1}");Z("\\grayA","\\textcolor{##f6f7f7}{#1}");Z("\\grayB","\\textcolor{##f0f1f2}{#1}");Z("\\grayC","\\textcolor{##e3e5e6}{#1}");Z("\\grayD","\\textcolor{##d6d8da}{#1}");Z("\\grayE","\\textcolor{##babec2}{#1}");Z("\\grayF","\\textcolor{##888d93}{#1}");Z("\\grayG","\\textcolor{##626569}{#1}");Z("\\grayH","\\textcolor{##3b3e40}{#1}");Z("\\grayI","\\textcolor{##21242c}{#1}");Z("\\kaBlue","\\textcolor{##314453}{#1}");Z("\\kaGreen","\\textcolor{##71B307}{#1}");var BQ={"^":!0,_:!0,"\\limits":!0,"\\nolimits":!0};class O2e{constructor(e,n,r){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=n,this.expansionCount=0,this.feed(e),this.macros=new S2e(k2e,n.macros),this.mode=r,this.stack=[]}feed(e){this.lexer=new SM(e,this.settings)}switchMode(e){this.mode=e}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(e){this.stack.push(e)}pushTokens(e){this.stack.push(...e)}scanArgument(e){var n,r,s;if(e){if(this.consumeSpaces(),this.future().text!=="[")return null;n=this.popToken(),{tokens:s,end:r}=this.consumeArg(["]"])}else({tokens:s,start:n,end:r}=this.consumeArg());return this.pushToken(new Ai("EOF",r.loc)),this.pushTokens(s),new Ai("",Ys.range(n,r))}consumeSpaces(){for(;;){var e=this.future();if(e.text===" ")this.stack.pop();else break}}consumeArg(e){var n=[],r=e&&e.length>0;r||this.consumeSpaces();var s=this.future(),i,a=0,o=0;do{if(i=this.popToken(),n.push(i),i.text==="{")++a;else if(i.text==="}"){if(--a,a===-1)throw new Be("Extra }",i)}else if(i.text==="EOF")throw new Be("Unexpected end of input in a macro argument, expected '"+(e&&r?e[o]:"}")+"'",i);if(e&&r)if((a===0||a===1&&e[o]==="{")&&i.text===e[o]){if(++o,o===e.length){n.splice(-o,o);break}}else o=0}while(a!==0||r);return s.text==="{"&&n[n.length-1].text==="}"&&(n.pop(),n.shift()),n.reverse(),{tokens:n,start:s,end:i}}consumeArgs(e,n){if(n){if(n.length!==e+1)throw new Be("The length of delimiters doesn't match the number of args!");for(var r=n[0],s=0;sthis.settings.maxExpand)throw new Be("Too many expansions: infinite loop or need to increase maxExpand setting")}expandOnce(e){var n=this.popToken(),r=n.text,s=n.noexpand?null:this._getExpansion(r);if(s==null||e&&s.unexpandable){if(e&&s==null&&r[0]==="\\"&&!this.isDefined(r))throw new Be("Undefined control sequence: "+r);return this.pushToken(n),!1}this.countExpansion(1);var i=s.tokens,a=this.consumeArgs(s.numArgs,s.delimiters);if(s.numArgs){i=i.slice();for(var o=i.length-1;o>=0;--o){var c=i[o];if(c.text==="#"){if(o===0)throw new Be("Incomplete placeholder at end of macro body",c);if(c=i[--o],c.text==="#")i.splice(o+1,1);else if(/^[1-9]$/.test(c.text))i.splice(o,2,...a[+c.text-1]);else throw new Be("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 e=this.stack.pop();return e.treatAsRelax&&(e.text="\\relax"),e}throw new Error}expandMacro(e){return this.macros.has(e)?this.expandTokens([new Ai(e)]):void 0}expandTokens(e){var n=[],r=this.stack.length;for(this.pushTokens(e);this.stack.length>r;)if(this.expandOnce(!0)===!1){var s=this.stack.pop();s.treatAsRelax&&(s.noexpand=!1,s.treatAsRelax=!1),n.push(s)}return this.countExpansion(n.length),n}expandMacroAsText(e){var n=this.expandMacro(e);return n&&n.map(r=>r.text).join("")}_getExpansion(e){var n=this.macros.get(e);if(n==null)return n;if(e.length===1){var r=this.lexer.catcodes[e];if(r!=null&&r!==13)return}var s=typeof n=="function"?n(this):n;if(typeof s=="string"){var i=0;if(s.indexOf("#")!==-1)for(var a=s.replace(/##/g,"");a.indexOf("#"+(i+1))!==-1;)++i;for(var o=new SM(s,this.settings),c=[],h=o.lex();h.text!=="EOF";)c.push(h),h=o.lex();c.reverse();var f={tokens:c,numArgs:i};return f}return s}isDefined(e){return this.macros.has(e)||fc.hasOwnProperty(e)||Gn.math.hasOwnProperty(e)||Gn.text.hasOwnProperty(e)||BQ.hasOwnProperty(e)}isExpandable(e){var n=this.macros.get(e);return n!=null?typeof n=="string"||typeof n=="function"||!n.unexpandable:fc.hasOwnProperty(e)&&!fc[e].primitive}}var jM=/^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/,zx=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","ᵝ":"β","ᵞ":"γ","ᵟ":"δ","ᵠ":"ϕ","ᵡ":"χ","ᶿ":"θ"}),M4={"́":{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"}},NM={á:"á",à:"à",ä:"ä",ǟ:"ǟ",ã:"ã",ā:"ā",ă:"ă",ắ:"ắ",ằ:"ằ",ẵ:"ẵ",ǎ:"ǎ",â:"â",ấ:"ấ",ầ:"ầ",ẫ:"ẫ",ȧ:"ȧ",ǡ:"ǡ",å:"å",ǻ:"ǻ",ḃ:"ḃ",ć:"ć",ḉ:"ḉ",č:"č",ĉ:"ĉ",ċ:"ċ",ç:"ç",ď:"ď",ḋ:"ḋ",ḑ:"ḑ",é:"é",è:"è",ë:"ë",ẽ:"ẽ",ē:"ē",ḗ:"ḗ",ḕ:"ḕ",ĕ:"ĕ",ḝ:"ḝ",ě:"ě",ê:"ê",ế:"ế",ề:"ề",ễ:"ễ",ė:"ė",ȩ:"ȩ",ḟ:"ḟ",ǵ:"ǵ",ḡ:"ḡ",ğ:"ğ",ǧ:"ǧ",ĝ:"ĝ",ġ:"ġ",ģ:"ģ",ḧ:"ḧ",ȟ:"ȟ",ĥ:"ĥ",ḣ:"ḣ",ḩ:"ḩ",í:"í",ì:"ì",ï:"ï",ḯ:"ḯ",ĩ:"ĩ",ī:"ī",ĭ:"ĭ",ǐ:"ǐ",î:"î",ǰ:"ǰ",ĵ:"ĵ",ḱ:"ḱ",ǩ:"ǩ",ķ:"ķ",ĺ:"ĺ",ľ:"ľ",ļ:"ļ",ḿ:"ḿ",ṁ:"ṁ",ń:"ń",ǹ:"ǹ",ñ:"ñ",ň:"ň",ṅ:"ṅ",ņ:"ņ",ó:"ó",ò:"ò",ö:"ö",ȫ:"ȫ",õ:"õ",ṍ:"ṍ",ṏ:"ṏ",ȭ:"ȭ",ō:"ō",ṓ:"ṓ",ṑ:"ṑ",ŏ:"ŏ",ǒ:"ǒ",ô:"ô",ố:"ố",ồ:"ồ",ỗ:"ỗ",ȯ:"ȯ",ȱ:"ȱ",ő:"ő",ṕ:"ṕ",ṗ:"ṗ",ŕ:"ŕ",ř:"ř",ṙ:"ṙ",ŗ:"ŗ",ś:"ś",ṥ:"ṥ",š:"š",ṧ:"ṧ",ŝ:"ŝ",ṡ:"ṡ",ş:"ş",ẗ:"ẗ",ť:"ť",ṫ:"ṫ",ţ:"ţ",ú:"ú",ù:"ù",ü:"ü",ǘ:"ǘ",ǜ:"ǜ",ǖ:"ǖ",ǚ:"ǚ",ũ:"ũ",ṹ:"ṹ",ū:"ū",ṻ:"ṻ",ŭ:"ŭ",ǔ:"ǔ",û:"û",ů:"ů",ű:"ű",ṽ:"ṽ",ẃ:"ẃ",ẁ:"ẁ",ẅ:"ẅ",ŵ:"ŵ",ẇ:"ẇ",ẘ:"ẘ",ẍ:"ẍ",ẋ:"ẋ",ý:"ý",ỳ:"ỳ",ÿ:"ÿ",ỹ:"ỹ",ȳ:"ȳ",ŷ:"ŷ",ẏ:"ẏ",ẙ:"ẙ",ź:"ź",ž:"ž",ẑ:"ẑ",ż:"ż",Á:"Á",À:"À",Ä:"Ä",Ǟ:"Ǟ",Ã:"Ã",Ā:"Ā",Ă:"Ă",Ắ:"Ắ",Ằ:"Ằ",Ẵ:"Ẵ",Ǎ:"Ǎ",Â:"Â",Ấ:"Ấ",Ầ:"Ầ",Ẫ:"Ẫ",Ȧ:"Ȧ",Ǡ:"Ǡ",Å:"Å",Ǻ:"Ǻ",Ḃ:"Ḃ",Ć:"Ć",Ḉ:"Ḉ",Č:"Č",Ĉ:"Ĉ",Ċ:"Ċ",Ç:"Ç",Ď:"Ď",Ḋ:"Ḋ",Ḑ:"Ḑ",É:"É",È:"È",Ë:"Ë",Ẽ:"Ẽ",Ē:"Ē",Ḗ:"Ḗ",Ḕ:"Ḕ",Ĕ:"Ĕ",Ḝ:"Ḝ",Ě:"Ě",Ê:"Ê",Ế:"Ế",Ề:"Ề",Ễ:"Ễ",Ė:"Ė",Ȩ:"Ȩ",Ḟ:"Ḟ",Ǵ:"Ǵ",Ḡ:"Ḡ",Ğ:"Ğ",Ǧ:"Ǧ",Ĝ:"Ĝ",Ġ:"Ġ",Ģ:"Ģ",Ḧ:"Ḧ",Ȟ:"Ȟ",Ĥ:"Ĥ",Ḣ:"Ḣ",Ḩ:"Ḩ",Í:"Í",Ì:"Ì",Ï:"Ï",Ḯ:"Ḯ",Ĩ:"Ĩ",Ī:"Ī",Ĭ:"Ĭ",Ǐ:"Ǐ",Î:"Î",İ:"İ",Ĵ:"Ĵ",Ḱ:"Ḱ",Ǩ:"Ǩ",Ķ:"Ķ",Ĺ:"Ĺ",Ľ:"Ľ",Ļ:"Ļ",Ḿ:"Ḿ",Ṁ:"Ṁ",Ń:"Ń",Ǹ:"Ǹ",Ñ:"Ñ",Ň:"Ň",Ṅ:"Ṅ",Ņ:"Ņ",Ó:"Ó",Ò:"Ò",Ö:"Ö",Ȫ:"Ȫ",Õ:"Õ",Ṍ:"Ṍ",Ṏ:"Ṏ",Ȭ:"Ȭ",Ō:"Ō",Ṓ:"Ṓ",Ṑ:"Ṑ",Ŏ:"Ŏ",Ǒ:"Ǒ",Ô:"Ô",Ố:"Ố",Ồ:"Ồ",Ỗ:"Ỗ",Ȯ:"Ȯ",Ȱ:"Ȱ",Ő:"Ő",Ṕ:"Ṕ",Ṗ:"Ṗ",Ŕ:"Ŕ",Ř:"Ř",Ṙ:"Ṙ",Ŗ:"Ŗ",Ś:"Ś",Ṥ:"Ṥ",Š:"Š",Ṧ:"Ṧ",Ŝ:"Ŝ",Ṡ:"Ṡ",Ş:"Ş",Ť:"Ť",Ṫ:"Ṫ",Ţ:"Ţ",Ú:"Ú",Ù:"Ù",Ü:"Ü",Ǘ:"Ǘ",Ǜ:"Ǜ",Ǖ:"Ǖ",Ǚ:"Ǚ",Ũ:"Ũ",Ṹ:"Ṹ",Ū:"Ū",Ṻ:"Ṻ",Ŭ:"Ŭ",Ǔ:"Ǔ",Û:"Û",Ů:"Ů",Ű:"Ű",Ṽ:"Ṽ",Ẃ:"Ẃ",Ẁ:"Ẁ",Ẅ:"Ẅ",Ŵ:"Ŵ",Ẇ:"Ẇ",Ẍ:"Ẍ",Ẋ:"Ẋ",Ý:"Ý",Ỳ:"Ỳ",Ÿ:"Ÿ",Ỹ:"Ỹ",Ȳ:"Ȳ",Ŷ:"Ŷ",Ẏ:"Ẏ",Ź:"Ź",Ž:"Ž",Ẑ:"Ẑ",Ż:"Ż",ά:"ά",ὰ:"ὰ",ᾱ:"ᾱ",ᾰ:"ᾰ",έ:"έ",ὲ:"ὲ",ή:"ή",ὴ:"ὴ",ί:"ί",ὶ:"ὶ",ϊ:"ϊ",ΐ:"ΐ",ῒ:"ῒ",ῑ:"ῑ",ῐ:"ῐ",ό:"ό",ὸ:"ὸ",ύ:"ύ",ὺ:"ὺ",ϋ:"ϋ",ΰ:"ΰ",ῢ:"ῢ",ῡ:"ῡ",ῠ:"ῠ",ώ:"ώ",ὼ:"ὼ",Ύ:"Ύ",Ὺ:"Ὺ",Ϋ:"Ϋ",Ῡ:"Ῡ",Ῠ:"Ῠ",Ώ:"Ώ",Ὼ:"Ὼ"};class jy{constructor(e,n){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 O2e(e,n,this.mode),this.settings=n,this.leftrightDepth=0}expect(e,n){if(n===void 0&&(n=!0),this.fetch().text!==e)throw new Be("Expected '"+e+"', got '"+this.fetch().text+"'",this.fetch());n&&this.consume()}consume(){this.nextToken=null}fetch(){return this.nextToken==null&&(this.nextToken=this.gullet.expandNextToken()),this.nextToken}switchMode(e){this.mode=e,this.gullet.switchMode(e)}parse(){this.settings.globalGroup||this.gullet.beginGroup(),this.settings.colorIsTextColor&&this.gullet.macros.set("\\color","\\textcolor");try{var e=this.parseExpression(!1);return this.expect("EOF"),this.settings.globalGroup||this.gullet.endGroup(),e}finally{this.gullet.endGroups()}}subparse(e){var n=this.nextToken;this.consume(),this.gullet.pushToken(new Ai("}")),this.gullet.pushTokens(e);var r=this.parseExpression(!1);return this.expect("}"),this.nextToken=n,r}parseExpression(e,n){for(var r=[];;){this.mode==="math"&&this.consumeSpaces();var s=this.fetch();if(jy.endOfExpression.indexOf(s.text)!==-1||n&&s.text===n||e&&fc[s.text]&&fc[s.text].infix)break;var i=this.parseAtom(n);if(i){if(i.type==="internal")continue}else break;r.push(i)}return this.mode==="text"&&this.formLigatures(r),this.handleInfixNodes(r)}handleInfixNodes(e){for(var n=-1,r,s=0;s=0&&this.settings.reportNonstrict("unicodeTextInMathMode",'Latin-1/Unicode text character "'+n[0]+'" used in math mode',e);var o=Gn[this.mode][n].group,c=Ys.range(e),h;if(hbe.hasOwnProperty(o)){var f=o;h={type:"atom",mode:this.mode,family:f,loc:c,text:n}}else h={type:o,mode:this.mode,loc:c,text:n};a=h}else if(n.charCodeAt(0)>=128)this.settings.strict&&(G$(n.charCodeAt(0))?this.mode==="math"&&this.settings.reportNonstrict("unicodeTextInMathMode",'Unicode text character "'+n[0]+'" used in math mode',e):this.settings.reportNonstrict("unknownSymbol",'Unrecognized Unicode character "'+n[0]+'"'+(" ("+n.charCodeAt(0)+")"),e)),a={type:"textord",mode:"text",loc:Ys.range(e),text:n};else return null;if(this.consume(),i)for(var m=0;mh&&(h=f):f&&(h!==void 0&&h>-1&&c.push(` +`.repeat(h)||" "),h=-1,c.push(f))}return c.join("")}function UQ(t,e,n){return t.type==="element"?twe(t,e,n):t.type==="text"?n.whitespace==="normal"?WQ(t,n):nwe(t):[]}function twe(t,e,n){const r=GQ(t,n),s=t.children||[];let i=-1,a=[];if(J2e(t))return a;let o,c;for(mk(t)||zM(t)&&MM(e,t,zM)?c=` +`:Z2e(t)?(o=2,c=2):VQ(t)&&(o=1,c=1);++i{try{i(!0);const je=await hwe({page:a,page_size:f,is_registered:g==="all"?void 0:g==="registered",is_banned:y==="all"?void 0:y==="banned",format:S==="all"?void 0:S,sort_by:N,sort_order:T});e(je.data),h(je.total)}catch(je){const Qe=je instanceof Error?je.message:"加载表情包列表失败";G({title:"错误",description:Qe,variant:"destructive"})}finally{i(!1)}},[a,f,g,y,S,N,T,G]),U=async()=>{try{const je=await gwe();r(je.data)}catch(je){console.error("加载统计数据失败:",je)}};b.useEffect(()=>{F()},[F]),b.useEffect(()=>{U()},[]);const te=async je=>{try{const Qe=await fwe(je.id);M(Qe.data),L(!0)}catch(Qe){const He=Qe instanceof Error?Qe.message:"加载详情失败";G({title:"错误",description:He,variant:"destructive"})}},ne=je=>{M(je),$(!0)},Y=je=>{M(je),ee(!0)},ae=async()=>{if(E)try{await pwe(E.id),G({title:"成功",description:"表情包已删除"}),ee(!1),M(null),F(),U()}catch(je){const Qe=je instanceof Error?je.message:"删除失败";G({title:"错误",description:Qe,variant:"destructive"})}},re=async je=>{try{await xwe(je.id),G({title:"成功",description:"表情包已注册"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"注册失败";G({title:"错误",description:He,variant:"destructive"})}},le=async je=>{try{await vwe(je.id),G({title:"成功",description:"表情包已封禁"}),F(),U()}catch(Qe){const He=Qe instanceof Error?Qe.message:"封禁失败";G({title:"错误",description:He,variant:"destructive"})}},_e=je=>{const Qe=new Set(z);Qe.has(je)?Qe.delete(je):Qe.add(je),H(Qe)},Ge=async()=>{try{const je=await ywe(Array.from(z));G({title:"批量删除完成",description:je.message}),H(new Set),W(!1),F(),U()}catch(je){G({title:"批量删除失败",description:je instanceof Error?je.message:"批量删除失败",variant:"destructive"})}},tt=()=>{const je=parseInt(J),Qe=Math.ceil(c/f);je>=1&&je<=Qe?(o(je),X("")):G({title:"无效的页码",description:`请输入1-${Qe}之间的页码`,variant:"destructive"})},Xe=n?.formats?Object.keys(n.formats):[];return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsxs("div",{className:"mb-4 sm:mb-6",children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"表情包管理"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理麦麦的表情包资源"})]}),l.jsx(on,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[n&&l.jsxs("div",{className:"grid gap-4 grid-cols-2 lg:grid-cols-4",children:[l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"总数"}),l.jsx(yn,{className:"text-2xl",children:n.total})]})}),l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"已注册"}),l.jsx(yn,{className:"text-2xl text-green-600",children:n.registered})]})}),l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"已封禁"}),l.jsx(yn,{className:"text-2xl text-red-600",children:n.banned})]})}),l.jsx(Tt,{children:l.jsxs(vn,{className:"pb-2",children:[l.jsx(zr,{children:"未注册"}),l.jsx(yn,{className:"text-2xl text-gray-600",children:n.unregistered})]})})]}),l.jsxs(Tt,{children:[l.jsx(vn,{children:l.jsxs(yn,{className:"flex items-center gap-2",children:[l.jsx(_3,{className:"h-5 w-5"}),"筛选和排序"]})}),l.jsxs(En,{className:"space-y-4",children:[l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"排序方式"}),l.jsxs(zt,{value:`${N}-${T}`,onValueChange:je=>{const[Qe,He]=je.split("-");C(Qe),_(He),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"usage_count-desc",children:"使用次数 (多→少)"}),l.jsx(ze,{value:"usage_count-asc",children:"使用次数 (少→多)"}),l.jsx(ze,{value:"register_time-desc",children:"注册时间 (新→旧)"}),l.jsx(ze,{value:"register_time-asc",children:"注册时间 (旧→新)"}),l.jsx(ze,{value:"record_time-desc",children:"记录时间 (新→旧)"}),l.jsx(ze,{value:"record_time-asc",children:"记录时间 (旧→新)"}),l.jsx(ze,{value:"last_used_time-desc",children:"最后使用 (新→旧)"}),l.jsx(ze,{value:"last_used_time-asc",children:"最后使用 (旧→新)"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"注册状态"}),l.jsxs(zt,{value:g,onValueChange:je=>{x(je),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"registered",children:"已注册"}),l.jsx(ze,{value:"unregistered",children:"未注册"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"封禁状态"}),l.jsxs(zt,{value:y,onValueChange:je=>{w(je),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"banned",children:"已封禁"}),l.jsx(ze,{value:"unbanned",children:"未封禁"})]})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"格式"}),l.jsxs(zt,{value:S,onValueChange:je=>{k(je),o(1)},children:[l.jsx(At,{children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),Xe.map(je=>l.jsxs(ze,{value:je,children:[je.toUpperCase()," (",n?.formats[je],")"]},je))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 pt-4 border-t",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[z.size>0&&l.jsxs("span",{className:"text-sm text-muted-foreground",children:["已选择 ",z.size," 个表情包"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{className:"text-sm whitespace-nowrap",children:"卡片大小"}),l.jsxs(zt,{value:R,onValueChange:je=>se(je),children:[l.jsx(At,{className:"w-24",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"small",children:"小"}),l.jsx(ze,{value:"medium",children:"中"}),l.jsx(ze,{value:"large",children:"大"})]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"emoji-page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:f.toString(),onValueChange:je=>{m(parseInt(je)),o(1),H(new Set)},children:[l.jsx(At,{id:"emoji-page-size",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"40",children:"40"}),l.jsx(ze,{value:"60",children:"60"}),l.jsx(ze,{value:"100",children:"100"})]})]}),z.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>H(new Set),children:"取消选择"}),l.jsxs(fe,{variant:"destructive",size:"sm",onClick:()=>W(!0),children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]}),l.jsx("div",{className:"flex justify-end pt-4 border-t",children:l.jsxs(fe,{variant:"outline",size:"sm",onClick:F,disabled:s,children:[l.jsx(ti,{className:`h-4 w-4 mr-2 ${s?"animate-spin":""}`}),"刷新"]})})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"表情包列表"}),l.jsxs(zr,{children:["共 ",c," 个表情包,当前第 ",a," 页"]})]}),l.jsxs(En,{children:[t.length===0?l.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"暂无数据"}):l.jsx("div",{className:`grid gap-3 ${R==="small"?"grid-cols-3 sm:grid-cols-4 md:grid-cols-6 lg:grid-cols-8 xl:grid-cols-10":R==="medium"?"grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 xl:grid-cols-8":"grid-cols-2 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5"}`,children:t.map(je=>l.jsxs("div",{className:`group relative rounded-lg border bg-card overflow-hidden hover:ring-2 hover:ring-primary transition-all cursor-pointer ${z.has(je.id)?"ring-2 ring-primary bg-primary/5":""}`,onClick:()=>_e(je.id),children:[l.jsx("div",{className:`absolute top-1 left-1 z-10 transition-opacity ${z.has(je.id)?"opacity-100":"opacity-0 group-hover:opacity-100"}`,children:l.jsx("div",{className:`w-5 h-5 rounded-full border-2 flex items-center justify-center ${z.has(je.id)?"bg-primary border-primary text-primary-foreground":"bg-background/80 border-muted-foreground/50"}`,children:z.has(je.id)&&l.jsx(xc,{className:"h-3 w-3"})})}),l.jsxs("div",{className:"absolute top-1 right-1 z-10 flex flex-col gap-0.5",children:[je.is_registered&&l.jsx(In,{variant:"default",className:"bg-green-600 text-[10px] px-1 py-0",children:"已注册"}),je.is_banned&&l.jsx(In,{variant:"destructive",className:"text-[10px] px-1 py-0",children:"已封禁"})]}),l.jsx("div",{className:`aspect-square bg-muted flex items-center justify-center overflow-hidden ${R==="small"?"p-1":R==="medium"?"p-2":"p-3"}`,children:l.jsx("img",{src:XQ(je.id),alt:"表情包",className:"w-full h-full object-contain",loading:"lazy",onError:Qe=>{const He=Qe.target;He.style.display="none";const $e=He.parentElement;$e&&($e.innerHTML='')}})}),l.jsxs("div",{className:`border-t bg-card ${R==="small"?"p-1":"p-2"}`,children:[l.jsxs("div",{className:"flex items-center justify-between gap-1 text-xs text-muted-foreground mb-1",children:[l.jsx(In,{variant:"outline",className:"text-[10px] px-1 py-0",children:je.format.toUpperCase()}),l.jsxs("span",{className:"font-mono",children:[je.usage_count,"次"]})]}),l.jsxs("div",{className:`flex gap-1 justify-center opacity-0 group-hover:opacity-100 transition-opacity ${R==="small"?"flex-wrap":""}`,children:[l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),ne(je)},title:"编辑",children:l.jsx($m,{className:"h-3 w-3"})}),l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:Qe=>{Qe.stopPropagation(),te(je)},title:"详情",children:l.jsx(Oa,{className:"h-3 w-3"})}),!je.is_registered&&l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-green-600 hover:text-green-700",onClick:Qe=>{Qe.stopPropagation(),re(je)},title:"注册",children:l.jsx(xc,{className:"h-3 w-3"})}),!je.is_banned&&l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-orange-600 hover:text-orange-700",onClick:Qe=>{Qe.stopPropagation(),le(je)},title:"封禁",children:l.jsx($K,{className:"h-3 w-3"})}),l.jsx(fe,{variant:"ghost",size:"icon",className:"h-6 w-6 text-red-600 hover:text-red-700",onClick:Qe=>{Qe.stopPropagation(),Y(je)},title:"删除",children:l.jsx(ln,{className:"h-3 w-3"})})]})]})]},je.id))}),c>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 mt-4",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["显示 ",(a-1)*f+1," 到"," ",Math.min(a*f,c)," 条,共 ",c," 条"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(je=>Math.max(1,je-1)),disabled:a===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:J,onChange:je=>X(je.target.value),onKeyDown:je=>je.key==="Enter"&&tt(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(c/f)}),l.jsx(fe,{variant:"outline",size:"sm",onClick:tt,disabled:!J,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(je=>je+1),disabled:a>=Math.ceil(c/f),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(c/f)),disabled:a>=Math.ceil(c/f),className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]})]}),l.jsx(wwe,{emoji:E,open:q,onOpenChange:L}),l.jsx(Swe,{emoji:E,open:I,onOpenChange:$,onSuccess:()=>{F(),U()}})]})}),l.jsx(wn,{open:P,onOpenChange:W,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["你确定要删除选中的 ",z.size," 个表情包吗?此操作不可撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:Ge,children:"确认删除"})]})]})}),l.jsx(fr,{open:V,onOpenChange:ee,children:l.jsxs(rr,{children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"确认删除"}),l.jsx(Ir,{children:"确定要删除这个表情包吗?此操作无法撤销。"})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>ee(!1),children:"取消"}),l.jsx(fe,{variant:"destructive",onClick:ae,children:"删除"})]})]})})]})}function wwe({emoji:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[90vh]",children:[l.jsx(sr,{children:l.jsx(ir,{children:"表情包详情"})}),l.jsx(on,{className:"max-h-[calc(90vh-8rem)] pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"flex justify-center",children:l.jsx("div",{className:"w-32 h-32 bg-muted rounded-lg flex items-center justify-center overflow-hidden",children:l.jsx("img",{src:XQ(t.id),alt:t.description||"表情包",className:"w-full h-full object-cover",onError:s=>{const i=s.target;i.style.display="none";const a=i.parentElement;a&&(a.innerHTML='')}})})}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"ID"}),l.jsx("div",{className:"mt-1 font-mono",children:t.id})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"格式"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:"outline",children:t.format.toUpperCase()})})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"文件路径"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.full_path})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"哈希值"}),l.jsx("div",{className:"mt-1 font-mono text-sm break-all bg-muted p-2 rounded",children:t.emoji_hash})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"描述"}),t.description?l.jsx("div",{className:"mt-1 rounded-lg border bg-muted/50 p-3",children:l.jsx(dwe,{className:"prose-sm",children:t.description})}):l.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:"-"})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"情绪"}),l.jsx("div",{className:"mt-1",children:t.emotion?l.jsx("span",{className:"text-sm",children:t.emotion}):l.jsx("span",{className:"text-sm text-muted-foreground",children:"-"})})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"状态"}),l.jsxs("div",{className:"mt-2 flex gap-2",children:[t.is_registered&&l.jsx(In,{variant:"default",className:"bg-green-600",children:"已注册"}),t.is_banned&&l.jsx(In,{variant:"destructive",children:"已封禁"}),!t.is_registered&&!t.is_banned&&l.jsx(In,{variant:"outline",children:"未注册"})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"使用次数"}),l.jsx("div",{className:"mt-1 font-mono text-lg",children:t.usage_count})]})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"记录时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.record_time)})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"注册时间"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.register_time)})]})]}),l.jsxs("div",{children:[l.jsx(de,{className:"text-muted-foreground",children:"最后使用"}),l.jsx("div",{className:"mt-1 text-sm",children:r(t.last_used_time)})]})]})})]})})}function Swe({emoji:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState(""),[a,o]=b.useState(!1),[c,h]=b.useState(!1),[f,m]=b.useState(!1),{toast:g}=Gr();b.useEffect(()=>{t&&(i(t.emotion||""),o(t.is_registered),h(t.is_banned))},[t]);const x=async()=>{if(t)try{m(!0);const y=s.split(/[,,]/).map(w=>w.trim()).filter(Boolean).join(",");await mwe(t.id,{emotion:y||void 0,is_registered:a,is_banned:c}),g({title:"成功",description:"表情包信息已更新"}),n(!1),r()}catch(y){const w=y instanceof Error?y.message:"保存失败";g({title:"错误",description:w,variant:"destructive"})}finally{m(!1)}};return t?l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑表情包"}),l.jsx(Ir,{children:"修改表情包的情绪和状态信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(de,{children:"情绪"}),l.jsx(dr,{value:s,onChange:y=>i(y.target.value),placeholder:"输入情绪描述...",rows:2,className:"mt-1"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"输入情绪相关的文本描述"})]}),l.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ii,{id:"is_registered",checked:a,onCheckedChange:y=>{y===!0?(o(!0),h(!1)):o(!1)}}),l.jsx(de,{htmlFor:"is_registered",className:"cursor-pointer",children:"已注册"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ii,{id:"is_banned",checked:c,onCheckedChange:y=>{y===!0?(h(!0),o(!1)):h(!1)}}),l.jsx(de,{htmlFor:"is_banned",className:"cursor-pointer",children:"已封禁"})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(fe,{onClick:x,disabled:f,children:f?"保存中...":"保存"})]})]})}):null}const Pc="/api/webui/expression";async function kwe(){const t=await mt(`${Pc}/chats`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取聊天列表失败")}return t.json()}async function Owe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.chat_id&&e.append("chat_id",t.chat_id);const n=await mt(`${Pc}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取表达方式列表失败")}return n.json()}async function jwe(t){const e=await mt(`${Pc}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取表达方式详情失败")}return e.json()}async function Nwe(t){const e=await mt(`${Pc}/`,{method:"POST",headers:Nt(),body:JSON.stringify(t)});if(!e.ok){const n=await e.json();throw new Error(n.detail||"创建表达方式失败")}return e.json()}async function Cwe(t,e){const n=await mt(`${Pc}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新表达方式失败")}return n.json()}async function Twe(t){const e=await mt(`${Pc}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除表达方式失败")}return e.json()}async function Ewe(t){const e=await mt(`${Pc}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除表达方式失败")}return e.json()}async function _we(){const t=await mt(`${Pc}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}function Mwe(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(null),[y,w]=b.useState(!1),[S,k]=b.useState(!1),[N,C]=b.useState(!1),[T,_]=b.useState(null),[E,M]=b.useState(new Set),[q,L]=b.useState(!1),[I,$]=b.useState(""),[V,ee]=b.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[z,H]=b.useState([]),[P,W]=b.useState(new Map),{toast:J}=Gr(),X=async()=>{try{r(!0);const le=await Owe({page:a,page_size:c,search:f||void 0});e(le.data),i(le.total)}catch(le){J({title:"加载失败",description:le instanceof Error?le.message:"无法加载表达方式",variant:"destructive"})}finally{r(!1)}},R=async()=>{try{const le=await _we();le?.data&&ee(le.data)}catch(le){console.error("加载统计数据失败:",le)}},se=async()=>{try{const le=await kwe();if(le?.data){H(le.data);const _e=new Map;le.data.forEach(Ge=>{_e.set(Ge.chat_id,Ge.chat_name)}),W(_e)}}catch(le){console.error("加载聊天列表失败:",le)}},G=le=>P.get(le)||le;b.useEffect(()=>{X(),R(),se()},[a,c,f]);const F=async le=>{try{const _e=await jwe(le.id);x(_e.data),w(!0)}catch(_e){J({title:"加载详情失败",description:_e instanceof Error?_e.message:"无法加载表达方式详情",variant:"destructive"})}},U=le=>{x(le),k(!0)},te=async le=>{try{await Twe(le.id),J({title:"删除成功",description:`已删除表达方式: ${le.situation}`}),_(null),X(),R()}catch(_e){J({title:"删除失败",description:_e instanceof Error?_e.message:"无法删除表达方式",variant:"destructive"})}},ne=le=>{const _e=new Set(E);_e.has(le)?_e.delete(le):_e.add(le),M(_e)},Y=()=>{E.size===t.length&&t.length>0?M(new Set):M(new Set(t.map(le=>le.id)))},ae=async()=>{try{await Ewe(Array.from(E)),J({title:"批量删除成功",description:`已删除 ${E.size} 个表达方式`}),M(new Set),L(!1),X(),R()}catch(le){J({title:"批量删除失败",description:le instanceof Error?le.message:"无法批量删除表达方式",variant:"destructive"})}},re=()=>{const le=parseInt(I),_e=Math.ceil(s/c);le>=1&&le<=_e?(o(le),$("")):J({title:"无效的页码",description:`请输入1-${_e}之间的页码`,variant:"destructive"})};return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(A0,{className:"h-8 w-8",strokeWidth:2}),"表达方式管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),l.jsxs(fe,{onClick:()=>C(!0),className:"gap-2",children:[l.jsx(gs,{className:"h-4 w-4"}),"新增表达方式"]})]})}),l.jsx(on,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:V.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:V.recent_7days})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:V.chat_count})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx(de,{htmlFor:"search",children:"搜索"}),l.jsx("div",{className:"flex flex-col sm:flex-row gap-2 mt-1.5",children:l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(li,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{id:"search",placeholder:"搜索情境、风格或上下文...",value:f,onChange:le=>m(le.target.value),className:"pl-9"})]})}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:E.size>0&&l.jsxs("span",{children:["已选择 ",E.size," 个表达方式"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:c.toString(),onValueChange:le=>{h(parseInt(le)),o(1),M(new Set)},children:[l.jsx(At,{id:"page-size",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),E.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>M(new Set),children:"取消选择"}),l.jsxs(fe,{variant:"destructive",size:"sm",onClick:()=>L(!0),children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:E.size===t.length&&t.length>0,onCheckedChange:Y})}),l.jsx(tn,{children:"情境"}),l.jsx(tn,{children:"风格"}),l.jsx(tn,{children:"聊天"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n?l.jsx(ps,{children:l.jsx(It,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(le=>l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:E.has(le.id),onCheckedChange:()=>ne(le.id)})}),l.jsx(It,{className:"font-medium max-w-xs truncate",children:le.situation}),l.jsx(It,{className:"max-w-xs truncate",children:le.style}),l.jsx(It,{className:"max-w-[200px] truncate",title:G(le.chat_id),style:{wordBreak:"keep-all"},children:l.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:G(le.chat_id)})}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>U(le),children:[l.jsx($m,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(fe,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>F(le),title:"查看详情",children:l.jsx(aa,{className:"h-4 w-4"})}),l.jsxs(fe,{size:"sm",onClick:()=>_(le),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},le.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(le=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ii,{checked:E.has(le.id),onCheckedChange:()=>ne(le.id),className:"mt-1"}),l.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:le.situation,children:le.situation})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),l.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:le.style,children:le.style})]})]})]}),l.jsxs("div",{className:"text-sm",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),l.jsx("p",{className:"text-sm truncate",title:G(le.chat_id),style:{wordBreak:"keep-all"},children:G(le.chat_id)})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>U(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx($m,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>F(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:l.jsx(aa,{className:"h-3 w-3"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>_(le),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(ln,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},le.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:I,onChange:le=>$(le.target.value),onKeyDown:le=>le.key==="Enter"&&re(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),l.jsx(fe,{variant:"outline",size:"sm",onClick:re,disabled:!I,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/c),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Awe,{expression:g,open:y,onOpenChange:w,chatNameMap:P}),l.jsx(Rwe,{open:N,onOpenChange:C,chatList:z,onSuccess:()=>{X(),R(),C(!1)}}),l.jsx(Dwe,{expression:g,open:S,onOpenChange:k,chatList:z,onSuccess:()=>{X(),R(),k(!1)}}),l.jsx(wn,{open:!!T,onOpenChange:()=>_(null),children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除表达方式 "',T?.situation,'" 吗? 此操作不可撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>T&&te(T),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(zwe,{open:q,onOpenChange:L,onConfirm:ae,count:E.size})]})}function Awe({expression:t,open:e,onOpenChange:n,chatNameMap:r}){if(!t)return null;const s=a=>a?new Date(a*1e3).toLocaleString("zh-CN"):"-",i=a=>r.get(a)||a;return l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"表达方式详情"}),l.jsx(Ir,{children:"查看表达方式的完整信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(om,{label:"情境",value:t.situation}),l.jsx(om,{label:"风格",value:t.style}),l.jsx(om,{label:"聊天",value:i(t.chat_id)}),l.jsx(om,{icon:M3,label:"记录ID",value:t.id.toString(),mono:!0})]}),l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsx(om,{icon:Yd,label:"创建时间",value:s(t.create_date)})})]}),l.jsx(ts,{children:l.jsx(fe,{onClick:()=>n(!1),children:"关闭"})})]})})}function om({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Rwe({open:t,onOpenChange:e,chatList:n,onSuccess:r}){const[s,i]=b.useState({situation:"",style:"",chat_id:""}),[a,o]=b.useState(!1),{toast:c}=Gr(),h=async()=>{if(!s.situation||!s.style||!s.chat_id){c({title:"验证失败",description:"请填写必填字段:情境、风格和聊天",variant:"destructive"});return}try{o(!0),await Nwe(s),c({title:"创建成功",description:"表达方式已创建"}),i({situation:"",style:"",chat_id:""}),r()}catch(f){c({title:"创建失败",description:f instanceof Error?f.message:"无法创建表达方式",variant:"destructive"})}finally{o(!1)}};return l.jsx(fr,{open:t,onOpenChange:e,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"新增表达方式"}),l.jsx(Ir,{children:"创建新的表达方式记录"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsxs(de,{htmlFor:"situation",children:["情境 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Pe,{id:"situation",value:s.situation,onChange:f=>i({...s,situation:f.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(de,{htmlFor:"style",children:["风格 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsx(Pe,{id:"style",value:s.style,onChange:f=>i({...s,style:f.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs(de,{htmlFor:"chat_id",children:["聊天 ",l.jsx("span",{className:"text-destructive",children:"*"})]}),l.jsxs(zt,{value:s.chat_id,onValueChange:f=>i({...s,chat_id:f}),children:[l.jsx(At,{children:l.jsx(Pt,{placeholder:"选择关联的聊天"})}),l.jsx(Rt,{children:n.map(f=>l.jsx(ze,{value:f.chat_id,children:l.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[f.chat_name,f.is_group&&l.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},f.chat_id))})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>e(!1),children:"取消"}),l.jsx(fe,{onClick:h,disabled:a,children:a?"创建中...":"创建"})]})]})})}function Dwe({expression:t,open:e,onOpenChange:n,chatList:r,onSuccess:s}){const[i,a]=b.useState({}),[o,c]=b.useState(!1),{toast:h}=Gr();b.useEffect(()=>{t&&a({situation:t.situation,style:t.style,chat_id:t.chat_id})},[t]);const f=async()=>{if(t)try{c(!0),await Cwe(t.id,i),h({title:"保存成功",description:"表达方式已更新"}),s()}catch(m){h({title:"保存失败",description:m instanceof Error?m.message:"无法更新表达方式",variant:"destructive"})}finally{c(!1)}};return t?l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑表达方式"}),l.jsx(Ir,{children:"修改表达方式的信息"})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit_situation",children:"情境"}),l.jsx(Pe,{id:"edit_situation",value:i.situation||"",onChange:m=>a({...i,situation:m.target.value}),placeholder:"描述使用场景"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit_style",children:"风格"}),l.jsx(Pe,{id:"edit_style",value:i.style||"",onChange:m=>a({...i,style:m.target.value}),placeholder:"描述表达风格"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit_chat_id",children:"聊天"}),l.jsxs(zt,{value:i.chat_id||"",onValueChange:m=>a({...i,chat_id:m}),children:[l.jsx(At,{children:l.jsx(Pt,{placeholder:"选择关联的聊天"})}),l.jsx(Rt,{children:r.map(m=>l.jsx(ze,{value:m.chat_id,children:l.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[m.chat_name,m.is_group&&l.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},m.chat_id))})]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(fe,{onClick:f,disabled:o,children:o?"保存中...":"保存"})]})]})}):null}function zwe({open:t,onOpenChange:e,onConfirm:n,count:r}){return l.jsx(wn,{open:t,onOpenChange:e,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["您即将删除 ",r," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:n,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}const tf="/api/webui/person";async function Pwe(t){const e=new URLSearchParams;t.page&&e.append("page",t.page.toString()),t.page_size&&e.append("page_size",t.page_size.toString()),t.search&&e.append("search",t.search),t.is_known!==void 0&&e.append("is_known",t.is_known.toString()),t.platform&&e.append("platform",t.platform);const n=await mt(`${tf}/list?${e}`,{headers:Nt()});if(!n.ok){const r=await n.json();throw new Error(r.detail||"获取人物列表失败")}return n.json()}async function Lwe(t){const e=await mt(`${tf}/${t}`,{headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"获取人物详情失败")}return e.json()}async function Iwe(t,e){const n=await mt(`${tf}/${t}`,{method:"PATCH",headers:Nt(),body:JSON.stringify(e)});if(!n.ok){const r=await n.json();throw new Error(r.detail||"更新人物信息失败")}return n.json()}async function Bwe(t){const e=await mt(`${tf}/${t}`,{method:"DELETE",headers:Nt()});if(!e.ok){const n=await e.json();throw new Error(n.detail||"删除人物信息失败")}return e.json()}async function qwe(){const t=await mt(`${tf}/stats/summary`,{headers:Nt()});if(!t.ok){const e=await t.json();throw new Error(e.detail||"获取统计数据失败")}return t.json()}async function Fwe(t){const e=await mt(`${tf}/batch/delete`,{method:"POST",headers:Nt(),body:JSON.stringify({person_ids:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"批量删除失败")}return e.json()}function $we(){const[t,e]=b.useState([]),[n,r]=b.useState(!0),[s,i]=b.useState(0),[a,o]=b.useState(1),[c,h]=b.useState(20),[f,m]=b.useState(""),[g,x]=b.useState(void 0),[y,w]=b.useState(void 0),[S,k]=b.useState(null),[N,C]=b.useState(!1),[T,_]=b.useState(!1),[E,M]=b.useState(null),[q,L]=b.useState({total:0,known:0,unknown:0,platforms:{}}),[I,$]=b.useState(new Set),[V,ee]=b.useState(!1),[z,H]=b.useState(""),{toast:P}=Gr(),W=async()=>{try{r(!0);const re=await Pwe({page:a,page_size:c,search:f||void 0,is_known:g,platform:y});e(re.data),i(re.total)}catch(re){P({title:"加载失败",description:re instanceof Error?re.message:"无法加载人物信息",variant:"destructive"})}finally{r(!1)}},J=async()=>{try{const re=await qwe();re?.data&&L(re.data)}catch(re){console.error("加载统计数据失败:",re)}};b.useEffect(()=>{W(),J()},[a,c,f,g,y]);const X=async re=>{try{const le=await Lwe(re.person_id);k(le.data),C(!0)}catch(le){P({title:"加载详情失败",description:le instanceof Error?le.message:"无法加载人物详情",variant:"destructive"})}},R=re=>{k(re),_(!0)},se=async re=>{try{await Bwe(re.person_id),P({title:"删除成功",description:`已删除人物信息: ${re.person_name||re.nickname||re.user_id}`}),M(null),W(),J()}catch(le){P({title:"删除失败",description:le instanceof Error?le.message:"无法删除人物信息",variant:"destructive"})}},G=b.useMemo(()=>Object.keys(q.platforms),[q.platforms]),F=re=>{const le=new Set(I);le.has(re)?le.delete(re):le.add(re),$(le)},U=()=>{I.size===t.length&&t.length>0?$(new Set):$(new Set(t.map(re=>re.person_id)))},te=()=>{if(I.size===0){P({title:"未选择任何人物",description:"请先选择要删除的人物",variant:"destructive"});return}ee(!0)},ne=async()=>{try{const re=await Fwe(Array.from(I));P({title:"批量删除完成",description:re.message}),$(new Set),ee(!1),W(),J()}catch(re){P({title:"批量删除失败",description:re instanceof Error?re.message:"批量删除失败",variant:"destructive"})}},Y=()=>{const re=parseInt(z),le=Math.ceil(s/c);re>=1&&re<=le?(o(re),H("")):P({title:"无效的页码",description:`请输入1-${le}之间的页码`,variant:"destructive"})},ae=re=>re?new Date(re*1e3).toLocaleString("zh-CN"):"-";return l.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[l.jsx("div",{className:"mb-4 sm:mb-6",children:l.jsx("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:l.jsxs("div",{children:[l.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[l.jsx(QK,{className:"h-8 w-8",strokeWidth:2}),"人物信息管理"]}),l.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦认识的所有人物信息"})]})})}),l.jsx(on,{className:"flex-1",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"总人数"}),l.jsx("div",{className:"text-2xl font-bold mt-1",children:q.total})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"已认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:q.known})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsx("div",{className:"text-sm text-muted-foreground",children:"未认识"}),l.jsx("div",{className:"text-2xl font-bold mt-1 text-muted-foreground",children:q.unknown})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[l.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"sm:col-span-2",children:[l.jsx(de,{htmlFor:"search",children:"搜索"}),l.jsxs("div",{className:"relative mt-1.5",children:[l.jsx(li,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{id:"search",placeholder:"搜索名称、昵称或用户ID...",value:f,onChange:re=>m(re.target.value),className:"pl-9"})]})]}),l.jsxs("div",{children:[l.jsx(de,{htmlFor:"filter-known",children:"认识状态"}),l.jsxs(zt,{value:g===void 0?"all":g.toString(),onValueChange:re=>{x(re==="all"?void 0:re==="true"),o(1)},children:[l.jsx(At,{id:"filter-known",className:"mt-1.5",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部"}),l.jsx(ze,{value:"true",children:"已认识"}),l.jsx(ze,{value:"false",children:"未认识"})]})]})]}),l.jsxs("div",{children:[l.jsx(de,{htmlFor:"filter-platform",children:"平台"}),l.jsxs(zt,{value:y||"all",onValueChange:re=>{w(re==="all"?void 0:re),o(1)},children:[l.jsx(At,{id:"filter-platform",className:"mt-1.5",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部平台"}),G.map(re=>l.jsxs(ze,{value:re,children:[re," (",q.platforms[re],")"]},re))]})]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[l.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:I.size>0&&l.jsxs("span",{children:["已选择 ",I.size," 个人物"]})}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(de,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),l.jsxs(zt,{value:c.toString(),onValueChange:re=>{h(parseInt(re)),o(1),$(new Set)},children:[l.jsx(At,{id:"page-size",className:"w-20",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"10",children:"10"}),l.jsx(ze,{value:"20",children:"20"}),l.jsx(ze,{value:"50",children:"50"}),l.jsx(ze,{value:"100",children:"100"})]})]}),I.size>0&&l.jsxs(l.Fragment,{children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>$(new Set),children:"取消选择"}),l.jsxs(fe,{variant:"destructive",size:"sm",onClick:te,children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})]})]})]}),l.jsxs("div",{className:"rounded-lg border bg-card",children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{className:"w-12",children:l.jsx(ii,{checked:t.length>0&&I.size===t.length,onCheckedChange:U,"aria-label":"全选"})}),l.jsx(tn,{children:"状态"}),l.jsx(tn,{children:"名称"}),l.jsx(tn,{children:"昵称"}),l.jsx(tn,{children:"平台"}),l.jsx(tn,{children:"用户ID"}),l.jsx(tn,{children:"最后更新"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n?l.jsx(ps,{children:l.jsx(It,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?l.jsx(ps,{children:l.jsx(It,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(re=>l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(ii,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),"aria-label":`选择 ${re.person_name||re.nickname||re.user_id}`})}),l.jsx(It,{children:l.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"})}),l.jsx(It,{className:"font-medium",children:re.person_name||l.jsx("span",{className:"text-muted-foreground",children:"-"})}),l.jsx(It,{children:re.nickname||"-"}),l.jsx(It,{children:re.platform}),l.jsx(It,{className:"font-mono text-sm",children:re.user_id}),l.jsx(It,{className:"text-sm text-muted-foreground",children:ae(re.last_know)}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>X(re),children:[l.jsx(aa,{className:"h-4 w-4 mr-1"}),"详情"]}),l.jsxs(fe,{variant:"default",size:"sm",onClick:()=>R(re),children:[l.jsx($m,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsxs(fe,{size:"sm",onClick:()=>M(re),className:"bg-red-600 hover:bg-red-700 text-white",children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},re.id))})]})}),l.jsx("div",{className:"md:hidden space-y-3 p-4",children:n?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?l.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(re=>l.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ii,{checked:I.has(re.person_id),onCheckedChange:()=>F(re.person_id),className:"mt-1"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:ye("inline-flex items-center gap-1 px-2 py-1 rounded-full text-xs font-medium mb-2",re.is_known?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400"),children:re.is_known?"已认识":"未认识"}),l.jsx("h3",{className:"font-semibold text-sm line-clamp-1 w-full break-all",children:re.person_name||l.jsx("span",{className:"text-muted-foreground",children:"未命名"})}),re.nickname&&l.jsxs("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-1 w-full break-all",children:["昵称: ",re.nickname]})]})]}),l.jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"平台"}),l.jsx("p",{className:"font-medium text-xs",children:re.platform})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"用户ID"}),l.jsx("p",{className:"font-mono text-xs truncate",title:re.user_id,children:re.user_id})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"最后更新"}),l.jsx("p",{className:"text-xs",children:ae(re.last_know)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>X(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx(aa,{className:"h-3 w-3 mr-1"}),"查看"]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>R(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[l.jsx($m,{className:"h-3 w-3 mr-1"}),"编辑"]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>M(re),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[l.jsx(ln,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},re.id))}),s>0&&l.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[l.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",s," 条记录,第 ",a," / ",Math.ceil(s/c)," 页"]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(1),disabled:a===1,className:"hidden sm:flex",children:l.jsx(D0,{className:"h-4 w-4"})}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a-1),disabled:a===1,children:[l.jsx(qu,{className:"h-4 w-4 sm:mr-1"}),l.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Pe,{type:"number",value:z,onChange:re=>H(re.target.value),onKeyDown:re=>re.key==="Enter"&&Y(),placeholder:a.toString(),className:"w-16 h-8 text-center",min:1,max:Math.ceil(s/c)}),l.jsx(fe,{variant:"outline",size:"sm",onClick:Y,disabled:!z,className:"h-8",children:"跳转"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:()=>o(a+1),disabled:a>=Math.ceil(s/c),children:[l.jsx("span",{className:"hidden sm:inline",children:"下一页"}),l.jsx(Fu,{className:"h-4 w-4 sm:ml-1"})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>o(Math.ceil(s/c)),disabled:a>=Math.ceil(s/c),className:"hidden sm:flex",children:l.jsx(z0,{className:"h-4 w-4"})})]})]})]})]})}),l.jsx(Qwe,{person:S,open:N,onOpenChange:C}),l.jsx(Hwe,{person:S,open:T,onOpenChange:_,onSuccess:()=>{W(),J(),_(!1)}}),l.jsx(wn,{open:!!E,onOpenChange:()=>M(null),children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认删除"}),l.jsxs(mn,{children:['确定要删除人物信息 "',E?.person_name||E?.nickname||E?.user_id,'" 吗? 此操作不可撤销。']})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:()=>E&&se(E),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})}),l.jsx(wn,{open:V,onOpenChange:ee,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"确认批量删除"}),l.jsxs(mn,{children:["确定要删除选中的 ",I.size," 个人物信息吗? 此操作不可撤销。"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{children:"取消"}),l.jsx(pn,{onClick:ne,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"批量删除"})]})]})})]})}function Qwe({person:t,open:e,onOpenChange:n}){if(!t)return null;const r=s=>s?new Date(s*1e3).toLocaleString("zh-CN"):"-";return l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"人物详情"}),l.jsxs(Ir,{children:["查看 ",t.person_name||t.nickname||t.user_id," 的完整信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsx(Vl,{icon:rz,label:"人物名称",value:t.person_name}),l.jsx(Vl,{icon:A0,label:"昵称",value:t.nickname}),l.jsx(Vl,{icon:M3,label:"用户ID",value:t.user_id,mono:!0}),l.jsx(Vl,{icon:M3,label:"人物ID",value:t.person_id,mono:!0}),l.jsx(Vl,{label:"平台",value:t.platform}),l.jsx(Vl,{label:"状态",value:t.is_known?"已认识":"未认识"})]}),t.name_reason&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(de,{className:"text-xs text-muted-foreground",children:"名称设定原因"}),l.jsx("p",{className:"mt-1 text-sm",children:t.name_reason})]}),t.memory_points&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(de,{className:"text-xs text-muted-foreground",children:"个人印象"}),l.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t.memory_points})]}),t.group_nick_name&&t.group_nick_name.length>0&&l.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[l.jsx(de,{className:"text-xs text-muted-foreground",children:"群昵称"}),l.jsx("div",{className:"mt-2 space-y-1",children:t.group_nick_name.map((s,i)=>l.jsxs("div",{className:"text-sm flex items-center gap-2",children:[l.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:s.group_id}),l.jsx("span",{children:"→"}),l.jsx("span",{children:s.group_nick_name})]},i))})]}),l.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[l.jsx(Vl,{icon:Yd,label:"认识时间",value:r(t.know_times)}),l.jsx(Vl,{icon:Yd,label:"首次记录",value:r(t.know_since)}),l.jsx(Vl,{icon:Yd,label:"最后更新",value:r(t.last_know)})]})]}),l.jsx(ts,{children:l.jsx(fe,{onClick:()=>n(!1),children:"关闭"})})]})})}function Vl({icon:t,label:e,value:n,mono:r=!1}){return l.jsxs("div",{className:"space-y-1",children:[l.jsxs(de,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&l.jsx(t,{className:"h-3 w-3"}),e]}),l.jsx("div",{className:ye("text-sm",r&&"font-mono",!n&&"text-muted-foreground"),children:n||"-"})]})}function Hwe({person:t,open:e,onOpenChange:n,onSuccess:r}){const[s,i]=b.useState({}),[a,o]=b.useState(!1),{toast:c}=Gr();b.useEffect(()=>{t&&i({person_name:t.person_name||"",name_reason:t.name_reason||"",nickname:t.nickname||"",memory_points:t.memory_points||"",is_known:t.is_known})},[t]);const h=async()=>{if(t)try{o(!0),await Iwe(t.person_id,s),c({title:"保存成功",description:"人物信息已更新"}),r()}catch(f){c({title:"保存失败",description:f instanceof Error?f.message:"无法更新人物信息",variant:"destructive"})}finally{o(!1)}};return t?l.jsx(fr,{open:e,onOpenChange:n,children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑人物信息"}),l.jsxs(Ir,{children:["修改 ",t.person_name||t.nickname||t.user_id," 的信息"]})]}),l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"person_name",children:"人物名称"}),l.jsx(Pe,{id:"person_name",value:s.person_name||"",onChange:f=>i({...s,person_name:f.target.value}),placeholder:"为这个人设置一个名称"})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"nickname",children:"昵称"}),l.jsx(Pe,{id:"nickname",value:s.nickname||"",onChange:f=>i({...s,nickname:f.target.value}),placeholder:"昵称"})]})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"name_reason",children:"名称设定原因"}),l.jsx(dr,{id:"name_reason",value:s.name_reason||"",onChange:f=>i({...s,name_reason:f.target.value}),placeholder:"为什么这样称呼这个人?",rows:2})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"memory_points",children:"个人印象"}),l.jsx(dr,{id:"memory_points",value:s.memory_points||"",onChange:f=>i({...s,memory_points:f.target.value}),placeholder:"对这个人的印象和记忆点...",rows:4})]}),l.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[l.jsxs("div",{children:[l.jsx(de,{htmlFor:"is_known",className:"text-base font-medium",children:"已认识"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"标记是否已经认识这个人"})]}),l.jsx(_t,{id:"is_known",checked:s.is_known,onCheckedChange:f=>i({...s,is_known:f})})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>n(!1),children:"取消"}),l.jsx(fe,{onClick:h,disabled:a,children:a?"保存中...":"保存"})]})]})}):null}function xs(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n{let e;const n=new Set,r=(f,m)=>{const g=typeof f=="function"?f(e):f;if(!Object.is(g,e)){const x=e;e=m??(typeof g!="object"||g===null)?g:Object.assign({},e,g),n.forEach(y=>y(e,x))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>h,subscribe:f=>(n.add(f),()=>n.delete(f)),destroy:()=>{(Vwe?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=e=t(r,s,c);return c},Uwe=t=>t?PM(t):PM,{useDebugValue:Wwe}=he,{useSyncExternalStoreWithSelector:Gwe}=iY,Xwe=t=>t;function YQ(t,e=Xwe,n){const r=Gwe(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Wwe(r),r}const LM=(t,e)=>{const n=Uwe(t),r=(s,i=e)=>YQ(n,s,i);return Object.assign(r,n),r},Ywe=(t,e)=>t?LM(t,e):LM;function rs(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}var Kwe={value:()=>{}};function Ny(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}v1.prototype=Ny.prototype={constructor:v1,on:function(t,e){var n=this._,r=Zwe(t+"",n),s,i=-1,a=r.length;if(arguments.length<2){for(;++i0)for(var n=new Array(s),r=0,s,i;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),BM.hasOwnProperty(e)?{space:BM[e],local:t}:t}function e4e(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===pk&&e.documentElement.namespaceURI===pk?e.createElement(t):e.createElementNS(n,t)}}function t4e(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function KQ(t){var e=Cy(t);return(e.local?t4e:e4e)(e)}function n4e(){}function uj(t){return t==null?n4e:function(){return this.querySelector(t)}}function r4e(t){typeof t!="function"&&(t=uj(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s=C&&(C=N+1);!(_=S[C])&&++C=0;)(a=r[s])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function T4e(t){t||(t=E4e);function e(m,g){return m&&g?t(m.__data__,g.__data__):!m-!g}for(var n=this._groups,r=n.length,s=new Array(r),i=0;ie?1:t>=e?0:NaN}function _4e(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function M4e(){return Array.from(this)}function A4e(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?Q4e:typeof e=="function"?V4e:H4e)(t,e,n??"")):Eh(this.node(),t)}function Eh(t,e){return t.style.getPropertyValue(e)||nH(t).getComputedStyle(t,null).getPropertyValue(e)}function W4e(t){return function(){delete this[t]}}function G4e(t,e){return function(){this[t]=e}}function X4e(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Y4e(t,e){return arguments.length>1?this.each((e==null?W4e:typeof e=="function"?X4e:G4e)(t,e)):this.node()[t]}function rH(t){return t.trim().split(/^|\s+/)}function dj(t){return t.classList||new sH(t)}function sH(t){this._node=t,this._names=rH(t.getAttribute("class")||"")}sH.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function iH(t,e){for(var n=dj(t),r=-1,s=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function O5e(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n()=>t;function gk(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:a,y:o,dx:c,dy:h,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:o,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:f}})}gk.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function D5e(t){return!t.ctrlKey&&!t.button}function z5e(){return this.parentNode}function P5e(t,e){return e??{x:t.x,y:t.y}}function L5e(){return navigator.maxTouchPoints||"ontouchstart"in this}function I5e(){var t=D5e,e=z5e,n=P5e,r=L5e,s={},i=Ny("start","drag","end"),a=0,o,c,h,f,m=0;function g(T){T.on("mousedown.drag",x).filter(r).on("touchstart.drag",S).on("touchmove.drag",k,R5e).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(T,_){if(!(f||!t.call(this,T,_))){var E=C(this,e.call(this,T,_),T,_,"mouse");E&&(Yi(T.view).on("mousemove.drag",y,w0).on("mouseup.drag",w,w0),cH(T.view),R4(T),h=!1,o=T.clientX,c=T.clientY,E("start",T))}}function y(T){if(ch(T),!h){var _=T.clientX-o,E=T.clientY-c;h=_*_+E*E>m}s.mouse("drag",T)}function w(T){Yi(T.view).on("mousemove.drag mouseup.drag",null),uH(T.view,h),ch(T),s.mouse("end",T)}function S(T,_){if(t.call(this,T,_)){var E=T.changedTouches,M=e.call(this,T,_),q=E.length,L,I;for(L=0;L=0&&t._call.call(void 0,e),t=t._next;--_h}function qM(){Lu=(pv=S0.now())+Ty,_h=ym=0;try{q5e()}finally{_h=0,$5e(),Lu=0}}function F5e(){var t=S0.now(),e=t-pv;e>dH&&(Ty-=e,pv=t)}function $5e(){for(var t,e=mv,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:mv=n);bm=t,xk(r)}function xk(t){if(!_h){ym&&(ym=clearTimeout(ym));var e=t-Lu;e>24?(t<1/0&&(ym=setTimeout(qM,t-S0.now()-Ty)),cm&&(cm=clearInterval(cm))):(cm||(pv=S0.now(),cm=setInterval(F5e,dH)),_h=1,hH(qM))}}function FM(t,e,n){var r=new gv;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var Q5e=Ny("start","end","cancel","interrupt"),H5e=[],mH=0,$M=1,vk=2,y1=3,QM=4,yk=5,b1=6;function Ey(t,e,n,r,s,i){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;V5e(t,n,{name:e,index:r,group:s,on:Q5e,tween:H5e,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mH})}function fj(t,e){var n=za(t,e);if(n.state>mH)throw new Error("too late; already scheduled");return n}function yl(t,e){var n=za(t,e);if(n.state>y1)throw new Error("too late; already running");return n}function za(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function V5e(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=fH(i,0,n.time);function i(h){n.state=$M,n.timer.restart(a,n.delay,n.time),n.delay<=h&&a(h-n.delay)}function a(h){var f,m,g,x;if(n.state!==$M)return c();for(f in r)if(x=r[f],x.name===n.name){if(x.state===y1)return FM(a);x.state===QM?(x.state=b1,x.timer.stop(),x.on.call("interrupt",t,t.__data__,x.index,x.group),delete r[f]):+fvk&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function w3e(t,e,n){var r,s,i=b3e(e)?fj:yl;return function(){var a=i(this,t),o=a.on;o!==r&&(s=(r=o).copy()).on(e,n),a.on=s}}function S3e(t,e){var n=this._id;return arguments.length<2?za(this.node(),n).on.on(t):this.each(w3e(n,t,e))}function k3e(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function O3e(){return this.on("end.remove",k3e(this._id))}function j3e(t){var e=this._name,n=this._id;typeof t!="function"&&(t=uj(t));for(var r=this._groups,s=r.length,i=new Array(s),a=0;a()=>t;function Y3e(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function to(t,e,n){this.k=t,this.x=e,this.y=n}to.prototype={constructor:to,scale:function(t){return t===1?this:new to(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new to(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var co=new to(1,0,0);to.prototype;function D4(t){t.stopImmediatePropagation()}function um(t){t.preventDefault(),t.stopImmediatePropagation()}function K3e(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Z3e(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function HM(){return this.__zoom||co}function J3e(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function eSe(){return navigator.maxTouchPoints||"ontouchstart"in this}function tSe(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function vH(){var t=K3e,e=Z3e,n=tSe,r=J3e,s=eSe,i=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],o=250,c=TY,h=Ny("start","zoom","end"),f,m,g,x=500,y=150,w=0,S=10;function k(z){z.property("__zoom",HM).on("wheel.zoom",q,{passive:!1}).on("mousedown.zoom",L).on("dblclick.zoom",I).filter(s).on("touchstart.zoom",$).on("touchmove.zoom",V).on("touchend.zoom touchcancel.zoom",ee).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(z,H,P,W){var J=z.selection?z.selection():z;J.property("__zoom",HM),z!==J?_(z,H,P,W):J.interrupt().each(function(){E(this,arguments).event(W).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},k.scaleBy=function(z,H,P,W){k.scaleTo(z,function(){var J=this.__zoom.k,X=typeof H=="function"?H.apply(this,arguments):H;return J*X},P,W)},k.scaleTo=function(z,H,P,W){k.transform(z,function(){var J=e.apply(this,arguments),X=this.__zoom,R=P==null?T(J):typeof P=="function"?P.apply(this,arguments):P,se=X.invert(R),G=typeof H=="function"?H.apply(this,arguments):H;return n(C(N(X,G),R,se),J,a)},P,W)},k.translateBy=function(z,H,P,W){k.transform(z,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof P=="function"?P.apply(this,arguments):P),e.apply(this,arguments),a)},null,W)},k.translateTo=function(z,H,P,W,J){k.transform(z,function(){var X=e.apply(this,arguments),R=this.__zoom,se=W==null?T(X):typeof W=="function"?W.apply(this,arguments):W;return n(co.translate(se[0],se[1]).scale(R.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof P=="function"?-P.apply(this,arguments):-P),X,a)},W,J)};function N(z,H){return H=Math.max(i[0],Math.min(i[1],H)),H===z.k?z:new to(H,z.x,z.y)}function C(z,H,P){var W=H[0]-P[0]*z.k,J=H[1]-P[1]*z.k;return W===z.x&&J===z.y?z:new to(z.k,W,J)}function T(z){return[(+z[0][0]+ +z[1][0])/2,(+z[0][1]+ +z[1][1])/2]}function _(z,H,P,W){z.on("start.zoom",function(){E(this,arguments).event(W).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(W).end()}).tween("zoom",function(){var J=this,X=arguments,R=E(J,X).event(W),se=e.apply(J,X),G=P==null?T(se):typeof P=="function"?P.apply(J,X):P,F=Math.max(se[1][0]-se[0][0],se[1][1]-se[0][1]),U=J.__zoom,te=typeof H=="function"?H.apply(J,X):H,ne=c(U.invert(G).concat(F/U.k),te.invert(G).concat(F/te.k));return function(Y){if(Y===1)Y=te;else{var ae=ne(Y),re=F/ae[2];Y=new to(re,G[0]-ae[0]*re,G[1]-ae[1]*re)}R.zoom(null,Y)}})}function E(z,H,P){return!P&&z.__zooming||new M(z,H)}function M(z,H){this.that=z,this.args=H,this.active=0,this.sourceEvent=null,this.extent=e.apply(z,H),this.taps=0}M.prototype={event:function(z){return z&&(this.sourceEvent=z),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(z,H){return this.mouse&&z!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&z!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&z!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(z){var H=Yi(this.that).datum();h.call(z,this.that,new Y3e(z,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:h}),H)}};function q(z,...H){if(!t.apply(this,arguments))return;var P=E(this,H).event(z),W=this.__zoom,J=Math.max(i[0],Math.min(i[1],W.k*Math.pow(2,r.apply(this,arguments)))),X=Sa(z);if(P.wheel)(P.mouse[0][0]!==X[0]||P.mouse[0][1]!==X[1])&&(P.mouse[1]=W.invert(P.mouse[0]=X)),clearTimeout(P.wheel);else{if(W.k===J)return;P.mouse=[X,W.invert(X)],w1(this),P.start()}um(z),P.wheel=setTimeout(R,y),P.zoom("mouse",n(C(N(W,J),P.mouse[0],P.mouse[1]),P.extent,a));function R(){P.wheel=null,P.end()}}function L(z,...H){if(g||!t.apply(this,arguments))return;var P=z.currentTarget,W=E(this,H,!0).event(z),J=Yi(z.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",F,!0),X=Sa(z,P),R=z.clientX,se=z.clientY;cH(z.view),D4(z),W.mouse=[X,this.__zoom.invert(X)],w1(this),W.start();function G(U){if(um(U),!W.moved){var te=U.clientX-R,ne=U.clientY-se;W.moved=te*te+ne*ne>w}W.event(U).zoom("mouse",n(C(W.that.__zoom,W.mouse[0]=Sa(U,P),W.mouse[1]),W.extent,a))}function F(U){J.on("mousemove.zoom mouseup.zoom",null),uH(U.view,W.moved),um(U),W.event(U).end()}}function I(z,...H){if(t.apply(this,arguments)){var P=this.__zoom,W=Sa(z.changedTouches?z.changedTouches[0]:z,this),J=P.invert(W),X=P.k*(z.shiftKey?.5:2),R=n(C(N(P,X),W,J),e.apply(this,H),a);um(z),o>0?Yi(this).transition().duration(o).call(_,R,W,z):Yi(this).call(k.transform,R,W,z)}}function $(z,...H){if(t.apply(this,arguments)){var P=z.touches,W=P.length,J=E(this,H,z.changedTouches.length===W).event(z),X,R,se,G;for(D4(z),R=0;R"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,e)=>`Couldn't create edge for ${t?"target":"source"} handle id: "${t?e.targetHandle:e.sourceHandle}", edge id: ${e.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},yH=bo.error001();function Xn(t,e){const n=b.useContext(_y);if(n===null)throw new Error(yH);return YQ(n,t,e)}const Xr=()=>{const t=b.useContext(_y);if(t===null)throw new Error(yH);return b.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe,destroy:t.destroy}),[t])},rSe=t=>t.userSelectionActive?"none":"all";function My({position:t,children:e,className:n,style:r,...s}){const i=Xn(rSe),a=`${t}`.split("-");return he.createElement("div",{className:xs(["react-flow__panel",n,...a]),style:{...r,pointerEvents:i},...s},e)}function sSe({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:he.createElement(My,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},he.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const iSe=({x:t,y:e,label:n,labelStyle:r={},labelShowBg:s=!0,labelBgStyle:i={},labelBgPadding:a=[2,4],labelBgBorderRadius:o=2,children:c,className:h,...f})=>{const m=b.useRef(null),[g,x]=b.useState({x:0,y:0,width:0,height:0}),y=xs(["react-flow__edge-textwrapper",h]);return b.useEffect(()=>{if(m.current){const w=m.current.getBBox();x({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),typeof n>"u"||!n?null:he.createElement("g",{transform:`translate(${t-g.width/2} ${e-g.height/2})`,className:y,visibility:g.width?"visible":"hidden",...f},s&&he.createElement("rect",{width:g.width+2*a[0],x:-a[0],y:-a[1],height:g.height+2*a[1],className:"react-flow__edge-textbg",style:i,rx:o,ry:o}),he.createElement("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:m,style:r},n),c)};var aSe=b.memo(iSe);const pj=t=>({width:t.offsetWidth,height:t.offsetHeight}),Mh=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),gj=(t={x:0,y:0},e)=>({x:Mh(t.x,e[0][0],e[1][0]),y:Mh(t.y,e[0][1],e[1][1])}),VM=(t,e,n)=>tn?-Mh(Math.abs(t-n),1,50)/50:0,bH=(t,e)=>{const n=VM(t.x,35,e.width-35)*20,r=VM(t.y,35,e.height-35)*20;return[n,r]},wH=t=>t.getRootNode?.()||window?.document,SH=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),k0=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),kH=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),UM=t=>({...t.positionAbsolute||{x:0,y:0},width:t.width||0,height:t.height||0}),lSe=(t,e)=>kH(SH(k0(t),k0(e))),bk=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},oSe=t=>ta(t.width)&&ta(t.height)&&ta(t.x)&&ta(t.y),ta=t=>!isNaN(t)&&isFinite(t),yr=Symbol.for("internals"),OH=["Enter"," ","Escape"],cSe=(t,e)=>{},uSe=t=>"nativeEvent"in t;function wk(t){const n=(uSe(t)?t.nativeEvent:t).composedPath?.()?.[0]||t.target;return["INPUT","SELECT","TEXTAREA"].includes(n?.nodeName)||n?.hasAttribute("contenteditable")||!!n?.closest(".nokey")}const jH=t=>"clientX"in t,pc=(t,e)=>{const n=jH(t),r=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:r-(e?.left??0),y:s-(e?.top??0)}},xv=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,mp=({id:t,path:e,labelX:n,labelY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x=20})=>he.createElement(he.Fragment,null,he.createElement("path",{id:t,style:f,d:e,fill:"none",className:"react-flow__edge-path",markerEnd:m,markerStart:g}),x&&he.createElement("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:x,className:"react-flow__edge-interaction"}),s&&ta(n)&&ta(r)?he.createElement(aSe,{x:n,y:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h}):null);mp.displayName="BaseEdge";function dm(t,e,n){return n===void 0?n:r=>{const s=e().edges.find(i=>i.id===t);s&&n(r,{...s})}}function NH({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n{const[S,k,N]=TH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i});return he.createElement(mp,{path:S,labelX:k,labelY:N,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:w})});xj.displayName="SimpleBezierEdge";const GM={[ht.Left]:{x:-1,y:0},[ht.Right]:{x:1,y:0},[ht.Top]:{x:0,y:-1},[ht.Bottom]:{x:0,y:1}},dSe=({source:t,sourcePosition:e=ht.Bottom,target:n})=>e===ht.Left||e===ht.Right?t.xMath.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function hSe({source:t,sourcePosition:e=ht.Bottom,target:n,targetPosition:r=ht.Top,center:s,offset:i}){const a=GM[e],o=GM[r],c={x:t.x+a.x*i,y:t.y+a.y*i},h={x:n.x+o.x*i,y:n.y+o.y*i},f=dSe({source:c,sourcePosition:e,target:h}),m=f.x!==0?"x":"y",g=f[m];let x=[],y,w;const S={x:0,y:0},k={x:0,y:0},[N,C,T,_]=NH({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[m]*o[m]===-1){y=s.x??N,w=s.y??C;const M=[{x:y,y:c.y},{x:y,y:h.y}],q=[{x:c.x,y:w},{x:h.x,y:w}];a[m]===g?x=m==="x"?M:q:x=m==="x"?q:M}else{const M=[{x:c.x,y:h.y}],q=[{x:h.x,y:c.y}];if(m==="x"?x=a.x===g?q:M:x=a.y===g?M:q,e===r){const ee=Math.abs(t[m]-n[m]);if(ee<=i){const z=Math.min(i-1,i-ee);a[m]===g?S[m]=(c[m]>t[m]?-1:1)*z:k[m]=(h[m]>n[m]?-1:1)*z}}if(e!==r){const ee=m==="x"?"y":"x",z=a[m]===o[ee],H=c[ee]>h[ee],P=c[ee]=V?(y=(L.x+I.x)/2,w=x[0].y):(y=x[0].x,w=(L.y+I.y)/2)}return[[t,{x:c.x+S.x,y:c.y+S.y},...x,{x:h.x+k.x,y:h.y+k.y},n],y,w,T,_]}function fSe(t,e,n,r){const s=Math.min(XM(t,e)/2,XM(e,n)/2,r),{x:i,y:a}=e;if(t.x===i&&i===n.x||t.y===a&&a===n.y)return`L${i} ${a}`;if(t.y===a){const h=t.x{let C="";return N>0&&N{const[k,N,C]=Sk({sourceX:t,sourceY:e,sourcePosition:m,targetX:n,targetY:r,targetPosition:g,borderRadius:w?.borderRadius,offset:w?.offset});return he.createElement(mp,{path:k,labelX:N,labelY:C,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:x,markerStart:y,interactionWidth:S})});Ay.displayName="SmoothStepEdge";const vj=b.memo(t=>he.createElement(Ay,{...t,pathOptions:b.useMemo(()=>({borderRadius:0,offset:t.pathOptions?.offset}),[t.pathOptions?.offset])}));vj.displayName="StepEdge";function mSe({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,a,o]=NH({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,a,o]}const yj=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})=>{const[y,w,S]=mSe({sourceX:t,sourceY:e,targetX:n,targetY:r});return he.createElement(mp,{path:y,labelX:w,labelY:S,label:s,labelStyle:i,labelShowBg:a,labelBgStyle:o,labelBgPadding:c,labelBgBorderRadius:h,style:f,markerEnd:m,markerStart:g,interactionWidth:x})});yj.displayName="StraightEdge";function Ix(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function YM({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case ht.Left:return[e-Ix(e-r,i),n];case ht.Right:return[e+Ix(r-e,i),n];case ht.Top:return[e,n-Ix(n-s,i)];case ht.Bottom:return[e,n+Ix(s-n,i)]}}function EH({sourceX:t,sourceY:e,sourcePosition:n=ht.Bottom,targetX:r,targetY:s,targetPosition:i=ht.Top,curvature:a=.25}){const[o,c]=YM({pos:n,x1:t,y1:e,x2:r,y2:s,c:a}),[h,f]=YM({pos:i,x1:r,y1:s,x2:t,y2:e,c:a}),[m,g,x,y]=CH({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:o,sourceControlY:c,targetControlX:h,targetControlY:f});return[`M${t},${e} C${o},${c} ${h},${f} ${r},${s}`,m,g,x,y]}const yv=b.memo(({sourceX:t,sourceY:e,targetX:n,targetY:r,sourcePosition:s=ht.Bottom,targetPosition:i=ht.Top,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,pathOptions:w,interactionWidth:S})=>{const[k,N,C]=EH({sourceX:t,sourceY:e,sourcePosition:s,targetX:n,targetY:r,targetPosition:i,curvature:w?.curvature});return he.createElement(mp,{path:k,labelX:N,labelY:C,label:a,labelStyle:o,labelShowBg:c,labelBgStyle:h,labelBgPadding:f,labelBgBorderRadius:m,style:g,markerEnd:x,markerStart:y,interactionWidth:S})});yv.displayName="BezierEdge";const bj=b.createContext(null),pSe=bj.Provider;bj.Consumer;const gSe=()=>b.useContext(bj),xSe=t=>"id"in t&&"source"in t&&"target"in t,vSe=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`reactflow__edge-${t}${e||""}-${n}${r||""}`,kk=(t,e)=>typeof t>"u"?"":typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`,ySe=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),bSe=(t,e)=>{if(!t.source||!t.target)return e;let n;return xSe(t)?n={...t}:n={...t,id:vSe(t)},ySe(n,e)?e:e.concat(n)},Ok=({x:t,y:e},[n,r,s],i,[a,o])=>{const c={x:(t-n)/s,y:(e-r)/s};return i?{x:a*Math.round(c.x/a),y:o*Math.round(c.y/o)}:c},_H=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r}),Ou=(t,e=[0,0])=>{if(!t)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(t.width??0)*e[0],r=(t.height??0)*e[1],s={x:t.position.x-n,y:t.position.y-r};return{...s,positionAbsolute:t.positionAbsolute?{x:t.positionAbsolute.x-n,y:t.positionAbsolute.y-r}:s}},Ry=(t,e=[0,0])=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const{x:i,y:a}=Ou(s,e).positionAbsolute;return SH(r,k0({x:i,y:a,width:s.width||0,height:s.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return kH(n)},MH=(t,e,[n,r,s]=[0,0,1],i=!1,a=!1,o=[0,0])=>{const c={x:(e.x-n)/s,y:(e.y-r)/s,width:e.width/s,height:e.height/s},h=[];return t.forEach(f=>{const{width:m,height:g,selectable:x=!0,hidden:y=!1}=f;if(a&&!x||y)return!1;const{positionAbsolute:w}=Ou(f,o),S={x:w.x,y:w.y,width:m||0,height:g||0},k=bk(c,S),N=typeof m>"u"||typeof g>"u"||m===null||g===null,C=i&&k>0,T=(m||0)*(g||0);(N||C||k>=T||f.dragging)&&h.push(f)}),h},AH=(t,e)=>{const n=t.map(r=>r.id);return e.filter(r=>n.includes(r.source)||n.includes(r.target))},RH=(t,e,n,r,s,i=.1)=>{const a=e/(t.width*(1+i)),o=n/(t.height*(1+i)),c=Math.min(a,o),h=Mh(c,r,s),f=t.x+t.width/2,m=t.y+t.height/2,g=e/2-f*h,x=n/2-m*h;return{x:g,y:x,zoom:h}},ou=(t,e=0)=>t.transition().duration(e);function KM(t,e,n,r){return(e[n]||[]).reduce((s,i)=>(`${t.id}-${i.id}-${n}`!==r&&s.push({id:i.id||null,type:n,nodeId:t.id,x:(t.positionAbsolute?.x??0)+i.x+i.width/2,y:(t.positionAbsolute?.y??0)+i.y+i.height/2}),s),[])}function wSe(t,e,n,r,s,i){const{x:a,y:o}=pc(t),h=e.elementsFromPoint(a,o).find(y=>y.classList.contains("react-flow__handle"));if(h){const y=h.getAttribute("data-nodeid");if(y){const w=wj(void 0,h),S=h.getAttribute("data-handleid"),k=i({nodeId:y,id:S,type:w});if(k){const N=s.find(C=>C.nodeId===y&&C.type===w&&C.id===S);return{handle:{id:S,type:w,nodeId:y,x:N?.x||n.x,y:N?.y||n.y},validHandleResult:k}}}}let f=[],m=1/0;if(s.forEach(y=>{const w=Math.sqrt((y.x-n.x)**2+(y.y-n.y)**2);if(w<=r){const S=i(y);w<=m&&(wy.isValid),x=f.some(({handle:y})=>y.type==="target");return f.find(({handle:y,validHandleResult:w})=>x?y.type==="target":g?w.isValid:!0)||f[0]}const SSe={source:null,target:null,sourceHandle:null,targetHandle:null},DH=()=>({handleDomNode:null,isValid:!1,connection:SSe,endHandle:null});function zH(t,e,n,r,s,i,a){const o=s==="target",c=a.querySelector(`.react-flow__handle[data-id="${t?.nodeId}-${t?.id}-${t?.type}"]`),h={...DH(),handleDomNode:c};if(c){const f=wj(void 0,c),m=c.getAttribute("data-nodeid"),g=c.getAttribute("data-handleid"),x=c.classList.contains("connectable"),y=c.classList.contains("connectableend"),w={source:o?m:n,sourceHandle:o?g:r,target:o?n:m,targetHandle:o?r:g};h.connection=w,x&&y&&(e===Iu.Strict?o&&f==="source"||!o&&f==="target":m!==n||g!==r)&&(h.endHandle={nodeId:m,handleId:g,type:f},h.isValid=i(w))}return h}function kSe({nodes:t,nodeId:e,handleId:n,handleType:r}){return t.reduce((s,i)=>{if(i[yr]){const{handleBounds:a}=i[yr];let o=[],c=[];a&&(o=KM(i,a,"source",`${e}-${n}-${r}`),c=KM(i,a,"target",`${e}-${n}-${r}`)),s.push(...o,...c)}return s},[])}function wj(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function z4(t){t?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function OSe(t,e){let n=null;return e?n="valid":t&&!e&&(n="invalid"),n}function PH({event:t,handleId:e,nodeId:n,onConnect:r,isTarget:s,getState:i,setState:a,isValidConnection:o,edgeUpdaterType:c,onReconnectEnd:h}){const f=wH(t.target),{connectionMode:m,domNode:g,autoPanOnConnect:x,connectionRadius:y,onConnectStart:w,panBy:S,getNodes:k,cancelConnection:N}=i();let C=0,T;const{x:_,y:E}=pc(t),M=f?.elementFromPoint(_,E),q=wj(c,M),L=g?.getBoundingClientRect();if(!L||!q)return;let I,$=pc(t,L),V=!1,ee=null,z=!1,H=null;const P=kSe({nodes:k(),nodeId:n,handleId:e,handleType:q}),W=()=>{if(!x)return;const[R,se]=bH($,L);S({x:R,y:se}),C=requestAnimationFrame(W)};a({connectionPosition:$,connectionStatus:null,connectionNodeId:n,connectionHandleId:e,connectionHandleType:q,connectionStartHandle:{nodeId:n,handleId:e,type:q},connectionEndHandle:null}),w?.(t,{nodeId:n,handleId:e,handleType:q});function J(R){const{transform:se}=i();$=pc(R,L);const{handle:G,validHandleResult:F}=wSe(R,f,Ok($,se,!1,[1,1]),y,P,U=>zH(U,m,n,e,s?"target":"source",o,f));if(T=G,V||(W(),V=!0),H=F.handleDomNode,ee=F.connection,z=F.isValid,a({connectionPosition:T&&z?_H({x:T.x,y:T.y},se):$,connectionStatus:OSe(!!T,z),connectionEndHandle:F.endHandle}),!T&&!z&&!H)return z4(I);ee.source!==ee.target&&H&&(z4(I),I=H,H.classList.add("connecting","react-flow__handle-connecting"),H.classList.toggle("valid",z),H.classList.toggle("react-flow__handle-valid",z))}function X(R){(T||H)&&ee&&z&&r?.(ee),i().onConnectEnd?.(R),c&&h?.(R),z4(I),N(),cancelAnimationFrame(C),V=!1,z=!1,ee=null,H=null,f.removeEventListener("mousemove",J),f.removeEventListener("mouseup",X),f.removeEventListener("touchmove",J),f.removeEventListener("touchend",X)}f.addEventListener("mousemove",J),f.addEventListener("mouseup",X),f.addEventListener("touchmove",J),f.addEventListener("touchend",X)}const ZM=()=>!0,jSe=t=>({connectionStartHandle:t.connectionStartHandle,connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName}),NSe=(t,e,n)=>r=>{const{connectionStartHandle:s,connectionEndHandle:i,connectionClickStartHandle:a}=r;return{connecting:s?.nodeId===t&&s?.handleId===e&&s?.type===n||i?.nodeId===t&&i?.handleId===e&&i?.type===n,clickConnecting:a?.nodeId===t&&a?.handleId===e&&a?.type===n}},LH=b.forwardRef(({type:t="source",position:e=ht.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:a,onConnect:o,children:c,className:h,onMouseDown:f,onTouchStart:m,...g},x)=>{const y=a||null,w=t==="target",S=Xr(),k=gSe(),{connectOnClick:N,noPanClassName:C}=Xn(jSe,rs),{connecting:T,clickConnecting:_}=Xn(NSe(k,y,t),rs);k||S.getState().onError?.("010",bo.error010());const E=L=>{const{defaultEdgeOptions:I,onConnect:$,hasDefaultEdges:V}=S.getState(),ee={...I,...L};if(V){const{edges:z,setEdges:H}=S.getState();H(bSe(ee,z))}$?.(ee),o?.(ee)},M=L=>{if(!k)return;const I=jH(L);s&&(I&&L.button===0||!I)&&PH({event:L,handleId:y,nodeId:k,onConnect:E,isTarget:w,getState:S.getState,setState:S.setState,isValidConnection:n||S.getState().isValidConnection||ZM}),I?f?.(L):m?.(L)},q=L=>{const{onClickConnectStart:I,onClickConnectEnd:$,connectionClickStartHandle:V,connectionMode:ee,isValidConnection:z}=S.getState();if(!k||!V&&!s)return;if(!V){I?.(L,{nodeId:k,handleId:y,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:k,type:t,handleId:y}});return}const H=wH(L.target),P=n||z||ZM,{connection:W,isValid:J}=zH({nodeId:k,id:y,type:t},ee,V.nodeId,V.handleId||null,V.type,P,H);J&&E(W),$?.(L),S.setState({connectionClickStartHandle:null})};return he.createElement("div",{"data-handleid":y,"data-nodeid":k,"data-handlepos":e,"data-id":`${k}-${y}-${t}`,className:xs(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:r,connectablestart:s,connectableend:i,connecting:_,connectionindicator:r&&(s&&!T||i&&T)}]),onMouseDown:M,onTouchStart:M,onClick:N?q:void 0,ref:x,...g},c)});LH.displayName="Handle";var Cc=b.memo(LH);const IH=({data:t,isConnectable:e,targetPosition:n=ht.Top,sourcePosition:r=ht.Bottom})=>he.createElement(he.Fragment,null,he.createElement(Cc,{type:"target",position:n,isConnectable:e}),t?.label,he.createElement(Cc,{type:"source",position:r,isConnectable:e}));IH.displayName="DefaultNode";var jk=b.memo(IH);const BH=({data:t,isConnectable:e,sourcePosition:n=ht.Bottom})=>he.createElement(he.Fragment,null,t?.label,he.createElement(Cc,{type:"source",position:n,isConnectable:e}));BH.displayName="InputNode";var qH=b.memo(BH);const FH=({data:t,isConnectable:e,targetPosition:n=ht.Top})=>he.createElement(he.Fragment,null,he.createElement(Cc,{type:"target",position:n,isConnectable:e}),t?.label);FH.displayName="OutputNode";var $H=b.memo(FH);const Sj=()=>null;Sj.displayName="GroupNode";const CSe=t=>({selectedNodes:t.getNodes().filter(e=>e.selected),selectedEdges:t.edges.filter(e=>e.selected).map(e=>({...e}))}),Bx=t=>t.id;function TSe(t,e){return rs(t.selectedNodes.map(Bx),e.selectedNodes.map(Bx))&&rs(t.selectedEdges.map(Bx),e.selectedEdges.map(Bx))}const QH=b.memo(({onSelectionChange:t})=>{const e=Xr(),{selectedNodes:n,selectedEdges:r}=Xn(CSe,TSe);return b.useEffect(()=>{const s={nodes:n,edges:r};t?.(s),e.getState().onSelectionChange.forEach(i=>i(s))},[n,r,t]),null});QH.displayName="SelectionListener";const ESe=t=>!!t.onSelectionChange;function _Se({onSelectionChange:t}){const e=Xn(ESe);return t||e?he.createElement(QH,{onSelectionChange:t}):null}const MSe=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset});function _d(t,e){b.useEffect(()=>{typeof t<"u"&&e(t)},[t])}function Ut(t,e,n){b.useEffect(()=>{typeof e<"u"&&n({[t]:e})},[e])}const ASe=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:s,onConnectStart:i,onConnectEnd:a,onClickConnectStart:o,onClickConnectEnd:c,nodesDraggable:h,nodesConnectable:f,nodesFocusable:m,edgesFocusable:g,edgesUpdatable:x,elevateNodesOnSelect:y,minZoom:w,maxZoom:S,nodeExtent:k,onNodesChange:N,onEdgesChange:C,elementsSelectable:T,connectionMode:_,snapGrid:E,snapToGrid:M,translateExtent:q,connectOnClick:L,defaultEdgeOptions:I,fitView:$,fitViewOptions:V,onNodesDelete:ee,onEdgesDelete:z,onNodeDrag:H,onNodeDragStart:P,onNodeDragStop:W,onSelectionDrag:J,onSelectionDragStart:X,onSelectionDragStop:R,noPanClassName:se,nodeOrigin:G,rfId:F,autoPanOnConnect:U,autoPanOnNodeDrag:te,onError:ne,connectionRadius:Y,isValidConnection:ae,nodeDragThreshold:re})=>{const{setNodes:le,setEdges:_e,setDefaultNodesAndEdges:Ge,setMinZoom:tt,setMaxZoom:Xe,setTranslateExtent:je,setNodeExtent:Qe,reset:He}=Xn(MSe,rs),$e=Xr();return b.useEffect(()=>{const bt=r?.map(lt=>({...lt,...I}));return Ge(n,bt),()=>{He()}},[]),Ut("defaultEdgeOptions",I,$e.setState),Ut("connectionMode",_,$e.setState),Ut("onConnect",s,$e.setState),Ut("onConnectStart",i,$e.setState),Ut("onConnectEnd",a,$e.setState),Ut("onClickConnectStart",o,$e.setState),Ut("onClickConnectEnd",c,$e.setState),Ut("nodesDraggable",h,$e.setState),Ut("nodesConnectable",f,$e.setState),Ut("nodesFocusable",m,$e.setState),Ut("edgesFocusable",g,$e.setState),Ut("edgesUpdatable",x,$e.setState),Ut("elementsSelectable",T,$e.setState),Ut("elevateNodesOnSelect",y,$e.setState),Ut("snapToGrid",M,$e.setState),Ut("snapGrid",E,$e.setState),Ut("onNodesChange",N,$e.setState),Ut("onEdgesChange",C,$e.setState),Ut("connectOnClick",L,$e.setState),Ut("fitViewOnInit",$,$e.setState),Ut("fitViewOnInitOptions",V,$e.setState),Ut("onNodesDelete",ee,$e.setState),Ut("onEdgesDelete",z,$e.setState),Ut("onNodeDrag",H,$e.setState),Ut("onNodeDragStart",P,$e.setState),Ut("onNodeDragStop",W,$e.setState),Ut("onSelectionDrag",J,$e.setState),Ut("onSelectionDragStart",X,$e.setState),Ut("onSelectionDragStop",R,$e.setState),Ut("noPanClassName",se,$e.setState),Ut("nodeOrigin",G,$e.setState),Ut("rfId",F,$e.setState),Ut("autoPanOnConnect",U,$e.setState),Ut("autoPanOnNodeDrag",te,$e.setState),Ut("onError",ne,$e.setState),Ut("connectionRadius",Y,$e.setState),Ut("isValidConnection",ae,$e.setState),Ut("nodeDragThreshold",re,$e.setState),_d(t,le),_d(e,_e),_d(w,tt),_d(S,Xe),_d(q,je),_d(k,Qe),null},JM={display:"none"},RSe={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},HH="react-flow__node-desc",VH="react-flow__edge-desc",DSe="react-flow__aria-live",zSe=t=>t.ariaLiveMessage;function PSe({rfId:t}){const e=Xn(zSe);return he.createElement("div",{id:`${DSe}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:RSe},e)}function LSe({rfId:t,disableKeyboardA11y:e}){return he.createElement(he.Fragment,null,he.createElement("div",{id:`${HH}-${t}`,style:JM},"Press enter or space to select a node.",!e&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),he.createElement("div",{id:`${VH}-${t}`,style:JM},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!e&&he.createElement(PSe,{rfId:t}))}var j0=(t=null,e={actInsideInputWithModifier:!0})=>{const[n,r]=b.useState(!1),s=b.useRef(!1),i=b.useRef(new Set([])),[a,o]=b.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.split("+")),f=h.reduce((m,g)=>m.concat(...g),[]);return[h,f]}return[[],[]]},[t]);return b.useEffect(()=>{const c=typeof document<"u"?document:null,h=e?.target||c;if(t!==null){const f=x=>{if(s.current=x.ctrlKey||x.metaKey||x.shiftKey,(!s.current||s.current&&!e.actInsideInputWithModifier)&&wk(x))return!1;const w=tA(x.code,o);i.current.add(x[w]),eA(a,i.current,!1)&&(x.preventDefault(),r(!0))},m=x=>{if((!s.current||s.current&&!e.actInsideInputWithModifier)&&wk(x))return!1;const w=tA(x.code,o);eA(a,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(x[w]),x.key==="Meta"&&i.current.clear(),s.current=!1},g=()=>{i.current.clear(),r(!1)};return h?.addEventListener("keydown",f),h?.addEventListener("keyup",m),window.addEventListener("blur",g),()=>{h?.removeEventListener("keydown",f),h?.removeEventListener("keyup",m),window.removeEventListener("blur",g)}}},[t,r]),n};function eA(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function tA(t,e){return e.includes(t)?"code":"key"}function UH(t,e,n,r){const s=t.parentNode||t.parentId;if(!s)return n;const i=e.get(s),a=Ou(i,r);return UH(i,e,{x:(n.x??0)+a.x,y:(n.y??0)+a.y,z:(i[yr]?.z??0)>(n.z??0)?i[yr]?.z??0:n.z??0},r)}function WH(t,e,n){t.forEach(r=>{const s=r.parentNode||r.parentId;if(s&&!t.has(s))throw new Error(`Parent node ${s} not found`);if(s||n?.[r.id]){const{x:i,y:a,z:o}=UH(r,t,{...r.position,z:r[yr]?.z??0},e);r.positionAbsolute={x:i,y:a},r[yr].z=o,n?.[r.id]&&(r[yr].isParent=!0)}})}function P4(t,e,n,r){const s=new Map,i={},a=r?1e3:0;return t.forEach(o=>{const c=(ta(o.zIndex)?o.zIndex:0)+(o.selected?a:0),h=e.get(o.id),f={...o,positionAbsolute:{x:o.position.x,y:o.position.y}},m=o.parentNode||o.parentId;m&&(i[m]=!0);const g=h?.type&&h?.type!==o.type;Object.defineProperty(f,yr,{enumerable:!1,value:{handleBounds:g?void 0:h?.[yr]?.handleBounds,z:c}}),s.set(o.id,f)}),WH(s,n,i),s}function GH(t,e={}){const{getNodes:n,width:r,height:s,minZoom:i,maxZoom:a,d3Zoom:o,d3Selection:c,fitViewOnInitDone:h,fitViewOnInit:f,nodeOrigin:m}=t(),g=e.initial&&!h&&f;if(o&&c&&(g||!e.initial)){const y=n().filter(S=>{const k=e.includeHiddenNodes?S.width&&S.height:!S.hidden;return e.nodes?.length?k&&e.nodes.some(N=>N.id===S.id):k}),w=y.every(S=>S.width&&S.height);if(y.length>0&&w){const S=Ry(y,m),{x:k,y:N,zoom:C}=RH(S,r,s,e.minZoom??i,e.maxZoom??a,e.padding??.1),T=co.translate(k,N).scale(C);return typeof e.duration=="number"&&e.duration>0?o.transform(ou(c,e.duration),T):o.transform(c,T),!0}}return!1}function ISe(t,e){return t.forEach(n=>{const r=e.get(n.id);r&&e.set(r.id,{...r,[yr]:r[yr],selected:n.selected})}),new Map(e)}function BSe(t,e){return e.map(n=>{const r=t.find(s=>s.id===n.id);return r&&(n.selected=r.selected),n})}function qx({changedNodes:t,changedEdges:e,get:n,set:r}){const{nodeInternals:s,edges:i,onNodesChange:a,onEdgesChange:o,hasDefaultNodes:c,hasDefaultEdges:h}=n();t?.length&&(c&&r({nodeInternals:ISe(t,s)}),a?.(t)),e?.length&&(h&&r({edges:BSe(e,i)}),o?.(e))}const Md=()=>{},qSe={zoomIn:Md,zoomOut:Md,zoomTo:Md,getZoom:()=>1,setViewport:Md,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:Md,fitBounds:Md,project:t=>t,screenToFlowPosition:t=>t,flowToScreenPosition:t=>t,viewportInitialized:!1},FSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection}),$Se=()=>{const t=Xr(),{d3Zoom:e,d3Selection:n}=Xn(FSe,rs);return b.useMemo(()=>n&&e?{zoomIn:s=>e.scaleBy(ou(n,s?.duration),1.2),zoomOut:s=>e.scaleBy(ou(n,s?.duration),1/1.2),zoomTo:(s,i)=>e.scaleTo(ou(n,i?.duration),s),getZoom:()=>t.getState().transform[2],setViewport:(s,i)=>{const[a,o,c]=t.getState().transform,h=co.translate(s.x??a,s.y??o).scale(s.zoom??c);e.transform(ou(n,i?.duration),h)},getViewport:()=>{const[s,i,a]=t.getState().transform;return{x:s,y:i,zoom:a}},fitView:s=>GH(t.getState,s),setCenter:(s,i,a)=>{const{width:o,height:c,maxZoom:h}=t.getState(),f=typeof a?.zoom<"u"?a.zoom:h,m=o/2-s*f,g=c/2-i*f,x=co.translate(m,g).scale(f);e.transform(ou(n,a?.duration),x)},fitBounds:(s,i)=>{const{width:a,height:o,minZoom:c,maxZoom:h}=t.getState(),{x:f,y:m,zoom:g}=RH(s,a,o,c,h,i?.padding??.1),x=co.translate(f,m).scale(g);e.transform(ou(n,i?.duration),x)},project:s=>{const{transform:i,snapToGrid:a,snapGrid:o}=t.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Ok(s,i,a,o)},screenToFlowPosition:s=>{const{transform:i,snapToGrid:a,snapGrid:o,domNode:c}=t.getState();if(!c)return s;const{x:h,y:f}=c.getBoundingClientRect(),m={x:s.x-h,y:s.y-f};return Ok(m,i,a,o)},flowToScreenPosition:s=>{const{transform:i,domNode:a}=t.getState();if(!a)return s;const{x:o,y:c}=a.getBoundingClientRect(),h=_H(s,i);return{x:h.x+o,y:h.y+c}},viewportInitialized:!0}:qSe,[e,n])};function kj(){const t=$Se(),e=Xr(),n=b.useCallback(()=>e.getState().getNodes().map(w=>({...w})),[]),r=b.useCallback(w=>e.getState().nodeInternals.get(w),[]),s=b.useCallback(()=>{const{edges:w=[]}=e.getState();return w.map(S=>({...S}))},[]),i=b.useCallback(w=>{const{edges:S=[]}=e.getState();return S.find(k=>k.id===w)},[]),a=b.useCallback(w=>{const{getNodes:S,setNodes:k,hasDefaultNodes:N,onNodesChange:C}=e.getState(),T=S(),_=typeof w=="function"?w(T):w;if(N)k(_);else if(C){const E=_.length===0?T.map(M=>({type:"remove",id:M.id})):_.map(M=>({item:M,type:"reset"}));C(E)}},[]),o=b.useCallback(w=>{const{edges:S=[],setEdges:k,hasDefaultEdges:N,onEdgesChange:C}=e.getState(),T=typeof w=="function"?w(S):w;if(N)k(T);else if(C){const _=T.length===0?S.map(E=>({type:"remove",id:E.id})):T.map(E=>({item:E,type:"reset"}));C(_)}},[]),c=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{getNodes:k,setNodes:N,hasDefaultNodes:C,onNodesChange:T}=e.getState();if(C){const E=[...k(),...S];N(E)}else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),h=b.useCallback(w=>{const S=Array.isArray(w)?w:[w],{edges:k=[],setEdges:N,hasDefaultEdges:C,onEdgesChange:T}=e.getState();if(C)N([...k,...S]);else if(T){const _=S.map(E=>({item:E,type:"add"}));T(_)}},[]),f=b.useCallback(()=>{const{getNodes:w,edges:S=[],transform:k}=e.getState(),[N,C,T]=k;return{nodes:w().map(_=>({..._})),edges:S.map(_=>({..._})),viewport:{x:N,y:C,zoom:T}}},[]),m=b.useCallback(({nodes:w,edges:S})=>{const{nodeInternals:k,getNodes:N,edges:C,hasDefaultNodes:T,hasDefaultEdges:_,onNodesDelete:E,onEdgesDelete:M,onNodesChange:q,onEdgesChange:L}=e.getState(),I=(w||[]).map(H=>H.id),$=(S||[]).map(H=>H.id),V=N().reduce((H,P)=>{const W=P.parentNode||P.parentId,J=!I.includes(P.id)&&W&&H.find(R=>R.id===W);return(typeof P.deletable=="boolean"?P.deletable:!0)&&(I.includes(P.id)||J)&&H.push(P),H},[]),ee=C.filter(H=>typeof H.deletable=="boolean"?H.deletable:!0),z=ee.filter(H=>$.includes(H.id));if(V||z){const H=AH(V,ee),P=[...z,...H],W=P.reduce((J,X)=>(J.includes(X.id)||J.push(X.id),J),[]);if((_||T)&&(_&&e.setState({edges:C.filter(J=>!W.includes(J.id))}),T&&(V.forEach(J=>{k.delete(J.id)}),e.setState({nodeInternals:new Map(k)}))),W.length>0&&(M?.(P),L&&L(W.map(J=>({id:J,type:"remove"})))),V.length>0&&(E?.(V),q)){const J=V.map(X=>({id:X.id,type:"remove"}));q(J)}}},[]),g=b.useCallback(w=>{const S=oSe(w),k=S?null:e.getState().nodeInternals.get(w.id);return!S&&!k?[null,null,S]:[S?w:UM(k),k,S]},[]),x=b.useCallback((w,S=!0,k)=>{const[N,C,T]=g(w);return N?(k||e.getState().getNodes()).filter(_=>{if(!T&&(_.id===C.id||!_.positionAbsolute))return!1;const E=UM(_),M=bk(E,N);return S&&M>0||M>=N.width*N.height}):[]},[]),y=b.useCallback((w,S,k=!0)=>{const[N]=g(w);if(!N)return!1;const C=bk(N,S);return k&&C>0||C>=N.width*N.height},[]);return b.useMemo(()=>({...t,getNodes:n,getNode:r,getEdges:s,getEdge:i,setNodes:a,setEdges:o,addNodes:c,addEdges:h,toObject:f,deleteElements:m,getIntersectingNodes:x,isNodeIntersecting:y}),[t,n,r,s,i,a,o,c,h,f,m,x,y])}const QSe={actInsideInputWithModifier:!1};var HSe=({deleteKeyCode:t,multiSelectionKeyCode:e})=>{const n=Xr(),{deleteElements:r}=kj(),s=j0(t,QSe),i=j0(e);b.useEffect(()=>{if(s){const{edges:a,getNodes:o}=n.getState(),c=o().filter(f=>f.selected),h=a.filter(f=>f.selected);r({nodes:c,edges:h}),n.setState({nodesSelectionActive:!1})}},[s]),b.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])};function VSe(t){const e=Xr();b.useEffect(()=>{let n;const r=()=>{if(!t.current)return;const s=pj(t.current);(s.height===0||s.width===0)&&e.getState().onError?.("004",bo.error004()),e.setState({width:s.width||500,height:s.height||500})};return r(),window.addEventListener("resize",r),t.current&&(n=new ResizeObserver(()=>r()),n.observe(t.current)),()=>{window.removeEventListener("resize",r),n&&t.current&&n.unobserve(t.current)}},[])}const Oj={position:"absolute",width:"100%",height:"100%",top:0,left:0},USe=(t,e)=>t.x!==e.x||t.y!==e.y||t.zoom!==e.k,Fx=t=>({x:t.x,y:t.y,zoom:t.k}),Ad=(t,e)=>t.target.closest(`.${e}`),nA=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),rA=t=>{const e=t.ctrlKey&&xv()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e},WSe=t=>({d3Zoom:t.d3Zoom,d3Selection:t.d3Selection,d3ZoomHandler:t.d3ZoomHandler,userSelectionActive:t.userSelectionActive}),GSe=({onMove:t,onMoveStart:e,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:s=!0,zoomOnPinch:i=!0,panOnScroll:a=!1,panOnScrollSpeed:o=.5,panOnScrollMode:c=xu.Free,zoomOnDoubleClick:h=!0,elementsSelectable:f,panOnDrag:m=!0,defaultViewport:g,translateExtent:x,minZoom:y,maxZoom:w,zoomActivationKeyCode:S,preventScrolling:k=!0,children:N,noWheelClassName:C,noPanClassName:T})=>{const _=b.useRef(),E=Xr(),M=b.useRef(!1),q=b.useRef(!1),L=b.useRef(null),I=b.useRef({x:0,y:0,zoom:0}),{d3Zoom:$,d3Selection:V,d3ZoomHandler:ee,userSelectionActive:z}=Xn(WSe,rs),H=j0(S),P=b.useRef(0),W=b.useRef(!1),J=b.useRef();return VSe(L),b.useEffect(()=>{if(L.current){const X=L.current.getBoundingClientRect(),R=vH().scaleExtent([y,w]).translateExtent(x),se=Yi(L.current).call(R),G=co.translate(g.x,g.y).scale(Mh(g.zoom,y,w)),F=[[0,0],[X.width,X.height]],U=R.constrain()(G,F,x);R.transform(se,U),R.wheelDelta(rA),E.setState({d3Zoom:R,d3Selection:se,d3ZoomHandler:se.on("wheel.zoom"),transform:[U.x,U.y,U.k],domNode:L.current.closest(".react-flow")})}},[]),b.useEffect(()=>{V&&$&&(a&&!H&&!z?V.on("wheel.zoom",X=>{if(Ad(X,C))return!1;X.preventDefault(),X.stopImmediatePropagation();const R=V.property("__zoom").k||1;if(X.ctrlKey&&i){const ae=Sa(X),re=rA(X),le=R*Math.pow(2,re);$.scaleTo(V,le,ae,X);return}const se=X.deltaMode===1?20:1;let G=c===xu.Vertical?0:X.deltaX*se,F=c===xu.Horizontal?0:X.deltaY*se;!xv()&&X.shiftKey&&c!==xu.Vertical&&(G=X.deltaY*se,F=0),$.translateBy(V,-(G/R)*o,-(F/R)*o,{internal:!0});const U=Fx(V.property("__zoom")),{onViewportChangeStart:te,onViewportChange:ne,onViewportChangeEnd:Y}=E.getState();clearTimeout(J.current),W.current||(W.current=!0,e?.(X,U),te?.(U)),W.current&&(t?.(X,U),ne?.(U),J.current=setTimeout(()=>{n?.(X,U),Y?.(U),W.current=!1},150))},{passive:!1}):typeof ee<"u"&&V.on("wheel.zoom",function(X,R){if(!k&&X.type==="wheel"&&!X.ctrlKey||Ad(X,C))return null;X.preventDefault(),ee.call(this,X,R)},{passive:!1}))},[z,a,c,V,$,ee,H,i,k,C,e,t,n]),b.useEffect(()=>{$&&$.on("start",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;P.current=X.sourceEvent?.button;const{onViewportChangeStart:R}=E.getState(),se=Fx(X.transform);M.current=!0,I.current=se,X.sourceEvent?.type==="mousedown"&&E.setState({paneDragging:!0}),R?.(se),e?.(X.sourceEvent,se)})},[$,e]),b.useEffect(()=>{$&&(z&&!M.current?$.on("zoom",null):z||$.on("zoom",X=>{const{onViewportChange:R}=E.getState();if(E.setState({transform:[X.transform.x,X.transform.y,X.transform.k]}),q.current=!!(r&&nA(m,P.current??0)),(t||R)&&!X.sourceEvent?.internal){const se=Fx(X.transform);R?.(se),t?.(X.sourceEvent,se)}}))},[z,$,t,m,r]),b.useEffect(()=>{$&&$.on("end",X=>{if(!X.sourceEvent||X.sourceEvent.internal)return null;const{onViewportChangeEnd:R}=E.getState();if(M.current=!1,E.setState({paneDragging:!1}),r&&nA(m,P.current??0)&&!q.current&&r(X.sourceEvent),q.current=!1,(n||R)&&USe(I.current,X.transform)){const se=Fx(X.transform);I.current=se,clearTimeout(_.current),_.current=setTimeout(()=>{R?.(se),n?.(X.sourceEvent,se)},a?150:0)}})},[$,a,m,n,r]),b.useEffect(()=>{$&&$.filter(X=>{const R=H||s,se=i&&X.ctrlKey;if((m===!0||Array.isArray(m)&&m.includes(1))&&X.button===1&&X.type==="mousedown"&&(Ad(X,"react-flow__node")||Ad(X,"react-flow__edge")))return!0;if(!m&&!R&&!a&&!h&&!i||z||!h&&X.type==="dblclick"||Ad(X,C)&&X.type==="wheel"||Ad(X,T)&&(X.type!=="wheel"||a&&X.type==="wheel"&&!H)||!i&&X.ctrlKey&&X.type==="wheel"||!R&&!a&&!se&&X.type==="wheel"||!m&&(X.type==="mousedown"||X.type==="touchstart")||Array.isArray(m)&&!m.includes(X.button)&&X.type==="mousedown")return!1;const G=Array.isArray(m)&&m.includes(X.button)||!X.button||X.button<=1;return(!X.ctrlKey||X.type==="wheel")&&G})},[z,$,s,i,a,h,m,f,H]),he.createElement("div",{className:"react-flow__renderer",ref:L,style:Oj},N)},XSe=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function YSe(){const{userSelectionActive:t,userSelectionRect:e}=Xn(XSe,rs);return t&&e?he.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}function sA(t,e){const n=e.parentNode||e.parentId,r=t.find(s=>s.id===n);if(r){const s=e.position.x+e.width-r.width,i=e.position.y+e.height-r.height;if(s>0||i>0||e.position.x<0||e.position.y<0){if(r.style={...r.style},r.style.width=r.style.width??r.width,r.style.height=r.style.height??r.height,s>0&&(r.style.width+=s),i>0&&(r.style.height+=i),e.position.x<0){const a=Math.abs(e.position.x);r.position.x=r.position.x-a,r.style.width+=a,e.position.x=0}if(e.position.y<0){const a=Math.abs(e.position.y);r.position.y=r.position.y-a,r.style.height+=a,e.position.y=0}r.width=r.style.width,r.height=r.style.height}}}function XH(t,e){if(t.some(r=>r.type==="reset"))return t.filter(r=>r.type==="reset").map(r=>r.item);const n=t.filter(r=>r.type==="add").map(r=>r.item);return e.reduce((r,s)=>{const i=t.filter(o=>o.id===s.id);if(i.length===0)return r.push(s),r;const a={...s};for(const o of i)if(o)switch(o.type){case"select":{a.selected=o.selected;break}case"position":{typeof o.position<"u"&&(a.position=o.position),typeof o.positionAbsolute<"u"&&(a.positionAbsolute=o.positionAbsolute),typeof o.dragging<"u"&&(a.dragging=o.dragging),a.expandParent&&sA(r,a);break}case"dimensions":{typeof o.dimensions<"u"&&(a.width=o.dimensions.width,a.height=o.dimensions.height),typeof o.updateStyle<"u"&&(a.style={...a.style||{},...o.dimensions}),typeof o.resizing=="boolean"&&(a.resizing=o.resizing),a.expandParent&&sA(r,a);break}case"remove":return r}return r.push(a),r},n)}function YH(t,e){return XH(t,e)}function KSe(t,e){return XH(t,e)}const oc=(t,e)=>({id:t,type:"select",selected:e});function Xd(t,e){return t.reduce((n,r)=>{const s=e.includes(r.id);return!r.selected&&s?(r.selected=!0,n.push(oc(r.id,!0))):r.selected&&!s&&(r.selected=!1,n.push(oc(r.id,!1))),n},[])}const L4=(t,e)=>n=>{n.target===e.current&&t?.(n)},ZSe=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging}),KH=b.memo(({isSelecting:t,selectionMode:e=O0.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:s,onPaneClick:i,onPaneContextMenu:a,onPaneScroll:o,onPaneMouseEnter:c,onPaneMouseMove:h,onPaneMouseLeave:f,children:m})=>{const g=b.useRef(null),x=Xr(),y=b.useRef(0),w=b.useRef(0),S=b.useRef(),{userSelectionActive:k,elementsSelectable:N,dragging:C}=Xn(ZSe,rs),T=()=>{x.setState({userSelectionActive:!1,userSelectionRect:null}),y.current=0,w.current=0},_=ee=>{i?.(ee),x.getState().resetSelectedElements(),x.setState({nodesSelectionActive:!1})},E=ee=>{if(Array.isArray(n)&&n?.includes(2)){ee.preventDefault();return}a?.(ee)},M=o?ee=>o(ee):void 0,q=ee=>{const{resetSelectedElements:z,domNode:H}=x.getState();if(S.current=H?.getBoundingClientRect(),!N||!t||ee.button!==0||ee.target!==g.current||!S.current)return;const{x:P,y:W}=pc(ee,S.current);z(),x.setState({userSelectionRect:{width:0,height:0,startX:P,startY:W,x:P,y:W}}),r?.(ee)},L=ee=>{const{userSelectionRect:z,nodeInternals:H,edges:P,transform:W,onNodesChange:J,onEdgesChange:X,nodeOrigin:R,getNodes:se}=x.getState();if(!t||!S.current||!z)return;x.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=pc(ee,S.current),F=z.startX??0,U=z.startY??0,te={...z,x:G.xle.id),re=Y.map(le=>le.id);if(y.current!==re.length){y.current=re.length;const le=Xd(ne,re);le.length&&J?.(le)}if(w.current!==ae.length){w.current=ae.length;const le=Xd(P,ae);le.length&&X?.(le)}x.setState({userSelectionRect:te})},I=ee=>{if(ee.button!==0)return;const{userSelectionRect:z}=x.getState();!k&&z&&ee.target===g.current&&_?.(ee),x.setState({nodesSelectionActive:y.current>0}),T(),s?.(ee)},$=ee=>{k&&(x.setState({nodesSelectionActive:y.current>0}),s?.(ee)),T()},V=N&&(t||k);return he.createElement("div",{className:xs(["react-flow__pane",{dragging:C,selection:t}]),onClick:V?void 0:L4(_,g),onContextMenu:L4(E,g),onWheel:L4(M,g),onMouseEnter:V?void 0:c,onMouseDown:V?q:void 0,onMouseMove:V?L:h,onMouseUp:V?I:void 0,onMouseLeave:V?$:f,ref:g,style:Oj},m,he.createElement(YSe,null))});KH.displayName="Pane";function ZH(t,e){const n=t.parentNode||t.parentId;if(!n)return!1;const r=e.get(n);return r?r.selected?!0:ZH(r,e):!1}function iA(t,e,n){let r=t;do{if(r?.matches(e))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function JSe(t,e,n,r){return Array.from(t.values()).filter(s=>(s.selected||s.id===r)&&(!s.parentNode||s.parentId||!ZH(s,t))&&(s.draggable||e&&typeof s.draggable>"u")).map(s=>({id:s.id,position:s.position||{x:0,y:0},positionAbsolute:s.positionAbsolute||{x:0,y:0},distance:{x:n.x-(s.positionAbsolute?.x??0),y:n.y-(s.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:s.extent,parentNode:s.parentNode||s.parentId,parentId:s.parentNode||s.parentId,width:s.width,height:s.height,expandParent:s.expandParent}))}function eke(t,e){return!e||e==="parent"?e:[e[0],[e[1][0]-(t.width||0),e[1][1]-(t.height||0)]]}function JH(t,e,n,r,s=[0,0],i){const a=eke(t,t.extent||r);let o=a;const c=t.parentNode||t.parentId;if(t.extent==="parent"&&!t.expandParent)if(c&&t.width&&t.height){const m=n.get(c),{x:g,y:x}=Ou(m,s).positionAbsolute;o=m&&ta(g)&&ta(x)&&ta(m.width)&&ta(m.height)?[[g+t.width*s[0],x+t.height*s[1]],[g+m.width-t.width+t.width*s[0],x+m.height-t.height+t.height*s[1]]]:o}else i?.("005",bo.error005()),o=a;else if(t.extent&&c&&t.extent!=="parent"){const m=n.get(c),{x:g,y:x}=Ou(m,s).positionAbsolute;o=[[t.extent[0][0]+g,t.extent[0][1]+x],[t.extent[1][0]+g,t.extent[1][1]+x]]}let h={x:0,y:0};if(c){const m=n.get(c);h=Ou(m,s).positionAbsolute}const f=o&&o!=="parent"?gj(e,o):e;return{position:{x:f.x-h.x,y:f.y-h.y},positionAbsolute:f}}function I4({nodeId:t,dragItems:e,nodeInternals:n}){const r=e.map(s=>({...n.get(s.id),position:s.position,positionAbsolute:s.positionAbsolute}));return[t?r.find(s=>s.id===t):r[0],r]}const aA=(t,e,n,r)=>{const s=e.querySelectorAll(t);if(!s||!s.length)return null;const i=Array.from(s),a=e.getBoundingClientRect(),o={x:a.width*r[0],y:a.height*r[1]};return i.map(c=>{const h=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),position:c.getAttribute("data-handlepos"),x:(h.left-a.left-o.x)/n,y:(h.top-a.top-o.y)/n,...pj(c)}})};function hm(t,e,n){return n===void 0?n:r=>{const s=e().nodeInternals.get(t);s&&n(r,{...s})}}function Nk({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:a,nodeInternals:o,onError:c}=e.getState(),h=o.get(t);if(!h){c?.("012",bo.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&a)&&(i({nodes:[h],edges:[]}),requestAnimationFrame(()=>r?.current?.blur())):s([t])}function tke(){const t=Xr();return b.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:s,snapToGrid:i}=t.getState(),a=n.touches?n.touches[0].clientX:n.clientX,o=n.touches?n.touches[0].clientY:n.clientY,c={x:(a-r[0])/r[2],y:(o-r[1])/r[2]};return{xSnapped:i?s[0]*Math.round(c.x/s[0]):c.x,ySnapped:i?s[1]*Math.round(c.y/s[1]):c.y,...c}},[])}function B4(t){return(e,n,r)=>t?.(e,r)}function eV({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,selectNodesOnDrag:a}){const o=Xr(),[c,h]=b.useState(!1),f=b.useRef([]),m=b.useRef({x:null,y:null}),g=b.useRef(0),x=b.useRef(null),y=b.useRef({x:0,y:0}),w=b.useRef(null),S=b.useRef(!1),k=b.useRef(!1),N=b.useRef(!1),C=tke();return b.useEffect(()=>{if(t?.current){const T=Yi(t.current),_=({x:q,y:L})=>{const{nodeInternals:I,onNodeDrag:$,onSelectionDrag:V,updateNodePositions:ee,nodeExtent:z,snapGrid:H,snapToGrid:P,nodeOrigin:W,onError:J}=o.getState();m.current={x:q,y:L};let X=!1,R={x:0,y:0,x2:0,y2:0};if(f.current.length>1&&z){const G=Ry(f.current,W);R=k0(G)}if(f.current=f.current.map(G=>{const F={x:q-G.distance.x,y:L-G.distance.y};P&&(F.x=H[0]*Math.round(F.x/H[0]),F.y=H[1]*Math.round(F.y/H[1]));const U=[[z[0][0],z[0][1]],[z[1][0],z[1][1]]];f.current.length>1&&z&&!G.extent&&(U[0][0]=G.positionAbsolute.x-R.x+z[0][0],U[1][0]=G.positionAbsolute.x+(G.width??0)-R.x2+z[1][0],U[0][1]=G.positionAbsolute.y-R.y+z[0][1],U[1][1]=G.positionAbsolute.y+(G.height??0)-R.y2+z[1][1]);const te=JH(G,F,I,U,W,J);return X=X||G.position.x!==te.position.x||G.position.y!==te.position.y,G.position=te.position,G.positionAbsolute=te.positionAbsolute,G}),!X)return;ee(f.current,!0,!0),h(!0);const se=s?$:B4(V);if(se&&w.current){const[G,F]=I4({nodeId:s,dragItems:f.current,nodeInternals:I});se(w.current,G,F)}},E=()=>{if(!x.current)return;const[q,L]=bH(y.current,x.current);if(q!==0||L!==0){const{transform:I,panBy:$}=o.getState();m.current.x=(m.current.x??0)-q/I[2],m.current.y=(m.current.y??0)-L/I[2],$({x:q,y:L})&&_(m.current)}g.current=requestAnimationFrame(E)},M=q=>{const{nodeInternals:L,multiSelectionActive:I,nodesDraggable:$,unselectNodesAndEdges:V,onNodeDragStart:ee,onSelectionDragStart:z}=o.getState();k.current=!0;const H=s?ee:B4(z);(!a||!i)&&!I&&s&&(L.get(s)?.selected||V()),s&&i&&a&&Nk({id:s,store:o,nodeRef:t});const P=C(q);if(m.current=P,f.current=JSe(L,$,P,s),H&&f.current){const[W,J]=I4({nodeId:s,dragItems:f.current,nodeInternals:L});H(q.sourceEvent,W,J)}};if(e)T.on(".drag",null);else{const q=I5e().on("start",L=>{const{domNode:I,nodeDragThreshold:$}=o.getState();$===0&&M(L),N.current=!1;const V=C(L);m.current=V,x.current=I?.getBoundingClientRect()||null,y.current=pc(L.sourceEvent,x.current)}).on("drag",L=>{const I=C(L),{autoPanOnNodeDrag:$,nodeDragThreshold:V}=o.getState();if(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1&&(N.current=!0),!N.current){if(!S.current&&k.current&&$&&(S.current=!0,E()),!k.current){const ee=I.xSnapped-(m?.current?.x??0),z=I.ySnapped-(m?.current?.y??0);Math.sqrt(ee*ee+z*z)>V&&M(L)}(m.current.x!==I.xSnapped||m.current.y!==I.ySnapped)&&f.current&&k.current&&(w.current=L.sourceEvent,y.current=pc(L.sourceEvent,x.current),_(I))}}).on("end",L=>{if(!(!k.current||N.current)&&(h(!1),S.current=!1,k.current=!1,cancelAnimationFrame(g.current),f.current)){const{updateNodePositions:I,nodeInternals:$,onNodeDragStop:V,onSelectionDragStop:ee}=o.getState(),z=s?V:B4(ee);if(I(f.current,!1,!1),z){const[H,P]=I4({nodeId:s,dragItems:f.current,nodeInternals:$});z(L.sourceEvent,H,P)}}}).filter(L=>{const I=L.target;return!L.button&&(!n||!iA(I,`.${n}`,t))&&(!r||iA(I,r,t))});return T.call(q),()=>{T.on(".drag",null)}}}},[t,e,n,r,i,o,s,a,C]),c}function tV(){const t=Xr();return b.useCallback(n=>{const{nodeInternals:r,nodeExtent:s,updateNodePositions:i,getNodes:a,snapToGrid:o,snapGrid:c,onError:h,nodesDraggable:f}=t.getState(),m=a().filter(N=>N.selected&&(N.draggable||f&&typeof N.draggable>"u")),g=o?c[0]:5,x=o?c[1]:5,y=n.isShiftPressed?4:1,w=n.x*g*y,S=n.y*x*y,k=m.map(N=>{if(N.positionAbsolute){const C={x:N.positionAbsolute.x+w,y:N.positionAbsolute.y+S};o&&(C.x=c[0]*Math.round(C.x/c[0]),C.y=c[1]*Math.round(C.y/c[1]));const{positionAbsolute:T,position:_}=JH(N,C,r,s,void 0,h);N.position=_,N.positionAbsolute=T}return N});i(k,!0,!1)},[])}const uh={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var fm=t=>{const e=({id:n,type:r,data:s,xPos:i,yPos:a,xPosOrigin:o,yPosOrigin:c,selected:h,onClick:f,onMouseEnter:m,onMouseMove:g,onMouseLeave:x,onContextMenu:y,onDoubleClick:w,style:S,className:k,isDraggable:N,isSelectable:C,isConnectable:T,isFocusable:_,selectNodesOnDrag:E,sourcePosition:M,targetPosition:q,hidden:L,resizeObserver:I,dragHandle:$,zIndex:V,isParent:ee,noDragClassName:z,noPanClassName:H,initialized:P,disableKeyboardA11y:W,ariaLabel:J,rfId:X,hasHandleBounds:R})=>{const se=Xr(),G=b.useRef(null),F=b.useRef(null),U=b.useRef(M),te=b.useRef(q),ne=b.useRef(r),Y=C||N||f||m||g||x,ae=tV(),re=hm(n,se.getState,m),le=hm(n,se.getState,g),_e=hm(n,se.getState,x),Ge=hm(n,se.getState,y),tt=hm(n,se.getState,w),Xe=He=>{const{nodeDragThreshold:$e}=se.getState();if(C&&(!E||!N||$e>0)&&Nk({id:n,store:se,nodeRef:G}),f){const bt=se.getState().nodeInternals.get(n);bt&&f(He,{...bt})}},je=He=>{if(!wk(He)&&!W)if(OH.includes(He.key)&&C){const $e=He.key==="Escape";Nk({id:n,store:se,unselect:$e,nodeRef:G})}else N&&h&&Object.prototype.hasOwnProperty.call(uh,He.key)&&(se.setState({ariaLiveMessage:`Moved selected node ${He.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~i}, y: ${~~a}`}),ae({x:uh[He.key].x,y:uh[He.key].y,isShiftPressed:He.shiftKey}))};b.useEffect(()=>()=>{F.current&&(I?.unobserve(F.current),F.current=null)},[]),b.useEffect(()=>{if(G.current&&!L){const He=G.current;(!P||!R||F.current!==He)&&(F.current&&I?.unobserve(F.current),I?.observe(He),F.current=He)}},[L,P,R]),b.useEffect(()=>{const He=ne.current!==r,$e=U.current!==M,bt=te.current!==q;G.current&&(He||$e||bt)&&(He&&(ne.current=r),$e&&(U.current=M),bt&&(te.current=q),se.getState().updateNodeDimensions([{id:n,nodeElement:G.current,forceUpdate:!0}]))},[n,r,M,q]);const Qe=eV({nodeRef:G,disabled:L||!N,noDragClassName:z,handleSelector:$,nodeId:n,isSelectable:C,selectNodesOnDrag:E});return L?null:he.createElement("div",{className:xs(["react-flow__node",`react-flow__node-${r}`,{[H]:N},k,{selected:h,selectable:C,parent:ee,dragging:Qe}]),ref:G,style:{zIndex:V,transform:`translate(${o}px,${c}px)`,pointerEvents:Y?"all":"none",visibility:P?"visible":"hidden",...S},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:re,onMouseMove:le,onMouseLeave:_e,onContextMenu:Ge,onClick:Xe,onDoubleClick:tt,onKeyDown:_?je:void 0,tabIndex:_?0:void 0,role:_?"button":void 0,"aria-describedby":W?void 0:`${HH}-${X}`,"aria-label":J},he.createElement(pSe,{value:n},he.createElement(t,{id:n,data:s,type:r,xPos:i,yPos:a,selected:h,isConnectable:T,sourcePosition:M,targetPosition:q,dragging:Qe,dragHandle:$,zIndex:V})))};return e.displayName="NodeWrapper",b.memo(e)};const nke=t=>{const e=t.getNodes().filter(n=>n.selected);return{...Ry(e,t.nodeOrigin),transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`,userSelectionActive:t.userSelectionActive}};function rke({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=Xr(),{width:s,height:i,x:a,y:o,transformString:c,userSelectionActive:h}=Xn(nke,rs),f=tV(),m=b.useRef(null);if(b.useEffect(()=>{n||m.current?.focus({preventScroll:!0})},[n]),eV({nodeRef:m}),h||!s||!i)return null;const g=t?y=>{const w=r.getState().getNodes().filter(S=>S.selected);t(y,w)}:void 0,x=y=>{Object.prototype.hasOwnProperty.call(uh,y.key)&&f({x:uh[y.key].x,y:uh[y.key].y,isShiftPressed:y.shiftKey})};return he.createElement("div",{className:xs(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c}},he.createElement("div",{ref:m,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:n?void 0:-1,onKeyDown:n?void 0:x,style:{width:s,height:i,top:o,left:a}}))}var ske=b.memo(rke);const ike=t=>t.nodesSelectionActive,nV=({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,deleteKeyCode:o,onMove:c,onMoveStart:h,onMoveEnd:f,selectionKeyCode:m,selectionOnDrag:g,selectionMode:x,onSelectionStart:y,onSelectionEnd:w,multiSelectionKeyCode:S,panActivationKeyCode:k,zoomActivationKeyCode:N,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:I,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,preventScrolling:H,onSelectionContextMenu:P,noWheelClassName:W,noPanClassName:J,disableKeyboardA11y:X})=>{const R=Xn(ike),se=j0(m),G=j0(k),F=G||I,U=G||E,te=se||g&&F!==!0;return HSe({deleteKeyCode:o,multiSelectionKeyCode:S}),he.createElement(GSe,{onMove:c,onMoveStart:h,onMoveEnd:f,onPaneContextMenu:i,elementsSelectable:C,zoomOnScroll:T,zoomOnPinch:_,panOnScroll:U,panOnScrollSpeed:M,panOnScrollMode:q,zoomOnDoubleClick:L,panOnDrag:!se&&F,defaultViewport:$,translateExtent:V,minZoom:ee,maxZoom:z,zoomActivationKeyCode:N,preventScrolling:H,noWheelClassName:W,noPanClassName:J},he.createElement(KH,{onSelectionStart:y,onSelectionEnd:w,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:a,panOnDrag:F,isSelecting:!!te,selectionMode:x},t,R&&he.createElement(ske,{onSelectionContextMenu:P,noPanClassName:J,disableKeyboardA11y:X})))};nV.displayName="FlowRenderer";var ake=b.memo(nV);function lke(t){return Xn(b.useCallback(n=>t?MH(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[t]))}function oke(t){const e={input:fm(t.input||qH),default:fm(t.default||jk),output:fm(t.output||$H),group:fm(t.group||Sj)},n={},r=Object.keys(t).filter(s=>!["input","default","output","group"].includes(s)).reduce((s,i)=>(s[i]=fm(t[i]||jk),s),n);return{...e,...r}}const cke=({x:t,y:e,width:n,height:r,origin:s})=>!n||!r?{x:t,y:e}:s[0]<0||s[1]<0||s[0]>1||s[1]>1?{x:t,y:e}:{x:t-n*s[0],y:e-r*s[1]},uke=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,updateNodeDimensions:t.updateNodeDimensions,onError:t.onError}),rV=t=>{const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,updateNodeDimensions:i,onError:a}=Xn(uke,rs),o=lke(t.onlyRenderVisibleElements),c=b.useRef(),h=b.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const f=new ResizeObserver(m=>{const g=m.map(x=>({id:x.target.getAttribute("data-id"),nodeElement:x.target,forceUpdate:!0}));i(g)});return c.current=f,f},[]);return b.useEffect(()=>()=>{c?.current?.disconnect()},[]),he.createElement("div",{className:"react-flow__nodes",style:Oj},o.map(f=>{let m=f.type||"default";t.nodeTypes[m]||(a?.("003",bo.error003(m)),m="default");const g=t.nodeTypes[m]||t.nodeTypes.default,x=!!(f.draggable||e&&typeof f.draggable>"u"),y=!!(f.selectable||s&&typeof f.selectable>"u"),w=!!(f.connectable||n&&typeof f.connectable>"u"),S=!!(f.focusable||r&&typeof f.focusable>"u"),k=t.nodeExtent?gj(f.positionAbsolute,t.nodeExtent):f.positionAbsolute,N=k?.x??0,C=k?.y??0,T=cke({x:N,y:C,width:f.width??0,height:f.height??0,origin:t.nodeOrigin});return he.createElement(g,{key:f.id,id:f.id,className:f.className,style:f.style,type:m,data:f.data,sourcePosition:f.sourcePosition||ht.Bottom,targetPosition:f.targetPosition||ht.Top,hidden:f.hidden,xPos:N,yPos:C,xPosOrigin:T.x,yPosOrigin:T.y,selectNodesOnDrag:t.selectNodesOnDrag,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,selected:!!f.selected,isDraggable:x,isSelectable:y,isConnectable:w,isFocusable:S,resizeObserver:h,dragHandle:f.dragHandle,zIndex:f[yr]?.z??0,isParent:!!f[yr]?.isParent,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,initialized:!!f.width&&!!f.height,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,ariaLabel:f.ariaLabel,hasHandleBounds:!!f[yr]?.handleBounds})}))};rV.displayName="NodeRenderer";var dke=b.memo(rV);const hke=(t,e,n)=>n===ht.Left?t-e:n===ht.Right?t+e:t,fke=(t,e,n)=>n===ht.Top?t-e:n===ht.Bottom?t+e:t,lA="react-flow__edgeupdater",oA=({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:a,type:o})=>he.createElement("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:a,className:xs([lA,`${lA}-${o}`]),cx:hke(e,r,t),cy:fke(n,r,t),r,stroke:"transparent",fill:"transparent"}),mke=()=>!0;var Rd=t=>{const e=({id:n,className:r,type:s,data:i,onClick:a,onEdgeDoubleClick:o,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,style:S,source:k,target:N,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,elementsSelectable:L,hidden:I,sourceHandleId:$,targetHandleId:V,onContextMenu:ee,onMouseEnter:z,onMouseMove:H,onMouseLeave:P,reconnectRadius:W,onReconnect:J,onReconnectStart:X,onReconnectEnd:R,markerEnd:se,markerStart:G,rfId:F,ariaLabel:U,isFocusable:te,isReconnectable:ne,pathOptions:Y,interactionWidth:ae,disableKeyboardA11y:re})=>{const le=b.useRef(null),[_e,Ge]=b.useState(!1),[tt,Xe]=b.useState(!1),je=Xr(),Qe=b.useMemo(()=>`url('#${kk(G,F)}')`,[G,F]),He=b.useMemo(()=>`url('#${kk(se,F)}')`,[se,F]);if(I)return null;const $e=jt=>{const{edges:Ne,addSelectedEdges:ie,unselectNodesAndEdges:xe,multiSelectionActive:Je}=je.getState(),dt=Ne.find(er=>er.id===n);dt&&(L&&(je.setState({nodesSelectionActive:!1}),dt.selected&&Je?(xe({nodes:[],edges:[dt]}),le.current?.blur()):ie([n])),a&&a(jt,dt))},bt=dm(n,je.getState,o),lt=dm(n,je.getState,ee),xn=dm(n,je.getState,z),_n=dm(n,je.getState,H),Cn=dm(n,je.getState,P),Dt=(jt,Ne)=>{if(jt.button!==0)return;const{edges:ie,isValidConnection:xe}=je.getState(),Je=Ne?N:k,dt=(Ne?V:$)||null,er=Ne?"target":"source",pt=xe||mke,kn=Ne,vt=ie.find(ot=>ot.id===n);Xe(!0),X?.(jt,vt,er);const Gt=ot=>{Xe(!1),R?.(ot,vt,er)};PH({event:jt,handleId:dt,nodeId:Je,onConnect:ot=>J?.(vt,ot),isTarget:kn,getState:je.getState,setState:je.setState,isValidConnection:pt,edgeUpdaterType:er,onReconnectEnd:Gt})},xt=jt=>Dt(jt,!0),Te=jt=>Dt(jt,!1),Re=()=>Ge(!0),qe=()=>Ge(!1),rt=!L&&!a,wt=jt=>{if(!re&&OH.includes(jt.key)&&L){const{unselectNodesAndEdges:Ne,addSelectedEdges:ie,edges:xe}=je.getState();jt.key==="Escape"?(le.current?.blur(),Ne({edges:[xe.find(dt=>dt.id===n)]})):ie([n])}};return he.createElement("g",{className:xs(["react-flow__edge",`react-flow__edge-${s}`,r,{selected:c,animated:h,inactive:rt,updating:_e}]),onClick:$e,onDoubleClick:bt,onContextMenu:lt,onMouseEnter:xn,onMouseMove:_n,onMouseLeave:Cn,onKeyDown:te?wt:void 0,tabIndex:te?0:void 0,role:te?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":U===null?void 0:U||`Edge from ${k} to ${N}`,"aria-describedby":te?`${VH}-${F}`:void 0,ref:le},!tt&&he.createElement(t,{id:n,source:k,target:N,selected:c,animated:h,label:f,labelStyle:m,labelShowBg:g,labelBgStyle:x,labelBgPadding:y,labelBgBorderRadius:w,data:i,style:S,sourceX:C,sourceY:T,targetX:_,targetY:E,sourcePosition:M,targetPosition:q,sourceHandleId:$,targetHandleId:V,markerStart:Qe,markerEnd:He,pathOptions:Y,interactionWidth:ae}),ne&&he.createElement(he.Fragment,null,(ne==="source"||ne===!0)&&he.createElement(oA,{position:M,centerX:C,centerY:T,radius:W,onMouseDown:xt,onMouseEnter:Re,onMouseOut:qe,type:"source"}),(ne==="target"||ne===!0)&&he.createElement(oA,{position:q,centerX:_,centerY:E,radius:W,onMouseDown:Te,onMouseEnter:Re,onMouseOut:qe,type:"target"})))};return e.displayName="EdgeWrapper",b.memo(e)};function pke(t){const e={default:Rd(t.default||yv),straight:Rd(t.bezier||yj),step:Rd(t.step||vj),smoothstep:Rd(t.step||Ay),simplebezier:Rd(t.simplebezier||xj)},n={},r=Object.keys(t).filter(s=>!["default","bezier"].includes(s)).reduce((s,i)=>(s[i]=Rd(t[i]||yv),s),n);return{...e,...r}}function cA(t,e,n=null){const r=(n?.x||0)+e.x,s=(n?.y||0)+e.y,i=n?.width||e.width,a=n?.height||e.height;switch(t){case ht.Top:return{x:r+i/2,y:s};case ht.Right:return{x:r+i,y:s+a/2};case ht.Bottom:return{x:r+i/2,y:s+a};case ht.Left:return{x:r,y:s+a/2}}}function uA(t,e){return t?t.length===1||!e?t[0]:e&&t.find(n=>n.id===e)||null:null}const gke=(t,e,n,r,s,i)=>{const a=cA(n,t,e),o=cA(i,r,s);return{sourceX:a.x,sourceY:a.y,targetX:o.x,targetY:o.y}};function xke({sourcePos:t,targetPos:e,sourceWidth:n,sourceHeight:r,targetWidth:s,targetHeight:i,width:a,height:o,transform:c}){const h={x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x+n,e.x+s),y2:Math.max(t.y+r,e.y+i)};h.x===h.x2&&(h.x2+=1),h.y===h.y2&&(h.y2+=1);const f=k0({x:(0-c[0])/c[2],y:(0-c[1])/c[2],width:a/c[2],height:o/c[2]}),m=Math.max(0,Math.min(f.x2,h.x2)-Math.max(f.x,h.x)),g=Math.max(0,Math.min(f.y2,h.y2)-Math.max(f.y,h.y));return Math.ceil(m*g)>0}function dA(t){const e=t?.[yr]?.handleBounds||null,n=e&&t?.width&&t?.height&&typeof t?.positionAbsolute?.x<"u"&&typeof t?.positionAbsolute?.y<"u";return[{x:t?.positionAbsolute?.x||0,y:t?.positionAbsolute?.y||0,width:t?.width||0,height:t?.height||0},e,!!n]}const vke=[{level:0,isMaxLevel:!0,edges:[]}];function yke(t,e,n=!1){let r=-1;const s=t.reduce((a,o)=>{const c=ta(o.zIndex);let h=c?o.zIndex:0;if(n){const f=e.get(o.target),m=e.get(o.source),g=o.selected||f?.selected||m?.selected,x=Math.max(m?.[yr]?.z||0,f?.[yr]?.z||0,1e3);h=(c?o.zIndex:0)+(g?x:0)}return a[h]?a[h].push(o):a[h]=[o],r=h>r?h:r,a},{}),i=Object.entries(s).map(([a,o])=>{const c=+a;return{edges:o,level:c,isMaxLevel:c===r}});return i.length===0?vke:i}function bke(t,e,n){const r=Xn(b.useCallback(s=>t?s.edges.filter(i=>{const a=e.get(i.source),o=e.get(i.target);return a?.width&&a?.height&&o?.width&&o?.height&&xke({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:o.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:o.width,targetHeight:o.height,width:s.width,height:s.height,transform:s.transform})}):s.edges,[t,e]));return yke(r,e,n)}const wke=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),Ske=({color:t="none",strokeWidth:e=1})=>he.createElement("polyline",{style:{stroke:t,fill:t,strokeWidth:e},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),hA={[vv.Arrow]:wke,[vv.ArrowClosed]:Ske};function kke(t){const e=Xr();return b.useMemo(()=>Object.prototype.hasOwnProperty.call(hA,t)?hA[t]:(e.getState().onError?.("009",bo.error009(t)),null),[t])}const Oke=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:a,orient:o="auto-start-reverse"})=>{const c=kke(e);return c?he.createElement("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:o,refX:"0",refY:"0"},he.createElement(c,{color:n,strokeWidth:a})):null},jke=({defaultColor:t,rfId:e})=>n=>{const r=[];return n.edges.reduce((s,i)=>([i.markerStart,i.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const o=kk(a,e);r.includes(o)||(s.push({id:o,color:a.color||t,...a}),r.push(o))}}),s),[]).sort((s,i)=>s.id.localeCompare(i.id))},sV=({defaultColor:t,rfId:e})=>{const n=Xn(b.useCallback(jke({defaultColor:t,rfId:e}),[t,e]),(r,s)=>!(r.length!==s.length||r.some((i,a)=>i.id!==s[a].id)));return he.createElement("defs",null,n.map(r=>he.createElement(Oke,{id:r.id,key:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient})))};sV.displayName="MarkerDefinitions";var Nke=b.memo(sV);const Cke=t=>({nodesConnectable:t.nodesConnectable,edgesFocusable:t.edgesFocusable,edgesUpdatable:t.edgesUpdatable,elementsSelectable:t.elementsSelectable,width:t.width,height:t.height,connectionMode:t.connectionMode,nodeInternals:t.nodeInternals,onError:t.onError}),iV=({defaultMarkerColor:t,onlyRenderVisibleElements:e,elevateEdgesOnSelect:n,rfId:r,edgeTypes:s,noPanClassName:i,onEdgeContextMenu:a,onEdgeMouseEnter:o,onEdgeMouseMove:c,onEdgeMouseLeave:h,onEdgeClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,children:S,disableKeyboardA11y:k})=>{const{edgesFocusable:N,edgesUpdatable:C,elementsSelectable:T,width:_,height:E,connectionMode:M,nodeInternals:q,onError:L}=Xn(Cke,rs),I=bke(e,q,n);return _?he.createElement(he.Fragment,null,I.map(({level:$,edges:V,isMaxLevel:ee})=>he.createElement("svg",{key:$,style:{zIndex:$},width:_,height:E,className:"react-flow__edges react-flow__container"},ee&&he.createElement(Nke,{defaultColor:t,rfId:r}),he.createElement("g",null,V.map(z=>{const[H,P,W]=dA(q.get(z.source)),[J,X,R]=dA(q.get(z.target));if(!W||!R)return null;let se=z.type||"default";s[se]||(L?.("011",bo.error011(se)),se="default");const G=s[se]||s.default,F=M===Iu.Strict?X.target:(X.target??[]).concat(X.source??[]),U=uA(P.source,z.sourceHandle),te=uA(F,z.targetHandle),ne=U?.position||ht.Bottom,Y=te?.position||ht.Top,ae=!!(z.focusable||N&&typeof z.focusable>"u"),re=z.reconnectable||z.updatable,le=typeof g<"u"&&(re||C&&typeof re>"u");if(!U||!te)return L?.("008",bo.error008(U,z)),null;const{sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe}=gke(H,U,ne,J,te,Y);return he.createElement(G,{key:z.id,id:z.id,className:xs([z.className,i]),type:se,data:z.data,selected:!!z.selected,animated:!!z.animated,hidden:!!z.hidden,label:z.label,labelStyle:z.labelStyle,labelShowBg:z.labelShowBg,labelBgStyle:z.labelBgStyle,labelBgPadding:z.labelBgPadding,labelBgBorderRadius:z.labelBgBorderRadius,style:z.style,source:z.source,target:z.target,sourceHandleId:z.sourceHandle,targetHandleId:z.targetHandle,markerEnd:z.markerEnd,markerStart:z.markerStart,sourceX:_e,sourceY:Ge,targetX:tt,targetY:Xe,sourcePosition:ne,targetPosition:Y,elementsSelectable:T,onContextMenu:a,onMouseEnter:o,onMouseMove:c,onMouseLeave:h,onClick:f,onEdgeDoubleClick:m,onReconnect:g,onReconnectStart:x,onReconnectEnd:y,reconnectRadius:w,rfId:r,ariaLabel:z.ariaLabel,isFocusable:ae,isReconnectable:le,pathOptions:"pathOptions"in z?z.pathOptions:void 0,interactionWidth:z.interactionWidth,disableKeyboardA11y:k})})))),S):null};iV.displayName="EdgeRenderer";var Tke=b.memo(iV);const Eke=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function _ke({children:t}){const e=Xn(Eke);return he.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:e}},t)}function Mke(t){const e=kj(),n=b.useRef(!1);b.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Ake={[ht.Left]:ht.Right,[ht.Right]:ht.Left,[ht.Top]:ht.Bottom,[ht.Bottom]:ht.Top},aV=({nodeId:t,handleType:e,style:n,type:r=uc.Bezier,CustomComponent:s,connectionStatus:i})=>{const{fromNode:a,handleId:o,toX:c,toY:h,connectionMode:f}=Xn(b.useCallback(E=>({fromNode:E.nodeInternals.get(t),handleId:E.connectionHandleId,toX:(E.connectionPosition.x-E.transform[0])/E.transform[2],toY:(E.connectionPosition.y-E.transform[1])/E.transform[2],connectionMode:E.connectionMode}),[t]),rs),m=a?.[yr]?.handleBounds;let g=m?.[e];if(f===Iu.Loose&&(g=g||m?.[e==="source"?"target":"source"]),!a||!g)return null;const x=o?g.find(E=>E.id===o):g[0],y=x?x.x+x.width/2:(a.width??0)/2,w=x?x.y+x.height/2:a.height??0,S=(a.positionAbsolute?.x??0)+y,k=(a.positionAbsolute?.y??0)+w,N=x?.position,C=N?Ake[N]:null;if(!N||!C)return null;if(s)return he.createElement(s,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:x,fromX:S,fromY:k,toX:c,toY:h,fromPosition:N,toPosition:C,connectionStatus:i});let T="";const _={sourceX:S,sourceY:k,sourcePosition:N,targetX:c,targetY:h,targetPosition:C};return r===uc.Bezier?[T]=EH(_):r===uc.Step?[T]=Sk({..._,borderRadius:0}):r===uc.SmoothStep?[T]=Sk(_):r===uc.SimpleBezier?[T]=TH(_):T=`M${S},${k} ${c},${h}`,he.createElement("path",{d:T,fill:"none",className:"react-flow__connection-path",style:n})};aV.displayName="ConnectionLine";const Rke=t=>({nodeId:t.connectionNodeId,handleType:t.connectionHandleType,nodesConnectable:t.nodesConnectable,connectionStatus:t.connectionStatus,width:t.width,height:t.height});function Dke({containerStyle:t,style:e,type:n,component:r}){const{nodeId:s,handleType:i,nodesConnectable:a,width:o,height:c,connectionStatus:h}=Xn(Rke,rs);return!(s&&i&&o&&a)?null:he.createElement("svg",{style:t,width:o,height:c,className:"react-flow__edges react-flow__connectionline react-flow__container"},he.createElement("g",{className:xs(["react-flow__connection",h])},he.createElement(aV,{nodeId:s,handleType:i,style:e,type:n,CustomComponent:r,connectionStatus:h})))}function fA(t,e){return b.useRef(null),Xr(),b.useMemo(()=>e(t),[t])}const lV=({nodeTypes:t,edgeTypes:e,onMove:n,onMoveStart:r,onMoveEnd:s,onInit:i,onNodeClick:a,onEdgeClick:o,onNodeDoubleClick:c,onEdgeDoubleClick:h,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,onSelectionContextMenu:y,onSelectionStart:w,onSelectionEnd:S,connectionLineType:k,connectionLineStyle:N,connectionLineComponent:C,connectionLineContainerStyle:T,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,deleteKeyCode:$,onlyRenderVisibleElements:V,elementsSelectable:ee,selectNodesOnDrag:z,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,preventScrolling:X,defaultMarkerColor:R,zoomOnScroll:se,zoomOnPinch:G,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,zoomOnDoubleClick:ne,panOnDrag:Y,onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:le,onPaneMouseLeave:_e,onPaneScroll:Ge,onPaneContextMenu:tt,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:lt,reconnectRadius:xn,noDragClassName:_n,noWheelClassName:Cn,noPanClassName:Dt,elevateEdgesOnSelect:xt,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})=>{const wt=fA(t,oke),jt=fA(e,pke);return Mke(i),he.createElement(ake,{onPaneClick:ae,onPaneMouseEnter:re,onPaneMouseMove:le,onPaneMouseLeave:_e,onPaneContextMenu:tt,onPaneScroll:Ge,deleteKeyCode:$,selectionKeyCode:_,selectionOnDrag:E,selectionMode:M,onSelectionStart:w,onSelectionEnd:S,multiSelectionKeyCode:q,panActivationKeyCode:L,zoomActivationKeyCode:I,elementsSelectable:ee,onMove:n,onMoveStart:r,onMoveEnd:s,zoomOnScroll:se,zoomOnPinch:G,zoomOnDoubleClick:ne,panOnScroll:F,panOnScrollSpeed:U,panOnScrollMode:te,panOnDrag:Y,defaultViewport:H,translateExtent:P,minZoom:W,maxZoom:J,onSelectionContextMenu:y,preventScrolling:X,noDragClassName:_n,noWheelClassName:Cn,noPanClassName:Dt,disableKeyboardA11y:Te},he.createElement(_ke,null,he.createElement(Tke,{edgeTypes:jt,onEdgeClick:o,onEdgeDoubleClick:h,onlyRenderVisibleElements:V,onEdgeContextMenu:Xe,onEdgeMouseEnter:je,onEdgeMouseMove:Qe,onEdgeMouseLeave:He,onReconnect:$e,onReconnectStart:bt,onReconnectEnd:lt,reconnectRadius:xn,defaultMarkerColor:R,noPanClassName:Dt,elevateEdgesOnSelect:!!xt,disableKeyboardA11y:Te,rfId:rt},he.createElement(Dke,{style:N,type:k,component:C,containerStyle:T})),he.createElement("div",{className:"react-flow__edgelabel-renderer"}),he.createElement(dke,{nodeTypes:wt,onNodeClick:a,onNodeDoubleClick:c,onNodeMouseEnter:f,onNodeMouseMove:m,onNodeMouseLeave:g,onNodeContextMenu:x,selectNodesOnDrag:z,onlyRenderVisibleElements:V,noPanClassName:Dt,noDragClassName:_n,disableKeyboardA11y:Te,nodeOrigin:Re,nodeExtent:qe,rfId:rt})))};lV.displayName="GraphView";var zke=b.memo(lV);const Ck=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nc={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Ck,nodeExtent:Ck,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:Iu.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:cSe,isValidConnection:void 0},Pke=()=>Ywe((t,e)=>({...nc,setNodes:n=>{const{nodeInternals:r,nodeOrigin:s,elevateNodesOnSelect:i}=e();t({nodeInternals:P4(n,r,s,i)})},getNodes:()=>Array.from(e().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=e();t({edges:n.map(s=>({...r,...s}))})},setDefaultNodesAndEdges:(n,r)=>{const s=typeof n<"u",i=typeof r<"u",a=s?P4(n,new Map,e().nodeOrigin,e().elevateNodesOnSelect):new Map;t({nodeInternals:a,edges:i?r:[],hasDefaultNodes:s,hasDefaultEdges:i})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:s,fitViewOnInit:i,fitViewOnInitDone:a,fitViewOnInitOptions:o,domNode:c,nodeOrigin:h}=e(),f=c?.querySelector(".react-flow__viewport");if(!f)return;const m=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(m.transform),x=n.reduce((w,S)=>{const k=s.get(S.id);if(k?.hidden)s.set(k.id,{...k,[yr]:{...k[yr],handleBounds:void 0}});else if(k){const N=pj(S.nodeElement);!!(N.width&&N.height&&(k.width!==N.width||k.height!==N.height||S.forceUpdate))&&(s.set(k.id,{...k,[yr]:{...k[yr],handleBounds:{source:aA(".source",S.nodeElement,g,h),target:aA(".target",S.nodeElement,g,h)}},...N}),w.push({id:k.id,type:"dimensions",dimensions:N}))}return w},[]);WH(s,h);const y=a||i&&!a&&GH(e,{initial:!0,...o});t({nodeInternals:new Map(s),fitViewOnInitDone:y}),x?.length>0&&r?.(x)},updateNodePositions:(n,r=!0,s=!1)=>{const{triggerNodeChanges:i}=e(),a=n.map(o=>{const c={id:o.id,type:"position",dragging:s};return r&&(c.positionAbsolute=o.positionAbsolute,c.position=o.position),c});i(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:s,hasDefaultNodes:i,nodeOrigin:a,getNodes:o,elevateNodesOnSelect:c}=e();if(n?.length){if(i){const h=YH(n,o()),f=P4(h,s,a,c);t({nodeInternals:f})}r?.(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(c=>oc(c,!0)):(a=Xd(i(),n),o=Xd(s,[])),qx({changedNodes:a,changedEdges:o,get:e,set:t})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:s,getNodes:i}=e();let a,o=null;r?a=n.map(c=>oc(c,!0)):(a=Xd(s,n),o=Xd(i(),[])),qx({changedNodes:o,changedEdges:a,get:e,set:t})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:s,getNodes:i}=e(),a=n||i(),o=r||s,c=a.map(f=>(f.selected=!1,oc(f.id,!1))),h=o.map(f=>oc(f.id,!1));qx({changedNodes:c,changedEdges:h,get:e,set:t})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:s}=e();r?.scaleExtent([n,s]),t({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:s}=e();r?.scaleExtent([s,n]),t({maxZoom:n})},setTranslateExtent:n=>{e().d3Zoom?.translateExtent(n),t({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=e(),i=r().filter(o=>o.selected).map(o=>oc(o.id,!1)),a=n.filter(o=>o.selected).map(o=>oc(o.id,!1));qx({changedNodes:i,changedEdges:a,get:e,set:t})},setNodeExtent:n=>{const{nodeInternals:r}=e();r.forEach(s=>{s.positionAbsolute=gj(s.position,n)}),t({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:s,height:i,d3Zoom:a,d3Selection:o,translateExtent:c}=e();if(!a||!o||!n.x&&!n.y)return!1;const h=co.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),f=[[0,0],[s,i]],m=a?.constrain()(h,f,c);return a.transform(o,m),r[0]!==m.x||r[1]!==m.y||r[2]!==m.k},cancelConnection:()=>t({connectionNodeId:nc.connectionNodeId,connectionHandleId:nc.connectionHandleId,connectionHandleType:nc.connectionHandleType,connectionStatus:nc.connectionStatus,connectionStartHandle:nc.connectionStartHandle,connectionEndHandle:nc.connectionEndHandle}),reset:()=>t({...nc})}),Object.is),oV=({children:t})=>{const e=b.useRef(null);return e.current||(e.current=Pke()),he.createElement(nSe,{value:e.current},t)};oV.displayName="ReactFlowProvider";const cV=({children:t})=>b.useContext(_y)?he.createElement(he.Fragment,null,t):he.createElement(oV,null,t);cV.displayName="ReactFlowWrapper";const Lke={input:qH,default:jk,output:$H,group:Sj},Ike={default:yv,straight:yj,step:vj,smoothstep:Ay,simplebezier:xj},Bke=[0,0],qke=[15,15],Fke={x:0,y:0,zoom:1},$ke={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},uV=b.forwardRef(({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i=Lke,edgeTypes:a=Ike,onNodeClick:o,onEdgeClick:c,onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onNodesDelete:I,onEdgesDelete:$,onSelectionChange:V,onSelectionDragStart:ee,onSelectionDrag:z,onSelectionDragStop:H,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,connectionMode:X=Iu.Strict,connectionLineType:R=uc.Bezier,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,deleteKeyCode:U="Backspace",selectionKeyCode:te="Shift",selectionOnDrag:ne=!1,selectionMode:Y=O0.Full,panActivationKeyCode:ae="Space",multiSelectionKeyCode:re=xv()?"Meta":"Control",zoomActivationKeyCode:le=xv()?"Meta":"Control",snapToGrid:_e=!1,snapGrid:Ge=qke,onlyRenderVisibleElements:tt=!1,selectNodesOnDrag:Xe=!0,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,nodeOrigin:$e=Bke,edgesFocusable:bt,edgesUpdatable:lt,elementsSelectable:xn,defaultViewport:_n=Fke,minZoom:Cn=.5,maxZoom:Dt=2,translateExtent:xt=Ck,preventScrolling:Te=!0,nodeExtent:Re,defaultMarkerColor:qe="#b1b1b7",zoomOnScroll:rt=!0,zoomOnPinch:wt=!0,panOnScroll:jt=!1,panOnScrollSpeed:Ne=.5,panOnScrollMode:ie=xu.Free,zoomOnDoubleClick:xe=!0,panOnDrag:Je=!0,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:kn,onPaneScroll:vt,onPaneContextMenu:Gt,children:Vt,onEdgeContextMenu:ot,onEdgeDoubleClick:mr,onEdgeMouseEnter:Yr,onEdgeMouseMove:Kr,onEdgeMouseLeave:pr,onEdgeUpdate:Cr,onEdgeUpdateStart:Bs,onEdgeUpdateEnd:wr,onReconnect:hi,onReconnectStart:Cs,onReconnectEnd:qs,reconnectRadius:ma=10,edgeUpdaterRadius:pa=10,onNodesChange:fi,onEdgesChange:Pa,noDragClassName:Fs="nodrag",noWheelClassName:Fr="nowheel",noPanClassName:as="nopan",fitView:No=!1,fitViewOptions:nf,connectOnClick:qy=!0,attributionPosition:Fy,proOptions:jp,defaultEdgeOptions:Ic,elevateNodesOnSelect:rf=!0,elevateEdgesOnSelect:Co=!1,disableKeyboardA11y:wl=!1,autoPanOnConnect:Bc=!0,autoPanOnNodeDrag:To=!0,connectionRadius:Tr=20,isValidConnection:Np,onError:Cp,style:Sl,id:kl,nodeDragThreshold:$y,...Tp},Ep)=>{const sf=kl||"1";return he.createElement("div",{...Tp,style:{...Sl,...$ke},ref:Ep,className:xs(["react-flow",s]),"data-testid":"rf__wrapper",id:kl},he.createElement(cV,null,he.createElement(zke,{onInit:h,onMove:f,onMoveStart:m,onMoveEnd:g,onNodeClick:o,onEdgeClick:c,onNodeMouseEnter:N,onNodeMouseMove:C,onNodeMouseLeave:T,onNodeContextMenu:_,onNodeDoubleClick:E,nodeTypes:i,edgeTypes:a,connectionLineType:R,connectionLineStyle:se,connectionLineComponent:G,connectionLineContainerStyle:F,selectionKeyCode:te,selectionOnDrag:ne,selectionMode:Y,deleteKeyCode:U,multiSelectionKeyCode:re,panActivationKeyCode:ae,zoomActivationKeyCode:le,onlyRenderVisibleElements:tt,selectNodesOnDrag:Xe,defaultViewport:_n,translateExtent:xt,minZoom:Cn,maxZoom:Dt,preventScrolling:Te,zoomOnScroll:rt,zoomOnPinch:wt,zoomOnDoubleClick:xe,panOnScroll:jt,panOnScrollSpeed:Ne,panOnScrollMode:ie,panOnDrag:Je,onPaneClick:dt,onPaneMouseEnter:er,onPaneMouseMove:pt,onPaneMouseLeave:kn,onPaneScroll:vt,onPaneContextMenu:Gt,onSelectionContextMenu:P,onSelectionStart:W,onSelectionEnd:J,onEdgeContextMenu:ot,onEdgeDoubleClick:mr,onEdgeMouseEnter:Yr,onEdgeMouseMove:Kr,onEdgeMouseLeave:pr,onReconnect:hi??Cr,onReconnectStart:Cs??Bs,onReconnectEnd:qs??wr,reconnectRadius:ma??pa,defaultMarkerColor:qe,noDragClassName:Fs,noWheelClassName:Fr,noPanClassName:as,elevateEdgesOnSelect:Co,rfId:sf,disableKeyboardA11y:wl,nodeOrigin:$e,nodeExtent:Re}),he.createElement(ASe,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:x,onConnectStart:y,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:k,nodesDraggable:je,nodesConnectable:Qe,nodesFocusable:He,edgesFocusable:bt,edgesUpdatable:lt,elementsSelectable:xn,elevateNodesOnSelect:rf,minZoom:Cn,maxZoom:Dt,nodeExtent:Re,onNodesChange:fi,onEdgesChange:Pa,snapToGrid:_e,snapGrid:Ge,connectionMode:X,translateExtent:xt,connectOnClick:qy,defaultEdgeOptions:Ic,fitView:No,fitViewOptions:nf,onNodesDelete:I,onEdgesDelete:$,onNodeDragStart:M,onNodeDrag:q,onNodeDragStop:L,onSelectionDrag:z,onSelectionDragStart:ee,onSelectionDragStop:H,noPanClassName:as,nodeOrigin:$e,rfId:sf,autoPanOnConnect:Bc,autoPanOnNodeDrag:To,onError:Cp,connectionRadius:Tr,isValidConnection:Np,nodeDragThreshold:$y}),he.createElement(_Se,{onSelectionChange:V}),Vt,he.createElement(sSe,{proOptions:jp,position:Fy}),he.createElement(LSe,{rfId:sf,disableKeyboardA11y:wl})))});uV.displayName="ReactFlow";function dV(t){return e=>{const[n,r]=b.useState(e),s=b.useCallback(i=>r(a=>t(i,a)),[]);return[n,r,s]}}const Qke=dV(YH),Hke=dV(KSe),hV=({id:t,x:e,y:n,width:r,height:s,style:i,color:a,strokeColor:o,strokeWidth:c,className:h,borderRadius:f,shapeRendering:m,onClick:g,selected:x})=>{const{background:y,backgroundColor:w}=i||{},S=a||y||w;return he.createElement("rect",{className:xs(["react-flow__minimap-node",{selected:x},h]),x:e,y:n,rx:f,ry:f,width:r,height:s,fill:S,stroke:o,strokeWidth:c,shapeRendering:m,onClick:g?k=>g(k,t):void 0})};hV.displayName="MiniMapNode";var Vke=b.memo(hV);const Uke=t=>t.nodeOrigin,Wke=t=>t.getNodes().filter(e=>!e.hidden&&e.width&&e.height),q4=t=>t instanceof Function?t:()=>t;function Gke({nodeStrokeColor:t="transparent",nodeColor:e="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s=2,nodeComponent:i=Vke,onClick:a}){const o=Xn(Wke,rs),c=Xn(Uke),h=q4(e),f=q4(t),m=q4(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return he.createElement(he.Fragment,null,o.map(x=>{const{x:y,y:w}=Ou(x,c).positionAbsolute;return he.createElement(i,{key:x.id,x:y,y:w,width:x.width,height:x.height,style:x.style,selected:x.selected,className:m(x),color:h(x),borderRadius:r,strokeColor:f(x),strokeWidth:s,shapeRendering:g,onClick:a,id:x.id})}))}var Xke=b.memo(Gke);const Yke=200,Kke=150,Zke=t=>{const e=t.getNodes(),n={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:n,boundingRect:e.length>0?lSe(Ry(e,t.nodeOrigin),n):n,rfId:t.rfId}},Jke="react-flow__minimap-desc";function fV({style:t,className:e,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:a=2,nodeComponent:o,maskColor:c="rgb(240, 240, 240, 0.6)",maskStrokeColor:h="none",maskStrokeWidth:f=1,position:m="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:w=!1,ariaLabel:S="React Flow mini map",inversePan:k=!1,zoomStep:N=10,offsetScale:C=5}){const T=Xr(),_=b.useRef(null),{boundingRect:E,viewBB:M,rfId:q}=Xn(Zke,rs),L=t?.width??Yke,I=t?.height??Kke,$=E.width/L,V=E.height/I,ee=Math.max($,V),z=ee*L,H=ee*I,P=C*ee,W=E.x-(z-E.width)/2-P,J=E.y-(H-E.height)/2-P,X=z+P*2,R=H+P*2,se=`${Jke}-${q}`,G=b.useRef(0);G.current=ee,b.useEffect(()=>{if(_.current){const te=Yi(_.current),ne=re=>{const{transform:le,d3Selection:_e,d3Zoom:Ge}=T.getState();if(re.sourceEvent.type!=="wheel"||!_e||!Ge)return;const tt=-re.sourceEvent.deltaY*(re.sourceEvent.deltaMode===1?.05:re.sourceEvent.deltaMode?1:.002)*N,Xe=le[2]*Math.pow(2,tt);Ge.scaleTo(_e,Xe)},Y=re=>{const{transform:le,d3Selection:_e,d3Zoom:Ge,translateExtent:tt,width:Xe,height:je}=T.getState();if(re.sourceEvent.type!=="mousemove"||!_e||!Ge)return;const Qe=G.current*Math.max(1,le[2])*(k?-1:1),He={x:le[0]-re.sourceEvent.movementX*Qe,y:le[1]-re.sourceEvent.movementY*Qe},$e=[[0,0],[Xe,je]],bt=co.translate(He.x,He.y).scale(le[2]),lt=Ge.constrain()(bt,$e,tt);Ge.transform(_e,lt)},ae=vH().on("zoom",y?Y:null).on("zoom.wheel",w?ne:null);return te.call(ae),()=>{te.on("zoom",null)}}},[y,w,k,N]);const F=g?te=>{const ne=Sa(te);g(te,{x:ne[0],y:ne[1]})}:void 0,U=x?(te,ne)=>{const Y=T.getState().nodeInternals.get(ne);x(te,Y)}:void 0;return he.createElement(My,{position:m,style:t,className:xs(["react-flow__minimap",e]),"data-testid":"rf__minimap"},he.createElement("svg",{width:L,height:I,viewBox:`${W} ${J} ${X} ${R}`,role:"img","aria-labelledby":se,ref:_,onClick:F},S&&he.createElement("title",{id:se},S),he.createElement(Xke,{onClick:U,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:a,nodeComponent:o}),he.createElement("path",{className:"react-flow__minimap-mask",d:`M${W-P},${J-P}h${X+P*2}v${R+P*2}h${-X-P*2}z + M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fill:c,fillRule:"evenodd",stroke:h,strokeWidth:f,pointerEvents:"none"})))}fV.displayName="MiniMap";var e6e=b.memo(fV);function t6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},he.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function n6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},he.createElement("path",{d:"M0 0h32v4.2H0z"}))}function r6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},he.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function s6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function i6e(){return he.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},he.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const wm=({children:t,className:e,...n})=>he.createElement("button",{type:"button",className:xs(["react-flow__controls-button",e]),...n},t);wm.displayName="ControlButton";const a6e=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom}),mV=({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:a,onFitView:o,onInteractiveChange:c,className:h,children:f,position:m="bottom-left"})=>{const g=Xr(),[x,y]=b.useState(!1),{isInteractive:w,minZoomReached:S,maxZoomReached:k}=Xn(a6e,rs),{zoomIn:N,zoomOut:C,fitView:T}=kj();if(b.useEffect(()=>{y(!0)},[]),!x)return null;const _=()=>{N(),i?.()},E=()=>{C(),a?.()},M=()=>{T(s),o?.()},q=()=>{g.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),c?.(!w)};return he.createElement(My,{className:xs(["react-flow__controls",h]),position:m,style:t,"data-testid":"rf__controls"},e&&he.createElement(he.Fragment,null,he.createElement(wm,{onClick:_,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:k},he.createElement(t6e,null)),he.createElement(wm,{onClick:E,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:S},he.createElement(n6e,null))),n&&he.createElement(wm,{className:"react-flow__controls-fitview",onClick:M,title:"fit view","aria-label":"fit view"},he.createElement(r6e,null)),r&&he.createElement(wm,{className:"react-flow__controls-interactive",onClick:q,title:"toggle interactivity","aria-label":"toggle interactivity"},w?he.createElement(i6e,null):he.createElement(s6e,null)),f)};mV.displayName="Controls";var l6e=b.memo(mV),sa;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(sa||(sa={}));function o6e({color:t,dimensions:e,lineWidth:n}){return he.createElement("path",{stroke:t,strokeWidth:n,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})}function c6e({color:t,radius:e}){return he.createElement("circle",{cx:e,cy:e,r:e,fill:t})}const u6e={[sa.Dots]:"#91919a",[sa.Lines]:"#eee",[sa.Cross]:"#e2e2e2"},d6e={[sa.Dots]:1,[sa.Lines]:1,[sa.Cross]:6},h6e=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function pV({id:t,variant:e=sa.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=2,color:a,style:o,className:c}){const h=b.useRef(null),{transform:f,patternId:m}=Xn(h6e,rs),g=a||u6e[e],x=r||d6e[e],y=e===sa.Dots,w=e===sa.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*f[2]||1,S[1]*f[2]||1],N=x*f[2],C=w?[N,N]:k,T=y?[N/i,N/i]:[C[0]/i,C[1]/i];return he.createElement("svg",{className:xs(["react-flow__background",c]),style:{...o,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:h,"data-testid":"rf__background"},he.createElement("pattern",{id:m+t,x:f[0]%k[0],y:f[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`},y?he.createElement(c6e,{color:g,radius:N/i}):he.createElement(o6e,{dimensions:C,color:g,lineWidth:s})),he.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${m+t})`}))}pV.displayName="Background";var f6e=b.memo(pV);function jj(t){throw new Error('Could not dynamically require "'+t+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var F4,mA;function m6e(){if(mA)return F4;mA=1;var t=kD(),e=4;function n(r){return t(r,e)}return F4=n,F4}var $4,pA;function gV(){if(pA)return $4;pA=1;var t=EY();function e(n){return typeof n=="function"?n:t}return $4=e,$4}var Q4,gA;function xV(){if(gA)return Q4;gA=1;var t=OD(),e=Pk(),n=gV(),r=Bu();function s(i,a){var o=r(i)?t:e;return o(i,n(a))}return Q4=s,Q4}var H4,xA;function vV(){return xA||(xA=1,H4=xV()),H4}var V4,vA;function p6e(){if(vA)return V4;vA=1;var t=Pk();function e(n,r){var s=[];return t(n,function(i,a,o){r(i,a,o)&&s.push(i)}),s}return V4=e,V4}var U4,yA;function yV(){if(yA)return U4;yA=1;var t=_Y(),e=p6e(),n=Lk(),r=Bu();function s(i,a){var o=r(i)?t:e;return o(i,n(a,3))}return U4=s,U4}var W4,bA;function g6e(){if(bA)return W4;bA=1;var t=Object.prototype,e=t.hasOwnProperty;function n(r,s){return r!=null&&e.call(r,s)}return W4=n,W4}var G4,wA;function bV(){if(wA)return G4;wA=1;var t=g6e(),e=MY();function n(r,s){return r!=null&&e(r,s,t)}return G4=n,G4}var X4,SA;function x6e(){if(SA)return X4;SA=1;var t=jD(),e=ND(),n=CD(),r=Bu(),s=Ik(),i=Bk(),a=AY(),o=qk(),c="[object Map]",h="[object Set]",f=Object.prototype,m=f.hasOwnProperty;function g(x){if(x==null)return!0;if(s(x)&&(r(x)||typeof x=="string"||typeof x.splice=="function"||i(x)||o(x)||n(x)))return!x.length;var y=e(x);if(y==c||y==h)return!x.size;if(a(x))return!t(x).length;for(var w in x)if(m.call(x,w))return!1;return!0}return X4=g,X4}var Y4,kA;function wV(){if(kA)return Y4;kA=1;function t(e){return e===void 0}return Y4=t,Y4}var K4,OA;function v6e(){if(OA)return K4;OA=1;function t(e,n,r,s){var i=-1,a=e==null?0:e.length;for(s&&a&&(r=e[++i]);++i1?x.setNode(y,m):x.setNode(y)}),this},s.prototype.setNode=function(f,m){return t.has(this._nodes,f)?(arguments.length>1&&(this._nodes[f]=m),this):(this._nodes[f]=arguments.length>1?m:this._defaultNodeLabelFn(f),this._isCompound&&(this._parent[f]=n,this._children[f]={},this._children[n][f]=!0),this._in[f]={},this._preds[f]={},this._out[f]={},this._sucs[f]={},++this._nodeCount,this)},s.prototype.node=function(f){return this._nodes[f]},s.prototype.hasNode=function(f){return t.has(this._nodes,f)},s.prototype.removeNode=function(f){var m=this;if(t.has(this._nodes,f)){var g=function(x){m.removeEdge(m._edgeObjs[x])};delete this._nodes[f],this._isCompound&&(this._removeFromParentsChildList(f),delete this._parent[f],t.each(this.children(f),function(x){m.setParent(x)}),delete this._children[f]),t.each(t.keys(this._in[f]),g),delete this._in[f],delete this._preds[f],t.each(t.keys(this._out[f]),g),delete this._out[f],delete this._sucs[f],--this._nodeCount}return this},s.prototype.setParent=function(f,m){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t.isUndefined(m))m=n;else{m+="";for(var g=m;!t.isUndefined(g);g=this.parent(g))if(g===f)throw new Error("Setting "+m+" as parent of "+f+" would create a cycle");this.setNode(m)}return this.setNode(f),this._removeFromParentsChildList(f),this._parent[f]=m,this._children[m][f]=!0,this},s.prototype._removeFromParentsChildList=function(f){delete this._children[this._parent[f]][f]},s.prototype.parent=function(f){if(this._isCompound){var m=this._parent[f];if(m!==n)return m}},s.prototype.children=function(f){if(t.isUndefined(f)&&(f=n),this._isCompound){var m=this._children[f];if(m)return t.keys(m)}else{if(f===n)return this.nodes();if(this.hasNode(f))return[]}},s.prototype.predecessors=function(f){var m=this._preds[f];if(m)return t.keys(m)},s.prototype.successors=function(f){var m=this._sucs[f];if(m)return t.keys(m)},s.prototype.neighbors=function(f){var m=this.predecessors(f);if(m)return t.union(m,this.successors(f))},s.prototype.isLeaf=function(f){var m;return this.isDirected()?m=this.successors(f):m=this.neighbors(f),m.length===0},s.prototype.filterNodes=function(f){var m=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});m.setGraph(this.graph());var g=this;t.each(this._nodes,function(w,S){f(S)&&m.setNode(S,w)}),t.each(this._edgeObjs,function(w){m.hasNode(w.v)&&m.hasNode(w.w)&&m.setEdge(w,g.edge(w))});var x={};function y(w){var S=g.parent(w);return S===void 0||m.hasNode(S)?(x[w]=S,S):S in x?x[S]:y(S)}return this._isCompound&&t.each(m.nodes(),function(w){m.setParent(w,y(w))}),m},s.prototype.setDefaultEdgeLabel=function(f){return t.isFunction(f)||(f=t.constant(f)),this._defaultEdgeLabelFn=f,this},s.prototype.edgeCount=function(){return this._edgeCount},s.prototype.edges=function(){return t.values(this._edgeObjs)},s.prototype.setPath=function(f,m){var g=this,x=arguments;return t.reduce(f,function(y,w){return x.length>1?g.setEdge(y,w,m):g.setEdge(y,w),w}),this},s.prototype.setEdge=function(){var f,m,g,x,y=!1,w=arguments[0];typeof w=="object"&&w!==null&&"v"in w?(f=w.v,m=w.w,g=w.name,arguments.length===2&&(x=arguments[1],y=!0)):(f=w,m=arguments[1],g=arguments[3],arguments.length>2&&(x=arguments[2],y=!0)),f=""+f,m=""+m,t.isUndefined(g)||(g=""+g);var S=o(this._isDirected,f,m,g);if(t.has(this._edgeLabels,S))return y&&(this._edgeLabels[S]=x),this;if(!t.isUndefined(g)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(f),this.setNode(m),this._edgeLabels[S]=y?x:this._defaultEdgeLabelFn(f,m,g);var k=c(this._isDirected,f,m,g);return f=k.v,m=k.w,Object.freeze(k),this._edgeObjs[S]=k,i(this._preds[m],f),i(this._sucs[f],m),this._in[m][S]=k,this._out[f][S]=k,this._edgeCount++,this},s.prototype.edge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return this._edgeLabels[x]},s.prototype.hasEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g);return t.has(this._edgeLabels,x)},s.prototype.removeEdge=function(f,m,g){var x=arguments.length===1?h(this._isDirected,arguments[0]):o(this._isDirected,f,m,g),y=this._edgeObjs[x];return y&&(f=y.v,m=y.w,delete this._edgeLabels[x],delete this._edgeObjs[x],a(this._preds[m],f),a(this._sucs[f],m),delete this._in[m][x],delete this._out[f][x],this._edgeCount--),this},s.prototype.inEdges=function(f,m){var g=this._in[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.v===m}):x}},s.prototype.outEdges=function(f,m){var g=this._out[f];if(g){var x=t.values(g);return m?t.filter(x,function(y){return y.w===m}):x}},s.prototype.nodeEdges=function(f,m){var g=this.inEdges(f,m);if(g)return g.concat(this.outEdges(f,m))};function i(f,m){f[m]?f[m]++:f[m]=1}function a(f,m){--f[m]||delete f[m]}function o(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}return y+r+w+r+(t.isUndefined(x)?e:x)}function c(f,m,g,x){var y=""+m,w=""+g;if(!f&&y>w){var S=y;y=w,w=S}var k={v:y,w};return x&&(k.name=x),k}function h(f,m){return o(f,m.v,m.w,m.name)}return u5}var d5,IA;function C6e(){return IA||(IA=1,d5="2.1.8"),d5}var h5,BA;function T6e(){return BA||(BA=1,h5={Graph:Nj(),version:C6e()}),h5}var f5,qA;function E6e(){if(qA)return f5;qA=1;var t=fa(),e=Nj();f5={write:n,read:i};function n(a){var o={options:{directed:a.isDirected(),multigraph:a.isMultigraph(),compound:a.isCompound()},nodes:r(a),edges:s(a)};return t.isUndefined(a.graph())||(o.value=t.clone(a.graph())),o}function r(a){return t.map(a.nodes(),function(o){var c=a.node(o),h=a.parent(o),f={v:o};return t.isUndefined(c)||(f.value=c),t.isUndefined(h)||(f.parent=h),f})}function s(a){return t.map(a.edges(),function(o){var c=a.edge(o),h={v:o.v,w:o.w};return t.isUndefined(o.name)||(h.name=o.name),t.isUndefined(c)||(h.value=c),h})}function i(a){var o=new e(a.options).setGraph(a.value);return t.each(a.nodes,function(c){o.setNode(c.v,c.value),c.parent&&o.setParent(c.v,c.parent)}),t.each(a.edges,function(c){o.setEdge({v:c.v,w:c.w,name:c.name},c.value)}),o}return f5}var m5,FA;function _6e(){if(FA)return m5;FA=1;var t=fa();m5=e;function e(n){var r={},s=[],i;function a(o){t.has(r,o)||(r[o]=!0,i.push(o),t.each(n.successors(o),a),t.each(n.predecessors(o),a))}return t.each(n.nodes(),function(o){i=[],a(o),i.length&&s.push(i)}),s}return m5}var p5,$A;function jV(){if($A)return p5;$A=1;var t=fa();p5=e;function e(){this._arr=[],this._keyIndices={}}return e.prototype.size=function(){return this._arr.length},e.prototype.keys=function(){return this._arr.map(function(n){return n.key})},e.prototype.has=function(n){return t.has(this._keyIndices,n)},e.prototype.priority=function(n){var r=this._keyIndices[n];if(r!==void 0)return this._arr[r].priority},e.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},e.prototype.add=function(n,r){var s=this._keyIndices;if(n=String(n),!t.has(s,n)){var i=this._arr,a=i.length;return s[n]=a,i.push({key:n,priority:r}),this._decrease(a),!0}return!1},e.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var n=this._arr.pop();return delete this._keyIndices[n.key],this._heapify(0),n.key},e.prototype.decrease=function(n,r){var s=this._keyIndices[n];if(r>this._arr[s].priority)throw new Error("New priority is greater than current priority. Key: "+n+" Old: "+this._arr[s].priority+" New: "+r);this._arr[s].priority=r,this._decrease(s)},e.prototype._heapify=function(n){var r=this._arr,s=2*n,i=s+1,a=n;s>1,!(r[i].priority0&&(m=f.removeMin(),g=h[m],g.distance!==Number.POSITIVE_INFINITY);)c(m).forEach(x);return h}return g5}var x5,HA;function M6e(){if(HA)return x5;HA=1;var t=NV(),e=fa();x5=n;function n(r,s,i){return e.transform(r.nodes(),function(a,o){a[o]=t(r,o,s,i)},{})}return x5}var v5,VA;function CV(){if(VA)return v5;VA=1;var t=fa();v5=e;function e(n){var r=0,s=[],i={},a=[];function o(c){var h=i[c]={onStack:!0,lowlink:r,index:r++};if(s.push(c),n.successors(c).forEach(function(g){t.has(i,g)?i[g].onStack&&(h.lowlink=Math.min(h.lowlink,i[g].index)):(o(g),h.lowlink=Math.min(h.lowlink,i[g].lowlink))}),h.lowlink===h.index){var f=[],m;do m=s.pop(),i[m].onStack=!1,f.push(m);while(c!==m);a.push(f)}}return n.nodes().forEach(function(c){t.has(i,c)||o(c)}),a}return v5}var y5,UA;function A6e(){if(UA)return y5;UA=1;var t=fa(),e=CV();y5=n;function n(r){return t.filter(e(r),function(s){return s.length>1||s.length===1&&r.hasEdge(s[0],s[0])})}return y5}var b5,WA;function R6e(){if(WA)return b5;WA=1;var t=fa();b5=n;var e=t.constant(1);function n(s,i,a){return r(s,i||e,a||function(o){return s.outEdges(o)})}function r(s,i,a){var o={},c=s.nodes();return c.forEach(function(h){o[h]={},o[h][h]={distance:0},c.forEach(function(f){h!==f&&(o[h][f]={distance:Number.POSITIVE_INFINITY})}),a(h).forEach(function(f){var m=f.v===h?f.w:f.v,g=i(f);o[h][m]={distance:g,predecessor:h}})}),c.forEach(function(h){var f=o[h];c.forEach(function(m){var g=o[m];c.forEach(function(x){var y=g[h],w=f[x],S=g[x],k=y.distance+w.distance;k0;){if(h=c.removeMin(),t.has(o,h))a.setEdge(h,o[h]);else{if(m)throw new Error("Input graph is not connected: "+s);m=!0}s.nodeEdges(h).forEach(f)}return a}return N5}var C5,eR;function I6e(){return eR||(eR=1,C5={components:_6e(),dijkstra:NV(),dijkstraAll:M6e(),findCycles:A6e(),floydWarshall:R6e(),isAcyclic:D6e(),postorder:z6e(),preorder:P6e(),prim:L6e(),tarjan:CV(),topsort:TV()}),C5}var T5,tR;function B6e(){if(tR)return T5;tR=1;var t=T6e();return T5={Graph:t.Graph,json:E6e(),alg:I6e(),version:t.version},T5}var E5,nR;function _a(){if(nR)return E5;nR=1;var t;if(typeof jj=="function")try{t=B6e()}catch{}return t||(t=window.graphlib),E5=t,E5}var _5,rR;function q6e(){if(rR)return _5;rR=1;var t=kD(),e=1,n=4;function r(s){return t(s,e|n)}return _5=r,_5}var M5,sR;function F6e(){if(sR)return M5;sR=1;var t=$k(),e=AD(),n=MD(),r=Ov(),s=Object.prototype,i=s.hasOwnProperty,a=t(function(o,c){o=Object(o);var h=-1,f=c.length,m=f>2?c[2]:void 0;for(m&&n(c[0],c[1],m)&&(f=1);++h1?i[o-1]:void 0,h=o>2?i[2]:void 0;for(c=r.length>3&&typeof c=="function"?(o--,c):void 0,h&&e(i[0],i[1],h)&&(c=o<3?void 0:c,o=1),s=Object(s);++a0;--S)if(w=f[S].dequeue(),w){g=g.concat(a(h,f,m,w,!0));break}}}return g}function a(h,f,m,g,x){var y=x?[]:void 0;return t.forEach(h.inEdges(g.v),function(w){var S=h.edge(w),k=h.node(w.v);x&&y.push({v:w.v,w:w.w}),k.out-=S,c(f,m,k)}),t.forEach(h.outEdges(g.v),function(w){var S=h.edge(w),k=w.w,N=h.node(k);N.in-=S,c(f,m,N)}),h.removeNode(g.v),y}function o(h,f){var m=new e,g=0,x=0;t.forEach(h.nodes(),function(S){m.setNode(S,{v:S,in:0,out:0})}),t.forEach(h.edges(),function(S){var k=m.edge(S.v,S.w)||0,N=f(S),C=k+N;m.setEdge(S.v,S.w,C),x=Math.max(x,m.node(S.v).out+=N),g=Math.max(g,m.node(S.w).in+=N)});var y=t.range(x+g+3).map(function(){return new n}),w=g+1;return t.forEach(m.nodes(),function(S){c(y,w,m.node(S))}),{graph:m,buckets:y,zeroIdx:w}}function c(h,f,m){m.out?m.in?h[m.out-m.in+f].enqueue(m):h[h.length-1].enqueue(m):h[0].enqueue(m)}return X5}var Y5,kR;function rOe(){if(kR)return Y5;kR=1;var t=lr(),e=nOe();Y5={run:n,undo:s};function n(i){var a=i.graph().acyclicer==="greedy"?e(i,o(i)):r(i);t.forEach(a,function(c){var h=i.edge(c);i.removeEdge(c),h.forwardName=c.name,h.reversed=!0,i.setEdge(c.w,c.v,h,t.uniqueId("rev"))});function o(c){return function(h){return c.edge(h).weight}}}function r(i){var a=[],o={},c={};function h(f){t.has(c,f)||(c[f]=!0,o[f]=!0,t.forEach(i.outEdges(f),function(m){t.has(o,m.w)?a.push(m):h(m.w)}),delete o[f])}return t.forEach(i.nodes(),h),a}function s(i){t.forEach(i.edges(),function(a){var o=i.edge(a);if(o.reversed){i.removeEdge(a);var c=o.forwardName;delete o.reversed,delete o.forwardName,i.setEdge(a.w,a.v,o,c)}})}return Y5}var K5,OR;function ai(){if(OR)return K5;OR=1;var t=lr(),e=_a().Graph;K5={addDummyNode:n,simplify:r,asNonCompoundGraph:s,successorWeights:i,predecessorWeights:a,intersectRect:o,buildLayerMatrix:c,normalizeRanks:h,removeEmptyRanks:f,addBorderNode:m,maxRank:g,partition:x,time:y,notime:w};function n(S,k,N,C){var T;do T=t.uniqueId(C);while(S.hasNode(T));return N.dummy=k,S.setNode(T,N),T}function r(S){var k=new e().setGraph(S.graph());return t.forEach(S.nodes(),function(N){k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){var C=k.edge(N.v,N.w)||{weight:0,minlen:1},T=S.edge(N);k.setEdge(N.v,N.w,{weight:C.weight+T.weight,minlen:Math.max(C.minlen,T.minlen)})}),k}function s(S){var k=new e({multigraph:S.isMultigraph()}).setGraph(S.graph());return t.forEach(S.nodes(),function(N){S.children(N).length||k.setNode(N,S.node(N))}),t.forEach(S.edges(),function(N){k.setEdge(N,S.edge(N))}),k}function i(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.outEdges(N),function(T){C[T.w]=(C[T.w]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function a(S){var k=t.map(S.nodes(),function(N){var C={};return t.forEach(S.inEdges(N),function(T){C[T.v]=(C[T.v]||0)+S.edge(T).weight}),C});return t.zipObject(S.nodes(),k)}function o(S,k){var N=S.x,C=S.y,T=k.x-N,_=k.y-C,E=S.width/2,M=S.height/2;if(!T&&!_)throw new Error("Not possible to find intersection inside of the rectangle");var q,L;return Math.abs(_)*E>Math.abs(T)*M?(_<0&&(M=-M),q=M*T/_,L=M):(T<0&&(E=-E),q=E,L=E*_/T),{x:N+q,y:C+L}}function c(S){var k=t.map(t.range(g(S)+1),function(){return[]});return t.forEach(S.nodes(),function(N){var C=S.node(N),T=C.rank;t.isUndefined(T)||(k[T][C.order]=N)}),k}function h(S){var k=t.min(t.map(S.nodes(),function(N){return S.node(N).rank}));t.forEach(S.nodes(),function(N){var C=S.node(N);t.has(C,"rank")&&(C.rank-=k)})}function f(S){var k=t.min(t.map(S.nodes(),function(_){return S.node(_).rank})),N=[];t.forEach(S.nodes(),function(_){var E=S.node(_).rank-k;N[E]||(N[E]=[]),N[E].push(_)});var C=0,T=S.graph().nodeRankFactor;t.forEach(N,function(_,E){t.isUndefined(_)&&E%T!==0?--C:C&&t.forEach(_,function(M){S.node(M).rank+=C})})}function m(S,k,N,C){var T={width:0,height:0};return arguments.length>=4&&(T.rank=N,T.order=C),n(S,"border",T,k)}function g(S){return t.max(t.map(S.nodes(),function(k){var N=S.node(k).rank;if(!t.isUndefined(N))return N}))}function x(S,k){var N={lhs:[],rhs:[]};return t.forEach(S,function(C){k(C)?N.lhs.push(C):N.rhs.push(C)}),N}function y(S,k){var N=t.now();try{return k()}finally{console.log(S+" time: "+(t.now()-N)+"ms")}}function w(S,k){return k()}return K5}var Z5,jR;function sOe(){if(jR)return Z5;jR=1;var t=lr(),e=ai();Z5={run:n,undo:s};function n(i){i.graph().dummyChains=[],t.forEach(i.edges(),function(a){r(i,a)})}function r(i,a){var o=a.v,c=i.node(o).rank,h=a.w,f=i.node(h).rank,m=a.name,g=i.edge(a),x=g.labelRank;if(f!==c+1){i.removeEdge(a);var y,w,S;for(S=0,++c;cL.lim&&(I=L,$=!0);var V=t.filter(T.edges(),function(ee){return $===N(C,C.node(ee.v),I)&&$!==N(C,C.node(ee.w),I)});return t.minBy(V,function(ee){return n(T,ee)})}function w(C,T,_,E){var M=_.v,q=_.w;C.removeEdge(M,q),C.setEdge(E.v,E.w,{}),m(C),c(C,T),S(C,T)}function S(C,T){var _=t.find(C.nodes(),function(M){return!T.node(M).parent}),E=s(C,_);E=E.slice(1),t.forEach(E,function(M){var q=C.node(M).parent,L=T.edge(M,q),I=!1;L||(L=T.edge(q,M),I=!0),T.node(M).rank=T.node(q).rank+(I?L.minlen:-L.minlen)})}function k(C,T,_){return C.hasEdge(T,_)}function N(C,T,_){return _.low<=T.lim&&T.lim<=_.lim}return t3}var n3,ER;function aOe(){if(ER)return n3;ER=1;var t=bv(),e=t.longestPath,n=AV(),r=iOe();n3=s;function s(c){switch(c.graph().ranker){case"network-simplex":o(c);break;case"tight-tree":a(c);break;case"longest-path":i(c);break;default:o(c)}}var i=e;function a(c){e(c),n(c)}function o(c){r(c)}return n3}var r3,_R;function lOe(){if(_R)return r3;_R=1;var t=lr();r3=e;function e(s){var i=r(s);t.forEach(s.graph().dummyChains,function(a){for(var o=s.node(a),c=o.edgeObj,h=n(s,i,c.v,c.w),f=h.path,m=h.lca,g=0,x=f[g],y=!0;a!==c.w;){if(o=s.node(a),y){for(;(x=f[g])!==m&&s.node(x).maxRankf||m>i[g].lim));for(x=g,g=o;(g=s.parent(g))!==x;)h.push(g);return{path:c.concat(h.reverse()),lca:x}}function r(s){var i={},a=0;function o(c){var h=a;t.forEach(s.children(c),o),i[c]={low:h,lim:a++}}return t.forEach(s.children(),o),i}return r3}var s3,MR;function oOe(){if(MR)return s3;MR=1;var t=lr(),e=ai();s3={run:n,cleanup:a};function n(o){var c=e.addDummyNode(o,"root",{},"_root"),h=s(o),f=t.max(t.values(h))-1,m=2*f+1;o.graph().nestingRoot=c,t.forEach(o.edges(),function(x){o.edge(x).minlen*=m});var g=i(o)+1;t.forEach(o.children(),function(x){r(o,c,m,g,f,h,x)}),o.graph().nodeRankFactor=m}function r(o,c,h,f,m,g,x){var y=o.children(x);if(!y.length){x!==c&&o.setEdge(c,x,{weight:0,minlen:h});return}var w=e.addBorderNode(o,"_bt"),S=e.addBorderNode(o,"_bb"),k=o.node(x);o.setParent(w,x),k.borderTop=w,o.setParent(S,x),k.borderBottom=S,t.forEach(y,function(N){r(o,c,h,f,m,g,N);var C=o.node(N),T=C.borderTop?C.borderTop:N,_=C.borderBottom?C.borderBottom:N,E=C.borderTop?f:2*f,M=T!==_?1:m-g[x]+1;o.setEdge(w,T,{weight:E,minlen:M,nestingEdge:!0}),o.setEdge(_,S,{weight:E,minlen:M,nestingEdge:!0})}),o.parent(x)||o.setEdge(c,w,{weight:0,minlen:m+g[x]})}function s(o){var c={};function h(f,m){var g=o.children(f);g&&g.length&&t.forEach(g,function(x){h(x,m+1)}),c[f]=m}return t.forEach(o.children(),function(f){h(f,1)}),c}function i(o){return t.reduce(o.edges(),function(c,h){return c+o.edge(h).weight},0)}function a(o){var c=o.graph();o.removeNode(c.nestingRoot),delete c.nestingRoot,t.forEach(o.edges(),function(h){var f=o.edge(h);f.nestingEdge&&o.removeEdge(h)})}return s3}var i3,AR;function cOe(){if(AR)return i3;AR=1;var t=lr(),e=ai();i3=n;function n(s){function i(a){var o=s.children(a),c=s.node(a);if(o.length&&t.forEach(o,i),t.has(c,"minRank")){c.borderLeft=[],c.borderRight=[];for(var h=c.minRank,f=c.maxRank+1;h0;)x%2&&(y+=f[x+1]),x=x-1>>1,f[x]+=g.weight;m+=g.weight*y})),m}return o3}var c3,PR;function fOe(){if(PR)return c3;PR=1;var t=lr();c3=e;function e(n,r){return t.map(r,function(s){var i=n.inEdges(s);if(i.length){var a=t.reduce(i,function(o,c){var h=n.edge(c),f=n.node(c.v);return{sum:o.sum+h.weight*f.order,weight:o.weight+h.weight}},{sum:0,weight:0});return{v:s,barycenter:a.sum/a.weight,weight:a.weight}}else return{v:s}})}return c3}var u3,LR;function mOe(){if(LR)return u3;LR=1;var t=lr();u3=e;function e(s,i){var a={};t.forEach(s,function(c,h){var f=a[c.v]={indegree:0,in:[],out:[],vs:[c.v],i:h};t.isUndefined(c.barycenter)||(f.barycenter=c.barycenter,f.weight=c.weight)}),t.forEach(i.edges(),function(c){var h=a[c.v],f=a[c.w];!t.isUndefined(h)&&!t.isUndefined(f)&&(f.indegree++,h.out.push(a[c.w]))});var o=t.filter(a,function(c){return!c.indegree});return n(o)}function n(s){var i=[];function a(h){return function(f){f.merged||(t.isUndefined(f.barycenter)||t.isUndefined(h.barycenter)||f.barycenter>=h.barycenter)&&r(h,f)}}function o(h){return function(f){f.in.push(h),--f.indegree===0&&s.push(f)}}for(;s.length;){var c=s.pop();i.push(c),t.forEach(c.in.reverse(),a(c)),t.forEach(c.out,o(c))}return t.map(t.filter(i,function(h){return!h.merged}),function(h){return t.pick(h,["vs","i","barycenter","weight"])})}function r(s,i){var a=0,o=0;s.weight&&(a+=s.barycenter*s.weight,o+=s.weight),i.weight&&(a+=i.barycenter*i.weight,o+=i.weight),s.vs=i.vs.concat(s.vs),s.barycenter=a/o,s.weight=o,s.i=Math.min(i.i,s.i),i.merged=!0}return u3}var d3,IR;function pOe(){if(IR)return d3;IR=1;var t=lr(),e=ai();d3=n;function n(i,a){var o=e.partition(i,function(w){return t.has(w,"barycenter")}),c=o.lhs,h=t.sortBy(o.rhs,function(w){return-w.i}),f=[],m=0,g=0,x=0;c.sort(s(!!a)),x=r(f,h,x),t.forEach(c,function(w){x+=w.vs.length,f.push(w.vs),m+=w.barycenter*w.weight,g+=w.weight,x=r(f,h,x)});var y={vs:t.flatten(f,!0)};return g&&(y.barycenter=m/g,y.weight=g),y}function r(i,a,o){for(var c;a.length&&(c=t.last(a)).i<=o;)a.pop(),i.push(c.vs),o++;return o}function s(i){return function(a,o){return a.barycentero.barycenter?1:i?o.i-a.i:a.i-o.i}}return d3}var h3,BR;function gOe(){if(BR)return h3;BR=1;var t=lr(),e=fOe(),n=mOe(),r=pOe();h3=s;function s(o,c,h,f){var m=o.children(c),g=o.node(c),x=g?g.borderLeft:void 0,y=g?g.borderRight:void 0,w={};x&&(m=t.filter(m,function(_){return _!==x&&_!==y}));var S=e(o,m);t.forEach(S,function(_){if(o.children(_.v).length){var E=s(o,_.v,h,f);w[_.v]=E,t.has(E,"barycenter")&&a(_,E)}});var k=n(S,h);i(k,w);var N=r(k,f);if(x&&(N.vs=t.flatten([x,N.vs,y],!0),o.predecessors(x).length)){var C=o.node(o.predecessors(x)[0]),T=o.node(o.predecessors(y)[0]);t.has(N,"barycenter")||(N.barycenter=0,N.weight=0),N.barycenter=(N.barycenter*N.weight+C.order+T.order)/(N.weight+2),N.weight+=2}return N}function i(o,c){t.forEach(o,function(h){h.vs=t.flatten(h.vs.map(function(f){return c[f]?c[f].vs:f}),!0)})}function a(o,c){t.isUndefined(o.barycenter)?(o.barycenter=c.barycenter,o.weight=c.weight):(o.barycenter=(o.barycenter*o.weight+c.barycenter*c.weight)/(o.weight+c.weight),o.weight+=c.weight)}return h3}var f3,qR;function xOe(){if(qR)return f3;qR=1;var t=lr(),e=_a().Graph;f3=n;function n(s,i,a){var o=r(s),c=new e({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(function(h){return s.node(h)});return t.forEach(s.nodes(),function(h){var f=s.node(h),m=s.parent(h);(f.rank===i||f.minRank<=i&&i<=f.maxRank)&&(c.setNode(h),c.setParent(h,m||o),t.forEach(s[a](h),function(g){var x=g.v===h?g.w:g.v,y=c.edge(x,h),w=t.isUndefined(y)?0:y.weight;c.setEdge(x,h,{weight:s.edge(g).weight+w})}),t.has(f,"minRank")&&c.setNode(h,{borderLeft:f.borderLeft[i],borderRight:f.borderRight[i]}))}),c}function r(s){for(var i;s.hasNode(i=t.uniqueId("_root")););return i}return f3}var m3,FR;function vOe(){if(FR)return m3;FR=1;var t=lr();m3=e;function e(n,r,s){var i={},a;t.forEach(s,function(o){for(var c=n.parent(o),h,f;c;){if(h=n.parent(c),h?(f=i[h],i[h]=c):(f=a,a=c),f&&f!==c){r.setEdge(f,c);return}c=h}})}return m3}var p3,$R;function yOe(){if($R)return p3;$R=1;var t=lr(),e=dOe(),n=hOe(),r=gOe(),s=xOe(),i=vOe(),a=_a().Graph,o=ai();p3=c;function c(g){var x=o.maxRank(g),y=h(g,t.range(1,x+1),"inEdges"),w=h(g,t.range(x-1,-1,-1),"outEdges"),S=e(g);m(g,S);for(var k=Number.POSITIVE_INFINITY,N,C=0,T=0;T<4;++C,++T){f(C%2?y:w,C%4>=2),S=o.buildLayerMatrix(g);var _=n(g,S);_I)&&a(C,ee,$)})})}function _(E,M){var q=-1,L,I=0;return t.forEach(M,function($,V){if(k.node($).dummy==="border"){var ee=k.predecessors($);ee.length&&(L=k.node(ee[0]).order,T(M,I,V,q,L),I=V,q=L)}T(M,I,M.length,L,E.length)}),M}return t.reduce(N,_),C}function i(k,N){if(k.node(N).dummy)return t.find(k.predecessors(N),function(C){return k.node(C).dummy})}function a(k,N,C){if(N>C){var T=N;N=C,C=T}var _=k[N];_||(k[N]=_={}),_[C]=!0}function o(k,N,C){if(N>C){var T=N;N=C,C=T}return t.has(k[N],C)}function c(k,N,C,T){var _={},E={},M={};return t.forEach(N,function(q){t.forEach(q,function(L,I){_[L]=L,E[L]=L,M[L]=I})}),t.forEach(N,function(q){var L=-1;t.forEach(q,function(I){var $=T(I);if($.length){$=t.sortBy($,function(P){return M[P]});for(var V=($.length-1)/2,ee=Math.floor(V),z=Math.ceil(V);ee<=z;++ee){var H=$[ee];E[I]===I&&Ll.jsxs("div",{className:"px-4 py-2 shadow-md rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700 min-w-[120px]",children:[l.jsx(Cc,{type:"target",position:ht.Top}),l.jsx("div",{className:"font-semibold text-white text-sm truncate max-w-[200px]",title:t.content,children:t.label}),l.jsx(Cc,{type:"source",position:ht.Bottom})]}));RV.displayName="EntityNode";const DV=b.memo(({data:t})=>l.jsxs("div",{className:"px-3 py-2 shadow-md rounded-md bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700 min-w-[100px]",children:[l.jsx(Cc,{type:"target",position:ht.Top}),l.jsx("div",{className:"font-medium text-white text-xs truncate max-w-[150px]",title:t.content,children:t.label}),l.jsx(Cc,{type:"source",position:ht.Bottom})]}));DV.displayName="ParagraphNode";const _Oe={entity:RV,paragraph:DV};function MOe(t,e){const n=new XR.graphlib.Graph;n.setDefaultEdgeLabel(()=>({})),n.setGraph({rankdir:"TB",ranksep:100,nodesep:80});const r=[],s=[];return t.forEach(i=>{n.setNode(i.id,{width:150,height:50})}),e.forEach(i=>{n.setEdge(i.source,i.target)}),XR.layout(n),t.forEach(i=>{const a=n.node(i.id);r.push({id:i.id,type:i.type,position:{x:a.x-75,y:a.y-25},data:{label:i.content.slice(0,20)+(i.content.length>20?"...":""),content:i.content}})}),e.forEach((i,a)=>{const o={id:`edge-${a}`,source:i.source,target:i.target,animated:t.length<=200&&i.weight>5,style:{strokeWidth:Math.min(i.weight/2,5),opacity:.6}};i.weight>10&&t.length<100&&(o.label=`${i.weight.toFixed(0)}`),s.push(o)}),{nodes:r,edges:s}}function AOe(){const t=Ma(),[e,n]=b.useState(!1),[r,s]=b.useState(null),[i,a]=b.useState(""),[o,c]=b.useState("all"),[h,f]=b.useState(50),[m,g]=b.useState("50"),[x,y]=b.useState(!1),[w,S]=b.useState(!0),[k,N]=b.useState(!1),[C,T]=b.useState(!1),[_,E,M]=Qke([]),[q,L,I]=Hke([]),[$,V]=b.useState(0),[ee,z]=b.useState(null),[H,P]=b.useState(null),{toast:W}=Gr(),J=b.useCallback(ne=>ne.type==="entity"?"#6366f1":ne.type==="paragraph"?"#10b981":"#6b7280",[]),X=b.useCallback(async(ne=!1)=>{try{if(!ne&&h>200){T(!0);return}n(!0);const[Y,ae]=await Promise.all([COe(h,o),TOe()]);if(s(ae),Y.nodes.length===0){W({title:"提示",description:"知识库为空,请先导入知识数据"}),E([]),L([]);return}const{nodes:re,edges:le}=MOe(Y.nodes,Y.edges);E(re),L(le),V(re.length),ae&&ae.total_nodes>h&&W({title:"提示",description:`知识图谱包含 ${ae.total_nodes} 个节点,当前显示 ${re.length} 个`}),W({title:"加载成功",description:`已加载 ${re.length} 个节点,${le.length} 条边`})}catch(Y){console.error("加载知识图谱失败:",Y),W({title:"加载失败",description:Y instanceof Error?Y.message:"未知错误",variant:"destructive"})}finally{n(!1)}},[h,o,W]),R=b.useCallback(async()=>{if(!i.trim()){W({title:"提示",description:"请输入搜索关键词"});return}try{const ne=await EOe(i);if(ne.length===0){W({title:"未找到",description:"没有找到匹配的节点"});return}const Y=new Set(ne.map(ae=>ae.id));E(ae=>ae.map(re=>({...re,style:{...re.style,opacity:Y.has(re.id)?1:.3,filter:Y.has(re.id)?"brightness(1.2)":"brightness(0.8)"}}))),W({title:"搜索完成",description:`找到 ${ne.length} 个匹配节点`})}catch(ne){console.error("搜索失败:",ne),W({title:"搜索失败",description:ne instanceof Error?ne.message:"未知错误",variant:"destructive"})}},[i,W]),se=b.useCallback(()=>{E(ne=>ne.map(Y=>({...Y,style:{...Y.style,opacity:1,filter:"brightness(1)"}})))},[]),G=b.useCallback(()=>{S(!1),N(!0),X()},[X]),F=b.useCallback(()=>{T(!1),setTimeout(()=>{X(!0)},0)},[X]),U=b.useCallback((ne,Y)=>{_.find(re=>re.id===Y.id)&&z({id:Y.id,type:Y.type,content:Y.data.content})},[_]);b.useEffect(()=>{w||k&&X()},[h,o,w,k]);const te=b.useCallback((ne,Y)=>{const ae=_.find(_e=>_e.id===Y.source),re=_.find(_e=>_e.id===Y.target),le=q.find(_e=>_e.id===Y.id);ae&&re&&le&&P({source:{id:ae.id,type:ae.type,content:ae.data.content},target:{id:re.id,type:re.type,content:re.data.content},edge:{source:Y.source,target:Y.target,weight:parseFloat(Y.label||"0")}})},[_,q]);return l.jsxs("div",{className:"h-full flex flex-col",children:[l.jsxs("div",{className:"flex-shrink-0 p-4 border-b bg-background",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"麦麦知识库图谱"}),l.jsx("p",{className:"text-muted-foreground mt-1",children:"可视化知识实体与关系网络"})]}),r&&l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(N3,{className:"h-3 w-3"}),"节点: ",r.total_nodes]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(az,{className:"h-3 w-3"}),"边: ",r.total_edges]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(Oa,{className:"h-3 w-3"}),"实体: ",r.entity_nodes]}),l.jsxs(In,{variant:"outline",className:"gap-1",children:[l.jsx(io,{className:"h-3 w-3"}),"段落: ",r.paragraph_nodes]})]})]}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 mt-4",children:[l.jsxs("div",{className:"flex-1 flex gap-2",children:[l.jsx(Pe,{placeholder:"搜索节点内容...",value:i,onChange:ne=>a(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&R(),className:"flex-1"}),l.jsx(fe,{onClick:R,size:"sm",children:l.jsx(li,{className:"h-4 w-4"})}),l.jsx(fe,{onClick:se,variant:"outline",size:"sm",children:"重置"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(zt,{value:o,onValueChange:ne=>c(ne),children:[l.jsx(At,{className:"w-[120px]",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部节点"}),l.jsx(ze,{value:"entity",children:"仅实体"}),l.jsx(ze,{value:"paragraph",children:"仅段落"})]})]}),l.jsxs(zt,{value:h===1e4?"all":x?"custom":h.toString(),onValueChange:ne=>{ne==="custom"?(y(!0),g(h.toString())):ne==="all"?(y(!1),f(1e4)):(y(!1),f(Number(ne)))},children:[l.jsx(At,{className:"w-[120px]",children:l.jsx(Pt,{})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"50",children:"50 节点"}),l.jsx(ze,{value:"100",children:"100 节点"}),l.jsx(ze,{value:"200",children:"200 节点"}),l.jsx(ze,{value:"500",children:"500 节点"}),l.jsx(ze,{value:"1000",children:"1000 节点"}),l.jsx(ze,{value:"all",children:"全部 (最多10000)"}),l.jsx(ze,{value:"custom",children:"自定义..."})]})]}),x&&l.jsx(Pe,{type:"number",min:"50",value:m,onChange:ne=>g(ne.target.value),onBlur:()=>{const ne=parseInt(m);!isNaN(ne)&&ne>=50?f(ne):(g("50"),f(50))},onKeyDown:ne=>{if(ne.key==="Enter"){const Y=parseInt(m);!isNaN(Y)&&Y>=50?f(Y):(g("50"),f(50))}},placeholder:"最少50个",className:"w-[120px]"}),l.jsx(fe,{onClick:()=>X(),variant:"outline",size:"sm",disabled:e,children:l.jsx(ti,{className:ye("h-4 w-4",e&&"animate-spin")})})]})]})]}),l.jsx("div",{className:"flex-1 relative",children:e?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(ti,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-muted-foreground"}),l.jsx("p",{className:"text-muted-foreground",children:"加载知识图谱中..."})]})}):_.length===0?l.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l.jsxs("div",{className:"text-center",children:[l.jsx(N3,{className:"h-12 w-12 mx-auto mb-4 text-muted-foreground"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"知识库为空"}),l.jsx("p",{className:"text-muted-foreground",children:"请先导入知识数据"})]})}):l.jsxs(uV,{nodes:_,edges:q,onNodesChange:M,onEdgesChange:I,onNodeClick:U,onEdgeClick:te,nodeTypes:_Oe,fitView:!0,minZoom:.05,maxZoom:1.5,defaultViewport:{x:0,y:0,zoom:.5},elevateNodesOnSelect:$<=500,nodesDraggable:$<=1e3,attributionPosition:"bottom-left",children:[l.jsx(f6e,{variant:sa.Dots,gap:12,size:1}),l.jsx(l6e,{}),$<=500&&l.jsx(e6e,{nodeColor:J,nodeBorderRadius:8,pannable:!0,zoomable:!0}),l.jsxs(My,{position:"top-right",className:"bg-background/95 backdrop-blur-sm rounded-lg border p-3 shadow-lg",children:[l.jsx("div",{className:"text-sm font-semibold mb-2",children:"图例"}),l.jsxs("div",{className:"space-y-2 text-xs",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-blue-500 to-blue-600 border-2 border-blue-700"}),l.jsx("span",{children:"实体节点"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:"w-4 h-4 rounded bg-gradient-to-br from-green-500 to-green-600 border-2 border-green-700"}),l.jsx("span",{children:"段落节点"})]}),$>200&&l.jsxs("div",{className:"mt-2 pt-2 border-t text-yellow-600 dark:text-yellow-500",children:[l.jsx("div",{className:"font-semibold",children:"性能模式"}),l.jsx("div",{children:"已禁用动画"}),$>500&&l.jsx("div",{children:"已禁用缩略图"})]})]})]})]})}),l.jsx(fr,{open:!!ee,onOpenChange:ne=>!ne&&z(null),children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(sr,{children:l.jsx(ir,{children:"节点详情"})}),ee&&l.jsxs("div",{className:"space-y-4",children:[l.jsx("div",{className:"grid grid-cols-2 gap-4",children:l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"类型"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:ee.type==="entity"?"default":"secondary",children:ee.type==="entity"?"🏷️ 实体":"📄 段落"})})]})}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"ID"}),l.jsx("code",{className:"mt-1 block p-2 bg-muted rounded text-xs break-all",children:ee.id})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"内容"}),l.jsx(on,{className:"mt-1 h-40 p-3 bg-muted rounded",children:l.jsx("p",{className:"text-sm whitespace-pre-wrap",children:ee.content})})]})]})]})}),l.jsx(fr,{open:!!H,onOpenChange:ne=>!ne&&P(null),children:l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[l.jsx(sr,{children:l.jsx(ir,{children:"边详情"})}),H&&l.jsx(on,{className:"flex-1 pr-4",children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-blue-50 dark:bg-blue-950 rounded border-2 border-blue-200 dark:border-blue-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"源节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.source.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.source.id.slice(0,40),"..."]})]}),l.jsx("div",{className:"text-2xl text-muted-foreground flex-shrink-0",children:"→"}),l.jsxs("div",{className:"flex-1 min-w-0 p-3 bg-green-50 dark:bg-green-950 rounded border-2 border-green-200 dark:border-green-800",children:[l.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"目标节点"}),l.jsx("div",{className:"font-medium text-sm mb-2 truncate",children:H.target.content}),l.jsxs("code",{className:"text-xs text-muted-foreground truncate block",children:[H.target.id.slice(0,40),"..."]})]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium text-muted-foreground",children:"权重"}),l.jsx("div",{className:"mt-1",children:l.jsx(In,{variant:"outline",className:"text-base font-mono",children:H.edge.weight.toFixed(4)})})]})]})})]})}),l.jsx(wn,{open:w,onOpenChange:S,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"加载知识图谱"}),l.jsxs(mn,{children:["知识图谱的动态展示会消耗较多系统资源。",l.jsx("br",{}),"确定要加载知识图谱吗?"]})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>t({to:"/"}),children:"取消 (返回首页)"}),l.jsx(pn,{onClick:G,children:"确认加载"})]})]})}),l.jsx(wn,{open:C,onOpenChange:T,children:l.jsxs(un,{children:[l.jsxs(dn,{children:[l.jsx(fn,{children:"⚠️ 节点数量较多"}),l.jsx(mn,{asChild:!0,children:l.jsxs("div",{children:[l.jsxs("p",{children:["您正在尝试加载 ",l.jsx("strong",{className:"text-orange-600",children:h>=1e4?"全部 (最多10000个)":h})," 个节点。"]}),l.jsx("p",{className:"mt-4",children:"节点数量过多可能导致:"}),l.jsxs("ul",{className:"list-disc list-inside mt-2 space-y-1",children:[l.jsx("li",{children:"页面加载时间较长"}),l.jsx("li",{children:"浏览器卡顿或崩溃"}),l.jsx("li",{children:"系统资源占用过高"})]}),l.jsx("p",{className:"mt-4",children:"建议先选择较少的节点数量 (50-200 个)。"})]})})]}),l.jsxs(hn,{children:[l.jsx(gn,{onClick:()=>{T(!1),h>200&&(f(50),y(!1))},children:"取消"}),l.jsx(pn,{onClick:F,className:"bg-orange-600 hover:bg-orange-700",children:"我了解风险,继续加载"})]})]})})]})}function Dd(t,e,n){let r=n.initialDeps??[],s;function i(){var a,o,c,h;let f;n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now());const m=t();if(!(m.length!==r.length||m.some((y,w)=>r[w]!==y)))return s;r=m;let x;if(n.key&&((o=n.debug)!=null&&o.call(n))&&(x=Date.now()),s=e(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const y=Math.round((Date.now()-f)*100)/100,w=Math.round((Date.now()-x)*100)/100,S=w/16,k=(N,C)=>{for(N=String(N);N.length{r=a},i}function QR(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const xOe=(t,e)=>Math.abs(t-e)<1.01,vOe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},HR=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},yOe=t=>t,bOe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},wOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;e({width:Math.round(l),height:Math.round(c)})};if(s(HR(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(HR(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},VR={passive:!0},UR=typeof window>"u"?!0:"onscrollend"in window,SOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&UR?()=>{}:vOe(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=f=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,f)},l=a(!0),c=a(!1);c(),n.addEventListener("scroll",l,VR);const h=t.options.useScrollendEvent&&UR;return h&&n.addEventListener("scrollend",c,VR),()=>{n.removeEventListener("scroll",l),h&&n.removeEventListener("scrollend",c)}},kOe=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},OOe=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class jOe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:yOe,rangeExtractor:bOe,onChange:()=>{},measureElement:kOe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Ad(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const l=n[a];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.enda.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=Ad(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=Ad(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},l)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const h=this.measurementsCache.slice(0,c);for(let f=c;fthis.options.debug}),this.calculateRange=Ad(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?NOe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ad(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,l=this.elementsCache.get(a);l!==n&&(l&&this.observer.unobserve(l),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=Ad(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return QR(r[NV(0,r.length-1,s=>QR(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const l=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const l=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,l=h=>{if(!this.targetWindow)return;const f=this.getOffsetForIndex(n,h);if(!f){console.warn("Failed to get offset for index:",n);return}const[m,g]=f;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}xOe(y[0],x)||c(g)})},c=h=>{this.targetWindow&&(i++,il(h)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};l(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(l=>l===null);){const l=r[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}s=Math.max(...i.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const NV=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function NOe({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=NV(0,s,i,n),l=a;if(r===1)for(;l1){const c=Array(r).fill(0);for(;lf=0&&h.some(f=>f>=n);){const f=t[a];h[f.lane]=f.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const WR=typeof document<"u"?b.useLayoutEffect:b.useEffect;function COe(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?du.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new jOe(n));return r.setOptions(n),WR(()=>r._didMount(),[]),WR(()=>r._willUpdate()),r}function TOe(t){return COe({observeElementRect:wOe,observeElementOffset:SOe,scrollToFn:OOe,...t})}function EOe(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const _Oe={},bm={};function xu(t,e){try{const r=(_Oe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in bm?bm[r]:GR(r,r.split(":"))}catch{if(t in bm)return bm[t];const n=t?.match(MOe);return n?GR(t,n.slice(1)):NaN}}const MOe=/([+-]\d\d):?(\d\d)?/;function GR(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return bm[t]=n*60+r>0?n*60+r+s:n*60-r-s}class to extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(xu(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),CV(this),Ok(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new to(...n,e):new to(Date.now(),e)}withTimeZone(e){return new to(+this,e)}getTimezoneOffset(){const e=-xu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Ok(this),+this}[Symbol.for("constructDateFrom")](e){return new to(+new Date(e),this.timeZone)}}const XR=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!XR.test(t))return;const e=t.replace(XR,"$1UTC");to.prototype[e]&&(t.startsWith("get")?to.prototype[t]=function(){return this.internal[e]()}:(to.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),AOe(this),+this},to.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Ok(this),+this}))});function Ok(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-xu(t.timeZone,t)*60))}function AOe(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),CV(t)}function CV(t){const e=xu(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,l=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&l&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const h=new Date(+t);h.setUTCSeconds(0);const f=s>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(xu(t.timeZone,t)*60))%60;(m||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+f));const g=xu(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const N=xu(t.timeZone,t),C=N>0?Math.floor(N):Math.ceil(N),T=x-C;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class xs extends to{static tz(e,...n){return n.length?new xs(...n,e):new xs(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${EOe(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new xs(+this,e)}[Symbol.for("constructDateFrom")](e){return new xs(+new Date(e),this.timeZone)}}const TV=6048e5,ROe=864e5,YR=Symbol.for("constructDateFrom");function Pr(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&YR in t?t[YR](e):t instanceof Date?new t.constructor(e):new Date(e)}function Bn(t,e){return Pr(e||t,t)}function EV(t,e,n){const r=Bn(t,n?.in);return isNaN(e)?Pr(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function _V(t,e,n){const r=Bn(t,n?.in);if(isNaN(e))return Pr(t,NaN);if(!e)return r;const s=r.getDate(),i=Pr(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let DOe={};function hp(){return DOe}function Nc(t,e){const n=hp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Bn(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function KR(t){const e=Bn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Qu(t,...e){const n=Pr.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function O0(t,e){const n=Bn(t,e?.in);return n.setHours(0,0,0,0),n}function AV(t,e,n){const[r,s]=Qu(n?.in,t,e),i=O0(r),a=O0(s),l=+i-KR(i),c=+a-KR(a);return Math.round((l-c)/ROe)}function zOe(t,e){const n=MV(t,e),r=Pr(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),k0(r)}function POe(t,e,n){return EV(t,e*7,n)}function LOe(t,e,n){return _V(t,e*12,n)}function IOe(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Pr.bind(null,s));const i=Bn(s,r);(!n||n{!r&&typeof s=="object"&&(r=Pr.bind(null,s));const i=Bn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Pr(r,n||NaN)}function qOe(t,e,n){const[r,s]=Qu(n?.in,t,e);return+O0(r)==+O0(s)}function RV(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function FOe(t){return!(!RV(t)&&typeof t!="number"||isNaN(+Bn(t)))}function $Oe(t,e,n){const[r,s]=Qu(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function QOe(t,e){const n=Bn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function DV(t,e){const[n,r]=Qu(t,e.start,e.end);return{start:n,end:r}}function HOe(t,e){const{start:n,end:r}=DV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let l=1;const c=[];for(;+a<=i;)c.push(Pr(n,a)),a.setMonth(a.getMonth()+l);return s?c.reverse():c}function VOe(t,e){const n=Bn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function UOe(t,e){const n=Bn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function zV(t,e){const n=Bn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function WOe(t,e){const{start:n,end:r}=DV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let l=1;const c=[];for(;+a<=i;)c.push(Pr(n,a)),a.setFullYear(a.getFullYear()+l);return s?c.reverse():c}function PV(t,e){const n=hp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=Bn(t,e?.in),i=s.getDay(),a=(i{let r;const s=XOe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function uh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const KOe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ZOe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},JOe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},eje={date:uh({formats:KOe,defaultWidth:"full"}),time:uh({formats:ZOe,defaultWidth:"full"}),dateTime:uh({formats:JOe,defaultWidth:"full"})},tje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},nje=(t,e,n,r)=>tje[t];function Ga(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,l=n?.width?String(n.width):a;s=t.formattingValues[l]||t.formattingValues[a]}else{const a=t.defaultWidth,l=n?.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const rje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},sje={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ije={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},aje={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},oje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},lje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},cje=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},uje={ordinalNumber:cje,era:Ga({values:rje,defaultWidth:"wide"}),quarter:Ga({values:sje,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ga({values:ije,defaultWidth:"wide"}),day:Ga({values:aje,defaultWidth:"wide"}),dayPeriod:Ga({values:oje,defaultWidth:"wide",formattingValues:lje,defaultFormattingWidth:"wide"})};function Xa(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?hje(l,m=>m.test(a)):dje(l,m=>m.test(a));let h;h=t.valueCallback?t.valueCallback(c):c,h=n.valueCallback?n.valueCallback(h):h;const f=e.slice(a.length);return{value:h,rest:f}}}function dje(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function hje(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const l=e.slice(s.length);return{value:a,rest:l}}}const fje=/^(\d+)(th|st|nd|rd)?/i,mje=/\d+/i,pje={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},gje={any:[/^b/i,/^(a|c)/i]},xje={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},vje={any:[/1/i,/2/i,/3/i,/4/i]},yje={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},bje={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},wje={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Sje={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},kje={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Oje={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},jje={ordinalNumber:LV({matchPattern:fje,parsePattern:mje,valueCallback:t=>parseInt(t,10)}),era:Xa({matchPatterns:pje,defaultMatchWidth:"wide",parsePatterns:gje,defaultParseWidth:"any"}),quarter:Xa({matchPatterns:xje,defaultMatchWidth:"wide",parsePatterns:vje,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Xa({matchPatterns:yje,defaultMatchWidth:"wide",parsePatterns:bje,defaultParseWidth:"any"}),day:Xa({matchPatterns:wje,defaultMatchWidth:"wide",parsePatterns:Sje,defaultParseWidth:"any"}),dayPeriod:Xa({matchPatterns:kje,defaultMatchWidth:"any",parsePatterns:Oje,defaultParseWidth:"any"})},Oj={code:"en-US",formatDistance:YOe,formatLong:eje,formatRelative:nje,localize:uje,match:jje,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Nje(t,e){const n=Bn(t,e?.in);return AV(n,zV(n))+1}function IV(t,e){const n=Bn(t,e?.in),r=+k0(n)-+zOe(n);return Math.round(r/TV)+1}function BV(t,e){const n=Bn(t,e?.in),r=n.getFullYear(),s=hp(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Pr(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const l=Nc(a,e),c=Pr(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const h=Nc(c,e);return+n>=+l?r+1:+n>=+h?r:r-1}function Cje(t,e){const n=hp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=BV(t,e),i=Pr(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Nc(i,e)}function qV(t,e){const n=Bn(t,e?.in),r=+Nc(n,e)-+Cje(n,e);return Math.round(r/TV)+1}function Mn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const ec={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Mn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Mn(n+1,2)},d(t,e){return Mn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Mn(t.getHours()%12||12,e.length)},H(t,e){return Mn(t.getHours(),e.length)},m(t,e){return Mn(t.getMinutes(),e.length)},s(t,e){return Mn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Mn(s,e.length)}},Rd={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},ZR={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return ec.y(t,e)},Y:function(t,e,n,r){const s=BV(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Mn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Mn(i,e.length)},R:function(t,e){const n=MV(t);return Mn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Mn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Mn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Mn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return ec.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Mn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=qV(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Mn(s,e.length)},I:function(t,e,n){const r=IV(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Mn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):ec.d(t,e)},D:function(t,e,n){const r=Nje(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Mn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Mn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Mn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Mn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=Rd.noon:r===0?s=Rd.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=Rd.evening:r>=12?s=Rd.afternoon:r>=4?s=Rd.morning:s=Rd.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ec.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):ec.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Mn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Mn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):ec.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):ec.s(t,e)},S:function(t,e){return ec.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return eD(r);case"XXXX":case"XX":return lu(r);case"XXXXX":case"XXX":default:return lu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return eD(r);case"xxxx":case"xx":return lu(r);case"xxxxx":case"xxx":default:return lu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+JR(r,":");case"OOOO":default:return"GMT"+lu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+JR(r,":");case"zzzz":default:return"GMT"+lu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Mn(r,e.length)},T:function(t,e,n){return Mn(+t,e.length)}};function JR(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Mn(i,2)}function eD(t,e){return t%60===0?(t>0?"-":"+")+Mn(Math.abs(t)/60,2):lu(t,e)}function lu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Mn(Math.trunc(r/60),2),i=Mn(r%60,2);return n+s+e+i}const tD=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},FV=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Tje=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return tD(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",tD(r,e)).replace("{{time}}",FV(s,e))},Eje={p:FV,P:Tje},_je=/^D+$/,Mje=/^Y+$/,Aje=["D","DD","YY","YYYY"];function Rje(t){return _je.test(t)}function Dje(t){return Mje.test(t)}function zje(t,e,n){const r=Pje(t,e,n);if(console.warn(r),Aje.includes(t))throw new RangeError(r)}function Pje(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Lje=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ije=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bje=/^'([^]*?)'?$/,qje=/''/g,Fje=/[a-zA-Z]/;function y1(t,e,n){const r=hp(),s=n?.locale??r.locale??Oj,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,l=Bn(t,n?.in);if(!FOe(l))throw new RangeError("Invalid time value");let c=e.match(Ije).map(f=>{const m=f[0];if(m==="p"||m==="P"){const g=Eje[m];return g(f,s.formatLong)}return f}).join("").match(Lje).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const m=f[0];if(m==="'")return{isToken:!1,value:$je(f)};if(ZR[m])return{isToken:!0,value:f};if(m.match(Fje))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(f=>{if(!f.isToken)return f.value;const m=f.value;(!n?.useAdditionalWeekYearTokens&&Dje(m)||!n?.useAdditionalDayOfYearTokens&&Rje(m))&&zje(m,e,String(t));const g=ZR[m[0]];return g(l,m,s.localize,h)}).join("")}function $je(t){const e=t.match(Bje);return e?e[1].replace(qje,"'"):t}function Qje(t,e){const n=Bn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Pr(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function Hje(t,e){return Bn(t,e?.in).getMonth()}function Vje(t,e){return Bn(t,e?.in).getFullYear()}function Uje(t,e){return+Bn(t)>+Bn(e)}function Wje(t,e){return+Bn(t)<+Bn(e)}function Gje(t,e,n){const[r,s]=Qu(n?.in,t,e);return+Nc(r,n)==+Nc(s,n)}function Xje(t,e,n){const[r,s]=Qu(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function Yje(t,e,n){const[r,s]=Qu(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function Kje(t,e,n){const r=Bn(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=Pr(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const l=Qje(a);return r.setMonth(e,Math.min(i,l)),r}function Zje(t,e,n){const r=Bn(t,n?.in);return isNaN(+r)?Pr(t,NaN):(r.setFullYear(e),r)}const nD=5,Jje=4;function e7e(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,nD*7-1);return e.getMonth(t)===e.getMonth(i)?nD:Jje}function $V(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function t7e(t,e){const n=$V(t,e),r=e7e(t,e);return e.addDays(n,r*7-1)}class Ai{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?xs.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new xs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):EV(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):_V(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):POe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):LOe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):AV(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):$Oe(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):HOe(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):WOe(r),i=new Set(s.map(l=>this.getYear(l)));if(i.size===s.length)return s;const a=[];return i.forEach(l=>{a.push(new Date(l,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):t7e(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):GOe(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):QOe(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):PV(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):UOe(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):y1(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):IV(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):Hje(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):Vje(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):qV(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):Uje(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):Wje(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):RV(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):qOe(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):Xje(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):Yje(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):IOe(r),this.min=r=>this.overrides?.min?this.overrides.min(r):BOe(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):Kje(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):Zje(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):$V(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):O0(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):k0(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):VOe(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Nc(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):zV(r),this.options={locale:Oj,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&Ai.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&Ai.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}Ai.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const xo=new Ai;class QV{constructor(e,n,r=xo){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class n7e{constructor(e,n){this.date=e,this.weeks=n}}class r7e{constructor(e,n){this.days=n,this.weekNumber=e}}function s7e(t){return he.createElement("button",{...t})}function i7e(t){return he.createElement("span",{...t})}function a7e(t){const{size:e=24,orientation:n="left",className:r}=t;return he.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&he.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&he.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&he.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&he.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function o7e(t){const{day:e,modifiers:n,...r}=t;return he.createElement("td",{...r})}function l7e(t){const{day:e,modifiers:n,...r}=t,s=he.useRef(null);return he.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),he.createElement("button",{ref:s,...r})}var gt;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(gt||(gt={}));var lr;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(lr||(lr={}));var ba;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ba||(ba={}));var ji;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(ji||(ji={}));function c7e(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[gt.Dropdown],n].join(" "),l=e?.find(({value:c})=>c===i.value);return he.createElement("span",{"data-disabled":i.disabled,className:s[gt.DropdownRoot]},he.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:h,disabled:f})=>he.createElement(r.Option,{key:c,value:c,disabled:f},h))),he.createElement("span",{className:s[gt.CaptionLabel],"aria-hidden":!0},l?.label,he.createElement(r.Chevron,{orientation:"down",size:18,className:s[gt.Chevron]})))}function u7e(t){return he.createElement("div",{...t})}function d7e(t){return he.createElement("div",{...t})}function h7e(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r},t.children)}function f7e(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r})}function m7e(t){return he.createElement("table",{...t})}function p7e(t){return he.createElement("div",{...t})}const HV=b.createContext(void 0);function fp(){const t=b.useContext(HV);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function g7e(t){const{components:e}=fp();return he.createElement(e.Dropdown,{...t})}function x7e(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:l,labels:{labelPrevious:c,labelNext:h}}=fp(),f=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return he.createElement("nav",{...i},he.createElement(a.PreviousMonthButton,{type:"button",className:l[gt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},he.createElement(a.Chevron,{disabled:r?void 0:!0,className:l[gt.Chevron],orientation:"left"})),he.createElement(a.NextMonthButton,{type:"button",className:l[gt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:f},he.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[gt.Chevron]})))}function v7e(t){const{components:e}=fp();return he.createElement(e.Button,{...t})}function y7e(t){return he.createElement("option",{...t})}function b7e(t){const{components:e}=fp();return he.createElement(e.Button,{...t})}function w7e(t){const{rootRef:e,...n}=t;return he.createElement("div",{...n,ref:e})}function S7e(t){return he.createElement("select",{...t})}function k7e(t){const{week:e,...n}=t;return he.createElement("tr",{...n})}function O7e(t){return he.createElement("th",{...t})}function j7e(t){return he.createElement("thead",{"aria-hidden":!0},he.createElement("tr",{...t}))}function N7e(t){const{week:e,...n}=t;return he.createElement("th",{...n})}function C7e(t){return he.createElement("th",{...t})}function T7e(t){return he.createElement("tbody",{...t})}function E7e(t){const{components:e}=fp();return he.createElement(e.Dropdown,{...t})}const _7e=Object.freeze(Object.defineProperty({__proto__:null,Button:s7e,CaptionLabel:i7e,Chevron:a7e,Day:o7e,DayButton:l7e,Dropdown:c7e,DropdownNav:u7e,Footer:d7e,Month:h7e,MonthCaption:f7e,MonthGrid:m7e,Months:p7e,MonthsDropdown:g7e,Nav:x7e,NextMonthButton:v7e,Option:y7e,PreviousMonthButton:b7e,Root:w7e,Select:S7e,Week:k7e,WeekNumber:N7e,WeekNumberHeader:C7e,Weekday:O7e,Weekdays:j7e,Weeks:T7e,YearsDropdown:E7e},Symbol.toStringTag,{value:"Module"}));function Jo(t,e,n=!1,r=xo){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:l}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?l(i,e):!n&&s?l(s,e):!1}function VV(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function jj(t){return!!(t&&typeof t=="object"&&"from"in t)}function UV(t){return!!(t&&typeof t=="object"&&"after"in t)}function WV(t){return!!(t&&typeof t=="object"&&"before"in t)}function GV(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function XV(t,e){return Array.isArray(t)&&t.every(e.isDate)}function el(t,e,n=xo){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return s(t,l);if(XV(l,n))return l.includes(t);if(jj(l))return Jo(l,t,!1,n);if(GV(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if(VV(l)){const c=i(l.before,t),h=i(l.after,t),f=c>0,m=h<0;return a(l.before,l.after)?m&&f:f||m}return UV(l)?i(t,l.after)>0:WV(l)?i(l.before,t)>0:typeof l=="function"?l(t):!1})}function M7e(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:l,showOutsideDays:c,broadcastCalendar:h,today:f}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),N=r&&w(r),C={[lr.focused]:[],[lr.outside]:[],[lr.disabled]:[],[lr.hidden]:[],[lr.today]:[]},T={};for(const _ of t){const{date:E,displayMonth:M}=_,q=!!(M&&!g(E,M)),L=!!(k&&y(E,k)),I=!!(N&&S(E,N)),$=!!(i&&el(E,i,s)),V=!!(a&&el(E,a,s))||L||I||!h&&!c&&q||h&&c===!1&&q,ee=m(E,f??s.today());q&&C.outside.push(_),$&&C.disabled.push(_),V&&C.hidden.push(_),ee&&C.today.push(_),l&&Object.keys(l).forEach(z=>{const H=l?.[z];H&&el(E,H,s)&&(T[z]?T[z].push(_):T[z]=[_])})}return _=>{const E={[lr.focused]:!1,[lr.disabled]:!1,[lr.hidden]:!1,[lr.outside]:!1,[lr.today]:!1},M={};for(const q in C){const L=C[q];E[q]=L.some(I=>I===_)}for(const q in T)M[q]=T[q].some(L=>L===_);return{...E,...M}}}function A7e(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[lr[i]]?s.push(e[lr[i]]):e[ba[i]]&&s.push(e[ba[i]]),s),[e[gt.Day]])}function R7e(t){return{..._7e,...t}}function D7e(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function Nj(){const t={};for(const e in gt)t[gt[e]]=`rdp-${gt[e]}`;for(const e in lr)t[lr[e]]=`rdp-${lr[e]}`;for(const e in ba)t[ba[e]]=`rdp-${ba[e]}`;for(const e in ji)t[ji[e]]=`rdp-${ji[e]}`;return t}function YV(t,e,n){return(n??new Ai(e)).formatMonthYear(t)}const z7e=YV;function P7e(t,e,n){return(n??new Ai(e)).format(t,"d")}function L7e(t,e=xo){return e.format(t,"LLLL")}function I7e(t,e,n){return(n??new Ai(e)).format(t,"cccccc")}function B7e(t,e=xo){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function q7e(){return""}function KV(t,e=xo){return e.format(t,"yyyy")}const F7e=KV,$7e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:YV,formatDay:P7e,formatMonthCaption:z7e,formatMonthDropdown:L7e,formatWeekNumber:B7e,formatWeekNumberHeader:q7e,formatWeekdayName:I7e,formatYearCaption:F7e,formatYearDropdown:KV},Symbol.toStringTag,{value:"Module"}));function Q7e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...$7e,...t}}function H7e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:l,eachMonthOfInterval:c,getMonth:h}=s;return c({start:a(t),end:l(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=h(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function V7e(t,e={},n={}){let r={...e?.[gt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function U7e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const l=t.addDays(s,a);i.push(l)}return i}function W7e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:l,getYear:c}=r,h=i(t),f=a(e),m=l({start:h,end:f});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function ZV(t,e,n,r){let s=(r??new Ai(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const G7e=ZV;function JV(t,e,n){return(n??new Ai(e)).formatMonthYear(t)}const X7e=JV;function Y7e(t,e,n,r){let s=(r??new Ai(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function K7e(t){return"Choose the Month"}function Z7e(){return""}function J7e(t){return"Go to the Next Month"}function eNe(t){return"Go to the Previous Month"}function tNe(t,e,n){return(n??new Ai(e)).format(t,"cccc")}function nNe(t,e){return`Week ${t}`}function rNe(t){return"Week Number"}function sNe(t){return"Choose the Year"}const iNe=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:X7e,labelDay:G7e,labelDayButton:ZV,labelGrid:JV,labelGridcell:Y7e,labelMonthDropdown:K7e,labelNav:Z7e,labelNext:J7e,labelPrevious:eNe,labelWeekNumber:nNe,labelWeekNumberHeader:rNe,labelWeekday:tNe,labelYearDropdown:sNe},Symbol.toStringTag,{value:"Module"})),mp=t=>t instanceof HTMLElement?t:null,g3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],aNe=t=>mp(t.querySelector("[data-animated-month]")),x3=t=>mp(t.querySelector("[data-animated-caption]")),v3=t=>mp(t.querySelector("[data-animated-weeks]")),oNe=t=>mp(t.querySelector("[data-animated-nav]")),lNe=t=>mp(t.querySelector("[data-animated-weekdays]"));function cNe(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),l=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const h=l.current;if(l.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const f=i.isSameMonth(r[0].date,h[0].date),m=i.isAfter(r[0].date,h[0].date),g=m?n[ji.caption_after_enter]:n[ji.caption_before_enter],x=m?n[ji.weeks_after_enter]:n[ji.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(g3(w).forEach(C=>{if(!(C instanceof HTMLElement))return;const T=aNe(C);T&&C.contains(T)&&C.removeChild(T);const _=x3(C);_&&_.classList.remove(g);const E=v3(C);E&&E.classList.remove(x)}),a.current=w):a.current=null,c.current||f||s)return;const S=y instanceof HTMLElement?g3(y):[],k=g3(t.current);if(k?.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const N=oNe(t.current);N&&(N.style.zIndex="1"),k.forEach((C,T)=>{const _=S[T];if(!_)return;C.style.position="relative",C.style.overflow="hidden";const E=x3(C);E&&E.classList.add(g);const M=v3(C);M&&M.classList.add(x);const q=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),N&&(N.style.zIndex=""),E&&E.classList.remove(g),M&&M.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(_)&&C.removeChild(_)};_.style.pointerEvents="none",_.style.position="absolute",_.style.overflow="hidden",_.setAttribute("aria-hidden","true");const L=lNe(_);L&&(L.style.opacity="0");const I=x3(_);I&&(I.classList.add(m?n[ji.caption_before_exit]:n[ji.caption_after_exit]),I.addEventListener("animationend",q));const $=v3(_);$&&$.classList.add(m?n[ji.weeks_before_exit]:n[ji.weeks_after_exit]),C.insertBefore(_,C.firstChild)})}})}function uNe(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:l,broadcastCalendar:c}=n??{},{addDays:h,differenceInCalendarDays:f,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:N,startOfWeek:C}=r,T=c?k(s,r):a?N(s):C(s),_=c?g(i):a?x(y(i)):w(y(i)),E=f(_,T),M=m(i,s)+1,q=[];for(let $=0;$<=E;$++){const V=h(T,$);if(e&&S(V,e))break;q.push(V)}const I=(c?35:42)*M;if(l&&q.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function hNe(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(l)}return i}function rD(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:l=1}=t;let c=s||i||a;const{differenceInCalendarMonths:h,addMonths:f,startOfMonth:m}=r;if(n&&h(n,c){const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),N=n.broadcastCalendar?i(S):n.ISOWeek?a(l(S)):c(l(S)),C=e.filter(M=>M>=k&&M<=N),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length{const L=T-C.length;return q>N&&q<=s(N,L)});C.push(...M)}const _=C.reduce((M,q)=>{const L=n.ISOWeek?h(q):f(q),I=M.find(V=>V.weekNumber===L),$=new QV(q,S,r);return I?I.days.push($):M.push(new r7e(L,[$])),M},[]),E=new n7e(S,_);return w.push(E),w},[]);return n.reverseMonths?y.reverse():y}function mNe(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:l,addYears:c,endOfYear:h,newDate:f,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=f(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=f(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=l(r):x?r=f(x,11,31):!r&&S&&(r=h(t.today??m())),[n&&i(n),r&&i(r)]}function pNe(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:l,differenceInCalendarMonths:c}=r,h=s?i:1,f=a(t);if(!e)return l(f,h);if(!(c(e,t)n.concat(r.weeks.slice()),e.slice())}function Ey(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function vNe(t,e){const[n,r]=mNe(t,e),{startOfMonth:s,endOfMonth:i}=e,a=rD(t,n,r,e),[l,c]=Ey(a,t.month?a:void 0);b.useEffect(()=>{const E=rD(t,n,r,e);c(E)},[t.timeZone]);const h=hNe(l,r,t,e),f=uNe(h,t.endMonth?i(t.endMonth):void 0,t,e),m=fNe(h,f,t,e),g=xNe(m),x=dNe(m),y=gNe(l,n,t,e),w=pNe(l,r,t,e),{disableNavigation:S,onMonthChange:k}=t,N=E=>g.some(M=>M.days.some(q=>q.isEqualTo(E))),C=E=>{if(S)return;let M=s(E);n&&Ms(r)&&(M=s(r)),c(M),k?.(M)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:E=>{N(E)||C(E.date)}}}var Ha;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Ha||(Ha={}));function sD(t){return!t[lr.disabled]&&!t[lr.hidden]&&!t[lr.outside]}function yNe(t,e,n,r){let s,i=-1;for(const a of t){const l=e(a);sD(l)&&(l[lr.focused]&&isD(e(a)))),s}function bNe(t,e,n,r,s,i,a){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:h,addMonths:f,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:N,startOfISOWeek:C,startOfWeek:T}=a;let E={day:h,week:m,month:f,year:g,startOfWeek:M=>c?N(M,a):l?C(M):T(M),endOfWeek:M=>c?x(M):l?y(M):w(M)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=S([r,E]):e==="after"&&s&&(E=k([s,E])),E}function eU(t,e,n,r,s,i,a,l=0){if(l>365)return;const c=bNe(t,e,n.date,r,s,i,a),h=!!(i.disabled&&el(c,i.disabled,a)),f=!!(i.hidden&&el(c,i.hidden,a)),m=c,g=new QV(c,m,a);return!h&&!f?g:eU(t,e,g,r,s,i,a,l+1)}function wNe(t,e,n,r,s){const{autoFocus:i}=t,[a,l]=b.useState(),c=yNe(e.days,n,r||(()=>!1),a),[h,f]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:h,blur:()=>{l(h),f(void 0)},moveFocus:(w,S)=>{if(!h)return;const k=eU(w,S,h,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(C=>C.isEqualTo(k))||(e.goToDay(k),f(k)))}}}function SNe(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Ey(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e,h=x=>l?.some(y=>c(y,x))??!1,{min:f,max:m}=t;return{selected:l,select:(x,y,w)=>{let S=[...l??[]];if(h(x)){if(l?.length===f||r&&l?.length===1)return;S=l?.filter(k=>!c(k,x))}else l?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:h}}function kNe(t,e,n=0,r=0,s=!1,i=xo){const{from:a,to:l}=e||{},{isSameDay:c,isAfter:h,isBefore:f}=i;let m;if(!a&&!l)m={from:t,to:n>0?void 0:t};else if(a&&!l)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:f(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&l)if(c(a,t)&&c(l,t))s?m={from:a,to:l}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(l,t))m={from:t,to:n>0?void 0:t};else if(f(t,a))m={from:t,to:l};else if(h(t,a))m={from:a,to:t};else if(h(t,l))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?Jo(t,l,!1,n):XV(l,n)?l.some(c=>Jo(t,c,!1,n)):jj(l)?l.from&&l.to?iD(t,{from:l.from,to:l.to},n):!1:GV(l)?ONe(t,l.dayOfWeek,n):VV(l)?n.isAfter(l.before,l.after)?iD(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):el(t.from,l,n)||el(t.to,l,n):UV(l)||WV(l)?el(t.from,l,n)||el(t.to,l,n):!1))return!0;const a=r.filter(l=>typeof l=="function");if(a.length){let l=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=c;h++){if(a.some(f=>f(l)))return!0;l=n.addDays(l,1)}}return!1}function NNe(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[l,c]=Ey(s,a?s:void 0),h=a?s:l;return{selected:h,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?kNe(g,h,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&jNe({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>h&&Jo(h,g,!1,e)}}function CNe(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Ey(n,s?n:void 0),l=s?n:i,{isSameDay:c}=e;return{selected:l,select:(m,g,x)=>{let y=m;return!r&&l&&l&&c(m,l)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>l?c(l,m):!1}}function TNe(t,e){const n=CNe(t,e),r=SNe(t,e),s=NNe(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function ENe(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new xs(e.today,e.timeZone)),e.month&&(e.month=new xs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new xs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new xs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new xs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new xs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(pt=>new xs(pt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new xs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new xs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:l}=b.useMemo(()=>{const pt={...Oj,...e.locale};return{dateLib:new Ai({locale:pt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:R7e(e.components),formatters:Q7e(e.formatters),labels:{...iNe,...e.labels},locale:pt,classNames:{...Nj(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:h,navLayout:f,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:N,onPrevClick:C,showWeekNumber:T,styles:_}=e,{formatCaption:E,formatDay:M,formatMonthDropdown:q,formatWeekNumber:L,formatWeekNumberHeader:I,formatWeekdayName:$,formatYearDropdown:V}=r,ee=vNe(e,i),{days:z,months:H,navStart:P,navEnd:W,previousMonth:J,nextMonth:X,goToMonth:R}=ee,se=M7e(z,e,P,W,i),{isSelected:G,select:F,selected:U}=TNe(e,i)??{},{blur:te,focused:ne,isFocusTarget:Y,moveFocus:ae,setFocused:re}=wNe(e,ee,se,G??(()=>!1),i),{labelDayButton:oe,labelGridcell:_e,labelGrid:Ge,labelMonthDropdown:tt,labelNav:Xe,labelPrevious:je,labelNext:Qe,labelWeekday:He,labelWeekNumber:$e,labelWeekNumberHeader:bt,labelYearDropdown:ot}=s,on=b.useMemo(()=>U7e(i,e.ISOWeek),[i,e.ISOWeek]),Tn=h!==void 0||x!==void 0,Nn=b.useCallback(()=>{J&&(R(J),C?.(J))},[J,R,C]),Rt=b.useCallback(()=>{X&&(R(X),N?.(X))},[R,X,N]),xt=b.useCallback((pt,vn)=>vt=>{vt.preventDefault(),vt.stopPropagation(),re(pt),F?.(pt.date,vn,vt),x?.(pt.date,vn,vt)},[F,x,re]),Te=b.useCallback((pt,vn)=>vt=>{re(pt),y?.(pt.date,vn,vt)},[y,re]),Re=b.useCallback((pt,vn)=>vt=>{te(),g?.(pt.date,vn,vt)},[te,g]),qe=b.useCallback((pt,vn)=>vt=>{const Wt={ArrowLeft:[vt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[vt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[vt.shiftKey?"year":"week","after"],ArrowUp:[vt.shiftKey?"year":"week","before"],PageUp:[vt.shiftKey?"year":"month","before"],PageDown:[vt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Wt[vt.key]){vt.preventDefault(),vt.stopPropagation();const[Ht,lt]=Wt[vt.key];ae(Ht,lt)}w?.(pt.date,vn,vt)},[ae,w,e.dir]),rt=b.useCallback((pt,vn)=>vt=>{S?.(pt.date,vn,vt)},[S]),wt=b.useCallback((pt,vn)=>vt=>{k?.(pt.date,vn,vt)},[k]),jt=b.useCallback(pt=>vn=>{const vt=Number(vn.target.value),Wt=i.setMonth(i.startOfMonth(pt),vt);R(Wt)},[i,R]),Ne=b.useCallback(pt=>vn=>{const vt=Number(vn.target.value),Wt=i.setYear(i.startOfMonth(pt),vt);R(Wt)},[i,R]),{className:ie,style:xe}=b.useMemo(()=>({className:[l[gt.Root],e.className].filter(Boolean).join(" "),style:{..._?.[gt.Root],...e.style}}),[l,e.className,e.style,_]),Je=D7e(e),dt=b.useRef(null);cNe(dt,!!e.animate,{classNames:l,months:H,focused:ne,dateLib:i});const er={dayPickerProps:e,selected:U,select:F,isSelected:G,months:H,nextMonth:X,previousMonth:J,goToMonth:R,getModifiers:se,components:n,classNames:l,styles:_,labels:s,formatters:r};return he.createElement(HV.Provider,{value:er},he.createElement(n.Root,{rootRef:e.animate?dt:void 0,className:ie,style:xe,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Je},he.createElement(n.Months,{className:l[gt.Months],style:_?.[gt.Months]},!e.hideNavigation&&!f&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Nn,onNextClick:Rt,previousMonth:J,nextMonth:X}),H.map((pt,vn)=>he.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:l[gt.Month],style:_?.[gt.Month],key:vn,displayIndex:vn,calendarMonth:pt},f==="around"&&!e.hideNavigation&&vn===0&&he.createElement(n.PreviousMonthButton,{type:"button",className:l[gt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":je(J),onClick:Nn,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:J?void 0:!0,className:l[gt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),he.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:l[gt.MonthCaption],style:_?.[gt.MonthCaption],calendarMonth:pt,displayIndex:vn},c?.startsWith("dropdown")?he.createElement(n.DropdownNav,{className:l[gt.Dropdowns],style:_?.[gt.Dropdowns]},(()=>{const vt=c==="dropdown"||c==="dropdown-months"?he.createElement(n.MonthsDropdown,{key:"month",className:l[gt.MonthsDropdown],"aria-label":tt(),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:jt(pt.date),options:H7e(pt.date,P,W,r,i),style:_?.[gt.Dropdown],value:i.getMonth(pt.date)}):he.createElement("span",{key:"month"},q(pt.date,i)),Wt=c==="dropdown"||c==="dropdown-years"?he.createElement(n.YearsDropdown,{key:"year",className:l[gt.YearsDropdown],"aria-label":ot(i.options),classNames:l,components:n,disabled:!!e.disableNavigation,onChange:Ne(pt.date),options:W7e(P,W,r,i,!!e.reverseYears),style:_?.[gt.Dropdown],value:i.getYear(pt.date)}):he.createElement("span",{key:"year"},V(pt.date,i));return i.getMonthYearOrder()==="year-first"?[Wt,vt]:[vt,Wt]})(),he.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(pt.date,i.options,i))):he.createElement(n.CaptionLabel,{className:l[gt.CaptionLabel],role:"status","aria-live":"polite"},E(pt.date,i.options,i))),f==="around"&&!e.hideNavigation&&vn===m-1&&he.createElement(n.NextMonthButton,{type:"button",className:l[gt.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":Qe(X),onClick:Rt,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:X?void 0:!0,className:l[gt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),vn===m-1&&f==="after"&&!e.hideNavigation&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:l[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Nn,onNextClick:Rt,previousMonth:J,nextMonth:X}),he.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Ge(pt.date,i.options,i)||void 0,className:l[gt.MonthGrid],style:_?.[gt.MonthGrid]},!e.hideWeekdays&&he.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:l[gt.Weekdays],style:_?.[gt.Weekdays]},T&&he.createElement(n.WeekNumberHeader,{"aria-label":bt(i.options),className:l[gt.WeekNumberHeader],style:_?.[gt.WeekNumberHeader],scope:"col"},I()),on.map(vt=>he.createElement(n.Weekday,{"aria-label":He(vt,i.options,i),className:l[gt.Weekday],key:String(vt),style:_?.[gt.Weekday],scope:"col"},$(vt,i.options,i)))),he.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:l[gt.Weeks],style:_?.[gt.Weeks]},pt.weeks.map(vt=>he.createElement(n.Week,{className:l[gt.Week],key:vt.weekNumber,style:_?.[gt.Week],week:vt},T&&he.createElement(n.WeekNumber,{week:vt,style:_?.[gt.WeekNumber],"aria-label":$e(vt.weekNumber,{locale:a}),className:l[gt.WeekNumber],scope:"row",role:"rowheader"},L(vt.weekNumber,i)),vt.days.map(Wt=>{const{date:Ht}=Wt,lt=se(Wt);if(lt[lr.focused]=!lt.hidden&&!!ne?.isEqualTo(Wt),lt[ba.selected]=G?.(Ht)||lt.selected,jj(U)){const{from:dr,to:Nr}=U;lt[ba.range_start]=!!(dr&&Nr&&i.isSameDay(Ht,dr)),lt[ba.range_end]=!!(dr&&Nr&&i.isSameDay(Ht,Nr)),lt[ba.range_middle]=Jo(U,Ht,!0,i)}const ur=V7e(lt,_,e.modifiersStyles),Xr=A7e(lt,l,e.modifiersClassNames),Yr=!Tn&&!lt.hidden?_e(Ht,lt,i.options,i):void 0;return he.createElement(n.Day,{key:`${i.format(Ht,"yyyy-MM-dd")}_${i.format(Wt.displayMonth,"yyyy-MM")}`,day:Wt,modifiers:lt,className:Xr.join(" "),style:ur,role:"gridcell","aria-selected":lt.selected||void 0,"aria-label":Yr,"data-day":i.format(Ht,"yyyy-MM-dd"),"data-month":Wt.outside?i.format(Ht,"yyyy-MM"):void 0,"data-selected":lt.selected||void 0,"data-disabled":lt.disabled||void 0,"data-hidden":lt.hidden||void 0,"data-outside":Wt.outside||void 0,"data-focused":lt.focused||void 0,"data-today":lt.today||void 0},!lt.hidden&&Tn?he.createElement(n.DayButton,{className:l[gt.DayButton],style:_?.[gt.DayButton],type:"button",day:Wt,modifiers:lt,disabled:lt.disabled||void 0,tabIndex:Y(Wt)?0:-1,"aria-label":oe(Ht,lt,i.options,i),onClick:xt(Wt,lt),onBlur:Re(Wt,lt),onFocus:Te(Wt,lt),onKeyDown:qe(Wt,lt),onMouseEnter:rt(Wt,lt),onMouseLeave:wt(Wt,lt)},M(Ht,i.options,i)):!lt.hidden&&M(Wt.date,i.options,i))})))))))),e.footer&&he.createElement(n.Footer,{className:l[gt.Footer],style:_?.[gt.Footer],role:"status","aria-live":"polite"},e.footer)))}function aD({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...l}){const c=Nj();return o.jsx(ENe,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",c.root),months:ye("relative flex flex-col gap-4 md:flex-row",c.months),month:ye("flex w-full flex-col gap-4",c.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:ye(qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:ye(qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:ye("flex",c.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:ye("mt-2 flex w-full",c.week),week_number_header:ye("w-[--cell-size] select-none",c.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:ye("bg-accent rounded-l-md",c.range_start),range_middle:ye("rounded-none",c.range_middle),range_end:ye("bg-accent rounded-r-md",c.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:ye("text-muted-foreground opacity-50",c.disabled),hidden:ye("invisible",c.hidden),...e},components:{Root:({className:h,rootRef:f,...m})=>o.jsx("div",{"data-slot":"calendar",ref:f,className:ye(h),...m}),Chevron:({className:h,orientation:f,...m})=>f==="left"?o.jsx(Iu,{className:ye("size-4",h),...m}):f==="right"?o.jsx(Bu,{className:ye("size-4",h),...m}):o.jsx(Im,{className:ye("size-4",h),...m}),DayButton:_Ne,WeekNumber:({children:h,...f})=>o.jsx("td",{...f,children:o.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...a},...l})}function _Ne({className:t,day:e,modifiers:n,...r}){const s=Nj(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),o.jsx(me,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class MNe{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const $d=new MNe;typeof window<"u"&&$d.connect();const ANe={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},RNe=(t,e,n)=>{let r;const s=ANe[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},DNe={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},zNe={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},PNe={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},LNe={date:uh({formats:DNe,defaultWidth:"full"}),time:uh({formats:zNe,defaultWidth:"full"}),dateTime:uh({formats:PNe,defaultWidth:"full"})};function oD(t,e,n){const r="eeee p";return Gje(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const INe={lastWeek:oD,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:oD,other:"PP p"},BNe=(t,e,n,r)=>{const s=INe[t];return typeof s=="function"?s(e,n,r):s},qNe={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},FNe={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},$Ne={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},QNe={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},HNe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},VNe={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},UNe=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},WNe={ordinalNumber:UNe,era:Ga({values:qNe,defaultWidth:"wide"}),quarter:Ga({values:FNe,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ga({values:$Ne,defaultWidth:"wide"}),day:Ga({values:QNe,defaultWidth:"wide"}),dayPeriod:Ga({values:HNe,defaultWidth:"wide",formattingValues:VNe,defaultFormattingWidth:"wide"})},GNe=/^(第\s*)?\d+(日|时|分|秒)?/i,XNe=/\d+/i,YNe={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},KNe={any:[/^(前)/i,/^(公元)/i]},ZNe={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},JNe={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},e8e={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},t8e={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},n8e={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},r8e={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},s8e={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},i8e={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},a8e={ordinalNumber:LV({matchPattern:GNe,parsePattern:XNe,valueCallback:t=>parseInt(t,10)}),era:Xa({matchPatterns:YNe,defaultMatchWidth:"wide",parsePatterns:KNe,defaultParseWidth:"any"}),quarter:Xa({matchPatterns:ZNe,defaultMatchWidth:"wide",parsePatterns:JNe,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Xa({matchPatterns:e8e,defaultMatchWidth:"wide",parsePatterns:t8e,defaultParseWidth:"any"}),day:Xa({matchPatterns:n8e,defaultMatchWidth:"wide",parsePatterns:r8e,defaultParseWidth:"any"}),dayPeriod:Xa({matchPatterns:s8e,defaultMatchWidth:"any",parsePatterns:i8e,defaultParseWidth:"any"})},Bx={code:"zh-CN",formatDistance:RNe,formatLong:LNe,formatRelative:BNe,localize:WNe,match:a8e,options:{weekStartsOn:1,firstWeekContainsDate:4}},qx={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function o8e(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,l]=b.useState("all"),[c,h]=b.useState(void 0),[f,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[N,C]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const P=$d.getAllLogs();e(P);const W=$d.onLog(()=>{e($d.getAllLogs())}),J=$d.onConnectionChange(X=>{w(X)});return()=>{W(),J()}},[]);const _=b.useMemo(()=>{const P=new Set(t.map(W=>W.module));return Array.from(P).sort()},[t]),E=P=>{switch(P){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},M=P=>{switch(P){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},q=()=>{window.location.reload()},L=()=>{$d.clearLogs(),e([])},I=()=>{const P=ee.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(` -`),W=new Blob([P],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(W),X=document.createElement("a");X.href=J,X.download=`logs-${y1(new Date,"yyyy-MM-dd-HHmmss")}.txt`,X.click(),URL.revokeObjectURL(J)},$=()=>{x(!g)},V=()=>{h(void 0),m(void 0)},ee=b.useMemo(()=>t.filter(P=>{const W=n===""||P.message.toLowerCase().includes(n.toLowerCase())||P.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||P.level===s,X=a==="all"||P.module===a;let R=!0;if(c||f){const se=new Date(P.timestamp);if(c){const G=new Date(c);G.setHours(0,0,0,0),R=R&&se>=G}if(f){const G=new Date(f);G.setHours(23,59,59,999),R=R&&se<=G}}return W&&J&&X&&R}),[t,n,s,a,c,f]),z=qx[S].rowHeight+N,H=TOe({count:ee.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&ee.length>0&&H.scrollToIndex(ee.length-1,{align:"end",behavior:"auto"})},[ee.length,g,H]),o.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),o.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),o.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),o.jsx(_t,{className:"p-3 sm:p-4",children:o.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索日志...",value:n,onChange:P=>r(P.target.value),className:"pl-9 h-9 text-sm"})]}),o.jsxs(Dt,{value:s,onValueChange:i,children:[o.jsxs(Mt,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[o.jsx(N3,{className:"h-4 w-4 mr-2"}),o.jsx(zt,{placeholder:"级别"})]}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部级别"}),o.jsx(ze,{value:"DEBUG",children:"DEBUG"}),o.jsx(ze,{value:"INFO",children:"INFO"}),o.jsx(ze,{value:"WARNING",children:"WARNING"}),o.jsx(ze,{value:"ERROR",children:"ERROR"}),o.jsx(ze,{value:"CRITICAL",children:"CRITICAL"})]})]}),o.jsxs(Dt,{value:a,onValueChange:l,children:[o.jsxs(Mt,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[o.jsx(N3,{className:"h-4 w-4 mr-2"}),o.jsx(zt,{placeholder:"模块"})]}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部模块"}),_.map(P=>o.jsx(ze,{value:P,children:P},P))]})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[o.jsx(MC,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:c?y1(c,"PPP",{locale:Bx}):"开始日期"})]})}),o.jsx(so,{className:"w-auto p-0",align:"start",children:o.jsx(aD,{mode:"single",selected:c,onSelect:h,initialFocus:!0,locale:Bx})})]}),o.jsxs(cl,{children:[o.jsx(ul,{asChild:!0,children:o.jsxs(me,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!f&&"text-muted-foreground"),children:[o.jsx(MC,{className:"mr-2 h-4 w-4"}),o.jsx("span",{className:"text-xs sm:text-sm",children:f?y1(f,"PPP",{locale:Bx}):"结束日期"})]})}),o.jsx(so,{className:"w-auto p-0",align:"start",children:o.jsx(aD,{mode:"single",selected:f,onSelect:m,initialFocus:!0,locale:Bx})})]}),(c||f)&&o.jsxs(me,{variant:"outline",size:"sm",onClick:V,className:"w-full sm:w-auto h-9",children:[o.jsx(_0,{className:"h-4 w-4 sm:mr-2"}),o.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),o.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),o.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[o.jsxs("div",{className:"flex gap-2 flex-wrap",children:[o.jsxs(me,{variant:g?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[g?o.jsx(_K,{className:"h-4 w-4"}):o.jsx(MK,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:q,className:"flex-1 sm:flex-none h-9",children:[o.jsx(Ti,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[o.jsx(sn,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:I,className:"flex-1 sm:flex-none h-9",children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),o.jsx("div",{className:"flex-1 hidden sm:block"}),o.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[o.jsxs("span",{className:"font-mono",children:[ee.length," / ",t.length]}),o.jsx("span",{className:"ml-1",children:"条日志"})]})]}),o.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(AK,{className:"h-4 w-4"}),o.jsx("span",{children:"字号"})]}),o.jsx("div",{className:"flex gap-1",children:Object.keys(qx).map(P=>o.jsx(me,{variant:S===P?"default":"outline",size:"sm",onClick:()=>k(P),className:"h-7 px-3 text-xs",children:qx[P].label},P))})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[o.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),o.jsx(B0,{value:[N],onValueChange:([P])=>C(P),min:0,max:12,step:2,className:"flex-1"}),o.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[N,"px"]})]})]})]})})]}),o.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:o.jsx(_t,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:o.jsx(kn,{viewportRef:T,className:"h-full",children:o.jsx("div",{className:ye("p-2 sm:p-3 font-mono relative",qx[S].class),style:{height:`${H.getTotalSize()}px`},children:ee.length===0?o.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):H.getVirtualItems().map(P=>{const W=ee[P.index];return o.jsxs("div",{"data-index":P.index,ref:H.measureElement,className:ye("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",M(W.level)),style:{transform:`translateY(${P.start}px)`,paddingTop:`${N/2}px`,paddingBottom:`${N/2}px`},children:[o.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:W.timestamp}),o.jsxs("span",{className:ye("font-semibold",E(W.level)),children:["[",W.level,"]"]})]}),o.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:W.module}),o.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:W.message})]}),o.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[o.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:W.timestamp}),o.jsxs("span",{className:ye("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",E(W.level)),children:["[",W.level,"]"]}),o.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:W.module}),o.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:W.message})]})]},P.key)})})})})})]})}const l8e="Mai-with-u",c8e="plugin-repo",u8e="main",d8e="plugin_details.json";async function h8e(){try{const t=await mt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Nt(),body:JSON.stringify({owner:l8e,repo:c8e,branch:u8e,file_path:d8e})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function f8e(){try{const t=await mt("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function m8e(){try{const t=await mt("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function p8e(t,e,n){const r=t.split(".").map(l=>parseInt(l)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),c=l[0]||0,h=l[1]||0,f=l[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>h||n.version_major===c&&n.version_minor===h&&n.version_patch>f)return!1}return!0}function g8e(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Fx(){try{const t=await mt("/api/webui/plugins/installed",{headers:Nt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function $x(t,e){return e.some(n=>n.id===t)}function Qx(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function x8e(t,e,n="main"){const r=await mt("/api/webui/plugins/install",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function v8e(t){const e=await mt("/api/webui/plugins/uninstall",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function y8e(t,e,n="main"){const r=await mt("/api/webui/plugins/update",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const pp="https://maibot-plugin-stats.maibot-webui.workers.dev";async function tU(t){try{const e=await fetch(`${pp}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function b8e(t,e){try{const n=e||Cj(),r=await fetch(`${pp}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function w8e(t,e){try{const n=e||Cj(),r=await fetch(`${pp}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function S8e(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||Cj(),i=await fetch(`${pp}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function k8e(t){try{const e=await fetch(`${pp}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function O8e(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await tU(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await b8e(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await w8e(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await S8e(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),l(0),h(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tc,{className:"h-4 w-4"}),o.jsx("span",{children:"-"})]})]}):n?e?o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{children:n.downloads.toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[o.jsx(tc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:n.rating.toFixed(1)})]}),o.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[o.jsx(V2,{className:"h-4 w-4"}),o.jsx("span",{children:n.likes})]})]}):o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(yu,{className:"h-5 w-5 text-muted-foreground mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(tc,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),o.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),o.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(V2,{className:"h-5 w-5 text-green-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.likes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),o.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[o.jsx(AC,{className:"h-5 w-5 text-red-500 mb-1"}),o.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),o.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(me,{variant:"outline",size:"sm",onClick:y,children:[o.jsx(V2,{className:"h-4 w-4 mr-1"}),"点赞"]}),o.jsxs(me,{variant:"outline",size:"sm",onClick:w,children:[o.jsx(AC,{className:"h-4 w-4 mr-1"}),"点踩"]}),o.jsxs(zr,{open:f,onOpenChange:m,children:[o.jsx(h6,{asChild:!0,children:o.jsxs(me,{variant:"default",size:"sm",children:[o.jsx(tc,{className:"h-4 w-4 mr-1"}),"评分"]})}),o.jsxs(Sr,{children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"为插件评分"}),o.jsx(ps,{children:"分享你的使用体验,帮助其他用户"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>o.jsx("button",{onClick:()=>l(k),className:"focus:outline-none",children:o.jsx(tc,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),o.jsx(nr,{value:c,onChange:k=>h(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(me,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),o.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,N)=>o.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(C=>o.jsx(tc,{className:`h-3 w-3 ${C<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},C))}),o.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&o.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},N))})]})]}):null}const lD={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function N8e(){const t=Ca(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[l,c]=b.useState("all"),[h,f]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,N]=b.useState(null),[C,T]=b.useState(null),[_,E]=b.useState(null),[,M]=b.useState([]),[q,L]=b.useState({}),{toast:I}=Wr(),$=async R=>{const se=R.map(async U=>{try{const te=await tU(U.id);return{id:U.id,stats:te}}catch(te){return console.warn(`Failed to load stats for ${U.id}:`,te),{id:U.id,stats:null}}}),G=await Promise.all(se),F={};G.forEach(({id:U,stats:te})=>{te&&(F[U]=te)}),L(F)};b.useEffect(()=>{let R=null,se=!1;return(async()=>{if(R=g8e(F=>{se||(T(F),F.stage==="success"?setTimeout(()=>{se||T(null)},2e3):F.stage==="error"&&(y(!1),S(F.error||"加载失败")))},F=>{console.error("WebSocket error:",F),se||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(F=>{if(!R){F();return}const U=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),F()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),F()):setTimeout(U,100)};U()}),!se){const F=await f8e();N(F),F.installed||I({title:"Git 未安装",description:F.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!se){const F=await m8e();E(F)}if(!se)try{y(!0),S(null);const F=await h8e();if(!se){const U=await Fx();M(U);const te=F.map(ne=>{const Y=$x(ne.id,U),ae=Qx(ne.id,U);return{...ne,installed:Y,installed_version:ae}});for(const ne of U)!te.some(ae=>ae.id===ne.id)&&ne.manifest&&te.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(te),$(te)}}catch(F){if(!se){const U=F instanceof Error?F.message:"加载插件列表失败";S(U),I({title:"加载失败",description:U,variant:"destructive"})}}finally{se||y(!1)}})(),()=>{se=!0,R&&R.close()}},[I]);const V=R=>{if(!R.installed&&_&&!ee(R))return o.jsxs(Ln,{variant:"destructive",className:"gap-1",children:[o.jsx(Ou,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const se=R.installed_version?.trim(),G=R.manifest.version?.trim();if(se!==G){const F=se?.split(".").map(Number)||[0,0,0],U=G?.split(".").map(Number)||[0,0,0];for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return o.jsxs(Ln,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[o.jsx(Ou,{className:"h-3 w-3"}),"可更新"]});if((U[te]||0)<(F[te]||0))break}}return o.jsxs(Ln,{variant:"default",className:"gap-1",children:[o.jsx(pc,{className:"h-3 w-3"}),"已安装"]})}return null},ee=R=>!_||!R.manifest?.host_application?!0:p8e(R.manifest.host_application.min_version,R.manifest.host_application.max_version,_),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const se=R.installed_version.trim(),G=R.manifest.version.trim();if(se===G)return!1;const F=se.split(".").map(Number),U=G.split(".").map(Number);for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return!0;if((U[te]||0)<(F[te]||0))return!1}return!1},H=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(te=>te.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let F=!0;l==="installed"?F=R.installed===!0:l==="updates"&&(F=R.installed===!0&&z(R));const U=!h||!_||ee(R);return se&&G&&F&&U}),P=()=>{n(null)},W=async R=>{if(!k?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(_&&!ee(R)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await x8e(R.id,R.manifest.repository_url||"","main"),k8e(R.id).catch(G=>{console.warn("Failed to record download:",G)}),I({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const se=await Fx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=$x(F.id,se),te=Qx(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"安装失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await v8e(R.id),I({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const se=await Fx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=$x(F.id,se),te=Qx(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"卸载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},X=async R=>{if(!k?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const se=await y8e(R.id,R.manifest.repository_url||"","main");I({title:"更新成功",description:`${R.manifest.name} 已从 ${se.old_version} 更新到 ${se.new_version}`});const G=await Fx();M(G),g(F=>F.map(U=>{if(U.id===R.id){const te=$x(U.id,G),ne=Qx(U.id,G);return{...U,installed:te,installed_version:ne}}return U}))}catch(se){I({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),o.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),o.jsxs(me,{onClick:()=>t({to:"/plugin-mirrors"}),children:[o.jsx(RK,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&o.jsxs(_t,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[o.jsx(wn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Xd,{className:"h-5 w-5 text-orange-600"}),o.jsxs("div",{children:[o.jsx(Sn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),o.jsx(Fr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),o.jsx(An,{children:o.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",o.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),o.jsx(_t,{className:"p-4",children:o.jsxs("div",{className:"flex flex-col gap-4",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(Pe,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),o.jsxs(Dt,{value:i,onValueChange:a,children:[o.jsx(Mt,{className:"w-full sm:w-[200px]",children:o.jsx(zt,{placeholder:"选择分类"})}),o.jsxs(At,{children:[o.jsx(ze,{value:"all",children:"全部分类"}),o.jsx(ze,{value:"Group Management",children:"群组管理"}),o.jsx(ze,{value:"Entertainment & Interaction",children:"娱乐互动"}),o.jsx(ze,{value:"Utility Tools",children:"实用工具"}),o.jsx(ze,{value:"Content Generation",children:"内容生成"}),o.jsx(ze,{value:"Multimedia",children:"多媒体"}),o.jsx(ze,{value:"External Integration",children:"外部集成"}),o.jsx(ze,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),o.jsx(ze,{value:"Other",children:"其他"})]})]})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(ri,{id:"compatible-only",checked:h,onCheckedChange:R=>f(R===!0)}),o.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),o.jsx(ll,{value:l,onValueChange:c,className:"w-full",children:o.jsxs(ro,{className:"grid w-full grid-cols-3",children:[o.jsxs(Jt,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return se&&G&&F}).length,")"]}),o.jsxs(Jt,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&se&&G&&F}).length,")"]}),o.jsxs(Jt,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&z(R)&&se&&G&&F}).length,")"]})]})}),C&&C.stage==="loading"&&o.jsx(_t,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(dh,{className:"h-4 w-4 animate-spin"}),o.jsxs("span",{className:"text-sm font-medium",children:[C.operation==="fetch"&&"加载插件列表",C.operation==="install"&&`安装插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="uninstall"&&`卸载插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="update"&&`更新插件${C.plugin_id?`: ${C.plugin_id}`:""}`]})]}),o.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),o.jsx(I0,{value:C.progress,className:"h-2"}),o.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&o.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&o.jsx(_t,{className:"border-destructive bg-destructive/10",children:o.jsx(wn,{children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(Xd,{className:"h-5 w-5 text-destructive"}),o.jsxs("div",{children:[o.jsx(Sn,{className:"text-lg text-destructive",children:"加载失败"}),o.jsx(Fr,{className:"text-destructive/80",children:C.error})]})]})})}),x?o.jsxs("div",{className:"flex items-center justify-center py-12",children:[o.jsx(dh,{className:"h-8 w-8 animate-spin text-muted-foreground"}),o.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?o.jsx(_t,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Xd,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),o.jsx(me,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):H.length===0?o.jsx(_t,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(ii,{className:"h-12 w-12 text-muted-foreground mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>o.jsxs(_t,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[o.jsxs(wn,{children:[o.jsxs("div",{className:"flex items-start justify-between gap-2",children:[o.jsx(Sn,{className:"text-xl",children:R.manifest?.name||R.id}),o.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&o.jsx(Ln,{variant:"secondary",className:"text-xs whitespace-nowrap",children:lD[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),o.jsx(Fr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),o.jsx(An,{className:"flex-1",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(yu,{className:"h-4 w-4"}),o.jsx("span",{children:(q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsx("span",{children:(q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(se=>o.jsx(Ln,{variant:"outline",className:"text-xs",children:se},se)),R.manifest?.keywords&&R.manifest.keywords.length>3&&o.jsxs(Ln,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),o.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[o.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("span",{children:"支持:"}),o.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),o.jsx(Lz,{className:"pt-4",children:o.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[o.jsx(me,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?o.jsxs(me,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>X(R),children:[o.jsx(Ti,{className:"h-4 w-4 mr-1"}),"更新"]}):o.jsxs(me,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[o.jsx(sn,{className:"h-4 w-4 mr-1"}),"卸载"]}):o.jsxs(me,{size:"sm",disabled:!k?.installed||C?.operation==="install"||_!==null&&!ee(R),title:k?.installed?_!==null&&!ee(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${_?.version})`:void 0:"Git 未安装",onClick:()=>W(R),children:[o.jsx(yu,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),o.jsx(zr,{open:e!==null,onOpenChange:P,children:e&&e.manifest&&o.jsxs(Sr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[o.jsx(kr,{children:o.jsxs("div",{className:"flex items-start justify-between gap-4",children:[o.jsxs("div",{className:"space-y-2 flex-1",children:[o.jsx(Or,{className:"text-2xl",children:e.manifest.name}),o.jsxs(ps,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&o.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:o.jsx(Yd,{className:"h-3 w-3 inline"})})]})]}),o.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&o.jsx(Ln,{variant:"secondary",children:lD[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),o.jsxs("div",{className:"space-y-6",children:[o.jsx(j8e,{pluginId:e.id}),o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"下载量"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:(q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"评分"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(tc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[(q[e.id]?.rating??e.rating??0).toFixed(1)," (",q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium",children:"许可证"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),o.jsxs("div",{className:"col-span-2",children:[o.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),o.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),o.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>o.jsx(Ln,{variant:"outline",children:R},R))})]}),e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),o.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),o.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"主页: "}),o.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&o.jsxs("div",{className:"text-sm",children:[o.jsx("span",{className:"font-medium",children:"仓库: "}),o.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),o.jsxs(Ds,{children:[e.manifest.homepage_url&&o.jsxs(me,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[o.jsx(Yd,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&o.jsxs(me,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[o.jsx(Yd,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function C8e(){return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),o.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(me,{variant:"outline",size:"sm",children:[o.jsx(Ti,{className:"h-4 w-4 mr-2"}),"刷新"]}),o.jsxs(me,{size:"sm",children:[o.jsx(vu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),o.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"已安装插件"}),o.jsx(fh,{className:"h-4 w-4 text-muted-foreground"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"已启用"}),o.jsx(pc,{className:"h-4 w-4 text-green-600"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"已禁用"}),o.jsx(Ou,{className:"h-4 w-4 text-orange-600"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[o.jsx(Sn,{className:"text-sm font-medium",children:"可更新"}),o.jsx(Ti,{className:"h-4 w-4 text-blue-600"})]}),o.jsxs(An,{children:[o.jsx("div",{className:"text-2xl font-bold",children:"0"}),o.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),o.jsxs(_t,{children:[o.jsxs(wn,{children:[o.jsx(Sn,{children:"已安装的插件"}),o.jsx(Fr,{children:"查看和管理已安装插件的配置"})]}),o.jsx(An,{children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[o.jsx(fh,{className:"h-16 w-16 text-muted-foreground/50"}),o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),o.jsx("div",{className:"flex gap-2",children:o.jsx(me,{variant:"outline",asChild:!0,children:o.jsxs("a",{href:"/plugins",children:[o.jsx(Yd,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),o.jsx(_t,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:o.jsx(An,{className:"pt-6",children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx(Ou,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),o.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",o.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function T8e(){const t=Ca(),{toast:e}=Wr(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,l]=b.useState(null),[c,h]=b.useState(null),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),l(null);const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${M}`}});if(!q.ok)throw new Error("获取镜像源列表失败");const L=await q.json();r(L.mirrors||[])}catch(M){const q=M instanceof Error?M.message:"加载镜像源失败";l(q),e({title:"加载失败",description:q,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!q.ok){const L=await q.json();throw new Error(L.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(M){e({title:"添加失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},N=async()=>{if(c)try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),h(null),S()}catch(M){e({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},C=async M=>{if(confirm("确定要删除这个镜像源吗?"))try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M}`,{method:"DELETE",headers:{Authorization:`Bearer ${q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(q){e({title:"删除失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},T=async M=>{try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!M.enabled})})).ok)throw new Error("更新状态失败");S()}catch(q){e({title:"更新失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},_=M=>{h(M),w({id:M.id,name:M.name,raw_prefix:M.raw_prefix,clone_prefix:M.clone_prefix,enabled:M.enabled,priority:M.priority}),x(!0)},E=async(M,q)=>{const L=q==="up"?M.priority-1:M.priority+1;if(!(L<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");S()}catch(I){e({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return o.jsx(kn,{className:"h-full",children:o.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[o.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:o.jsx(XD,{className:"h-5 w-5"})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),o.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),o.jsxs(me,{onClick:()=>m(!0),children:[o.jsx(ms,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?o.jsx(_t,{className:"p-6",children:o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(dh,{className:"h-8 w-8 animate-spin text-primary"})})}):a?o.jsx(_t,{className:"p-6",children:o.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[o.jsx(Xd,{className:"h-12 w-12 text-destructive mb-4"}),o.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),o.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),o.jsx(me,{onClick:S,children:"重新加载"})]})}):o.jsxs(_t,{children:[o.jsx("div",{className:"hidden md:block",children:o.jsxs(Qh,{children:[o.jsx(Hh,{children:o.jsxs(fs,{children:[o.jsx(en,{children:"状态"}),o.jsx(en,{children:"名称"}),o.jsx(en,{children:"ID"}),o.jsx(en,{children:"优先级"}),o.jsx(en,{className:"text-right",children:"操作"})]})}),o.jsx(Vh,{children:n.map(M=>o.jsxs(fs,{children:[o.jsx(Lt,{children:o.jsx(Tt,{checked:M.enabled,onCheckedChange:()=>T(M)})}),o.jsx(Lt,{children:o.jsxs("div",{children:[o.jsx("div",{className:"font-medium",children:M.name}),o.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",M.raw_prefix]})]})}),o.jsx(Lt,{children:o.jsx(Ln,{variant:"outline",children:M.id})}),o.jsx(Lt,{children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-mono",children:M.priority}),o.jsxs("div",{className:"flex flex-col gap-1",children:[o.jsx(me,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"up"),disabled:M.priority===1,children:o.jsx(j3,{className:"h-3 w-3"})}),o.jsx(me,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"down"),children:o.jsx(Im,{className:"h-3 w-3"})})]})]})}),o.jsx(Lt,{className:"text-right",children:o.jsxs("div",{className:"flex items-center justify-end gap-2",children:[o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>_(M),children:o.jsx(hh,{className:"h-4 w-4"})}),o.jsx(me,{variant:"ghost",size:"icon",onClick:()=>C(M.id),children:o.jsx(sn,{className:"h-4 w-4 text-destructive"})})]})})]},M.id))})]})}),o.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(M=>o.jsx(_t,{className:"p-4",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-start justify-between",children:[o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h3",{className:"font-semibold",children:M.name}),M.enabled&&o.jsx(Ln,{variant:"default",className:"text-xs",children:"启用"})]}),o.jsx(Ln,{variant:"outline",className:"mt-1 text-xs",children:M.id})]}),o.jsx(Tt,{checked:M.enabled,onCheckedChange:()=>T(M)})]}),o.jsxs("div",{className:"text-sm space-y-1",children:[o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"Raw: "}),o.jsx("span",{className:"break-all",children:M.raw_prefix})]}),o.jsxs("div",{className:"text-muted-foreground",children:[o.jsx("span",{className:"font-medium",children:"优先级: "}),o.jsx("span",{className:"font-mono",children:M.priority})]})]}),o.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[o.jsxs(me,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>_(M),children:[o.jsx(hh,{className:"h-4 w-4 mr-1"}),"编辑"]}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>E(M,"up"),disabled:M.priority===1,children:o.jsx(j3,{className:"h-4 w-4"})}),o.jsx(me,{variant:"outline",size:"sm",onClick:()=>E(M,"down"),children:o.jsx(Im,{className:"h-4 w-4"})}),o.jsx(me,{variant:"destructive",size:"sm",onClick:()=>C(M.id),children:o.jsx(sn,{className:"h-4 w-4"})})]})]})},M.id))})]}),o.jsx(zr,{open:f,onOpenChange:m,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"添加镜像源"}),o.jsx(ps,{children:"添加新的 Git 镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-id",children:"镜像源 ID *"}),o.jsx(Pe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:M=>w({...y,id:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-name",children:"名称 *"}),o.jsx(Pe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),o.jsx(Pe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-clone",children:"克隆前缀 *"}),o.jsx(Pe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"add-priority",children:"优先级"}),o.jsx(Pe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"add-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),o.jsx(de,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>m(!1),children:"取消"}),o.jsx(me,{onClick:k,children:"添加"})]})]})}),o.jsx(zr,{open:g,onOpenChange:x,children:o.jsxs(Sr,{className:"max-w-lg",children:[o.jsxs(kr,{children:[o.jsx(Or,{children:"编辑镜像源"}),o.jsx(ps,{children:"修改镜像源配置"})]}),o.jsxs("div",{className:"space-y-4 py-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{children:"镜像源 ID"}),o.jsx(Pe,{value:y.id,disabled:!0})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-name",children:"名称 *"}),o.jsx(Pe,{id:"edit-name",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),o.jsx(Pe,{id:"edit-raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-clone",children:"克隆前缀 *"}),o.jsx(Pe,{id:"edit-clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(de,{htmlFor:"edit-priority",children:"优先级"}),o.jsx(Pe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),o.jsxs("div",{className:"flex items-center space-x-2",children:[o.jsx(Tt,{id:"edit-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),o.jsx(de,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),o.jsxs(Ds,{children:[o.jsx(me,{variant:"outline",onClick:()=>x(!1),children:"取消"}),o.jsx(me,{onClick:N,children:"保存"})]})]})})]})})}const E8e=Lh("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),nU=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>o.jsx("kbd",{className:ye(E8e({size:e,className:t})),ref:i,...s,children:n?o.jsx("abbr",{title:n,children:r}):r}));nU.displayName="Kbd";const _8e=[{icon:w1,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:tl,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:ZD,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:JD,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Xk,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:E0,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:ez,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:DK,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:fh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:S1,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:vu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function M8e({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Ca(),l=_8e.filter(f=>f.title.toLowerCase().includes(n.toLowerCase())||f.description.toLowerCase().includes(n.toLowerCase())||f.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(f=>{a({to:f}),e(!1)},[a,e]),h=b.useCallback(f=>{f.key==="ArrowDown"?(f.preventDefault(),i(m=>(m+1)%l.length)):f.key==="ArrowUp"?(f.preventDefault(),i(m=>(m-1+l.length)%l.length)):f.key==="Enter"&&l[s]&&(f.preventDefault(),c(l[s].path))},[l,s,c]);return o.jsx(zr,{open:t,onOpenChange:e,children:o.jsxs(Sr,{className:"max-w-2xl p-0 gap-0",children:[o.jsxs(kr,{className:"px-4 pt-4 pb-0",children:[o.jsx(Or,{className:"sr-only",children:"搜索"}),o.jsxs("div",{className:"relative",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),o.jsx(Pe,{value:n,onChange:f=>{r(f.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),o.jsx("div",{className:"border-t",children:o.jsx(kn,{className:"h-[400px]",children:l.length>0?o.jsx("div",{className:"p-2",children:l.map((f,m)=>{const g=f.icon;return o.jsxs("button",{onClick:()=>c(f.path),onMouseEnter:()=>i(m),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[o.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("div",{className:"font-medium text-sm",children:f.title}),o.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.description})]}),o.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:f.category})]},f.path)})}):o.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[o.jsx(ii,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),o.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function A8e(t){const e=R8e(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,l=b.Children.toArray(i),c=l.find(z8e);if(c){const h=c.props.children,f=l.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return o.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return o.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function R8e(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=L8e(s),l=P8e(i,s.props);return s.type!==b.Fragment&&(l.ref=r?mc(r,a):a),b.cloneElement(s,l)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var D8e=Symbol("radix.slottable");function z8e(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===D8e}function P8e(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function L8e(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var jk=["Enter"," "],I8e=["ArrowDown","PageUp","Home"],rU=["ArrowUp","PageDown","End"],B8e=[...I8e,...rU],q8e={ltr:[...jk,"ArrowRight"],rtl:[...jk,"ArrowLeft"]},F8e={ltr:["ArrowLeft"],rtl:["ArrowRight"]},gp="Menu",[j0,$8e,Q8e]=Sv(gp),[Hu,sU]=Ta(gp,[Q8e,Ah,Dv]),xp=Ah(),iU=Dv(),[aU,Pc]=Hu(gp),[H8e,vp]=Hu(gp),oU=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,l=xp(e),[c,h]=b.useState(null),f=b.useRef(!1),m=ys(i),g=T0(s);return b.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),o.jsx(Nv,{...l,children:o.jsx(aU,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:h,children:o.jsx(H8e,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};oU.displayName=gp;var V8e="MenuAnchor",Tj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=xp(n);return o.jsx(Cv,{...s,...r,ref:e})});Tj.displayName=V8e;var Ej="MenuPortal",[U8e,lU]=Hu(Ej,{forceMount:void 0}),cU=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Pc(Ej,e);return o.jsx(U8e,{scope:e,forceMount:n,children:o.jsx(ai,{present:n||i.open,children:o.jsx(jv,{asChild:!0,container:s,children:r})})})};cU.displayName=Ej;var ra="MenuContent",[W8e,_j]=Hu(ra),uU=b.forwardRef((t,e)=>{const n=lU(ra,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Pc(ra,t.__scopeMenu),a=vp(ra,t.__scopeMenu);return o.jsx(j0.Provider,{scope:t.__scopeMenu,children:o.jsx(ai,{present:r||i.open,children:o.jsx(j0.Slot,{scope:t.__scopeMenu,children:a.modal?o.jsx(G8e,{...s,ref:e}):o.jsx(X8e,{...s,ref:e})})})})}),G8e=b.forwardRef((t,e)=>{const n=Pc(ra,t.__scopeMenu),r=b.useRef(null),s=qn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return BD(i)},[]),o.jsx(Mj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),X8e=b.forwardRef((t,e)=>{const n=Pc(ra,t.__scopeMenu);return o.jsx(Mj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Y8e=A8e("MenuContent.ScrollLock"),Mj=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=Pc(ra,n),k=vp(ra,n),N=xp(n),C=iU(n),T=$8e(n),[_,E]=b.useState(null),M=b.useRef(null),q=qn(e,M,S.onContentChange),L=b.useRef(0),I=b.useRef(""),$=b.useRef(0),V=b.useRef(null),ee=b.useRef("right"),z=b.useRef(0),H=y?qD:b.Fragment,P=y?{as:Y8e,allowPinchZoom:!0}:void 0,W=X=>{const R=I.current+X,se=T().filter(Y=>!Y.disabled),G=document.activeElement,F=se.find(Y=>Y.ref.current===G)?.textValue,U=se.map(Y=>Y.textValue),te=lCe(U,R,F),ne=se.find(Y=>Y.textValue===te)?.ref.current;(function Y(ae){I.current=ae,window.clearTimeout(L.current),ae!==""&&(L.current=window.setTimeout(()=>Y(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),FD();const J=b.useCallback(X=>ee.current===V.current?.side&&uCe(X,V.current?.area),[]);return o.jsx(W8e,{scope:n,searchRef:I,onItemEnter:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),onItemLeave:b.useCallback(X=>{J(X)||(M.current?.focus(),E(null))},[J]),onTriggerLeave:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),pointerGraceTimerRef:$,onPointerGraceIntentChange:b.useCallback(X=>{V.current=X},[]),children:o.jsx(H,{...P,children:o.jsx($D,{asChild:!0,trapped:s,onMountAutoFocus:Ze(i,X=>{X.preventDefault(),M.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:o.jsx(Uk,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:o.jsx(Qz,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:Ze(c,X=>{k.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:o.jsx(Wk,{role:"menu","aria-orientation":"vertical","data-state":CU(S.open),"data-radix-menu-content":"",dir:k.dir,...N,...w,ref:q,style:{outline:"none",...w.style},onKeyDown:Ze(w.onKeyDown,X=>{const se=X.target.closest("[data-radix-menu-content]")===X.currentTarget,G=X.ctrlKey||X.altKey||X.metaKey,F=X.key.length===1;se&&(X.key==="Tab"&&X.preventDefault(),!G&&F&&W(X.key));const U=M.current;if(X.target!==U||!B8e.includes(X.key))return;X.preventDefault();const ne=T().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);rU.includes(X.key)&&ne.reverse(),aCe(ne)}),onBlur:Ze(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(L.current),I.current="")}),onPointerMove:Ze(t.onPointerMove,N0(X=>{const R=X.target,se=z.current!==X.clientX;if(X.currentTarget.contains(R)&&se){const G=X.clientX>z.current?"right":"left";ee.current=G,z.current=X.clientX}}))})})})})})})});uU.displayName=ra;var K8e="MenuGroup",Aj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"group",...r,ref:e})});Aj.displayName=K8e;var Z8e="MenuLabel",dU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});dU.displayName=Z8e;var vv="MenuItem",cD="menu.itemSelect",_y=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=vp(vv,t.__scopeMenu),l=_j(vv,t.__scopeMenu),c=qn(e,i),h=b.useRef(!1),f=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(cD,{bubbles:!0,cancelable:!0});m.addEventListener(cD,x=>r?.(x),{once:!0}),HD(m,g),g.defaultPrevented?h.current=!1:a.onClose()}};return o.jsx(hU,{...s,ref:c,disabled:n,onClick:Ze(t.onClick,f),onPointerDown:m=>{t.onPointerDown?.(m),h.current=!0},onPointerUp:Ze(t.onPointerUp,m=>{h.current||m.currentTarget?.click()}),onKeyDown:Ze(t.onKeyDown,m=>{const g=l.searchRef.current!=="";n||g&&m.key===" "||jk.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});_y.displayName=vv;var hU=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=_j(vv,n),l=iU(n),c=b.useRef(null),h=qn(e,c),[f,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),o.jsx(j0.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:o.jsx(Hz,{asChild:!0,...l,focusable:!r,children:o.jsx(xn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:Ze(t.onPointerMove,N0(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ze(t.onPointerLeave,N0(y=>a.onItemLeave(y))),onFocus:Ze(t.onFocus,()=>m(!0)),onBlur:Ze(t.onBlur,()=>m(!1))})})})}),J8e="MenuCheckboxItem",fU=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return o.jsx(vU,{scope:t.__scopeMenu,checked:n,children:o.jsx(_y,{role:"menuitemcheckbox","aria-checked":yv(n)?"mixed":n,...s,ref:e,"data-state":zj(n),onSelect:Ze(s.onSelect,()=>r?.(yv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});fU.displayName=J8e;var mU="MenuRadioGroup",[eCe,tCe]=Hu(mU,{value:void 0,onValueChange:()=>{}}),pU=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=ys(r);return o.jsx(eCe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:o.jsx(Aj,{...s,ref:e})})});pU.displayName=mU;var gU="MenuRadioItem",xU=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=tCe(gU,t.__scopeMenu),i=n===s.value;return o.jsx(vU,{scope:t.__scopeMenu,checked:i,children:o.jsx(_y,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":zj(i),onSelect:Ze(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});xU.displayName=gU;var Rj="MenuItemIndicator",[vU,nCe]=Hu(Rj,{checked:!1}),yU=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=nCe(Rj,n);return o.jsx(ai,{present:r||yv(i.checked)||i.checked===!0,children:o.jsx(xn.span,{...s,ref:e,"data-state":zj(i.checked)})})});yU.displayName=Rj;var rCe="MenuSeparator",bU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return o.jsx(xn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});bU.displayName=rCe;var sCe="MenuArrow",wU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=xp(n);return o.jsx(Gk,{...s,...r,ref:e})});wU.displayName=sCe;var Dj="MenuSub",[iCe,SU]=Hu(Dj),kU=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Pc(Dj,e),a=xp(e),[l,c]=b.useState(null),[h,f]=b.useState(null),m=ys(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),o.jsx(Nv,{...a,children:o.jsx(aU,{scope:e,open:r,onOpenChange:m,content:h,onContentChange:f,children:o.jsx(iCe,{scope:e,contentId:ea(),triggerId:ea(),trigger:l,onTriggerChange:c,children:n})})})};kU.displayName=Dj;var wm="MenuSubTrigger",OU=b.forwardRef((t,e)=>{const n=Pc(wm,t.__scopeMenu),r=vp(wm,t.__scopeMenu),s=SU(wm,t.__scopeMenu),i=_j(wm,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,h={__scopeMenu:t.__scopeMenu},f=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>f,[f]),b.useEffect(()=>{const m=l.current;return()=>{window.clearTimeout(m),c(null)}},[l,c]),o.jsx(Tj,{asChild:!0,...h,children:o.jsx(hU,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":CU(n.open),...t,ref:mc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ze(t.onPointerMove,N0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ze(t.onPointerLeave,N0(m=>{f();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ze(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||q8e[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});OU.displayName=wm;var jU="MenuSubContent",NU=b.forwardRef((t,e)=>{const n=lU(ra,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Pc(ra,t.__scopeMenu),a=vp(ra,t.__scopeMenu),l=SU(jU,t.__scopeMenu),c=b.useRef(null),h=qn(e,c);return o.jsx(j0.Provider,{scope:t.__scopeMenu,children:o.jsx(ai,{present:r||i.open,children:o.jsx(j0.Slot,{scope:t.__scopeMenu,children:o.jsx(Mj,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:h,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{a.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ze(t.onFocusOutside,f=>{f.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ze(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:Ze(t.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),g=F8e[a.dir].includes(f.key);m&&g&&(i.onOpenChange(!1),l.trigger?.focus(),f.preventDefault())})})})})})});NU.displayName=jU;function CU(t){return t?"open":"closed"}function yv(t){return t==="indeterminate"}function zj(t){return yv(t)?"indeterminate":t?"checked":"unchecked"}function aCe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function oCe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function lCe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=oCe(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==n));const c=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function cCe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function uCe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return cCe(n,e)}function N0(t){return e=>e.pointerType==="mouse"?t(e):void 0}var dCe=oU,hCe=Tj,fCe=cU,mCe=uU,pCe=Aj,gCe=dU,xCe=_y,vCe=fU,yCe=pU,bCe=xU,wCe=yU,SCe=bU,kCe=wU,OCe=kU,jCe=OU,NCe=NU,Pj="ContextMenu",[CCe]=Ta(Pj,[sU]),js=sU(),[TCe,TU]=CCe(Pj),EU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,l]=b.useState(!1),c=js(e),h=ys(r),f=b.useCallback(m=>{l(m),h(m)},[h]);return o.jsx(TCe,{scope:e,open:a,onOpenChange:f,modal:i,children:o.jsx(dCe,{...c,dir:s,open:a,onOpenChange:f,modal:i,children:n})})};EU.displayName=Pj;var _U="ContextMenuTrigger",MU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=TU(_U,n),a=js(n),l=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),h=b.useRef(0),f=b.useCallback(()=>window.clearTimeout(h.current),[]),m=g=>{l.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>f,[f]),b.useEffect(()=>void(r&&f()),[r,f]),o.jsxs(o.Fragment,{children:[o.jsx(hCe,{...a,virtualRef:c}),o.jsx(xn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Ze(t.onContextMenu,g=>{f(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:Ze(t.onPointerDown,Hx(g=>{f(),h.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:Ze(t.onPointerMove,Hx(f)),onPointerCancel:r?t.onPointerCancel:Ze(t.onPointerCancel,Hx(f)),onPointerUp:r?t.onPointerUp:Ze(t.onPointerUp,Hx(f))})]})});MU.displayName=_U;var ECe="ContextMenuPortal",AU=t=>{const{__scopeContextMenu:e,...n}=t,r=js(e);return o.jsx(fCe,{...r,...n})};AU.displayName=ECe;var RU="ContextMenuContent",DU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=TU(RU,n),i=js(n),a=b.useRef(!1);return o.jsx(mCe,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{t.onCloseAutoFocus?.(l),!l.defaultPrevented&&a.current&&l.preventDefault(),a.current=!1},onInteractOutside:l=>{t.onInteractOutside?.(l),!l.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});DU.displayName=RU;var _Ce="ContextMenuGroup",MCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(pCe,{...s,...r,ref:e})});MCe.displayName=_Ce;var ACe="ContextMenuLabel",zU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(gCe,{...s,...r,ref:e})});zU.displayName=ACe;var RCe="ContextMenuItem",PU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(xCe,{...s,...r,ref:e})});PU.displayName=RCe;var DCe="ContextMenuCheckboxItem",LU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(vCe,{...s,...r,ref:e})});LU.displayName=DCe;var zCe="ContextMenuRadioGroup",PCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(yCe,{...s,...r,ref:e})});PCe.displayName=zCe;var LCe="ContextMenuRadioItem",IU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(bCe,{...s,...r,ref:e})});IU.displayName=LCe;var ICe="ContextMenuItemIndicator",BU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(wCe,{...s,...r,ref:e})});BU.displayName=ICe;var BCe="ContextMenuSeparator",qU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(SCe,{...s,...r,ref:e})});qU.displayName=BCe;var qCe="ContextMenuArrow",FCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(kCe,{...s,...r,ref:e})});FCe.displayName=qCe;var FU="ContextMenuSub",$U=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=js(e),[l,c]=Cc({prop:s,defaultProp:i??!1,onChange:r,caller:FU});return o.jsx(OCe,{...a,open:l,onOpenChange:c,children:n})};$U.displayName=FU;var $Ce="ContextMenuSubTrigger",QU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(jCe,{...s,...r,ref:e})});QU.displayName=$Ce;var QCe="ContextMenuSubContent",HU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=js(n);return o.jsx(NCe,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});HU.displayName=QCe;function Hx(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var HCe=EU,VCe=MU,UCe=AU,VU=DU,UU=zU,WU=PU,GU=LU,XU=IU,YU=BU,KU=qU,WCe=$U,ZU=QU,JU=HU;const GCe=HCe,XCe=VCe,YCe=WCe,eW=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>o.jsxs(ZU,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,o.jsx(Bu,{className:"ml-auto h-4 w-4"})]}));eW.displayName=ZU.displayName;const tW=b.forwardRef(({className:t,...e},n)=>o.jsx(JU,{ref:n,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e}));tW.displayName=JU.displayName;const nW=b.forwardRef(({className:t,...e},n)=>o.jsx(UCe,{children:o.jsx(VU,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));nW.displayName=VU.displayName;const xa=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(WU,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));xa.displayName=WU.displayName;const KCe=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>o.jsxs(GU,{ref:s,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(YU,{children:o.jsx(dc,{className:"h-4 w-4"})})}),e]}));KCe.displayName=GU.displayName;const ZCe=b.forwardRef(({className:t,children:e,...n},r)=>o.jsxs(XU,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(YU,{children:o.jsx(zK,{className:"h-2 w-2 fill-current"})})}),e]}));ZCe.displayName=XU.displayName;const JCe=b.forwardRef(({className:t,inset:e,...n},r)=>o.jsx(UU,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));JCe.displayName=UU.displayName;const Sm=b.forwardRef(({className:t,...e},n)=>o.jsx(KU,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Sm.displayName=KU.displayName;const Qd=({className:t,...e})=>o.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Qd.displayName="ContextMenuShortcut";var e9e=Symbol("radix.slottable");function t9e(t){const e=({children:n})=>o.jsx(o.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=e9e,e}var[My]=Ta("Tooltip",[Ah]),Ay=Ah(),rW="TooltipProvider",n9e=700,Nk="tooltip.open",[r9e,Lj]=My(rW),sW=t=>{const{__scopeTooltip:e,delayDuration:n=n9e,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),l=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const h=c.current;return()=>window.clearTimeout(h)},[]),o.jsx(r9e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:b.useCallback(h=>{l.current=h},[]),disableHoverableContent:s,children:i})};sW.displayName=rW;var C0="Tooltip",[s9e,yp]=My(C0),iW=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:l}=t,c=Lj(C0,t.__scopeTooltip),h=Ay(e),[f,m]=b.useState(null),g=ea(),x=b.useRef(0),y=a??c.disableHoverableContent,w=l??c.delayDuration,S=b.useRef(!1),[k,N]=Cc({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(Nk))):c.onClose(),i?.(M)},caller:C0}),C=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,N(!0)},[N]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,N(!0),x.current=0},w)},[w,N]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Nv,{...h,children:o.jsx(s9e,{scope:e,contentId:g,open:k,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?E():T()},[c.isOpenDelayedRef,E,T]),onTriggerLeave:b.useCallback(()=>{y?_():(window.clearTimeout(x.current),x.current=0)},[_,y]),onOpen:T,onClose:_,disableHoverableContent:y,children:n})})};iW.displayName=C0;var Ck="TooltipTrigger",aW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=yp(Ck,n),i=Lj(Ck,n),a=Ay(n),l=b.useRef(null),c=qn(e,l,s.onTriggerChange),h=b.useRef(!1),f=b.useRef(!1),m=b.useCallback(()=>h.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),o.jsx(Cv,{asChild:!0,...a,children:o.jsx(xn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Ze(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ze(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Ze(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ze(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Ze(t.onBlur,s.onClose),onClick:Ze(t.onClick,s.onClose)})})});aW.displayName=Ck;var Ij="TooltipPortal",[i9e,a9e]=My(Ij,{forceMount:void 0}),oW=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=yp(Ij,e);return o.jsx(i9e,{scope:e,forceMount:n,children:o.jsx(ai,{present:n||i.open,children:o.jsx(jv,{asChild:!0,container:s,children:r})})})};oW.displayName=Ij;var Mh="TooltipContent",lW=b.forwardRef((t,e)=>{const n=a9e(Mh,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=yp(Mh,t.__scopeTooltip);return o.jsx(ai,{present:r||a.open,children:a.disableHoverableContent?o.jsx(cW,{side:s,...i,ref:e}):o.jsx(o9e,{side:s,...i,ref:e})})}),o9e=b.forwardRef((t,e)=>{const n=yp(Mh,t.__scopeTooltip),r=Lj(Mh,t.__scopeTooltip),s=b.useRef(null),i=qn(e,s),[a,l]=b.useState(null),{trigger:c,onClose:h}=n,f=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{l(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},N=h9e(k,S.getBoundingClientRect()),C=f9e(k,N),T=m9e(w.getBoundingClientRect()),_=g9e([...C,...T]);l(_),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&f){const y=S=>x(S,f),w=S=>x(S,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",w)}}},[c,f,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},N=c?.contains(S)||f?.contains(S),C=!p9e(k,a);N?g():C&&(g(),h())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,a,h,g]),o.jsx(cW,{...t,ref:i})}),[l9e,c9e]=My(C0,{isInside:!1}),u9e=t9e("TooltipContent"),cW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...l}=t,c=yp(Mh,n),h=Ay(n),{onClose:f}=c;return b.useEffect(()=>(document.addEventListener(Nk,f),()=>document.removeEventListener(Nk,f)),[f]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,f]),o.jsx(Uk,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:o.jsxs(Wk,{"data-state":c.stateAttribute,...h,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(u9e,{children:r}),o.jsx(l9e,{scope:n,isInside:!0,children:o.jsx(lK,{id:c.contentId,role:"tooltip",children:s||r})})]})})});lW.displayName=Mh;var uW="TooltipArrow",d9e=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ay(n);return c9e(uW,n).isInside?null:o.jsx(Gk,{...s,...r,ref:e})});d9e.displayName=uW;function h9e(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function f9e(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function m9e(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function p9e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function g9e(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),x9e(e)}function x9e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var v9e=sW,y9e=iW,b9e=aW,w9e=oW,dW=lW;const S9e=v9e,k9e=y9e,O9e=b9e,hW=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>o.jsx(w9e,{children:o.jsx(dW,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));hW.displayName=dW.displayName;function j9e({children:t}){Rte();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:l,setTheme:c}=c6(),h=VX(),f=Ca();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:w1,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:tl,label:"麦麦主程序配置",path:"/config/bot"},{icon:ZD,label:"AI模型厂商配置",path:"/config/modelProvider"},{icon:JD,label:"模型管理与分配",path:"/config/model"},{icon:RC,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Xk,label:"表情包管理",path:"/resource/emoji"},{icon:E0,label:"表达方式管理",path:"/resource/expression"},{icon:ez,label:"人物信息管理",path:"/resource/person"},{icon:KD,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:fh,label:"插件市场",path:"/plugins"},{icon:RC,label:"插件配置",path:"/plugin-config"},{icon:S1,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:vu,label:"系统设置",path:"/settings"}]}],x=l==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":l,y=()=>{localStorage.removeItem("access-token"),f({to:"/auth"})};return o.jsx(S9e,{delayDuration:300,children:o.jsxs("div",{className:"flex h-screen overflow-hidden",children:[o.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[o.jsx("div",{className:"flex h-16 items-center border-b px-4",children:o.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[o.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[o.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),o.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:cte()})]}),!e&&o.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),o.jsx(kn,{className:ye("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:o.jsx("nav",{className:ye("p-4",!e&&"lg:p-2 lg:w-16"),children:o.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>o.jsxs("li",{children:[o.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&o.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),o.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const N=h({to:k.path}),C=k.icon,T=o.jsxs(o.Fragment,{children:[N&&o.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),o.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[o.jsx(C,{className:ye("h-5 w-5 flex-shrink-0",N&&"text-primary"),strokeWidth:2,fill:"none"}),o.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",N&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return o.jsx("li",{className:"relative",children:o.jsxs(k9e,{children:[o.jsx(O9e,{asChild:!0,children:o.jsx(UX,{to:k.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",N?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&o.jsx(hW,{side:"right",className:"hidden lg:block",children:o.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&o.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),o.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[o.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:o.jsx(PK,{className:"h-5 w-5"})}),o.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:o.jsx(Iu,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[o.jsx(ii,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),o.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),o.jsxs(nU,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[o.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),o.jsx(M8e,{open:i,onOpenChange:a}),o.jsxs(me,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[o.jsx(LK,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),o.jsx("button",{onClick:w=>{Gee(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?o.jsx(k3,{className:"h-5 w-5"}):o.jsx(O3,{className:"h-5 w-5"})}),o.jsx("div",{className:"h-6 w-px bg-border"}),o.jsxs(me,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[o.jsx(DC,{className:"h-4 w-4"}),o.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),o.jsxs(GCe,{children:[o.jsx(XCe,{asChild:!0,children:o.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),o.jsxs(nW,{className:"w-64",children:[o.jsxs(xa,{onClick:()=>f({to:"/"}),children:[o.jsx(w1,{className:"mr-2 h-4 w-4"}),"首页"]}),o.jsxs(xa,{onClick:()=>f({to:"/settings"}),children:[o.jsx(vu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),o.jsxs(xa,{onClick:()=>f({to:"/logs"}),children:[o.jsx(S1,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),o.jsx(Sm,{}),o.jsxs(YCe,{children:[o.jsxs(eW,{children:[o.jsx(UD,{className:"mr-2 h-4 w-4"}),"切换主题"]}),o.jsxs(tW,{className:"w-48",children:[o.jsxs(xa,{onClick:()=>c("light"),disabled:l==="light",children:[o.jsx(k3,{className:"mr-2 h-4 w-4"}),"浅色",l==="light"&&o.jsx(Qd,{children:"✓"})]}),o.jsxs(xa,{onClick:()=>c("dark"),disabled:l==="dark",children:[o.jsx(O3,{className:"mr-2 h-4 w-4"}),"深色",l==="dark"&&o.jsx(Qd,{children:"✓"})]}),o.jsxs(xa,{onClick:()=>c("system"),disabled:l==="system",children:[o.jsx(vu,{className:"mr-2 h-4 w-4"}),"跟随系统",l==="system"&&o.jsx(Qd,{children:"✓"})]})]})]}),o.jsx(Sm,{}),o.jsxs(xa,{onClick:()=>window.location.reload(),children:[o.jsx(IK,{className:"mr-2 h-4 w-4"}),"刷新页面",o.jsx(Qd,{children:"⌘R"})]}),o.jsxs(xa,{onClick:()=>a(!0),children:[o.jsx(ii,{className:"mr-2 h-4 w-4"}),"搜索",o.jsx(Qd,{children:"⌘K"})]}),o.jsx(Sm,{}),o.jsxs(xa,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[o.jsx(Yd,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),o.jsx(Sm,{}),o.jsxs(xa,{onClick:y,className:"text-destructive focus:text-destructive",children:[o.jsx(DC,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}const bp=WX({component:()=>o.jsxs(o.Fragment,{children:[o.jsx(dD,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!nL())throw XX({to:"/auth"})}}),N9e=ns({getParentRoute:()=>bp,path:"/auth",component:Dte}),C9e=ns({getParentRoute:()=>bp,path:"/setup",component:rne}),Ls=ns({getParentRoute:()=>bp,id:"protected",component:()=>o.jsx(j9e,{children:o.jsx(dD,{})})}),T9e=ns({getParentRoute:()=>Ls,path:"/",component:Uee}),E9e=ns({getParentRoute:()=>Ls,path:"/config/bot",component:ehe}),_9e=ns({getParentRoute:()=>Ls,path:"/config/modelProvider",component:$he}),M9e=ns({getParentRoute:()=>Ls,path:"/config/model",component:Ame}),A9e=ns({getParentRoute:()=>Ls,path:"/config/adapter",component:Dme}),R9e=ns({getParentRoute:()=>Ls,path:"/resource/emoji",component:swe}),D9e=ns({getParentRoute:()=>Ls,path:"/resource/expression",component:pwe}),z9e=ns({getParentRoute:()=>Ls,path:"/resource/person",component:Nwe}),P9e=ns({getParentRoute:()=>Ls,path:"/resource/knowledge-graph",component:gOe}),L9e=ns({getParentRoute:()=>Ls,path:"/logs",component:o8e}),I9e=ns({getParentRoute:()=>Ls,path:"/plugins",component:N8e}),B9e=ns({getParentRoute:()=>Ls,path:"/plugin-config",component:C8e}),q9e=ns({getParentRoute:()=>Ls,path:"/plugin-mirrors",component:T8e}),F9e=ns({getParentRoute:()=>Ls,path:"/settings",component:Nte}),$9e=ns({getParentRoute:()=>bp,path:"*",component:iL}),Q9e=bp.addChildren([N9e,C9e,Ls.addChildren([T9e,E9e,_9e,M9e,A9e,R9e,D9e,z9e,P9e,I9e,B9e,q9e,L9e,F9e]),$9e]),H9e=GX({routeTree:Q9e,defaultNotFoundComponent:iL});function V9e({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const l=window.document.documentElement;if(l.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";l.classList.add(c);return}l.classList.add(s)},[s]),b.useEffect(()=>{const l=localStorage.getItem("accent-color");if(l){const c=document.documentElement,f={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[l];f&&(c.style.setProperty("--primary",f.hsl),f.gradient?(c.style.setProperty("--primary-gradient",f.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:l=>{localStorage.setItem(n,l),i(l)}};return o.jsx(NP.Provider,{...r,value:a,children:t})}function U9e({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const f=localStorage.getItem(r);return f!==null?f==="true":e}),[l,c]=b.useState(()=>{const f=localStorage.getItem(s);return f!==null?f==="true":n});b.useEffect(()=>{const f=document.documentElement;i?f.classList.remove("no-animations"):f.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(l))},[l,s]);const h={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:l,setEnableWavesBackground:c};return o.jsx(CP.Provider,{value:h,children:t})}var Bj="ToastProvider",[qj,W9e,G9e]=Sv("Toast"),[fW]=Ta("Toast",[G9e]),[X9e,Ry]=fW(Bj),mW=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[l,c]=b.useState(null),[h,f]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Bj}\`. Expected non-empty \`string\`.`),o.jsx(qj.Provider,{scope:e,children:o.jsx(X9e,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:l,onViewportChange:c,onToastAdd:b.useCallback(()=>f(x=>x+1),[]),onToastRemove:b.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};mW.displayName=Bj;var pW="ToastViewport",Y9e=["F8"],Tk="toast.viewportPause",Ek="toast.viewportResume",gW=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=Y9e,label:s="Notifications ({hotkey})",...i}=t,a=Ry(pW,n),l=W9e(n),c=b.useRef(null),h=b.useRef(null),f=b.useRef(null),m=b.useRef(null),g=qn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(C=>k[C]||k.code===C)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const N=()=>{if(!a.isClosePausedRef.current){const E=new CustomEvent(Tk);k.dispatchEvent(E),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const E=new CustomEvent(Ek);k.dispatchEvent(E),a.isClosePausedRef.current=!1}},T=E=>{!S.contains(E.relatedTarget)&&C()},_=()=>{S.contains(document.activeElement)||C()};return S.addEventListener("focusin",N),S.addEventListener("focusout",T),S.addEventListener("pointermove",N),S.addEventListener("pointerleave",_),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{S.removeEventListener("focusin",N),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",N),S.removeEventListener("pointerleave",_),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const N=l().map(C=>{const T=C.ref.current,_=[T,...cTe(T)];return S==="forwards"?_:_.reverse()});return(S==="forwards"?N.reverse():N).flat()},[l]);return b.useEffect(()=>{const S=m.current;if(S){const k=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const _=document.activeElement,E=N.shiftKey;if(N.target===S&&E){h.current?.focus();return}const L=w({tabbingDirection:E?"backwards":"forwards"}),I=L.findIndex($=>$===_);y3(L.slice(I+1))?N.preventDefault():E?h.current?.focus():f.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[l,w]),o.jsxs(cK,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&o.jsx(_k,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});y3(S)}}),o.jsx(qj.Slot,{scope:n,children:o.jsx(xn.ol,{tabIndex:-1,...i,ref:g})}),y&&o.jsx(_k,{ref:f,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});y3(S)}})]})});gW.displayName=pW;var xW="ToastFocusProxy",_k=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=Ry(xW,n);return o.jsx(VD,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const l=a.relatedTarget;!i.viewport?.contains(l)&&r()}})});_k.displayName=xW;var wp="Toast",K9e="toast.swipeStart",Z9e="toast.swipeMove",J9e="toast.swipeCancel",eTe="toast.swipeEnd",vW=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[l,c]=Cc({prop:r,defaultProp:s??!0,onChange:i,caller:wp});return o.jsx(ai,{present:n||l,children:o.jsx(rTe,{open:l,...a,ref:e,onClose:()=>c(!1),onPause:ys(t.onPause),onResume:ys(t.onResume),onSwipeStart:Ze(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ze(t.onSwipeMove,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Ze(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ze(t.onSwipeEnd,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});vW.displayName=wp;var[tTe,nTe]=fW(wp,{onClose(){}}),rTe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:l,onPause:c,onResume:h,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=Ry(wp,n),[S,k]=b.useState(null),N=qn(e,z=>k(z)),C=b.useRef(null),T=b.useRef(null),_=s||w.duration,E=b.useRef(0),M=b.useRef(_),q=b.useRef(0),{onToastAdd:L,onToastRemove:I}=w,$=ys(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),V=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(q.current),E.current=new Date().getTime(),q.current=window.setTimeout($,z))},[$]);b.useEffect(()=>{const z=w.viewport;if(z){const H=()=>{V(M.current),h?.()},P=()=>{const W=new Date().getTime()-E.current;M.current=M.current-W,window.clearTimeout(q.current),c?.()};return z.addEventListener(Tk,P),z.addEventListener(Ek,H),()=>{z.removeEventListener(Tk,P),z.removeEventListener(Ek,H)}}},[w.viewport,_,c,h,V]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&V(_)},[i,_,w.isClosePausedRef,V]),b.useEffect(()=>(L(),()=>I()),[L,I]);const ee=b.useMemo(()=>S?jW(S):null,[S]);return w.viewport?o.jsxs(o.Fragment,{children:[ee&&o.jsx(sTe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ee}),o.jsx(tTe,{scope:n,onClose:$,children:du.createPortal(o.jsx(qj.ItemSlot,{scope:n,children:o.jsx(uK,{asChild:!0,onEscapeKeyDown:Ze(l,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:o.jsx(xn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ze(t.onKeyDown,z=>{z.key==="Escape"&&(l?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:Ze(t.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:Ze(t.onPointerMove,z=>{if(!C.current)return;const H=z.clientX-C.current.x,P=z.clientY-C.current.y,W=!!T.current,J=["left","right"].includes(w.swipeDirection),X=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?X(0,H):0,se=J?0:X(0,P),G=z.pointerType==="touch"?10:2,F={x:R,y:se},U={originalEvent:z,delta:F};W?(T.current=F,Vx(Z9e,m,U,{discrete:!1})):uD(F,w.swipeDirection,G)?(T.current=F,Vx(K9e,f,U,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(H)>G||Math.abs(P)>G)&&(C.current=null)}),onPointerUp:Ze(t.onPointerUp,z=>{const H=T.current,P=z.target;if(P.hasPointerCapture(z.pointerId)&&P.releasePointerCapture(z.pointerId),T.current=null,C.current=null,H){const W=z.currentTarget,J={originalEvent:z,delta:H};uD(H,w.swipeDirection,w.swipeThreshold)?Vx(eTe,x,J,{discrete:!0}):Vx(J9e,g,J,{discrete:!0}),W.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),sTe=t=>{const{__scopeToast:e,children:n,...r}=t,s=Ry(wp,e),[i,a]=b.useState(!1),[l,c]=b.useState(!1);return oTe(()=>a(!0)),b.useEffect(()=>{const h=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(h)},[]),l?null:o.jsx(jv,{asChild:!0,children:o.jsx(VD,{...r,children:i&&o.jsxs(o.Fragment,{children:[s.label," ",n]})})})},iTe="ToastTitle",yW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});yW.displayName=iTe;var aTe="ToastDescription",bW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return o.jsx(xn.div,{...r,ref:e})});bW.displayName=aTe;var wW="ToastAction",SW=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?o.jsx(OW,{altText:n,asChild:!0,children:o.jsx(Fj,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${wW}\`. Expected non-empty \`string\`.`),null)});SW.displayName=wW;var kW="ToastClose",Fj=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=nTe(kW,n);return o.jsx(OW,{asChild:!0,children:o.jsx(xn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,s.onClose)})})});Fj.displayName=kW;var OW=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return o.jsx(xn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function jW(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),lTe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...jW(r))}}),e}function Vx(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?HD(s,i):s.dispatchEvent(i)}var uD=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function oTe(t=()=>{}){const e=ys(t);ND(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function lTe(t){return t.nodeType===t.ELEMENT_NODE}function cTe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function y3(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var uTe=mW,NW=gW,CW=vW,TW=yW,EW=bW,_W=SW,MW=Fj;const dTe=uTe,AW=b.forwardRef(({className:t,...e},n)=>o.jsx(NW,{ref:n,className:ye("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));AW.displayName=NW.displayName;const hTe=Lh("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),RW=b.forwardRef(({className:t,variant:e,...n},r)=>o.jsx(CW,{ref:r,className:ye(hTe({variant:e}),t),...n}));RW.displayName=CW.displayName;const fTe=b.forwardRef(({className:t,...e},n)=>o.jsx(_W,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));fTe.displayName=_W.displayName;const DW=b.forwardRef(({className:t,...e},n)=>o.jsx(MW,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:o.jsx(_0,{className:"h-4 w-4"})}));DW.displayName=MW.displayName;const zW=b.forwardRef(({className:t,...e},n)=>o.jsx(TW,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));zW.displayName=TW.displayName;const PW=b.forwardRef(({className:t,...e},n)=>o.jsx(EW,{ref:n,className:ye("text-sm opacity-90",t),...e}));PW.displayName=EW.displayName;function mTe(){const{toasts:t}=Wr();return o.jsxs(dTe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return o.jsxs(RW,{...i,children:[o.jsxs("div",{className:"grid gap-1",children:[n&&o.jsx(zW,{children:n}),r&&o.jsx(PW,{children:r})]}),s,o.jsx(DW,{})]},e)}),o.jsx(AW,{})]})}QK.createRoot(document.getElementById("root")).render(o.jsx(b.StrictMode,{children:o.jsx(V9e,{defaultTheme:"system",children:o.jsxs(U9e,{children:[o.jsx(YX,{router:H9e}),o.jsx(mTe,{})]})})})); + color: hsl(${Math.max(0,Math.min(120-120*S,120))}deg 100% 31%);`,n?.key)}return(h=n?.onChange)==null||h.call(n,s),s}return i.updateDeps=a=>{r=a},i}function YR(t,e){if(t===void 0)throw new Error("Unexpected undefined");return t}const ROe=(t,e)=>Math.abs(t-e)<1.01,DOe=(t,e,n)=>{let r;return function(...s){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,s),n)}},KR=t=>{const{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},zOe=t=>t,POe=t=>{const e=Math.max(t.startIndex-t.overscan,0),n=Math.min(t.endIndex+t.overscan,t.count-1),r=[];for(let s=e;s<=n;s++)r.push(s);return r},LOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;const s=a=>{const{width:o,height:c}=a;e({width:Math.round(o),height:Math.round(c)})};if(s(KR(n)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const o=()=>{const c=a[0];if(c?.borderBoxSize){const h=c.borderBoxSize[0];if(h){s({width:h.inlineSize,height:h.blockSize});return}}s(KR(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},ZR={passive:!0},JR=typeof window>"u"?!0:"onscrollend"in window,IOe=(t,e)=>{const n=t.scrollElement;if(!n)return;const r=t.targetWindow;if(!r)return;let s=0;const i=t.options.useScrollendEvent&&JR?()=>{}:DOe(r,()=>{e(s,!1)},t.options.isScrollingResetDelay),a=f=>()=>{const{horizontal:m,isRtl:g}=t.options;s=m?n.scrollLeft*(g&&-1||1):n.scrollTop,i(),e(s,f)},o=a(!0),c=a(!1);c(),n.addEventListener("scroll",o,ZR);const h=t.options.useScrollendEvent&&JR;return h&&n.addEventListener("scrollend",c,ZR),()=>{n.removeEventListener("scroll",o),h&&n.removeEventListener("scrollend",c)}},BOe=(t,e,n)=>{if(e?.borderBoxSize){const r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},qOe=(t,{adjustments:e=0,behavior:n},r)=>{var s,i;const a=t+e;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class FOe{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:zOe,rangeExtractor:POe,onChange:()=>{},measureElement:BOe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Dd(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const o=n[a];if(s.has(o.lane))continue;const c=i.get(o.lane);if(c==null||o.end>c.end?i.set(o.lane,o):o.enda.end===o.end?a.index-o.index:a.end-o.end)[0]:void 0},this.getMeasurementOptions=Dd(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=Dd(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},o)=>{if(!a)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const h=this.measurementsCache.slice(0,c);for(let f=c;fthis.options.debug}),this.calculateRange=Dd(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,s,i)=>this.range=n.length>0&&r>0?$Oe({measurements:n,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Dd(()=>{let n=null,r=null;const s=this.calculateRange();return s&&(n=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,s,i,a)=>i===null||a===null?[]:n({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),i=this.measurementsCache[s];if(!i)return;const a=i.key,o=this.elementsCache.get(a);o!==n&&(o&&this.observer.unobserve(o),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=Dd(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let i=0,a=n.length;ithis.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return YR(r[zV(0,r.length-1,s=>YR(r[s]).start,n)])},this.getOffsetForAlignment=(n,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=n>=a+i?"end":"start"),r==="center"?n+=(s-i)/2:r==="end"&&(n-=i);const o=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(o,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const o=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(o,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(n,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),n=Math.max(0,Math.min(n,this.options.count-1));let i=0;const a=10,o=h=>{if(!this.targetWindow)return;const f=this.getOffsetForIndex(n,h);if(!f){console.warn("Failed to get offset for index:",n);return}const[m,g]=f;this._scrollToOffset(m,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const x=this.getScrollOffset(),y=this.getOffsetForIndex(n,g);if(!y){console.warn("Failed to get offset for index:",n);return}ROe(y[0],x)||c(g)})},c=h=>{this.targetWindow&&(i++,io(h)):console.warn(`Failed to scroll to index ${n} after ${a} attempts.`))};o(r)},this.scrollBy=(n,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((n=r[r.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(o=>o===null);){const o=r[a];i[o.lane]===null&&(i[o.lane]=o.end),a--}s=Math.max(...i.filter(o=>o!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(e)}}const zV=(t,e,n,r)=>{for(;t<=e;){const s=(t+e)/2|0,i=n(s);if(ir)e=s-1;else return s}return t>0?t-1:0};function $Oe({measurements:t,outerSize:e,scrollOffset:n,lanes:r}){const s=t.length-1,i=c=>t[c].start;if(t.length<=r)return{startIndex:0,endIndex:s};let a=zV(0,s,i,n),o=a;if(r===1)for(;o1){const c=Array(r).fill(0);for(;of=0&&h.some(f=>f>=n);){const f=t[a];h[f.lane]=f.start,a--}a=Math.max(0,a-a%r),o=Math.min(s,o+(r-1-o%r))}return{startIndex:a,endIndex:o}}const eD=typeof document<"u"?b.useLayoutEffect:b.useEffect;function QOe(t){const e=b.useReducer(()=>({}),{})[1],n={...t,onChange:(s,i)=>{var a;i?hu.flushSync(e):e(),(a=t.onChange)==null||a.call(t,s,i)}},[r]=b.useState(()=>new FOe(n));return r.setOptions(n),eD(()=>r._didMount(),[]),eD(()=>r._willUpdate()),r}function HOe(t){return QOe({observeElementRect:LOe,observeElementOffset:IOe,scrollToFn:qOe,...t})}function VOe(t,e,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(e).split(/\s/g).slice(2).join(" ")}const UOe={},Sm={};function vu(t,e){try{const r=(UOe[t]||=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format)(e).split("GMT")[1];return r in Sm?Sm[r]:tD(r,r.split(":"))}catch{if(t in Sm)return Sm[t];const n=t?.match(WOe);return n?tD(t,n.slice(1)):NaN}}const WOe=/([+-]\d\d):?(\d\d)?/;function tD(t,e){const n=+(e[0]||0),r=+(e[1]||0),s=+(e[2]||0)/60;return Sm[t]=n*60+r>0?n*60+r+s:n*60-r-s}class sl extends Date{constructor(...e){super(),e.length>1&&typeof e[e.length-1]=="string"&&(this.timeZone=e.pop()),this.internal=new Date,isNaN(vu(this.timeZone,this))?this.setTime(NaN):e.length?typeof e[0]=="number"&&(e.length===1||e.length===2&&typeof e[1]!="number")?this.setTime(e[0]):typeof e[0]=="string"?this.setTime(+new Date(e[0])):e[0]instanceof Date?this.setTime(+e[0]):(this.setTime(+new Date(...e)),PV(this),Tk(this)):this.setTime(Date.now())}static tz(e,...n){return n.length?new sl(...n,e):new sl(Date.now(),e)}withTimeZone(e){return new sl(+this,e)}getTimezoneOffset(){const e=-vu(this.timeZone,this);return e>0?Math.floor(e):Math.ceil(e)}setTime(e){return Date.prototype.setTime.apply(this,arguments),Tk(this),+this}[Symbol.for("constructDateFrom")](e){return new sl(+new Date(e),this.timeZone)}}const nD=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!nD.test(t))return;const e=t.replace(nD,"$1UTC");sl.prototype[e]&&(t.startsWith("get")?sl.prototype[t]=function(){return this.internal[e]()}:(sl.prototype[t]=function(){return Date.prototype[e].apply(this.internal,arguments),GOe(this),+this},sl.prototype[e]=function(){return Date.prototype[e].apply(this,arguments),Tk(this),+this}))});function Tk(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-vu(t.timeZone,t)*60))}function GOe(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),PV(t)}function PV(t){const e=vu(t.timeZone,t),n=e>0?Math.floor(e):Math.ceil(e),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const s=-new Date(+t).getTimezoneOffset(),i=-new Date(+r).getTimezoneOffset(),a=s-i,o=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();a&&o&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+a);const c=s-n;c&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+c);const h=new Date(+t);h.setUTCSeconds(0);const f=s>0?h.getSeconds():(h.getSeconds()-60)%60,m=Math.round(-(vu(t.timeZone,t)*60))%60;(m||f)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+f));const g=vu(t.timeZone,t),x=g>0?Math.floor(g):Math.ceil(g),w=-new Date(+t).getTimezoneOffset()-x,S=x!==n,k=w-c;if(S&&k){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+k);const N=vu(t.timeZone,t),C=N>0?Math.floor(N):Math.ceil(N),T=x-C;T&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+T),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+T))}}class vs extends sl{static tz(e,...n){return n.length?new vs(...n,e):new vs(Date.now(),e)}toISOString(){const[e,n,r]=this.tzComponents(),s=`${e}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[e,n,r,s]=this.internal.toUTCString().split(" ");return`${e?.slice(0,-1)} ${r} ${n} ${s}`}toTimeString(){const e=this.internal.toUTCString().split(" ")[4],[n,r,s]=this.tzComponents();return`${e} GMT${n}${r}${s} (${VOe(this.timeZone,this)})`}toLocaleString(e,n){return Date.prototype.toLocaleString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleDateString(e,n){return Date.prototype.toLocaleDateString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}toLocaleTimeString(e,n){return Date.prototype.toLocaleTimeString.call(this,e,{...n,timeZone:n?.timeZone||this.timeZone})}tzComponents(){const e=this.getTimezoneOffset(),n=e>0?"-":"+",r=String(Math.floor(Math.abs(e)/60)).padStart(2,"0"),s=String(Math.abs(e)%60).padStart(2,"0");return[n,r,s]}withTimeZone(e){return new vs(+this,e)}[Symbol.for("constructDateFrom")](e){return new vs(+new Date(e),this.timeZone)}}const LV=6048e5,XOe=864e5,rD=Symbol.for("constructDateFrom");function Br(t,e){return typeof t=="function"?t(e):t&&typeof t=="object"&&rD in t?t[rD](e):t instanceof Date?new t.constructor(e):new Date(e)}function qn(t,e){return Br(e||t,t)}function IV(t,e,n){const r=qn(t,n?.in);return isNaN(e)?Br(t,NaN):(e&&r.setDate(r.getDate()+e),r)}function BV(t,e,n){const r=qn(t,n?.in);if(isNaN(e))return Br(t,NaN);if(!e)return r;const s=r.getDate(),i=Br(t,r.getTime());i.setMonth(r.getMonth()+e+1,0);const a=i.getDate();return s>=a?i:(r.setFullYear(i.getFullYear(),i.getMonth(),s),r)}let YOe={};function pp(){return YOe}function Tc(t,e){const n=pp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=qn(t,e?.in),i=s.getDay(),a=(i=i.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function sD(t){const e=qn(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function Vu(t,...e){const n=Br.bind(null,t||e.find(r=>typeof r=="object"));return e.map(n)}function C0(t,e){const n=qn(t,e?.in);return n.setHours(0,0,0,0),n}function FV(t,e,n){const[r,s]=Vu(n?.in,t,e),i=C0(r),a=C0(s),o=+i-sD(i),c=+a-sD(a);return Math.round((o-c)/XOe)}function KOe(t,e){const n=qV(t,e),r=Br(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),N0(r)}function ZOe(t,e,n){return IV(t,e*7,n)}function JOe(t,e,n){return BV(t,e*12,n)}function eje(t,e){let n,r=e?.in;return t.forEach(s=>{!r&&typeof s=="object"&&(r=Br.bind(null,s));const i=qn(s,r);(!n||n{!r&&typeof s=="object"&&(r=Br.bind(null,s));const i=qn(s,r);(!n||n>i||isNaN(+i))&&(n=i)}),Br(r,n||NaN)}function nje(t,e,n){const[r,s]=Vu(n?.in,t,e);return+C0(r)==+C0(s)}function $V(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function rje(t){return!(!$V(t)&&typeof t!="number"||isNaN(+qn(t)))}function sje(t,e,n){const[r,s]=Vu(n?.in,t,e),i=r.getFullYear()-s.getFullYear(),a=r.getMonth()-s.getMonth();return i*12+a}function ije(t,e){const n=qn(t,e?.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function QV(t,e){const[n,r]=Vu(t,e.start,e.end);return{start:n,end:r}}function aje(t,e){const{start:n,end:r}=QV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setDate(1);let o=1;const c=[];for(;+a<=i;)c.push(Br(n,a)),a.setMonth(a.getMonth()+o);return s?c.reverse():c}function lje(t,e){const n=qn(t,e?.in);return n.setDate(1),n.setHours(0,0,0,0),n}function oje(t,e){const n=qn(t,e?.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function HV(t,e){const n=qn(t,e?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function cje(t,e){const{start:n,end:r}=QV(e?.in,t);let s=+n>+r;const i=s?+n:+r,a=s?r:n;a.setHours(0,0,0,0),a.setMonth(0,1);let o=1;const c=[];for(;+a<=i;)c.push(Br(n,a)),a.setFullYear(a.getFullYear()+o);return s?c.reverse():c}function VV(t,e){const n=pp(),r=e?.weekStartsOn??e?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,s=qn(t,e?.in),i=s.getDay(),a=(i{let r;const s=dje[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function dh(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const fje={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},mje={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},pje={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gje={date:dh({formats:fje,defaultWidth:"full"}),time:dh({formats:mje,defaultWidth:"full"}),dateTime:dh({formats:pje,defaultWidth:"full"})},xje={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},vje=(t,e,n,r)=>xje[t];function Ka(t){return(e,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const a=t.defaultFormattingWidth||t.defaultWidth,o=n?.width?String(n.width):a;s=t.formattingValues[o]||t.formattingValues[a]}else{const a=t.defaultWidth,o=n?.width?String(n.width):t.defaultWidth;s=t.values[o]||t.values[a]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const yje={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},bje={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wje={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Sje={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},kje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Oje={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},jje=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Nje={ordinalNumber:jje,era:Ka({values:yje,defaultWidth:"wide"}),quarter:Ka({values:bje,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ka({values:wje,defaultWidth:"wide"}),day:Ka({values:Sje,defaultWidth:"wide"}),dayPeriod:Ka({values:kje,defaultWidth:"wide",formattingValues:Oje,defaultFormattingWidth:"wide"})};function Za(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const a=i[0],o=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(o)?Tje(o,m=>m.test(a)):Cje(o,m=>m.test(a));let h;h=t.valueCallback?t.valueCallback(c):c,h=n.valueCallback?n.valueCallback(h):h;const f=e.slice(a.length);return{value:h,rest:f}}}function Cje(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function Tje(t,e){for(let n=0;n{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let a=t.valueCallback?t.valueCallback(i[0]):i[0];a=n.valueCallback?n.valueCallback(a):a;const o=e.slice(s.length);return{value:a,rest:o}}}const Eje=/^(\d+)(th|st|nd|rd)?/i,_je=/\d+/i,Mje={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Aje={any:[/^b/i,/^(a|c)/i]},Rje={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Dje={any:[/1/i,/2/i,/3/i,/4/i]},zje={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Pje={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Lje={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ije={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Bje={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},qje={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Fje={ordinalNumber:UV({matchPattern:Eje,parsePattern:_je,valueCallback:t=>parseInt(t,10)}),era:Za({matchPatterns:Mje,defaultMatchWidth:"wide",parsePatterns:Aje,defaultParseWidth:"any"}),quarter:Za({matchPatterns:Rje,defaultMatchWidth:"wide",parsePatterns:Dje,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Za({matchPatterns:zje,defaultMatchWidth:"wide",parsePatterns:Pje,defaultParseWidth:"any"}),day:Za({matchPatterns:Lje,defaultMatchWidth:"wide",parsePatterns:Ije,defaultParseWidth:"any"}),dayPeriod:Za({matchPatterns:Bje,defaultMatchWidth:"any",parsePatterns:qje,defaultParseWidth:"any"})},Tj={code:"en-US",formatDistance:hje,formatLong:gje,formatRelative:vje,localize:Nje,match:Fje,options:{weekStartsOn:0,firstWeekContainsDate:1}};function $je(t,e){const n=qn(t,e?.in);return FV(n,HV(n))+1}function WV(t,e){const n=qn(t,e?.in),r=+N0(n)-+KOe(n);return Math.round(r/LV)+1}function GV(t,e){const n=qn(t,e?.in),r=n.getFullYear(),s=pp(),i=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,a=Br(e?.in||t,0);a.setFullYear(r+1,0,i),a.setHours(0,0,0,0);const o=Tc(a,e),c=Br(e?.in||t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const h=Tc(c,e);return+n>=+o?r+1:+n>=+h?r:r-1}function Qje(t,e){const n=pp(),r=e?.firstWeekContainsDate??e?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=GV(t,e),i=Br(e?.in||t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Tc(i,e)}function XV(t,e){const n=qn(t,e?.in),r=+Tc(n,e)-+Qje(n,e);return Math.round(r/LV)+1}function Rn(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const rc={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Rn(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Rn(n+1,2)},d(t,e){return Rn(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Rn(t.getHours()%12||12,e.length)},H(t,e){return Rn(t.getHours(),e.length)},m(t,e){return Rn(t.getMinutes(),e.length)},s(t,e){return Rn(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Rn(s,e.length)}},zd={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iD={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return rc.y(t,e)},Y:function(t,e,n,r){const s=GV(t,r),i=s>0?s:1-s;if(e==="YY"){const a=i%100;return Rn(a,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Rn(i,e.length)},R:function(t,e){const n=qV(t);return Rn(n,e.length)},u:function(t,e){const n=t.getFullYear();return Rn(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Rn(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Rn(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return rc.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Rn(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=XV(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Rn(s,e.length)},I:function(t,e,n){const r=WV(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Rn(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):rc.d(t,e)},D:function(t,e,n){const r=$je(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Rn(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Rn(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Rn(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Rn(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=zd.noon:r===0?s=zd.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=zd.evening:r>=12?s=zd.afternoon:r>=4?s=zd.morning:s=zd.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return rc.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):rc.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Rn(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Rn(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):rc.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):rc.s(t,e)},S:function(t,e){return rc.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return lD(r);case"XXXX":case"XX":return cu(r);case"XXXXX":case"XXX":default:return cu(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return lD(r);case"xxxx":case"xx":return cu(r);case"xxxxx":case"xxx":default:return cu(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+aD(r,":");case"OOOO":default:return"GMT"+cu(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+aD(r,":");case"zzzz":default:return"GMT"+cu(r,":")}},t:function(t,e,n){const r=Math.trunc(+t/1e3);return Rn(r,e.length)},T:function(t,e,n){return Rn(+t,e.length)}};function aD(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Rn(i,2)}function lD(t,e){return t%60===0?(t>0?"-":"+")+Rn(Math.abs(t)/60,2):cu(t,e)}function cu(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Rn(Math.trunc(r/60),2),i=Rn(r%60,2);return n+s+e+i}const oD=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},YV=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Hje=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return oD(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",oD(r,e)).replace("{{time}}",YV(s,e))},Vje={p:YV,P:Hje},Uje=/^D+$/,Wje=/^Y+$/,Gje=["D","DD","YY","YYYY"];function Xje(t){return Uje.test(t)}function Yje(t){return Wje.test(t)}function Kje(t,e,n){const r=Zje(t,e,n);if(console.warn(r),Gje.includes(t))throw new RangeError(r)}function Zje(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Jje=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,eNe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,tNe=/^'([^]*?)'?$/,nNe=/''/g,rNe=/[a-zA-Z]/;function S1(t,e,n){const r=pp(),s=n?.locale??r.locale??Tj,i=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=qn(t,n?.in);if(!rje(o))throw new RangeError("Invalid time value");let c=e.match(eNe).map(f=>{const m=f[0];if(m==="p"||m==="P"){const g=Vje[m];return g(f,s.formatLong)}return f}).join("").match(Jje).map(f=>{if(f==="''")return{isToken:!1,value:"'"};const m=f[0];if(m==="'")return{isToken:!1,value:sNe(f)};if(iD[m])return{isToken:!0,value:f};if(m.match(rNe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+m+"`");return{isToken:!1,value:f}});s.localize.preprocessor&&(c=s.localize.preprocessor(o,c));const h={firstWeekContainsDate:i,weekStartsOn:a,locale:s};return c.map(f=>{if(!f.isToken)return f.value;const m=f.value;(!n?.useAdditionalWeekYearTokens&&Yje(m)||!n?.useAdditionalDayOfYearTokens&&Xje(m))&&Kje(m,e,String(t));const g=iD[m[0]];return g(o,m,s.localize,h)}).join("")}function sNe(t){const e=t.match(tNe);return e?e[1].replace(nNe,"'"):t}function iNe(t,e){const n=qn(t,e?.in),r=n.getFullYear(),s=n.getMonth(),i=Br(n,0);return i.setFullYear(r,s+1,0),i.setHours(0,0,0,0),i.getDate()}function aNe(t,e){return qn(t,e?.in).getMonth()}function lNe(t,e){return qn(t,e?.in).getFullYear()}function oNe(t,e){return+qn(t)>+qn(e)}function cNe(t,e){return+qn(t)<+qn(e)}function uNe(t,e,n){const[r,s]=Vu(n?.in,t,e);return+Tc(r,n)==+Tc(s,n)}function dNe(t,e,n){const[r,s]=Vu(n?.in,t,e);return r.getFullYear()===s.getFullYear()&&r.getMonth()===s.getMonth()}function hNe(t,e,n){const[r,s]=Vu(n?.in,t,e);return r.getFullYear()===s.getFullYear()}function fNe(t,e,n){const r=qn(t,n?.in),s=r.getFullYear(),i=r.getDate(),a=Br(t,0);a.setFullYear(s,e,15),a.setHours(0,0,0,0);const o=iNe(a);return r.setMonth(e,Math.min(i,o)),r}function mNe(t,e,n){const r=qn(t,n?.in);return isNaN(+r)?Br(t,NaN):(r.setFullYear(e),r)}const cD=5,pNe=4;function gNe(t,e){const n=e.startOfMonth(t),r=n.getDay()>0?n.getDay():7,s=e.addDays(t,-r+1),i=e.addDays(s,cD*7-1);return e.getMonth(t)===e.getMonth(i)?cD:pNe}function KV(t,e){const n=e.startOfMonth(t),r=n.getDay();return r===1?n:r===0?e.addDays(n,-6):e.addDays(n,-1*(r-1))}function xNe(t,e){const n=KV(t,e),r=gNe(t,e);return e.addDays(n,r*7-1)}class Di{constructor(e,n){this.Date=Date,this.today=()=>this.overrides?.today?this.overrides.today():this.options.timeZone?vs.tz(this.options.timeZone):new this.Date,this.newDate=(r,s,i)=>this.overrides?.newDate?this.overrides.newDate(r,s,i):this.options.timeZone?new vs(r,s,i,this.options.timeZone):new Date(r,s,i),this.addDays=(r,s)=>this.overrides?.addDays?this.overrides.addDays(r,s):IV(r,s),this.addMonths=(r,s)=>this.overrides?.addMonths?this.overrides.addMonths(r,s):BV(r,s),this.addWeeks=(r,s)=>this.overrides?.addWeeks?this.overrides.addWeeks(r,s):ZOe(r,s),this.addYears=(r,s)=>this.overrides?.addYears?this.overrides.addYears(r,s):JOe(r,s),this.differenceInCalendarDays=(r,s)=>this.overrides?.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,s):FV(r,s),this.differenceInCalendarMonths=(r,s)=>this.overrides?.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,s):sje(r,s),this.eachMonthOfInterval=r=>this.overrides?.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):aje(r),this.eachYearOfInterval=r=>{const s=this.overrides?.eachYearOfInterval?this.overrides.eachYearOfInterval(r):cje(r),i=new Set(s.map(o=>this.getYear(o)));if(i.size===s.length)return s;const a=[];return i.forEach(o=>{a.push(new Date(o,0,1))}),a},this.endOfBroadcastWeek=r=>this.overrides?.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):xNe(r,this),this.endOfISOWeek=r=>this.overrides?.endOfISOWeek?this.overrides.endOfISOWeek(r):uje(r),this.endOfMonth=r=>this.overrides?.endOfMonth?this.overrides.endOfMonth(r):ije(r),this.endOfWeek=(r,s)=>this.overrides?.endOfWeek?this.overrides.endOfWeek(r,s):VV(r,this.options),this.endOfYear=r=>this.overrides?.endOfYear?this.overrides.endOfYear(r):oje(r),this.format=(r,s,i)=>{const a=this.overrides?.format?this.overrides.format(r,s,this.options):S1(r,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(a):a},this.getISOWeek=r=>this.overrides?.getISOWeek?this.overrides.getISOWeek(r):WV(r),this.getMonth=(r,s)=>this.overrides?.getMonth?this.overrides.getMonth(r,this.options):aNe(r,this.options),this.getYear=(r,s)=>this.overrides?.getYear?this.overrides.getYear(r,this.options):lNe(r,this.options),this.getWeek=(r,s)=>this.overrides?.getWeek?this.overrides.getWeek(r,this.options):XV(r,this.options),this.isAfter=(r,s)=>this.overrides?.isAfter?this.overrides.isAfter(r,s):oNe(r,s),this.isBefore=(r,s)=>this.overrides?.isBefore?this.overrides.isBefore(r,s):cNe(r,s),this.isDate=r=>this.overrides?.isDate?this.overrides.isDate(r):$V(r),this.isSameDay=(r,s)=>this.overrides?.isSameDay?this.overrides.isSameDay(r,s):nje(r,s),this.isSameMonth=(r,s)=>this.overrides?.isSameMonth?this.overrides.isSameMonth(r,s):dNe(r,s),this.isSameYear=(r,s)=>this.overrides?.isSameYear?this.overrides.isSameYear(r,s):hNe(r,s),this.max=r=>this.overrides?.max?this.overrides.max(r):eje(r),this.min=r=>this.overrides?.min?this.overrides.min(r):tje(r),this.setMonth=(r,s)=>this.overrides?.setMonth?this.overrides.setMonth(r,s):fNe(r,s),this.setYear=(r,s)=>this.overrides?.setYear?this.overrides.setYear(r,s):mNe(r,s),this.startOfBroadcastWeek=(r,s)=>this.overrides?.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):KV(r,this),this.startOfDay=r=>this.overrides?.startOfDay?this.overrides.startOfDay(r):C0(r),this.startOfISOWeek=r=>this.overrides?.startOfISOWeek?this.overrides.startOfISOWeek(r):N0(r),this.startOfMonth=r=>this.overrides?.startOfMonth?this.overrides.startOfMonth(r):lje(r),this.startOfWeek=(r,s)=>this.overrides?.startOfWeek?this.overrides.startOfWeek(r,this.options):Tc(r,this.options),this.startOfYear=r=>this.overrides?.startOfYear?this.overrides.startOfYear(r):HV(r),this.options={locale:Tj,...e},this.overrides=n}getDigitMap(){const{numerals:e="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:e}),r={};for(let s=0;s<10;s++)r[s.toString()]=n.format(s);return r}replaceDigits(e){const n=this.getDigitMap();return e.replace(/\d/g,r=>n[r]||r)}formatNumber(e){return this.replaceDigits(e.toString())}getMonthYearOrder(){const e=this.options.locale?.code;return e&&Di.yearFirstLocales.has(e)?"year-first":"month-first"}formatMonthYear(e){const{locale:n,timeZone:r,numerals:s}=this.options,i=n?.code;if(i&&Di.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:r,numberingSystem:s}).format(e)}catch{}const a=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(e,a)}}Di.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const bl=new Di;class ZV{constructor(e,n,r=bl){this.date=e,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(e,n)),this.dateLib=r}isEqualTo(e){return this.dateLib.isSameDay(e.date,this.date)&&this.dateLib.isSameMonth(e.displayMonth,this.displayMonth)}}class vNe{constructor(e,n){this.date=e,this.weeks=n}}class yNe{constructor(e,n){this.days=n,this.weekNumber=e}}function bNe(t){return he.createElement("button",{...t})}function wNe(t){return he.createElement("span",{...t})}function SNe(t){const{size:e=24,orientation:n="left",className:r}=t;return he.createElement("svg",{className:r,width:e,height:e,viewBox:"0 0 24 24"},n==="up"&&he.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&he.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&he.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&he.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function kNe(t){const{day:e,modifiers:n,...r}=t;return he.createElement("td",{...r})}function ONe(t){const{day:e,modifiers:n,...r}=t,s=he.useRef(null);return he.useEffect(()=>{n.focused&&s.current?.focus()},[n.focused]),he.createElement("button",{ref:s,...r})}var gt;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(gt||(gt={}));var ur;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(ur||(ur={}));var ka;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ka||(ka={}));var Ni;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(Ni||(Ni={}));function jNe(t){const{options:e,className:n,components:r,classNames:s,...i}=t,a=[s[gt.Dropdown],n].join(" "),o=e?.find(({value:c})=>c===i.value);return he.createElement("span",{"data-disabled":i.disabled,className:s[gt.DropdownRoot]},he.createElement(r.Select,{className:a,...i},e?.map(({value:c,label:h,disabled:f})=>he.createElement(r.Option,{key:c,value:c,disabled:f},h))),he.createElement("span",{className:s[gt.CaptionLabel],"aria-hidden":!0},o?.label,he.createElement(r.Chevron,{orientation:"down",size:18,className:s[gt.Chevron]})))}function NNe(t){return he.createElement("div",{...t})}function CNe(t){return he.createElement("div",{...t})}function TNe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r},t.children)}function ENe(t){const{calendarMonth:e,displayIndex:n,...r}=t;return he.createElement("div",{...r})}function _Ne(t){return he.createElement("table",{...t})}function MNe(t){return he.createElement("div",{...t})}const JV=b.createContext(void 0);function gp(){const t=b.useContext(JV);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function ANe(t){const{components:e}=gp();return he.createElement(e.Dropdown,{...t})}function RNe(t){const{onPreviousClick:e,onNextClick:n,previousMonth:r,nextMonth:s,...i}=t,{components:a,classNames:o,labels:{labelPrevious:c,labelNext:h}}=gp(),f=b.useCallback(g=>{s&&n?.(g)},[s,n]),m=b.useCallback(g=>{r&&e?.(g)},[r,e]);return he.createElement("nav",{...i},he.createElement(a.PreviousMonthButton,{type:"button",className:o[gt.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":c(r),onClick:m},he.createElement(a.Chevron,{disabled:r?void 0:!0,className:o[gt.Chevron],orientation:"left"})),he.createElement(a.NextMonthButton,{type:"button",className:o[gt.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":h(s),onClick:f},he.createElement(a.Chevron,{disabled:s?void 0:!0,orientation:"right",className:o[gt.Chevron]})))}function DNe(t){const{components:e}=gp();return he.createElement(e.Button,{...t})}function zNe(t){return he.createElement("option",{...t})}function PNe(t){const{components:e}=gp();return he.createElement(e.Button,{...t})}function LNe(t){const{rootRef:e,...n}=t;return he.createElement("div",{...n,ref:e})}function INe(t){return he.createElement("select",{...t})}function BNe(t){const{week:e,...n}=t;return he.createElement("tr",{...n})}function qNe(t){return he.createElement("th",{...t})}function FNe(t){return he.createElement("thead",{"aria-hidden":!0},he.createElement("tr",{...t}))}function $Ne(t){const{week:e,...n}=t;return he.createElement("th",{...n})}function QNe(t){return he.createElement("th",{...t})}function HNe(t){return he.createElement("tbody",{...t})}function VNe(t){const{components:e}=gp();return he.createElement(e.Dropdown,{...t})}const UNe=Object.freeze(Object.defineProperty({__proto__:null,Button:bNe,CaptionLabel:wNe,Chevron:SNe,Day:kNe,DayButton:ONe,Dropdown:jNe,DropdownNav:NNe,Footer:CNe,Month:TNe,MonthCaption:ENe,MonthGrid:_Ne,Months:MNe,MonthsDropdown:ANe,Nav:RNe,NextMonthButton:DNe,Option:zNe,PreviousMonthButton:PNe,Root:LNe,Select:INe,Week:BNe,WeekNumber:$Ne,WeekNumberHeader:QNe,Weekday:qNe,Weekdays:FNe,Weeks:HNe,YearsDropdown:VNe},Symbol.toStringTag,{value:"Module"}));function no(t,e,n=!1,r=bl){let{from:s,to:i}=t;const{differenceInCalendarDays:a,isSameDay:o}=r;return s&&i?(a(i,s)<0&&([s,i]=[i,s]),a(e,s)>=(n?1:0)&&a(i,e)>=(n?1:0)):!n&&i?o(i,e):!n&&s?o(s,e):!1}function eU(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Ej(t){return!!(t&&typeof t=="object"&&"from"in t)}function tU(t){return!!(t&&typeof t=="object"&&"after"in t)}function nU(t){return!!(t&&typeof t=="object"&&"before"in t)}function rU(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function sU(t,e){return Array.isArray(t)&&t.every(e.isDate)}function ro(t,e,n=bl){const r=Array.isArray(e)?e:[e],{isSameDay:s,differenceInCalendarDays:i,isAfter:a}=n;return r.some(o=>{if(typeof o=="boolean")return o;if(n.isDate(o))return s(t,o);if(sU(o,n))return o.includes(t);if(Ej(o))return no(o,t,!1,n);if(rU(o))return Array.isArray(o.dayOfWeek)?o.dayOfWeek.includes(t.getDay()):o.dayOfWeek===t.getDay();if(eU(o)){const c=i(o.before,t),h=i(o.after,t),f=c>0,m=h<0;return a(o.before,o.after)?m&&f:f||m}return tU(o)?i(t,o.after)>0:nU(o)?i(o.before,t)>0:typeof o=="function"?o(t):!1})}function WNe(t,e,n,r,s){const{disabled:i,hidden:a,modifiers:o,showOutsideDays:c,broadcastCalendar:h,today:f}=e,{isSameDay:m,isSameMonth:g,startOfMonth:x,isBefore:y,endOfMonth:w,isAfter:S}=s,k=n&&x(n),N=r&&w(r),C={[ur.focused]:[],[ur.outside]:[],[ur.disabled]:[],[ur.hidden]:[],[ur.today]:[]},T={};for(const _ of t){const{date:E,displayMonth:M}=_,q=!!(M&&!g(E,M)),L=!!(k&&y(E,k)),I=!!(N&&S(E,N)),$=!!(i&&ro(E,i,s)),V=!!(a&&ro(E,a,s))||L||I||!h&&!c&&q||h&&c===!1&&q,ee=m(E,f??s.today());q&&C.outside.push(_),$&&C.disabled.push(_),V&&C.hidden.push(_),ee&&C.today.push(_),o&&Object.keys(o).forEach(z=>{const H=o?.[z];H&&ro(E,H,s)&&(T[z]?T[z].push(_):T[z]=[_])})}return _=>{const E={[ur.focused]:!1,[ur.disabled]:!1,[ur.hidden]:!1,[ur.outside]:!1,[ur.today]:!1},M={};for(const q in C){const L=C[q];E[q]=L.some(I=>I===_)}for(const q in T)M[q]=T[q].some(L=>L===_);return{...E,...M}}}function GNe(t,e,n={}){return Object.entries(t).filter(([,s])=>s===!0).reduce((s,[i])=>(n[i]?s.push(n[i]):e[ur[i]]?s.push(e[ur[i]]):e[ka[i]]&&s.push(e[ka[i]]),s),[e[gt.Day]])}function XNe(t){return{...UNe,...t}}function YNe(t){const e={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(e[n]=r)}),e}function _j(){const t={};for(const e in gt)t[gt[e]]=`rdp-${gt[e]}`;for(const e in ur)t[ur[e]]=`rdp-${ur[e]}`;for(const e in ka)t[ka[e]]=`rdp-${ka[e]}`;for(const e in Ni)t[Ni[e]]=`rdp-${Ni[e]}`;return t}function iU(t,e,n){return(n??new Di(e)).formatMonthYear(t)}const KNe=iU;function ZNe(t,e,n){return(n??new Di(e)).format(t,"d")}function JNe(t,e=bl){return e.format(t,"LLLL")}function e7e(t,e,n){return(n??new Di(e)).format(t,"cccccc")}function t7e(t,e=bl){return t<10?e.formatNumber(`0${t.toLocaleString()}`):e.formatNumber(`${t.toLocaleString()}`)}function n7e(){return""}function aU(t,e=bl){return e.format(t,"yyyy")}const r7e=aU,s7e=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:iU,formatDay:ZNe,formatMonthCaption:KNe,formatMonthDropdown:JNe,formatWeekNumber:t7e,formatWeekNumberHeader:n7e,formatWeekdayName:e7e,formatYearCaption:r7e,formatYearDropdown:aU},Symbol.toStringTag,{value:"Module"}));function i7e(t){return t?.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t?.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...s7e,...t}}function a7e(t,e,n,r,s){const{startOfMonth:i,startOfYear:a,endOfYear:o,eachMonthOfInterval:c,getMonth:h}=s;return c({start:a(t),end:o(t)}).map(g=>{const x=r.formatMonthDropdown(g,s),y=h(g),w=e&&gi(n)||!1;return{value:y,label:x,disabled:w}})}function l7e(t,e={},n={}){let r={...e?.[gt.Day]};return Object.entries(t).filter(([,s])=>s===!0).forEach(([s])=>{r={...r,...n?.[s]}}),r}function o7e(t,e,n){const r=t.today(),s=e?t.startOfISOWeek(r):t.startOfWeek(r),i=[];for(let a=0;a<7;a++){const o=t.addDays(s,a);i.push(o)}return i}function c7e(t,e,n,r,s=!1){if(!t||!e)return;const{startOfYear:i,endOfYear:a,eachYearOfInterval:o,getYear:c}=r,h=i(t),f=a(e),m=o({start:h,end:f});return s&&m.reverse(),m.map(g=>{const x=n.formatYearDropdown(g,r);return{value:c(g),label:x,disabled:!1}})}function lU(t,e,n,r){let s=(r??new Di(n)).format(t,"PPPP");return e.today&&(s=`Today, ${s}`),e.selected&&(s=`${s}, selected`),s}const u7e=lU;function oU(t,e,n){return(n??new Di(e)).formatMonthYear(t)}const d7e=oU;function h7e(t,e,n,r){let s=(r??new Di(n)).format(t,"PPPP");return e?.today&&(s=`Today, ${s}`),s}function f7e(t){return"Choose the Month"}function m7e(){return""}function p7e(t){return"Go to the Next Month"}function g7e(t){return"Go to the Previous Month"}function x7e(t,e,n){return(n??new Di(e)).format(t,"cccc")}function v7e(t,e){return`Week ${t}`}function y7e(t){return"Week Number"}function b7e(t){return"Choose the Year"}const w7e=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:d7e,labelDay:u7e,labelDayButton:lU,labelGrid:oU,labelGridcell:h7e,labelMonthDropdown:f7e,labelNav:m7e,labelNext:p7e,labelPrevious:g7e,labelWeekNumber:v7e,labelWeekNumberHeader:y7e,labelWeekday:x7e,labelYearDropdown:b7e},Symbol.toStringTag,{value:"Module"})),xp=t=>t instanceof HTMLElement?t:null,S3=t=>[...t.querySelectorAll("[data-animated-month]")??[]],S7e=t=>xp(t.querySelector("[data-animated-month]")),k3=t=>xp(t.querySelector("[data-animated-caption]")),O3=t=>xp(t.querySelector("[data-animated-weeks]")),k7e=t=>xp(t.querySelector("[data-animated-nav]")),O7e=t=>xp(t.querySelector("[data-animated-weekdays]"));function j7e(t,e,{classNames:n,months:r,focused:s,dateLib:i}){const a=b.useRef(null),o=b.useRef(r),c=b.useRef(!1);b.useLayoutEffect(()=>{const h=o.current;if(o.current=r,!e||!t.current||!(t.current instanceof HTMLElement)||r.length===0||h.length===0||r.length!==h.length)return;const f=i.isSameMonth(r[0].date,h[0].date),m=i.isAfter(r[0].date,h[0].date),g=m?n[Ni.caption_after_enter]:n[Ni.caption_before_enter],x=m?n[Ni.weeks_after_enter]:n[Ni.weeks_before_enter],y=a.current,w=t.current.cloneNode(!0);if(w instanceof HTMLElement?(S3(w).forEach(C=>{if(!(C instanceof HTMLElement))return;const T=S7e(C);T&&C.contains(T)&&C.removeChild(T);const _=k3(C);_&&_.classList.remove(g);const E=O3(C);E&&E.classList.remove(x)}),a.current=w):a.current=null,c.current||f||s)return;const S=y instanceof HTMLElement?S3(y):[],k=S3(t.current);if(k?.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){c.current=!0,t.current.style.isolation="isolate";const N=k7e(t.current);N&&(N.style.zIndex="1"),k.forEach((C,T)=>{const _=S[T];if(!_)return;C.style.position="relative",C.style.overflow="hidden";const E=k3(C);E&&E.classList.add(g);const M=O3(C);M&&M.classList.add(x);const q=()=>{c.current=!1,t.current&&(t.current.style.isolation=""),N&&(N.style.zIndex=""),E&&E.classList.remove(g),M&&M.classList.remove(x),C.style.position="",C.style.overflow="",C.contains(_)&&C.removeChild(_)};_.style.pointerEvents="none",_.style.position="absolute",_.style.overflow="hidden",_.setAttribute("aria-hidden","true");const L=O7e(_);L&&(L.style.opacity="0");const I=k3(_);I&&(I.classList.add(m?n[Ni.caption_before_exit]:n[Ni.caption_after_exit]),I.addEventListener("animationend",q));const $=O3(_);$&&$.classList.add(m?n[Ni.weeks_before_exit]:n[Ni.weeks_after_exit]),C.insertBefore(_,C.firstChild)})}})}function N7e(t,e,n,r){const s=t[0],i=t[t.length-1],{ISOWeek:a,fixedWeeks:o,broadcastCalendar:c}=n??{},{addDays:h,differenceInCalendarDays:f,differenceInCalendarMonths:m,endOfBroadcastWeek:g,endOfISOWeek:x,endOfMonth:y,endOfWeek:w,isAfter:S,startOfBroadcastWeek:k,startOfISOWeek:N,startOfWeek:C}=r,T=c?k(s,r):a?N(s):C(s),_=c?g(i):a?x(y(i)):w(y(i)),E=f(_,T),M=m(i,s)+1,q=[];for(let $=0;$<=E;$++){const V=h(T,$);if(e&&S(V,e))break;q.push(V)}const I=(c?35:42)*M;if(o&&q.length{const s=r.weeks.reduce((i,a)=>i.concat(a.days.slice()),e.slice());return n.concat(s.slice())},e.slice())}function T7e(t,e,n,r){const{numberOfMonths:s=1}=n,i=[];for(let a=0;ae)break;i.push(o)}return i}function uD(t,e,n,r){const{month:s,defaultMonth:i,today:a=r.today(),numberOfMonths:o=1}=t;let c=s||i||a;const{differenceInCalendarMonths:h,addMonths:f,startOfMonth:m}=r;if(n&&h(n,c){const k=n.broadcastCalendar?m(S,r):n.ISOWeek?g(S):x(S),N=n.broadcastCalendar?i(S):n.ISOWeek?a(o(S)):c(o(S)),C=e.filter(M=>M>=k&&M<=N),T=n.broadcastCalendar?35:42;if(n.fixedWeeks&&C.length{const L=T-C.length;return q>N&&q<=s(N,L)});C.push(...M)}const _=C.reduce((M,q)=>{const L=n.ISOWeek?h(q):f(q),I=M.find(V=>V.weekNumber===L),$=new ZV(q,S,r);return I?I.days.push($):M.push(new yNe(L,[$])),M},[]),E=new vNe(S,_);return w.push(E),w},[]);return n.reverseMonths?y.reverse():y}function _7e(t,e){let{startMonth:n,endMonth:r}=t;const{startOfYear:s,startOfDay:i,startOfMonth:a,endOfMonth:o,addYears:c,endOfYear:h,newDate:f,today:m}=e,{fromYear:g,toYear:x,fromMonth:y,toMonth:w}=t;!n&&y&&(n=y),!n&&g&&(n=e.newDate(g,0,1)),!r&&w&&(r=w),!r&&x&&(r=f(x,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=a(n):g?n=f(g,0,1):!n&&S&&(n=s(c(t.today??m(),-100))),r?r=o(r):x?r=f(x,11,31):!r&&S&&(r=h(t.today??m())),[n&&i(n),r&&i(r)]}function M7e(t,e,n,r){if(n.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=n,{startOfMonth:a,addMonths:o,differenceInCalendarMonths:c}=r,h=s?i:1,f=a(t);if(!e)return o(f,h);if(!(c(e,t)n.concat(r.weeks.slice()),e.slice())}function Dy(t,e){const[n,r]=b.useState(t);return[e===void 0?n:e,r]}function D7e(t,e){const[n,r]=_7e(t,e),{startOfMonth:s,endOfMonth:i}=e,a=uD(t,n,r,e),[o,c]=Dy(a,t.month?a:void 0);b.useEffect(()=>{const E=uD(t,n,r,e);c(E)},[t.timeZone]);const h=T7e(o,r,t,e),f=N7e(h,t.endMonth?i(t.endMonth):void 0,t,e),m=E7e(h,f,t,e),g=R7e(m),x=C7e(m),y=A7e(o,n,t,e),w=M7e(o,r,t,e),{disableNavigation:S,onMonthChange:k}=t,N=E=>g.some(M=>M.days.some(q=>q.isEqualTo(E))),C=E=>{if(S)return;let M=s(E);n&&Ms(r)&&(M=s(r)),c(M),k?.(M)};return{months:m,weeks:g,days:x,navStart:n,navEnd:r,previousMonth:y,nextMonth:w,goToMonth:C,goToDay:E=>{N(E)||C(E.date)}}}var Wa;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(Wa||(Wa={}));function dD(t){return!t[ur.disabled]&&!t[ur.hidden]&&!t[ur.outside]}function z7e(t,e,n,r){let s,i=-1;for(const a of t){const o=e(a);dD(o)&&(o[ur.focused]&&idD(e(a)))),s}function P7e(t,e,n,r,s,i,a){const{ISOWeek:o,broadcastCalendar:c}=i,{addDays:h,addMonths:f,addWeeks:m,addYears:g,endOfBroadcastWeek:x,endOfISOWeek:y,endOfWeek:w,max:S,min:k,startOfBroadcastWeek:N,startOfISOWeek:C,startOfWeek:T}=a;let E={day:h,week:m,month:f,year:g,startOfWeek:M=>c?N(M,a):o?C(M):T(M),endOfWeek:M=>c?x(M):o?y(M):w(M)}[t](n,e==="after"?1:-1);return e==="before"&&r?E=S([r,E]):e==="after"&&s&&(E=k([s,E])),E}function cU(t,e,n,r,s,i,a,o=0){if(o>365)return;const c=P7e(t,e,n.date,r,s,i,a),h=!!(i.disabled&&ro(c,i.disabled,a)),f=!!(i.hidden&&ro(c,i.hidden,a)),m=c,g=new ZV(c,m,a);return!h&&!f?g:cU(t,e,g,r,s,i,a,o+1)}function L7e(t,e,n,r,s){const{autoFocus:i}=t,[a,o]=b.useState(),c=z7e(e.days,n,r||(()=>!1),a),[h,f]=b.useState(i?c:void 0);return{isFocusTarget:w=>!!c?.isEqualTo(w),setFocused:f,focused:h,blur:()=>{o(h),f(void 0)},moveFocus:(w,S)=>{if(!h)return;const k=cU(w,S,h,e.navStart,e.navEnd,t,s);k&&(t.disableNavigation&&!e.days.some(C=>C.isEqualTo(k))||(e.goToDay(k),f(k)))}}}function I7e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Dy(n,s?n:void 0),o=s?n:i,{isSameDay:c}=e,h=x=>o?.some(y=>c(y,x))??!1,{min:f,max:m}=t;return{selected:o,select:(x,y,w)=>{let S=[...o??[]];if(h(x)){if(o?.length===f||r&&o?.length===1)return;S=o?.filter(k=>!c(k,x))}else o?.length===m?S=[x]:S=[...S,x];return s||a(S),s?.(S,x,y,w),S},isSelected:h}}function B7e(t,e,n=0,r=0,s=!1,i=bl){const{from:a,to:o}=e||{},{isSameDay:c,isAfter:h,isBefore:f}=i;let m;if(!a&&!o)m={from:t,to:n>0?void 0:t};else if(a&&!o)c(a,t)?n===0?m={from:a,to:t}:s?m={from:a,to:void 0}:m=void 0:f(t,a)?m={from:t,to:a}:m={from:a,to:t};else if(a&&o)if(c(a,t)&&c(o,t))s?m={from:a,to:o}:m=void 0;else if(c(a,t))m={from:a,to:n>0?void 0:t};else if(c(o,t))m={from:t,to:n>0?void 0:t};else if(f(t,a))m={from:t,to:o};else if(h(t,a))m={from:a,to:t};else if(h(t,o))m={from:a,to:t};else throw new Error("Invalid range");if(m?.from&&m?.to){const g=i.differenceInCalendarDays(m.to,m.from);r>0&&g>r?m={from:t,to:void 0}:n>1&&gtypeof o!="function").some(o=>typeof o=="boolean"?o:n.isDate(o)?no(t,o,!1,n):sU(o,n)?o.some(c=>no(t,c,!1,n)):Ej(o)?o.from&&o.to?hD(t,{from:o.from,to:o.to},n):!1:rU(o)?q7e(t,o.dayOfWeek,n):eU(o)?n.isAfter(o.before,o.after)?hD(t,{from:n.addDays(o.after,1),to:n.addDays(o.before,-1)},n):ro(t.from,o,n)||ro(t.to,o,n):tU(o)||nU(o)?ro(t.from,o,n)||ro(t.to,o,n):!1))return!0;const a=r.filter(o=>typeof o=="function");if(a.length){let o=t.from;const c=n.differenceInCalendarDays(t.to,t.from);for(let h=0;h<=c;h++){if(a.some(f=>f(o)))return!0;o=n.addDays(o,1)}}return!1}function $7e(t,e){const{disabled:n,excludeDisabled:r,selected:s,required:i,onSelect:a}=t,[o,c]=Dy(s,a?s:void 0),h=a?s:o;return{selected:h,select:(g,x,y)=>{const{min:w,max:S}=t,k=g?B7e(g,h,w,S,i,e):void 0;return r&&n&&k?.from&&k.to&&F7e({from:k.from,to:k.to},n,e)&&(k.from=g,k.to=void 0),a||c(k),a?.(k,g,x,y),k},isSelected:g=>h&&no(h,g,!1,e)}}function Q7e(t,e){const{selected:n,required:r,onSelect:s}=t,[i,a]=Dy(n,s?n:void 0),o=s?n:i,{isSameDay:c}=e;return{selected:o,select:(m,g,x)=>{let y=m;return!r&&o&&o&&c(m,o)&&(y=void 0),s||a(y),s?.(y,m,g,x),y},isSelected:m=>o?c(o,m):!1}}function H7e(t,e){const n=Q7e(t,e),r=I7e(t,e),s=$7e(t,e);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return s;default:return}}function V7e(t){let e=t;e.timeZone&&(e={...t},e.today&&(e.today=new vs(e.today,e.timeZone)),e.month&&(e.month=new vs(e.month,e.timeZone)),e.defaultMonth&&(e.defaultMonth=new vs(e.defaultMonth,e.timeZone)),e.startMonth&&(e.startMonth=new vs(e.startMonth,e.timeZone)),e.endMonth&&(e.endMonth=new vs(e.endMonth,e.timeZone)),e.mode==="single"&&e.selected?e.selected=new vs(e.selected,e.timeZone):e.mode==="multiple"&&e.selected?e.selected=e.selected?.map(pt=>new vs(pt,e.timeZone)):e.mode==="range"&&e.selected&&(e.selected={from:e.selected.from?new vs(e.selected.from,e.timeZone):void 0,to:e.selected.to?new vs(e.selected.to,e.timeZone):void 0}));const{components:n,formatters:r,labels:s,dateLib:i,locale:a,classNames:o}=b.useMemo(()=>{const pt={...Tj,...e.locale};return{dateLib:new Di({locale:pt,weekStartsOn:e.broadcastCalendar?1:e.weekStartsOn,firstWeekContainsDate:e.firstWeekContainsDate,useAdditionalWeekYearTokens:e.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:e.useAdditionalDayOfYearTokens,timeZone:e.timeZone,numerals:e.numerals},e.dateLib),components:XNe(e.components),formatters:i7e(e.formatters),labels:{...w7e,...e.labels},locale:pt,classNames:{..._j(),...e.classNames}}},[e.locale,e.broadcastCalendar,e.weekStartsOn,e.firstWeekContainsDate,e.useAdditionalWeekYearTokens,e.useAdditionalDayOfYearTokens,e.timeZone,e.numerals,e.dateLib,e.components,e.formatters,e.labels,e.classNames]),{captionLayout:c,mode:h,navLayout:f,numberOfMonths:m=1,onDayBlur:g,onDayClick:x,onDayFocus:y,onDayKeyDown:w,onDayMouseEnter:S,onDayMouseLeave:k,onNextClick:N,onPrevClick:C,showWeekNumber:T,styles:_}=e,{formatCaption:E,formatDay:M,formatMonthDropdown:q,formatWeekNumber:L,formatWeekNumberHeader:I,formatWeekdayName:$,formatYearDropdown:V}=r,ee=D7e(e,i),{days:z,months:H,navStart:P,navEnd:W,previousMonth:J,nextMonth:X,goToMonth:R}=ee,se=WNe(z,e,P,W,i),{isSelected:G,select:F,selected:U}=H7e(e,i)??{},{blur:te,focused:ne,isFocusTarget:Y,moveFocus:ae,setFocused:re}=L7e(e,ee,se,G??(()=>!1),i),{labelDayButton:le,labelGridcell:_e,labelGrid:Ge,labelMonthDropdown:tt,labelNav:Xe,labelPrevious:je,labelNext:Qe,labelWeekday:He,labelWeekNumber:$e,labelWeekNumberHeader:bt,labelYearDropdown:lt}=s,xn=b.useMemo(()=>o7e(i,e.ISOWeek),[i,e.ISOWeek]),_n=h!==void 0||x!==void 0,Cn=b.useCallback(()=>{J&&(R(J),C?.(J))},[J,R,C]),Dt=b.useCallback(()=>{X&&(R(X),N?.(X))},[R,X,N]),xt=b.useCallback((pt,kn)=>vt=>{vt.preventDefault(),vt.stopPropagation(),re(pt),F?.(pt.date,kn,vt),x?.(pt.date,kn,vt)},[F,x,re]),Te=b.useCallback((pt,kn)=>vt=>{re(pt),y?.(pt.date,kn,vt)},[y,re]),Re=b.useCallback((pt,kn)=>vt=>{te(),g?.(pt.date,kn,vt)},[te,g]),qe=b.useCallback((pt,kn)=>vt=>{const Gt={ArrowLeft:[vt.shiftKey?"month":"day",e.dir==="rtl"?"after":"before"],ArrowRight:[vt.shiftKey?"month":"day",e.dir==="rtl"?"before":"after"],ArrowDown:[vt.shiftKey?"year":"week","after"],ArrowUp:[vt.shiftKey?"year":"week","before"],PageUp:[vt.shiftKey?"year":"month","before"],PageDown:[vt.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Gt[vt.key]){vt.preventDefault(),vt.stopPropagation();const[Vt,ot]=Gt[vt.key];ae(Vt,ot)}w?.(pt.date,kn,vt)},[ae,w,e.dir]),rt=b.useCallback((pt,kn)=>vt=>{S?.(pt.date,kn,vt)},[S]),wt=b.useCallback((pt,kn)=>vt=>{k?.(pt.date,kn,vt)},[k]),jt=b.useCallback(pt=>kn=>{const vt=Number(kn.target.value),Gt=i.setMonth(i.startOfMonth(pt),vt);R(Gt)},[i,R]),Ne=b.useCallback(pt=>kn=>{const vt=Number(kn.target.value),Gt=i.setYear(i.startOfMonth(pt),vt);R(Gt)},[i,R]),{className:ie,style:xe}=b.useMemo(()=>({className:[o[gt.Root],e.className].filter(Boolean).join(" "),style:{..._?.[gt.Root],...e.style}}),[o,e.className,e.style,_]),Je=YNe(e),dt=b.useRef(null);j7e(dt,!!e.animate,{classNames:o,months:H,focused:ne,dateLib:i});const er={dayPickerProps:e,selected:U,select:F,isSelected:G,months:H,nextMonth:X,previousMonth:J,goToMonth:R,getModifiers:se,components:n,classNames:o,styles:_,labels:s,formatters:r};return he.createElement(JV.Provider,{value:er},he.createElement(n.Root,{rootRef:e.animate?dt:void 0,className:ie,style:xe,dir:e.dir,id:e.id,lang:e.lang,nonce:e.nonce,title:e.title,role:e.role,"aria-label":e["aria-label"],"aria-labelledby":e["aria-labelledby"],...Je},he.createElement(n.Months,{className:o[gt.Months],style:_?.[gt.Months]},!e.hideNavigation&&!f&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Cn,onNextClick:Dt,previousMonth:J,nextMonth:X}),H.map((pt,kn)=>he.createElement(n.Month,{"data-animated-month":e.animate?"true":void 0,className:o[gt.Month],style:_?.[gt.Month],key:kn,displayIndex:kn,calendarMonth:pt},f==="around"&&!e.hideNavigation&&kn===0&&he.createElement(n.PreviousMonthButton,{type:"button",className:o[gt.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":je(J),onClick:Cn,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:J?void 0:!0,className:o[gt.Chevron],orientation:e.dir==="rtl"?"right":"left"})),he.createElement(n.MonthCaption,{"data-animated-caption":e.animate?"true":void 0,className:o[gt.MonthCaption],style:_?.[gt.MonthCaption],calendarMonth:pt,displayIndex:kn},c?.startsWith("dropdown")?he.createElement(n.DropdownNav,{className:o[gt.Dropdowns],style:_?.[gt.Dropdowns]},(()=>{const vt=c==="dropdown"||c==="dropdown-months"?he.createElement(n.MonthsDropdown,{key:"month",className:o[gt.MonthsDropdown],"aria-label":tt(),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:jt(pt.date),options:a7e(pt.date,P,W,r,i),style:_?.[gt.Dropdown],value:i.getMonth(pt.date)}):he.createElement("span",{key:"month"},q(pt.date,i)),Gt=c==="dropdown"||c==="dropdown-years"?he.createElement(n.YearsDropdown,{key:"year",className:o[gt.YearsDropdown],"aria-label":lt(i.options),classNames:o,components:n,disabled:!!e.disableNavigation,onChange:Ne(pt.date),options:c7e(P,W,r,i,!!e.reverseYears),style:_?.[gt.Dropdown],value:i.getYear(pt.date)}):he.createElement("span",{key:"year"},V(pt.date,i));return i.getMonthYearOrder()==="year-first"?[Gt,vt]:[vt,Gt]})(),he.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},E(pt.date,i.options,i))):he.createElement(n.CaptionLabel,{className:o[gt.CaptionLabel],role:"status","aria-live":"polite"},E(pt.date,i.options,i))),f==="around"&&!e.hideNavigation&&kn===m-1&&he.createElement(n.NextMonthButton,{type:"button",className:o[gt.NextMonthButton],tabIndex:X?void 0:-1,"aria-disabled":X?void 0:!0,"aria-label":Qe(X),onClick:Dt,"data-animated-button":e.animate?"true":void 0},he.createElement(n.Chevron,{disabled:X?void 0:!0,className:o[gt.Chevron],orientation:e.dir==="rtl"?"left":"right"})),kn===m-1&&f==="after"&&!e.hideNavigation&&he.createElement(n.Nav,{"data-animated-nav":e.animate?"true":void 0,className:o[gt.Nav],style:_?.[gt.Nav],"aria-label":Xe(),onPreviousClick:Cn,onNextClick:Dt,previousMonth:J,nextMonth:X}),he.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":h==="multiple"||h==="range","aria-label":Ge(pt.date,i.options,i)||void 0,className:o[gt.MonthGrid],style:_?.[gt.MonthGrid]},!e.hideWeekdays&&he.createElement(n.Weekdays,{"data-animated-weekdays":e.animate?"true":void 0,className:o[gt.Weekdays],style:_?.[gt.Weekdays]},T&&he.createElement(n.WeekNumberHeader,{"aria-label":bt(i.options),className:o[gt.WeekNumberHeader],style:_?.[gt.WeekNumberHeader],scope:"col"},I()),xn.map(vt=>he.createElement(n.Weekday,{"aria-label":He(vt,i.options,i),className:o[gt.Weekday],key:String(vt),style:_?.[gt.Weekday],scope:"col"},$(vt,i.options,i)))),he.createElement(n.Weeks,{"data-animated-weeks":e.animate?"true":void 0,className:o[gt.Weeks],style:_?.[gt.Weeks]},pt.weeks.map(vt=>he.createElement(n.Week,{className:o[gt.Week],key:vt.weekNumber,style:_?.[gt.Week],week:vt},T&&he.createElement(n.WeekNumber,{week:vt,style:_?.[gt.WeekNumber],"aria-label":$e(vt.weekNumber,{locale:a}),className:o[gt.WeekNumber],scope:"row",role:"rowheader"},L(vt.weekNumber,i)),vt.days.map(Gt=>{const{date:Vt}=Gt,ot=se(Gt);if(ot[ur.focused]=!ot.hidden&&!!ne?.isEqualTo(Gt),ot[ka.selected]=G?.(Vt)||ot.selected,Ej(U)){const{from:pr,to:Cr}=U;ot[ka.range_start]=!!(pr&&Cr&&i.isSameDay(Vt,pr)),ot[ka.range_end]=!!(pr&&Cr&&i.isSameDay(Vt,Cr)),ot[ka.range_middle]=no(U,Vt,!0,i)}const mr=l7e(ot,_,e.modifiersStyles),Yr=GNe(ot,o,e.modifiersClassNames),Kr=!_n&&!ot.hidden?_e(Vt,ot,i.options,i):void 0;return he.createElement(n.Day,{key:`${i.format(Vt,"yyyy-MM-dd")}_${i.format(Gt.displayMonth,"yyyy-MM")}`,day:Gt,modifiers:ot,className:Yr.join(" "),style:mr,role:"gridcell","aria-selected":ot.selected||void 0,"aria-label":Kr,"data-day":i.format(Vt,"yyyy-MM-dd"),"data-month":Gt.outside?i.format(Vt,"yyyy-MM"):void 0,"data-selected":ot.selected||void 0,"data-disabled":ot.disabled||void 0,"data-hidden":ot.hidden||void 0,"data-outside":Gt.outside||void 0,"data-focused":ot.focused||void 0,"data-today":ot.today||void 0},!ot.hidden&&_n?he.createElement(n.DayButton,{className:o[gt.DayButton],style:_?.[gt.DayButton],type:"button",day:Gt,modifiers:ot,disabled:ot.disabled||void 0,tabIndex:Y(Gt)?0:-1,"aria-label":le(Vt,ot,i.options,i),onClick:xt(Gt,ot),onBlur:Re(Gt,ot),onFocus:Te(Gt,ot),onKeyDown:qe(Gt,ot),onMouseEnter:rt(Gt,ot),onMouseLeave:wt(Gt,ot)},M(Vt,i.options,i)):!ot.hidden&&M(Gt.date,i.options,i))})))))))),e.footer&&he.createElement(n.Footer,{className:o[gt.Footer],style:_?.[gt.Footer],role:"status","aria-live":"polite"},e.footer)))}function fD({className:t,classNames:e,showOutsideDays:n=!0,captionLayout:r="label",buttonVariant:s="ghost",formatters:i,components:a,...o}){const c=_j();return l.jsx(V7e,{showOutsideDays:n,className:ye("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw`rtl:**:[.rdp-button\_next>svg]:rotate-180`,String.raw`rtl:**:[.rdp-button\_previous>svg]:rotate-180`,t),captionLayout:r,formatters:{formatMonthDropdown:h=>h.toLocaleString("default",{month:"short"}),...i},classNames:{root:ye("w-fit",c.root),months:ye("relative flex flex-col gap-4 md:flex-row",c.months),month:ye("flex w-full flex-col gap-4",c.month),nav:ye("absolute inset-x-0 top-0 flex w-full items-center justify-between gap-1",c.nav),button_previous:ye(Qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_previous),button_next:ye(Qm({variant:s}),"h-[--cell-size] w-[--cell-size] select-none p-0 aria-disabled:opacity-50",c.button_next),month_caption:ye("flex h-[--cell-size] w-full items-center justify-center px-[--cell-size]",c.month_caption),dropdowns:ye("flex h-[--cell-size] w-full items-center justify-center gap-1.5 text-sm font-medium",c.dropdowns),dropdown_root:ye("has-focus:border-ring border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] relative rounded-md border",c.dropdown_root),dropdown:ye("bg-popover absolute inset-0 opacity-0",c.dropdown),caption_label:ye("select-none font-medium",r==="label"?"text-sm":"[&>svg]:text-muted-foreground flex h-8 items-center gap-1 rounded-md pl-2 pr-1 text-sm [&>svg]:size-3.5",c.caption_label),table:"w-full border-collapse",weekdays:ye("flex",c.weekdays),weekday:ye("text-muted-foreground flex-1 select-none rounded-md text-[0.8rem] font-normal",c.weekday),week:ye("mt-2 flex w-full",c.week),week_number_header:ye("w-[--cell-size] select-none",c.week_number_header),week_number:ye("text-muted-foreground select-none text-[0.8rem]",c.week_number),day:ye("group/day relative aspect-square h-full w-full select-none p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md",c.day),range_start:ye("bg-accent rounded-l-md",c.range_start),range_middle:ye("rounded-none",c.range_middle),range_end:ye("bg-accent rounded-r-md",c.range_end),today:ye("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",c.today),outside:ye("text-muted-foreground aria-selected:text-muted-foreground",c.outside),disabled:ye("text-muted-foreground opacity-50",c.disabled),hidden:ye("invisible",c.hidden),...e},components:{Root:({className:h,rootRef:f,...m})=>l.jsx("div",{"data-slot":"calendar",ref:f,className:ye(h),...m}),Chevron:({className:h,orientation:f,...m})=>f==="left"?l.jsx(qu,{className:ye("size-4",h),...m}):f==="right"?l.jsx(Fu,{className:ye("size-4",h),...m}):l.jsx(Nu,{className:ye("size-4",h),...m}),DayButton:U7e,WeekNumber:({children:h,...f})=>l.jsx("td",{...f,children:l.jsx("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:h})}),...a},...o})}function U7e({className:t,day:e,modifiers:n,...r}){const s=_j(),i=b.useRef(null);return b.useEffect(()=>{n.focused&&i.current?.focus()},[n.focused]),l.jsx(fe,{ref:i,variant:"ghost",size:"icon","data-day":e.date.toLocaleDateString(),"data-selected-single":n.selected&&!n.range_start&&!n.range_end&&!n.range_middle,"data-range-start":n.range_start,"data-range-end":n.range_end,"data-range-middle":n.range_middle,className:ye("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 flex aspect-square h-auto w-full min-w-[--cell-size] flex-col gap-1 font-normal leading-none data-[range-end=true]:rounded-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] [&>span]:text-xs [&>span]:opacity-70",s.day,t),...r})}class W7e{ws=null;reconnectTimeout=null;reconnectAttempts=0;maxReconnectAttempts=10;heartbeatInterval=null;logCallbacks=new Set;connectionCallbacks=new Set;isConnected=!1;logCache=[];maxCacheSize=1e3;getWebSocketUrl(){{const e=window.location.protocol==="https:"?"wss:":"ws:",n=window.location.host;return`${e}//${n}/ws/logs`}}connect(){if(this.ws?.readyState===WebSocket.OPEN||this.ws?.readyState===WebSocket.CONNECTING)return;const e=this.getWebSocketUrl();try{this.ws=new WebSocket(e),this.ws.onopen=()=>{this.isConnected=!0,this.reconnectAttempts=0,this.notifyConnection(!0),this.startHeartbeat()},this.ws.onmessage=n=>{try{if(n.data==="pong")return;const r=JSON.parse(n.data);this.notifyLog(r)}catch(r){console.error("解析日志消息失败:",r)}},this.ws.onerror=n=>{console.error("❌ WebSocket 错误:",n),this.isConnected=!1,this.notifyConnection(!1)},this.ws.onclose=()=>{this.isConnected=!1,this.notifyConnection(!1),this.stopHeartbeat(),this.attemptReconnect()}}catch(n){console.error("创建 WebSocket 连接失败:",n),this.attemptReconnect()}}attemptReconnect(){if(this.reconnectAttempts>=this.maxReconnectAttempts)return;this.reconnectAttempts+=1;const e=Math.min(1e3*this.reconnectAttempts,1e4);this.reconnectTimeout=window.setTimeout(()=>{this.connect()},e)}startHeartbeat(){this.heartbeatInterval=window.setInterval(()=>{this.ws?.readyState===WebSocket.OPEN&&this.ws.send("ping")},3e4)}stopHeartbeat(){this.heartbeatInterval!==null&&(clearInterval(this.heartbeatInterval),this.heartbeatInterval=null)}disconnect(){this.reconnectTimeout!==null&&(clearTimeout(this.reconnectTimeout),this.reconnectTimeout=null),this.stopHeartbeat(),this.ws&&(this.ws.close(),this.ws=null),this.isConnected=!1,this.reconnectAttempts=0}onLog(e){return this.logCallbacks.add(e),()=>this.logCallbacks.delete(e)}onConnectionChange(e){return this.connectionCallbacks.add(e),e(this.isConnected),()=>this.connectionCallbacks.delete(e)}notifyLog(e){this.logCache.some(r=>r.id===e.id)||(this.logCache.push(e),this.logCache.length>this.maxCacheSize&&(this.logCache=this.logCache.slice(-this.maxCacheSize)),this.logCallbacks.forEach(r=>{try{r(e)}catch(s){console.error("日志回调执行失败:",s)}}))}notifyConnection(e){this.connectionCallbacks.forEach(n=>{try{n(e)}catch(r){console.error("连接状态回调执行失败:",r)}})}getAllLogs(){return[...this.logCache]}clearLogs(){this.logCache=[]}getConnectionStatus(){return this.isConnected}}const Hd=new W7e;typeof window<"u"&&Hd.connect();const G7e={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},X7e=(t,e,n)=>{let r;const s=G7e[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",String(e)),n?.addSuffix?n.comparison&&n.comparison>0?r+"内":r+"前":r},Y7e={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},K7e={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},Z7e={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},J7e={date:dh({formats:Y7e,defaultWidth:"full"}),time:dh({formats:K7e,defaultWidth:"full"}),dateTime:dh({formats:Z7e,defaultWidth:"full"})};function mD(t,e,n){const r="eeee p";return uNe(t,e,n)?r:t.getTime()>e.getTime()?"'下个'"+r:"'上个'"+r}const e8e={lastWeek:mD,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:mD,other:"PP p"},t8e=(t,e,n,r)=>{const s=e8e[t];return typeof s=="function"?s(e,n,r):s},n8e={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},r8e={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},s8e={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},i8e={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},a8e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},l8e={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},o8e=(t,e)=>{const n=Number(t);switch(e?.unit){case"date":return n.toString()+"日";case"hour":return n.toString()+"时";case"minute":return n.toString()+"分";case"second":return n.toString()+"秒";default:return"第 "+n.toString()}},c8e={ordinalNumber:o8e,era:Ka({values:n8e,defaultWidth:"wide"}),quarter:Ka({values:r8e,defaultWidth:"wide",argumentCallback:t=>t-1}),month:Ka({values:s8e,defaultWidth:"wide"}),day:Ka({values:i8e,defaultWidth:"wide"}),dayPeriod:Ka({values:a8e,defaultWidth:"wide",formattingValues:l8e,defaultFormattingWidth:"wide"})},u8e=/^(第\s*)?\d+(日|时|分|秒)?/i,d8e=/\d+/i,h8e={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},f8e={any:[/^(前)/i,/^(公元)/i]},m8e={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},p8e={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},g8e={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},x8e={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},v8e={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},y8e={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},b8e={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},w8e={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},S8e={ordinalNumber:UV({matchPattern:u8e,parsePattern:d8e,valueCallback:t=>parseInt(t,10)}),era:Za({matchPatterns:h8e,defaultMatchWidth:"wide",parsePatterns:f8e,defaultParseWidth:"any"}),quarter:Za({matchPatterns:m8e,defaultMatchWidth:"wide",parsePatterns:p8e,defaultParseWidth:"any",valueCallback:t=>t+1}),month:Za({matchPatterns:g8e,defaultMatchWidth:"wide",parsePatterns:x8e,defaultParseWidth:"any"}),day:Za({matchPatterns:v8e,defaultMatchWidth:"wide",parsePatterns:y8e,defaultParseWidth:"any"}),dayPeriod:Za({matchPatterns:b8e,defaultMatchWidth:"any",parsePatterns:w8e,defaultParseWidth:"any"})},$x={code:"zh-CN",formatDistance:X7e,formatLong:J7e,formatRelative:t8e,localize:c8e,match:S8e,options:{weekStartsOn:1,firstWeekContainsDate:4}},Qx={xs:{label:"小",rowHeight:28,class:"text-[10px] sm:text-xs"},sm:{label:"中",rowHeight:36,class:"text-xs sm:text-sm"},base:{label:"大",rowHeight:44,class:"text-sm sm:text-base"}};function k8e(){const[t,e]=b.useState([]),[n,r]=b.useState(""),[s,i]=b.useState("all"),[a,o]=b.useState("all"),[c,h]=b.useState(void 0),[f,m]=b.useState(void 0),[g,x]=b.useState(!0),[y,w]=b.useState(!1),[S,k]=b.useState("xs"),[N,C]=b.useState(4),T=b.useRef(null);b.useEffect(()=>{const P=Hd.getAllLogs();e(P);const W=Hd.onLog(()=>{e(Hd.getAllLogs())}),J=Hd.onConnectionChange(X=>{w(X)});return()=>{W(),J()}},[]);const _=b.useMemo(()=>{const P=new Set(t.map(W=>W.module));return Array.from(P).sort()},[t]),E=P=>{switch(P){case"DEBUG":return"text-muted-foreground";case"INFO":return"text-blue-500 dark:text-blue-400";case"WARNING":return"text-yellow-600 dark:text-yellow-500";case"ERROR":return"text-red-600 dark:text-red-500";case"CRITICAL":return"text-red-700 dark:text-red-400 font-bold";default:return"text-foreground"}},M=P=>{switch(P){case"DEBUG":return"bg-gray-800/30 dark:bg-gray-800/50";case"INFO":return"bg-blue-900/20 dark:bg-blue-500/20";case"WARNING":return"bg-yellow-900/20 dark:bg-yellow-500/20";case"ERROR":return"bg-red-900/20 dark:bg-red-500/20";case"CRITICAL":return"bg-red-900/30 dark:bg-red-600/30";default:return"bg-gray-800/20 dark:bg-gray-800/30"}},q=()=>{window.location.reload()},L=()=>{Hd.clearLogs(),e([])},I=()=>{const P=ee.map(R=>`${R.timestamp} [${R.level.padEnd(8)}] [${R.module}] ${R.message}`).join(` +`),W=new Blob([P],{type:"text/plain;charset=utf-8"}),J=URL.createObjectURL(W),X=document.createElement("a");X.href=J,X.download=`logs-${S1(new Date,"yyyy-MM-dd-HHmmss")}.txt`,X.click(),URL.revokeObjectURL(J)},$=()=>{x(!g)},V=()=>{h(void 0),m(void 0)},ee=b.useMemo(()=>t.filter(P=>{const W=n===""||P.message.toLowerCase().includes(n.toLowerCase())||P.module.toLowerCase().includes(n.toLowerCase()),J=s==="all"||P.level===s,X=a==="all"||P.module===a;let R=!0;if(c||f){const se=new Date(P.timestamp);if(c){const G=new Date(c);G.setHours(0,0,0,0),R=R&&se>=G}if(f){const G=new Date(f);G.setHours(23,59,59,999),R=R&&se<=G}}return W&&J&&X&&R}),[t,n,s,a,c,f]),z=Qx[S].rowHeight+N,H=HOe({count:ee.length,getScrollElement:()=>T.current,estimateSize:()=>z,overscan:15});return b.useEffect(()=>{g&&ee.length>0&&H.scrollToIndex(ee.length-1,{align:"end",behavior:"auto"})},[ee.length,g,H]),l.jsxs("div",{className:"h-full flex flex-col overflow-hidden",children:[l.jsxs("div",{className:"flex-shrink-0 space-y-4 p-3 sm:p-4 lg:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-xl sm:text-2xl lg:text-3xl font-bold",children:"日志查看器"}),l.jsx("p",{className:"text-xs sm:text-sm text-muted-foreground mt-1",children:"实时查看和分析麦麦运行日志"})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("div",{className:ye("h-2.5 w-2.5 sm:h-3 sm:w-3 rounded-full",y?"bg-green-500 animate-pulse":"bg-red-500")}),l.jsx("span",{className:"text-xs sm:text-sm text-muted-foreground",children:y?"已连接":"未连接"})]})]}),l.jsx(Tt,{className:"p-3 sm:p-4",children:l.jsxs("div",{className:"flex flex-col gap-3 sm:gap-4",children:[l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索日志...",value:n,onChange:P=>r(P.target.value),className:"pl-9 h-9 text-sm"})]}),l.jsxs(zt,{value:s,onValueChange:i,children:[l.jsxs(At,{className:"w-full sm:w-[140px] lg:w-[180px] h-9 text-sm",children:[l.jsx(_3,{className:"h-4 w-4 mr-2"}),l.jsx(Pt,{placeholder:"级别"})]}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部级别"}),l.jsx(ze,{value:"DEBUG",children:"DEBUG"}),l.jsx(ze,{value:"INFO",children:"INFO"}),l.jsx(ze,{value:"WARNING",children:"WARNING"}),l.jsx(ze,{value:"ERROR",children:"ERROR"}),l.jsx(ze,{value:"CRITICAL",children:"CRITICAL"})]})]}),l.jsxs(zt,{value:a,onValueChange:o,children:[l.jsxs(At,{className:"w-full sm:w-[160px] lg:w-[200px] h-9 text-sm",children:[l.jsx(_3,{className:"h-4 w-4 mr-2"}),l.jsx(Pt,{placeholder:"模块"})]}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部模块"}),_.map(P=>l.jsx(ze,{value:P,children:P},P))]})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:gap-4",children:[l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!c&&"text-muted-foreground"),children:[l.jsx(IC,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:c?S1(c,"PPP",{locale:$x}):"开始日期"})]})}),l.jsx(ol,{className:"w-auto p-0",align:"start",children:l.jsx(fD,{mode:"single",selected:c,onSelect:h,initialFocus:!0,locale:$x})})]}),l.jsxs(uo,{children:[l.jsx(ho,{asChild:!0,children:l.jsxs(fe,{variant:"outline",size:"sm",className:ye("w-full sm:w-[200px] lg:w-[240px] justify-start text-left font-normal h-9",!f&&"text-muted-foreground"),children:[l.jsx(IC,{className:"mr-2 h-4 w-4"}),l.jsx("span",{className:"text-xs sm:text-sm",children:f?S1(f,"PPP",{locale:$x}):"结束日期"})]})}),l.jsx(ol,{className:"w-auto p-0",align:"start",children:l.jsx(fD,{mode:"single",selected:f,onSelect:m,initialFocus:!0,locale:$x})})]}),(c||f)&&l.jsxs(fe,{variant:"outline",size:"sm",onClick:V,className:"w-full sm:w-auto h-9",children:[l.jsx(R0,{className:"h-4 w-4 sm:mr-2"}),l.jsx("span",{className:"hidden sm:inline text-sm",children:"清除时间筛选"}),l.jsx("span",{className:"sm:hidden text-sm",children:"清除"})]})]}),l.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center",children:[l.jsxs("div",{className:"flex gap-2 flex-wrap",children:[l.jsxs(fe,{variant:g?"default":"outline",size:"sm",onClick:$,className:"flex-1 sm:flex-none h-9",children:[g?l.jsx(HK,{className:"h-4 w-4"}):l.jsx(VK,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:g?"自动滚动":"已暂停"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:q,className:"flex-1 sm:flex-none h-9",children:[l.jsx(ti,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"刷新"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:L,className:"flex-1 sm:flex-none h-9",children:[l.jsx(ln,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"清空"})]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:I,className:"flex-1 sm:flex-none h-9",children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{className:"ml-2 text-sm",children:"导出"})]})]}),l.jsx("div",{className:"flex-1 hidden sm:block"}),l.jsxs("div",{className:"text-xs sm:text-sm text-muted-foreground flex items-center justify-center sm:justify-end",children:[l.jsxs("span",{className:"font-mono",children:[ee.length," / ",t.length]}),l.jsx("span",{className:"ml-1",children:"条日志"})]})]}),l.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:gap-6 pt-2 border-t border-border/50",children:[l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[l.jsx(UK,{className:"h-4 w-4"}),l.jsx("span",{children:"字号"})]}),l.jsx("div",{className:"flex gap-1",children:Object.keys(Qx).map(P=>l.jsx(fe,{variant:S===P?"default":"outline",size:"sm",onClick:()=>k(P),className:"h-7 px-3 text-xs",children:Qx[P].label},P))})]}),l.jsxs("div",{className:"flex items-center gap-3 flex-1 max-w-xs",children:[l.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:"行距"}),l.jsx($0,{value:[N],onValueChange:([P])=>C(P),min:0,max:12,step:2,className:"flex-1"}),l.jsxs("span",{className:"text-xs text-muted-foreground w-8",children:[N,"px"]})]})]})]})})]}),l.jsx("div",{className:"flex-1 min-h-0 px-3 sm:px-4 lg:px-6 pb-3 sm:pb-4 lg:pb-6",children:l.jsx(Tt,{className:"bg-black dark:bg-gray-950 border-gray-800 dark:border-gray-900 h-full",children:l.jsx(on,{viewportRef:T,className:"h-full",children:l.jsx("div",{className:ye("p-2 sm:p-3 font-mono relative",Qx[S].class),style:{height:`${H.getTotalSize()}px`},children:ee.length===0?l.jsx("div",{className:"text-gray-500 dark:text-gray-600 text-center py-8 text-sm",children:"暂无日志数据"}):H.getVirtualItems().map(P=>{const W=ee[P.index];return l.jsxs("div",{"data-index":P.index,ref:H.measureElement,className:ye("absolute top-0 left-0 w-full px-2 sm:px-3 rounded hover:bg-white/5 transition-colors group",M(W.level)),style:{transform:`translateY(${P.start}px)`,paddingTop:`${N/2}px`,paddingBottom:`${N/2}px`},children:[l.jsxs("div",{className:"flex flex-col gap-0.5 sm:hidden",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600",children:W.timestamp}),l.jsxs("span",{className:ye("font-semibold",E(W.level)),children:["[",W.level,"]"]})]}),l.jsx("div",{className:"text-cyan-400 dark:text-cyan-500 truncate",children:W.module}),l.jsx("div",{className:"text-gray-300 dark:text-gray-400 whitespace-pre-wrap break-words",children:W.message})]}),l.jsxs("div",{className:"hidden sm:flex gap-2 items-start",children:[l.jsx("span",{className:"text-gray-500 dark:text-gray-600 flex-shrink-0 w-[130px] lg:w-[160px]",children:W.timestamp}),l.jsxs("span",{className:ye("flex-shrink-0 w-[65px] lg:w-[75px] font-semibold",E(W.level)),children:["[",W.level,"]"]}),l.jsx("span",{className:"text-cyan-400 dark:text-cyan-500 flex-shrink-0 w-[100px] lg:w-[130px] truncate",children:W.module}),l.jsx("span",{className:"text-gray-300 dark:text-gray-400 flex-1 whitespace-pre-wrap break-words",children:W.message})]})]},P.key)})})})})})]})}const O8e="Mai-with-u",j8e="plugin-repo",N8e="main",C8e="plugin_details.json";async function T8e(){try{const t=await mt("/api/webui/plugins/fetch-raw",{method:"POST",headers:Nt(),body:JSON.stringify({owner:O8e,repo:j8e,branch:N8e,file_path:C8e})});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success||!e.data)throw new Error(e.error||"获取插件列表失败");return JSON.parse(e.data).filter(s=>!s?.id||!s?.manifest?(console.warn("跳过无效插件数据:",s),!1):!s.manifest.name||!s.manifest.version?(console.warn("跳过缺少必需字段的插件:",s.id),!1):!0).map(s=>({id:s.id,manifest:{manifest_version:s.manifest.manifest_version||1,name:s.manifest.name,version:s.manifest.version,description:s.manifest.description||"",author:s.manifest.author||{name:"Unknown"},license:s.manifest.license||"Unknown",host_application:s.manifest.host_application||{min_version:"0.0.0"},homepage_url:s.manifest.homepage_url,repository_url:s.manifest.repository_url,keywords:s.manifest.keywords||[],categories:s.manifest.categories||[],default_locale:s.manifest.default_locale||"zh-CN",locales_path:s.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!1,published_at:new Date().toISOString(),updated_at:new Date().toISOString()}))}catch(t){throw console.error("Failed to fetch plugin list:",t),t}}async function E8e(){try{const t=await mt("/api/webui/plugins/git-status");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to check Git status:",t),{installed:!1,error:"无法检测 Git 安装状态"}}}async function _8e(){try{const t=await mt("/api/webui/plugins/version");if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return await t.json()}catch(t){return console.error("Failed to get Maimai version:",t),{version:"0.0.0",version_major:0,version_minor:0,version_patch:0}}}function M8e(t,e,n){const r=t.split(".").map(o=>parseInt(o)||0),s=r[0]||0,i=r[1]||0,a=r[2]||0;if(n.version_majorparseInt(m)||0),c=o[0]||0,h=o[1]||0,f=o[2]||0;if(n.version_major>c||n.version_major===c&&n.version_minor>h||n.version_major===c&&n.version_minor===h&&n.version_patch>f)return!1}return!0}function A8e(t,e){const n=window.location.protocol==="https:"?"wss:":"ws:",r=window.location.host,s=new WebSocket(`${n}//${r}/api/webui/ws/plugin-progress`);return s.onopen=()=>{console.log("Plugin progress WebSocket connected");const i=setInterval(()=>{s.readyState===WebSocket.OPEN?s.send("ping"):clearInterval(i)},3e4)},s.onmessage=i=>{try{if(i.data==="pong")return;const a=JSON.parse(i.data);t(a)}catch(a){console.error("Failed to parse progress data:",a)}},s.onerror=i=>{console.error("Plugin progress WebSocket error:",i),e?.(i)},s.onclose=()=>{console.log("Plugin progress WebSocket disconnected")},s}async function Hx(){try{const t=await mt("/api/webui/plugins/installed",{headers:Nt()});if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const e=await t.json();if(!e.success)throw new Error(e.message||"获取已安装插件列表失败");return e.plugins||[]}catch(t){return console.error("Failed to get installed plugins:",t),[]}}function Vx(t,e){return e.some(n=>n.id===t)}function Ux(t,e){const n=e.find(r=>r.id===t);if(n)return n.manifest?.version||n.version}async function R8e(t,e,n="main"){const r=await mt("/api/webui/plugins/install",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"安装失败")}return await r.json()}async function D8e(t){const e=await mt("/api/webui/plugins/uninstall",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t})});if(!e.ok){const n=await e.json();throw new Error(n.detail||"卸载失败")}return await e.json()}async function z8e(t,e,n="main"){const r=await mt("/api/webui/plugins/update",{method:"POST",headers:Nt(),body:JSON.stringify({plugin_id:t,repository_url:e,branch:n})});if(!r.ok){const s=await r.json();throw new Error(s.detail||"更新失败")}return await r.json()}const vp="https://maibot-plugin-stats.maibot-webui.workers.dev";async function uU(t){try{const e=await fetch(`${vp}/stats/${t}`);return e.ok?await e.json():(console.error("Failed to fetch plugin stats:",e.statusText),null)}catch(e){return console.error("Error fetching plugin stats:",e),null}}async function P8e(t,e){try{const n=e||Mj(),r=await fetch(`${vp}/stats/like`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点赞失败"}}catch(n){return console.error("Error liking plugin:",n),{success:!1,error:"网络错误"}}}async function L8e(t,e){try{const n=e||Mj(),r=await fetch(`${vp}/stats/dislike`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,user_id:n})}),s=await r.json();return r.status===429?{success:!1,error:"操作过于频繁,请稍后再试"}:r.ok?{success:!0,...s}:{success:!1,error:s.error||"点踩失败"}}catch(n){return console.error("Error disliking plugin:",n),{success:!1,error:"网络错误"}}}async function I8e(t,e,n,r){if(e<1||e>5)return{success:!1,error:"评分必须在 1-5 之间"};try{const s=r||Mj(),i=await fetch(`${vp}/stats/rate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t,rating:e,comment:n,user_id:s})}),a=await i.json();return i.status===429?{success:!1,error:"每天最多评分 3 次"}:i.ok?{success:!0,...a}:{success:!1,error:a.error||"评分失败"}}catch(s){return console.error("Error rating plugin:",s),{success:!1,error:"网络错误"}}}async function B8e(t){try{const e=await fetch(`${vp}/stats/download`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({plugin_id:t})}),n=await e.json();return e.status===429?(console.warn("Download recording rate limited"),{success:!0}):e.ok?{success:!0,...n}:(console.error("Failed to record download:",n.error),{success:!1,error:n.error})}catch(e){return console.error("Error recording download:",e),{success:!1,error:"网络错误"}}}function q8e(){const t=navigator,e=[navigator.userAgent,navigator.language,navigator.languages?.join(",")||"",navigator.platform,navigator.hardwareConcurrency||0,screen.width,screen.height,screen.colorDepth,screen.pixelDepth,new Date().getTimezoneOffset(),Intl.DateTimeFormat().resolvedOptions().timeZone,navigator.maxTouchPoints||0,t.deviceMemory||0].join("|");let n=0;for(let r=0;r{i(!0);const k=await uU(t);k&&r(k),i(!1)};b.useEffect(()=>{x()},[t]);const y=async()=>{const k=await P8e(t);k.success?(g({title:"已点赞",description:"感谢你的支持!"}),x()):g({title:"点赞失败",description:k.error||"未知错误",variant:"destructive"})},w=async()=>{const k=await L8e(t);k.success?(g({title:"已反馈",description:"感谢你的反馈!"}),x()):g({title:"操作失败",description:k.error||"未知错误",variant:"destructive"})},S=async()=>{if(a===0){g({title:"请选择评分",description:"至少选择 1 颗星",variant:"destructive"});return}const k=await I8e(t,a,c||void 0);k.success?(g({title:"评分成功",description:"感谢你的评价!"}),m(!1),o(0),h(""),x()):g({title:"评分失败",description:k.error||"未知错误",variant:"destructive"})};return s?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4"}),l.jsx("span",{children:"-"})]})]}):n?e?l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",title:`下载量: ${n.downloads.toLocaleString()}`,children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{children:n.downloads.toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`评分: ${n.rating.toFixed(1)} (${n.rating_count} 条评价)`,children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:n.rating.toFixed(1)})]}),l.jsxs("div",{className:"flex items-center gap-1",title:`点赞数: ${n.likes}`,children:[l.jsx(K2,{className:"h-4 w-4"}),l.jsx("span",{children:n.likes})]})]}):l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(bu,{className:"h-5 w-5 text-muted-foreground mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.downloads.toLocaleString()}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"下载量"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(sc,{className:"h-5 w-5 text-yellow-400 mb-1 fill-yellow-400"}),l.jsx("span",{className:"text-2xl font-bold",children:n.rating.toFixed(1)}),l.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.rating_count," 条评价"]})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(K2,{className:"h-5 w-5 text-green-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.likes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点赞"})]}),l.jsxs("div",{className:"flex flex-col items-center p-3 rounded-lg border bg-card",children:[l.jsx(BC,{className:"h-5 w-5 text-red-500 mb-1"}),l.jsx("span",{className:"text-2xl font-bold",children:n.dislikes}),l.jsx("span",{className:"text-xs text-muted-foreground",children:"点踩"})]})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(fe,{variant:"outline",size:"sm",onClick:y,children:[l.jsx(K2,{className:"h-4 w-4 mr-1"}),"点赞"]}),l.jsxs(fe,{variant:"outline",size:"sm",onClick:w,children:[l.jsx(BC,{className:"h-4 w-4 mr-1"}),"点踩"]}),l.jsxs(fr,{open:f,onOpenChange:m,children:[l.jsx(Bh,{asChild:!0,children:l.jsxs(fe,{variant:"default",size:"sm",children:[l.jsx(sc,{className:"h-4 w-4 mr-1"}),"评分"]})}),l.jsxs(rr,{children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"为插件评分"}),l.jsx(Ir,{children:"分享你的使用体验,帮助其他用户"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"flex flex-col items-center gap-2",children:[l.jsx("div",{className:"flex gap-2",children:[1,2,3,4,5].map(k=>l.jsx("button",{onClick:()=>o(k),className:"focus:outline-none",children:l.jsx(sc,{className:`h-8 w-8 transition-colors ${k<=a?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-300"}`})},k))}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[a===0&&"点击星星进行评分",a===1&&"很差",a===2&&"一般",a===3&&"还行",a===4&&"不错",a===5&&"非常好"]})]}),l.jsxs("div",{children:[l.jsx("label",{className:"text-sm font-medium mb-2 block",children:"评论(可选)"}),l.jsx(dr,{value:c,onChange:k=>h(k.target.value),placeholder:"分享你的使用体验...",rows:4,maxLength:500}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1 text-right",children:[c.length," / 500"]})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(fe,{onClick:S,disabled:a===0,children:"提交评分"})]})]})]})]}),n.recent_ratings&&n.recent_ratings.length>0&&l.jsxs("div",{className:"space-y-2",children:[l.jsx("h4",{className:"text-sm font-semibold",children:"最近评价"}),l.jsx("div",{className:"space-y-3",children:n.recent_ratings.map((k,N)=>l.jsxs("div",{className:"p-3 rounded-lg border bg-muted/50",children:[l.jsxs("div",{className:"flex items-center justify-between mb-2",children:[l.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(C=>l.jsx(sc,{className:`h-3 w-3 ${C<=k.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},C))}),l.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(k.created_at).toLocaleDateString()})]}),k.comment&&l.jsx("p",{className:"text-sm text-muted-foreground",children:k.comment})]},N))})]})]}):null}const pD={"Group Management":"群组管理","Entertainment & Interaction":"娱乐互动","Utility Tools":"实用工具","Content Generation":"内容生成",Multimedia:"多媒体","External Integration":"外部集成","Data Analysis & Insights":"数据分析与洞察",Other:"其他"};function $8e(){const t=Ma(),[e,n]=b.useState(null),[r,s]=b.useState(""),[i,a]=b.useState("all"),[o,c]=b.useState("all"),[h,f]=b.useState(!0),[m,g]=b.useState([]),[x,y]=b.useState(!0),[w,S]=b.useState(null),[k,N]=b.useState(null),[C,T]=b.useState(null),[_,E]=b.useState(null),[,M]=b.useState([]),[q,L]=b.useState({}),{toast:I}=Gr(),$=async R=>{const se=R.map(async U=>{try{const te=await uU(U.id);return{id:U.id,stats:te}}catch(te){return console.warn(`Failed to load stats for ${U.id}:`,te),{id:U.id,stats:null}}}),G=await Promise.all(se),F={};G.forEach(({id:U,stats:te})=>{te&&(F[U]=te)}),L(F)};b.useEffect(()=>{let R=null,se=!1;return(async()=>{if(R=A8e(F=>{se||(T(F),F.stage==="success"?setTimeout(()=>{se||T(null)},2e3):F.stage==="error"&&(y(!1),S(F.error||"加载失败")))},F=>{console.error("WebSocket error:",F),se||I({title:"WebSocket 连接失败",description:"无法实时显示加载进度",variant:"destructive"})}),await new Promise(F=>{if(!R){F();return}const U=()=>{R&&R.readyState===WebSocket.OPEN?(console.log("WebSocket connected, starting to load plugins"),F()):R&&R.readyState===WebSocket.CLOSED?(console.warn("WebSocket closed before loading plugins"),F()):setTimeout(U,100)};U()}),!se){const F=await E8e();N(F),F.installed||I({title:"Git 未安装",description:F.error||"请先安装 Git 才能使用插件安装功能",variant:"destructive"})}if(!se){const F=await _8e();E(F)}if(!se)try{y(!0),S(null);const F=await T8e();if(!se){const U=await Hx();M(U);const te=F.map(ne=>{const Y=Vx(ne.id,U),ae=Ux(ne.id,U);return{...ne,installed:Y,installed_version:ae}});for(const ne of U)!te.some(ae=>ae.id===ne.id)&&ne.manifest&&te.push({id:ne.id,manifest:{manifest_version:ne.manifest.manifest_version||1,name:ne.manifest.name,version:ne.manifest.version,description:ne.manifest.description||"",author:ne.manifest.author,license:ne.manifest.license||"Unknown",host_application:ne.manifest.host_application,homepage_url:ne.manifest.homepage_url,repository_url:ne.manifest.repository_url,keywords:ne.manifest.keywords||[],categories:ne.manifest.categories||[],default_locale:ne.manifest.default_locale||"zh-CN",locales_path:ne.manifest.locales_path},downloads:0,rating:0,review_count:0,installed:!0,installed_version:ne.manifest.version,published_at:new Date().toISOString(),updated_at:new Date().toISOString()});g(te),$(te)}}catch(F){if(!se){const U=F instanceof Error?F.message:"加载插件列表失败";S(U),I({title:"加载失败",description:U,variant:"destructive"})}}finally{se||y(!1)}})(),()=>{se=!0,R&&R.close()}},[I]);const V=R=>{if(!R.installed&&_&&!ee(R))return l.jsxs(In,{variant:"destructive",className:"gap-1",children:[l.jsx(ju,{className:"h-3 w-3"}),"不兼容"]});if(R.installed){const se=R.installed_version?.trim(),G=R.manifest.version?.trim();if(se!==G){const F=se?.split(".").map(Number)||[0,0,0],U=G?.split(".").map(Number)||[0,0,0];for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return l.jsxs(In,{variant:"outline",className:"gap-1 text-orange-600 border-orange-600",children:[l.jsx(ju,{className:"h-3 w-3"}),"可更新"]});if((U[te]||0)<(F[te]||0))break}}return l.jsxs(In,{variant:"default",className:"gap-1",children:[l.jsx(xc,{className:"h-3 w-3"}),"已安装"]})}return null},ee=R=>!_||!R.manifest?.host_application?!0:M8e(R.manifest.host_application.min_version,R.manifest.host_application.max_version,_),z=R=>{if(!R.installed||!R.installed_version||!R.manifest?.version)return!1;const se=R.installed_version.trim(),G=R.manifest.version.trim();if(se===G)return!1;const F=se.split(".").map(Number),U=G.split(".").map(Number);for(let te=0;te<3;te++){if((U[te]||0)>(F[te]||0))return!0;if((U[te]||0)<(F[te]||0))return!1}return!1},H=m.filter(R=>{if(!R.manifest)return console.warn("[过滤] 跳过无 manifest 的插件:",R.id),!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(te=>te.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i);let F=!0;o==="installed"?F=R.installed===!0:o==="updates"&&(F=R.installed===!0&&z(R));const U=!h||!_||ee(R);return se&&G&&F&&U}),P=()=>{n(null)},W=async R=>{if(!k?.installed){I({title:"无法安装",description:"Git 未安装",variant:"destructive"});return}if(_&&!ee(R)){I({title:"无法安装",description:"插件与当前麦麦版本不兼容",variant:"destructive"});return}try{await R8e(R.id,R.manifest.repository_url||"","main"),B8e(R.id).catch(G=>{console.warn("Failed to record download:",G)}),I({title:"安装成功",description:`${R.manifest.name} 已成功安装`});const se=await Hx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=Vx(F.id,se),te=Ux(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"安装失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},J=async R=>{try{await D8e(R.id),I({title:"卸载成功",description:`${R.manifest.name} 已成功卸载`});const se=await Hx();M(se),g(G=>G.map(F=>{if(F.id===R.id){const U=Vx(F.id,se),te=Ux(F.id,se);return{...F,installed:U,installed_version:te}}return F}))}catch(se){I({title:"卸载失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}},X=async R=>{if(!k?.installed){I({title:"无法更新",description:"Git 未安装",variant:"destructive"});return}try{const se=await z8e(R.id,R.manifest.repository_url||"","main");I({title:"更新成功",description:`${R.manifest.name} 已从 ${se.old_version} 更新到 ${se.new_version}`});const G=await Hx();M(G),g(F=>F.map(U=>{if(U.id===R.id){const te=Vx(U.id,G),ne=Ux(U.id,G);return{...U,installed:te,installed_version:ne}}return U}))}catch(se){I({title:"更新失败",description:se instanceof Error?se.message:"未知错误",variant:"destructive"})}};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件市场"}),l.jsx("p",{className:"text-muted-foreground mt-2",children:"浏览和管理麦麦的插件"})]}),l.jsxs(fe,{onClick:()=>t({to:"/plugin-mirrors"}),children:[l.jsx(WK,{className:"h-4 w-4 mr-2"}),"配置镜像源"]})]}),k&&!k.installed&&l.jsxs(Tt,{className:"border-orange-600 bg-orange-50 dark:bg-orange-950/20",children:[l.jsx(vn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ja,{className:"h-5 w-5 text-orange-600"}),l.jsxs("div",{children:[l.jsx(yn,{className:"text-lg text-orange-900 dark:text-orange-100",children:"Git 未安装"}),l.jsx(zr,{className:"text-orange-800 dark:text-orange-200",children:k.error||"请先安装 Git 才能使用插件安装功能"})]})]})}),l.jsx(En,{children:l.jsxs("p",{className:"text-sm text-orange-800 dark:text-orange-200",children:["您可以从 ",l.jsx("a",{href:"https://git-scm.com/downloads",target:"_blank",rel:"noopener noreferrer",className:"underline font-medium",children:"git-scm.com"})," 下载并安装 Git。 安装完成后,请重启麦麦应用。"]})})]}),l.jsx(Tt,{className:"p-4",children:l.jsxs("div",{className:"flex flex-col gap-4",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[l.jsxs("div",{className:"flex-1 relative",children:[l.jsx(li,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),l.jsx(Pe,{placeholder:"搜索插件...",value:r,onChange:R=>s(R.target.value),className:"pl-9"})]}),l.jsxs(zt,{value:i,onValueChange:a,children:[l.jsx(At,{className:"w-full sm:w-[200px]",children:l.jsx(Pt,{placeholder:"选择分类"})}),l.jsxs(Rt,{children:[l.jsx(ze,{value:"all",children:"全部分类"}),l.jsx(ze,{value:"Group Management",children:"群组管理"}),l.jsx(ze,{value:"Entertainment & Interaction",children:"娱乐互动"}),l.jsx(ze,{value:"Utility Tools",children:"实用工具"}),l.jsx(ze,{value:"Content Generation",children:"内容生成"}),l.jsx(ze,{value:"Multimedia",children:"多媒体"}),l.jsx(ze,{value:"External Integration",children:"外部集成"}),l.jsx(ze,{value:"Data Analysis & Insights",children:"数据分析与洞察"}),l.jsx(ze,{value:"Other",children:"其他"})]})]})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(ii,{id:"compatible-only",checked:h,onCheckedChange:R=>f(R===!0)}),l.jsx("label",{htmlFor:"compatible-only",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"只显示兼容当前版本的插件"})]})]})}),l.jsx(na,{value:o,onValueChange:c,className:"w-full",children:l.jsxs(_i,{className:"grid w-full grid-cols-3",children:[l.jsxs(Et,{value:"all",children:["全部插件 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return se&&G&&F}).length,")"]}),l.jsxs(Et,{value:"installed",children:["已安装 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&se&&G&&F}).length,")"]}),l.jsxs(Et,{value:"updates",children:["可更新 (",m.filter(R=>{if(!R.manifest)return!1;const se=r===""||R.manifest.name?.toLowerCase().includes(r.toLowerCase())||R.manifest.description?.toLowerCase().includes(r.toLowerCase())||R.manifest.keywords&&R.manifest.keywords.some(U=>U.toLowerCase().includes(r.toLowerCase())),G=i==="all"||R.manifest.categories&&R.manifest.categories.includes(i),F=!h||!_||ee(R);return R.installed&&z(R)&&se&&G&&F}).length,")"]})]})}),C&&C.stage==="loading"&&l.jsx(Tt,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(hh,{className:"h-4 w-4 animate-spin"}),l.jsxs("span",{className:"text-sm font-medium",children:[C.operation==="fetch"&&"加载插件列表",C.operation==="install"&&`安装插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="uninstall"&&`卸载插件${C.plugin_id?`: ${C.plugin_id}`:""}`,C.operation==="update"&&`更新插件${C.plugin_id?`: ${C.plugin_id}`:""}`]})]}),l.jsxs("span",{className:"text-sm font-medium",children:[C.progress,"%"]})]}),l.jsx(F0,{value:C.progress,className:"h-2"}),l.jsx("div",{className:"text-xs text-muted-foreground",children:C.message}),C.operation==="fetch"&&C.total_plugins>0&&l.jsxs("div",{className:"text-xs text-muted-foreground text-center",children:["已加载 ",C.loaded_plugins," / ",C.total_plugins," 个插件"]})]})}),C&&C.stage==="error"&&C.error&&l.jsx(Tt,{className:"border-destructive bg-destructive/10",children:l.jsx(vn,{children:l.jsxs("div",{className:"flex items-center gap-3",children:[l.jsx(ja,{className:"h-5 w-5 text-destructive"}),l.jsxs("div",{children:[l.jsx(yn,{className:"text-lg text-destructive",children:"加载失败"}),l.jsx(zr,{className:"text-destructive/80",children:C.error})]})]})})}),x?l.jsxs("div",{className:"flex items-center justify-center py-12",children:[l.jsx(hh,{className:"h-8 w-8 animate-spin text-muted-foreground"}),l.jsx("span",{className:"ml-3 text-muted-foreground",children:"加载插件列表中..."})]}):w?l.jsx(Tt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(ja,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:w}),l.jsx(fe,{onClick:()=>window.location.reload(),children:"重新加载"})]})}):H.length===0?l.jsx(Tt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(li,{className:"h-12 w-12 text-muted-foreground mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"未找到插件"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:r||i!=="all"?"尝试调整搜索条件或筛选器":"暂无可用插件"})]})}):l.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:H.map(R=>l.jsxs(Tt,{className:"flex flex-col hover:shadow-lg transition-shadow h-full",children:[l.jsxs(vn,{children:[l.jsxs("div",{className:"flex items-start justify-between gap-2",children:[l.jsx(yn,{className:"text-xl",children:R.manifest?.name||R.id}),l.jsxs("div",{className:"flex flex-col gap-1",children:[R.manifest?.categories&&R.manifest.categories[0]&&l.jsx(In,{variant:"secondary",className:"text-xs whitespace-nowrap",children:pD[R.manifest.categories[0]]||R.manifest.categories[0]}),V(R)]})]}),l.jsx(zr,{className:"line-clamp-2",children:R.manifest?.description||"无描述"})]}),l.jsx(En,{className:"flex-1",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(bu,{className:"h-4 w-4"}),l.jsx("span",{children:(q[R.id]?.downloads??R.downloads??0).toLocaleString()})]}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsx("span",{children:(q[R.id]?.rating??R.rating??0).toFixed(1)})]})]}),l.jsxs("div",{className:"flex flex-wrap gap-2",children:[R.manifest?.keywords&&R.manifest.keywords.slice(0,3).map(se=>l.jsx(In,{variant:"outline",className:"text-xs",children:se},se)),R.manifest?.keywords&&R.manifest.keywords.length>3&&l.jsxs(In,{variant:"outline",className:"text-xs",children:["+",R.manifest.keywords.length-3]})]}),l.jsxs("div",{className:"text-xs text-muted-foreground pt-2 border-t space-y-1",children:[l.jsxs("div",{children:["v",R.manifest?.version||"unknown"," · ",R.manifest?.author?.name||"Unknown"]}),R.manifest?.host_application&&l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx("span",{children:"支持:"}),l.jsxs("span",{className:"font-medium",children:[R.manifest.host_application.min_version,R.manifest.host_application.max_version?` - ${R.manifest.host_application.max_version}`:" - 最新版本"]})]})]})]})}),l.jsx(Uz,{className:"pt-4",children:l.jsxs("div",{className:"flex items-center justify-end gap-2 w-full",children:[l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>n(R),children:"查看详情"}),R.installed?z(R)?l.jsxs(fe,{size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>X(R),children:[l.jsx(ti,{className:"h-4 w-4 mr-1"}),"更新"]}):l.jsxs(fe,{variant:"destructive",size:"sm",disabled:!k?.installed,title:k?.installed?void 0:"Git 未安装",onClick:()=>J(R),children:[l.jsx(ln,{className:"h-4 w-4 mr-1"}),"卸载"]}):l.jsxs(fe,{size:"sm",disabled:!k?.installed||C?.operation==="install"||_!==null&&!ee(R),title:k?.installed?_!==null&&!ee(R)?`不兼容当前版本 (需要 ${R.manifest?.host_application?.min_version||"未知"}${R.manifest?.host_application?.max_version?` - ${R.manifest.host_application.max_version}`:"+"},当前 ${_?.version})`:void 0:"Git 未安装",onClick:()=>W(R),children:[l.jsx(bu,{className:"h-4 w-4 mr-1"}),C?.operation==="install"&&C?.plugin_id===R.id?"安装中...":"安装"]})]})})]},R.id))}),l.jsx(fr,{open:e!==null,onOpenChange:P,children:e&&e.manifest&&l.jsxs(rr,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[l.jsx(sr,{children:l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-2 flex-1",children:[l.jsx(ir,{className:"text-2xl",children:e.manifest.name}),l.jsxs(Ir,{children:["作者: ",e.manifest.author?.name||"Unknown",e.manifest.author?.url&&l.jsx("a",{href:e.manifest.author.url,target:"_blank",rel:"noopener noreferrer",className:"ml-2 text-primary hover:underline",children:l.jsx(Kd,{className:"h-3 w-3 inline"})})]})]}),l.jsxs("div",{className:"flex flex-col gap-2",children:[e.manifest.categories&&e.manifest.categories[0]&&l.jsx(In,{variant:"secondary",children:pD[e.manifest.categories[0]]||e.manifest.categories[0]}),V(e)]})]})}),l.jsxs("div",{className:"space-y-6",children:[l.jsx(F8e,{pluginId:e.id}),l.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:["v",e.manifest?.version||"unknown"]}),e.installed&&e.installed_version&&l.jsxs("p",{className:"text-xs text-muted-foreground",children:["已安装: v",e.installed_version]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"下载量"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:(q[e.id]?.downloads??e.downloads??0).toLocaleString()})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"评分"}),l.jsxs("div",{className:"flex items-center gap-1",children:[l.jsx(sc,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),l.jsxs("span",{className:"text-sm text-muted-foreground",children:[(q[e.id]?.rating??e.rating??0).toFixed(1)," (",q[e.id]?.rating_count??e.review_count??0,")"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium",children:"许可证"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.license||"Unknown"})]}),l.jsxs("div",{className:"col-span-2",children:[l.jsx("p",{className:"text-sm font-medium",children:"支持版本"}),l.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.manifest.host_application?.min_version||"未知",e.manifest.host_application?.max_version?` - ${e.manifest.host_application.max_version}`:" - 最新版本"]})]})]}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"关键词"}),l.jsx("div",{className:"flex flex-wrap gap-2",children:e.manifest.keywords&&e.manifest.keywords.map(R=>l.jsx(In,{variant:"outline",children:R},R))})]}),e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"详细说明"}),l.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-line",children:e.detailed_description})]}),!e.detailed_description&&l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium mb-2",children:"说明"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:e.manifest.description||"无描述"})]}),l.jsxs("div",{className:"space-y-2",children:[e.manifest.homepage_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"主页: "}),l.jsx("a",{href:e.manifest.homepage_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.homepage_url})]}),e.manifest.repository_url&&l.jsxs("div",{className:"text-sm",children:[l.jsx("span",{className:"font-medium",children:"仓库: "}),l.jsx("a",{href:e.manifest.repository_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:e.manifest.repository_url})]})]})]}),l.jsxs(ts,{children:[e.manifest.homepage_url&&l.jsxs(fe,{onClick:()=>window.open(e.manifest.homepage_url,"_blank"),children:[l.jsx(Kd,{className:"h-4 w-4 mr-2"}),"访问主页"]}),e.manifest.repository_url&&l.jsxs(fe,{variant:"outline",onClick:()=>window.open(e.manifest.repository_url,"_blank"),children:[l.jsx(Kd,{className:"h-4 w-4 mr-2"}),"查看仓库"]})]})]})})]})})}function Q8e(){return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-4 sm:space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"插件配置"}),l.jsx("p",{className:"text-muted-foreground mt-1 sm:mt-2 text-sm sm:text-base",children:"管理和配置已安装的插件"})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsxs(fe,{variant:"outline",size:"sm",children:[l.jsx(ti,{className:"h-4 w-4 mr-2"}),"刷新"]}),l.jsxs(fe,{size:"sm",children:[l.jsx(yu,{className:"h-4 w-4 mr-2"}),"全局设置"]})]})]}),l.jsxs("div",{className:"grid gap-4 grid-cols-1 xs:grid-cols-2 lg:grid-cols-4",children:[l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"已安装插件"}),l.jsx(mh,{className:"h-4 w-4 text-muted-foreground"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"正在加载..."})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"已启用"}),l.jsx(xc,{className:"h-4 w-4 text-green-600"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"运行中的插件"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"已禁用"}),l.jsx(ju,{className:"h-4 w-4 text-orange-600"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"未激活的插件"})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[l.jsx(yn,{className:"text-sm font-medium",children:"可更新"}),l.jsx(ti,{className:"h-4 w-4 text-blue-600"})]}),l.jsxs(En,{children:[l.jsx("div",{className:"text-2xl font-bold",children:"0"}),l.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"有新版本可用"})]})]})]}),l.jsxs(Tt,{children:[l.jsxs(vn,{children:[l.jsx(yn,{children:"已安装的插件"}),l.jsx(zr,{children:"查看和管理已安装插件的配置"})]}),l.jsx(En,{children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 space-y-4",children:[l.jsx(mh,{className:"h-16 w-16 text-muted-foreground/50"}),l.jsxs("div",{className:"text-center space-y-2",children:[l.jsx("p",{className:"text-lg font-medium text-muted-foreground",children:"插件配置功能开发中"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:"即将支持插件的启用/禁用、参数配置等功能"})]}),l.jsx("div",{className:"flex gap-2",children:l.jsx(fe,{variant:"outline",asChild:!0,children:l.jsxs("a",{href:"/plugins",children:[l.jsx(Kd,{className:"h-4 w-4 mr-2"}),"前往插件市场"]})})})]})})]}),l.jsx(Tt,{className:"border-blue-200 bg-blue-50 dark:bg-blue-950/20 dark:border-blue-900",children:l.jsx(En,{className:"pt-6",children:l.jsxs("div",{className:"flex items-start gap-3",children:[l.jsx(ju,{className:"h-5 w-5 text-blue-600 mt-0.5 flex-shrink-0"}),l.jsxs("div",{className:"space-y-1",children:[l.jsx("p",{className:"text-sm font-medium text-blue-900 dark:text-blue-100",children:"开发进行中"}),l.jsxs("p",{className:"text-sm text-blue-800 dark:text-blue-200",children:["插件配置功能正在积极开发中。目前您可以通过",l.jsx("strong",{children:"插件市场"}),"安装和卸载插件,完整的配置管理功能即将推出。"]})]})]})})})]})})}function H8e(){const t=Ma(),{toast:e}=Gr(),[n,r]=b.useState([]),[s,i]=b.useState(!0),[a,o]=b.useState(null),[c,h]=b.useState(null),[f,m]=b.useState(!1),[g,x]=b.useState(!1),[y,w]=b.useState({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S=b.useCallback(async()=>{try{i(!0),o(null);const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{headers:{Authorization:`Bearer ${M}`}});if(!q.ok)throw new Error("获取镜像源列表失败");const L=await q.json();r(L.mirrors||[])}catch(M){const q=M instanceof Error?M.message:"加载镜像源失败";o(q),e({title:"加载失败",description:q,variant:"destructive"})}finally{i(!1)}},[e]);b.useEffect(()=>{S()},[S]);const k=async()=>{try{const M=localStorage.getItem("access-token"),q=await fetch("/api/webui/plugins/mirrors",{method:"POST",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify(y)});if(!q.ok){const L=await q.json();throw new Error(L.detail||"添加镜像源失败")}e({title:"添加成功",description:"镜像源已添加"}),m(!1),w({id:"",name:"",raw_prefix:"",clone_prefix:"",enabled:!0,priority:1}),S()}catch(M){e({title:"添加失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},N=async()=>{if(c)try{const M=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${c.id}`,{method:"PUT",headers:{Authorization:`Bearer ${M}`,"Content-Type":"application/json"},body:JSON.stringify({name:y.name,raw_prefix:y.raw_prefix,clone_prefix:y.clone_prefix,enabled:y.enabled,priority:y.priority})})).ok)throw new Error("更新镜像源失败");e({title:"更新成功",description:"镜像源已更新"}),x(!1),h(null),S()}catch(M){e({title:"更新失败",description:M instanceof Error?M.message:"未知错误",variant:"destructive"})}},C=async M=>{if(confirm("确定要删除这个镜像源吗?"))try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M}`,{method:"DELETE",headers:{Authorization:`Bearer ${q}`}})).ok)throw new Error("删除镜像源失败");e({title:"删除成功",description:"镜像源已删除"}),S()}catch(q){e({title:"删除失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},T=async M=>{try{const q=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${q}`,"Content-Type":"application/json"},body:JSON.stringify({enabled:!M.enabled})})).ok)throw new Error("更新状态失败");S()}catch(q){e({title:"更新失败",description:q instanceof Error?q.message:"未知错误",variant:"destructive"})}},_=M=>{h(M),w({id:M.id,name:M.name,raw_prefix:M.raw_prefix,clone_prefix:M.clone_prefix,enabled:M.enabled,priority:M.priority}),x(!0)},E=async(M,q)=>{const L=q==="up"?M.priority-1:M.priority+1;if(!(L<1))try{const I=localStorage.getItem("access-token");if(!(await fetch(`/api/webui/plugins/mirrors/${M.id}`,{method:"PUT",headers:{Authorization:`Bearer ${I}`,"Content-Type":"application/json"},body:JSON.stringify({priority:L})})).ok)throw new Error("更新优先级失败");S()}catch(I){e({title:"更新失败",description:I instanceof Error?I.message:"未知错误",variant:"destructive"})}};return l.jsx(on,{className:"h-full",children:l.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[l.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>t({to:"/plugins"}),children:l.jsx(sz,{className:"h-5 w-5"})}),l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl sm:text-3xl font-bold",children:"镜像源配置"}),l.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"管理 Git 克隆和文件下载的镜像源"})]})]}),l.jsxs(fe,{onClick:()=>m(!0),children:[l.jsx(gs,{className:"h-4 w-4 mr-2"}),"添加镜像源"]})]}),s?l.jsx(Tt,{className:"p-6",children:l.jsx("div",{className:"flex items-center justify-center py-8",children:l.jsx(hh,{className:"h-8 w-8 animate-spin text-primary"})})}):a?l.jsx(Tt,{className:"p-6",children:l.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[l.jsx(ja,{className:"h-12 w-12 text-destructive mb-4"}),l.jsx("h3",{className:"text-lg font-semibold mb-2",children:"加载失败"}),l.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a}),l.jsx(fe,{onClick:S,children:"重新加载"})]})}):l.jsxs(Tt,{children:[l.jsx("div",{className:"hidden md:block",children:l.jsxs(Vh,{children:[l.jsx(Uh,{children:l.jsxs(ps,{children:[l.jsx(tn,{children:"状态"}),l.jsx(tn,{children:"名称"}),l.jsx(tn,{children:"ID"}),l.jsx(tn,{children:"优先级"}),l.jsx(tn,{className:"text-right",children:"操作"})]})}),l.jsx(Wh,{children:n.map(M=>l.jsxs(ps,{children:[l.jsx(It,{children:l.jsx(_t,{checked:M.enabled,onCheckedChange:()=>T(M)})}),l.jsx(It,{children:l.jsxs("div",{children:[l.jsx("div",{className:"font-medium",children:M.name}),l.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Raw: ",M.raw_prefix]})]})}),l.jsx(It,{children:l.jsx(In,{variant:"outline",children:M.id})}),l.jsx(It,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("span",{className:"font-mono",children:M.priority}),l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx(fe,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"up"),disabled:M.priority===1,children:l.jsx(Fm,{className:"h-3 w-3"})}),l.jsx(fe,{variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>E(M,"down"),children:l.jsx(Nu,{className:"h-3 w-3"})})]})]})}),l.jsx(It,{className:"text-right",children:l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>_(M),children:l.jsx(fh,{className:"h-4 w-4"})}),l.jsx(fe,{variant:"ghost",size:"icon",onClick:()=>C(M.id),children:l.jsx(ln,{className:"h-4 w-4 text-destructive"})})]})})]},M.id))})]})}),l.jsx("div",{className:"md:hidden p-4 space-y-4",children:n.map(M=>l.jsx(Tt,{className:"p-4",children:l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-start justify-between",children:[l.jsxs("div",{className:"flex-1",children:[l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx("h3",{className:"font-semibold",children:M.name}),M.enabled&&l.jsx(In,{variant:"default",className:"text-xs",children:"启用"})]}),l.jsx(In,{variant:"outline",className:"mt-1 text-xs",children:M.id})]}),l.jsx(_t,{checked:M.enabled,onCheckedChange:()=>T(M)})]}),l.jsxs("div",{className:"text-sm space-y-1",children:[l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"Raw: "}),l.jsx("span",{className:"break-all",children:M.raw_prefix})]}),l.jsxs("div",{className:"text-muted-foreground",children:[l.jsx("span",{className:"font-medium",children:"优先级: "}),l.jsx("span",{className:"font-mono",children:M.priority})]})]}),l.jsxs("div",{className:"flex items-center gap-2 pt-2 border-t",children:[l.jsxs(fe,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>_(M),children:[l.jsx(fh,{className:"h-4 w-4 mr-1"}),"编辑"]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>E(M,"up"),disabled:M.priority===1,children:l.jsx(Fm,{className:"h-4 w-4"})}),l.jsx(fe,{variant:"outline",size:"sm",onClick:()=>E(M,"down"),children:l.jsx(Nu,{className:"h-4 w-4"})}),l.jsx(fe,{variant:"destructive",size:"sm",onClick:()=>C(M.id),children:l.jsx(ln,{className:"h-4 w-4"})})]})]})},M.id))})]}),l.jsx(fr,{open:f,onOpenChange:m,children:l.jsxs(rr,{className:"max-w-lg",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"添加镜像源"}),l.jsx(Ir,{children:"添加新的 Git 镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-id",children:"镜像源 ID *"}),l.jsx(Pe,{id:"add-id",placeholder:"例如: my-mirror",value:y.id,onChange:M=>w({...y,id:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-name",children:"名称 *"}),l.jsx(Pe,{id:"add-name",placeholder:"例如: 我的镜像源",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-raw",children:"Raw 文件前缀 *"}),l.jsx(Pe,{id:"add-raw",placeholder:"https://example.com/raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-clone",children:"克隆前缀 *"}),l.jsx(Pe,{id:"add-clone",placeholder:"https://example.com/clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"add-priority",children:"优先级"}),l.jsx(Pe,{id:"add-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"add-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),l.jsx(de,{htmlFor:"add-enabled",children:"启用此镜像源"})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>m(!1),children:"取消"}),l.jsx(fe,{onClick:k,children:"添加"})]})]})}),l.jsx(fr,{open:g,onOpenChange:x,children:l.jsxs(rr,{className:"max-w-lg",children:[l.jsxs(sr,{children:[l.jsx(ir,{children:"编辑镜像源"}),l.jsx(Ir,{children:"修改镜像源配置"})]}),l.jsxs("div",{className:"space-y-4 py-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{children:"镜像源 ID"}),l.jsx(Pe,{value:y.id,disabled:!0})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-name",children:"名称 *"}),l.jsx(Pe,{id:"edit-name",value:y.name,onChange:M=>w({...y,name:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-raw",children:"Raw 文件前缀 *"}),l.jsx(Pe,{id:"edit-raw",value:y.raw_prefix,onChange:M=>w({...y,raw_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-clone",children:"克隆前缀 *"}),l.jsx(Pe,{id:"edit-clone",value:y.clone_prefix,onChange:M=>w({...y,clone_prefix:M.target.value})})]}),l.jsxs("div",{className:"space-y-2",children:[l.jsx(de,{htmlFor:"edit-priority",children:"优先级"}),l.jsx(Pe,{id:"edit-priority",type:"number",min:"1",value:y.priority,onChange:M=>w({...y,priority:parseInt(M.target.value)||1})}),l.jsx("p",{className:"text-xs text-muted-foreground",children:"数字越小优先级越高"})]}),l.jsxs("div",{className:"flex items-center space-x-2",children:[l.jsx(_t,{id:"edit-enabled",checked:y.enabled,onCheckedChange:M=>w({...y,enabled:M})}),l.jsx(de,{htmlFor:"edit-enabled",children:"启用此镜像源"})]})]}),l.jsxs(ts,{children:[l.jsx(fe,{variant:"outline",onClick:()=>x(!1),children:"取消"}),l.jsx(fe,{onClick:N,children:"保存"})]})]})})]})})}const V8e=Ih("pointer-events-none inline-flex select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono font-medium opacity-100",{variants:{size:{sm:"h-5 text-[10px]",default:"h-6 text-xs",lg:"h-7 text-sm"}},defaultVariants:{size:"default"}}),dU=b.forwardRef(({className:t,size:e,abbrTitle:n,children:r,...s},i)=>l.jsx("kbd",{className:ye(V8e({size:e,className:t})),ref:i,...s,children:n?l.jsx("abbr",{title:n,children:r}):r}));dU.displayName="Kbd";const U8e=[{icon:qm,title:"首页",description:"查看仪表板概览",path:"/",category:"概览"},{icon:io,title:"麦麦主程序配置",description:"配置麦麦的核心设置",path:"/config/bot",category:"配置"},{icon:lz,title:"麦麦模型提供商配置",description:"配置模型提供商",path:"/config/modelProvider",category:"配置"},{icon:oz,title:"麦麦模型配置",description:"配置模型参数",path:"/config/model",category:"配置"},{icon:Jk,title:"表情包管理",description:"管理麦麦的表情包",path:"/resource/emoji",category:"资源"},{icon:A0,title:"表达方式管理",description:"管理麦麦的表达方式",path:"/resource/expression",category:"资源"},{icon:cz,title:"人物信息管理",description:"管理人物信息",path:"/resource/person",category:"资源"},{icon:GK,title:"统计信息",description:"查看使用统计",path:"/statistics",category:"监控"},{icon:mh,title:"插件市场",description:"浏览和安装插件",path:"/plugins",category:"扩展"},{icon:j1,title:"日志查看器",description:"查看系统日志",path:"/logs",category:"监控"},{icon:yu,title:"系统设置",description:"配置系统参数",path:"/settings",category:"系统"}];function W8e({open:t,onOpenChange:e}){const[n,r]=b.useState(""),[s,i]=b.useState(0),a=Ma(),o=U8e.filter(f=>f.title.toLowerCase().includes(n.toLowerCase())||f.description.toLowerCase().includes(n.toLowerCase())||f.category.toLowerCase().includes(n.toLowerCase()));b.useEffect(()=>{t&&(r(""),i(0))},[t]);const c=b.useCallback(f=>{a({to:f}),e(!1)},[a,e]),h=b.useCallback(f=>{f.key==="ArrowDown"?(f.preventDefault(),i(m=>(m+1)%o.length)):f.key==="ArrowUp"?(f.preventDefault(),i(m=>(m-1+o.length)%o.length)):f.key==="Enter"&&o[s]&&(f.preventDefault(),c(o[s].path))},[o,s,c]);return l.jsx(fr,{open:t,onOpenChange:e,children:l.jsxs(rr,{className:"max-w-2xl p-0 gap-0",children:[l.jsxs(sr,{className:"px-4 pt-4 pb-0",children:[l.jsx(ir,{className:"sr-only",children:"搜索"}),l.jsxs("div",{className:"relative",children:[l.jsx(li,{className:"absolute left-3 top-1/2 h-5 w-5 -translate-y-1/2 text-muted-foreground"}),l.jsx(Pe,{value:n,onChange:f=>{r(f.target.value),i(0)},onKeyDown:h,placeholder:"搜索页面...",className:"h-12 pl-11 text-base border-0 focus-visible:ring-0 shadow-none",autoFocus:!0})]})]}),l.jsx("div",{className:"border-t",children:l.jsx(on,{className:"h-[400px]",children:o.length>0?l.jsx("div",{className:"p-2",children:o.map((f,m)=>{const g=f.icon;return l.jsxs("button",{onClick:()=>c(f.path),onMouseEnter:()=>i(m),className:ye("w-full flex items-center gap-3 px-3 py-2.5 rounded-md text-left transition-colors",m===s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),children:[l.jsx(g,{className:"h-5 w-5 flex-shrink-0"}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("div",{className:"font-medium text-sm",children:f.title}),l.jsx("div",{className:"text-xs text-muted-foreground truncate",children:f.description})]}),l.jsx("div",{className:"text-xs text-muted-foreground px-2 py-1 bg-muted rounded",children:f.category})]},f.path)})}):l.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[l.jsx(li,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),l.jsx("p",{className:"text-sm text-muted-foreground",children:n?"未找到匹配的页面":"输入关键词开始搜索"})]})})}),l.jsx("div",{className:"border-t px-4 py-3 flex items-center justify-between text-xs text-muted-foreground",children:l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↑"}),l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"↓"}),"导航"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Enter"}),"选择"]}),l.jsxs("span",{className:"flex items-center gap-1",children:[l.jsx("kbd",{className:"px-1.5 py-0.5 bg-muted rounded border",children:"Esc"}),"关闭"]})]})})]})})}function G8e(t){const e=X8e(t),n=b.forwardRef((r,s)=>{const{children:i,...a}=r,o=b.Children.toArray(i),c=o.find(K8e);if(c){const h=c.props.children,f=o.map(m=>m===c?b.Children.count(h)>1?b.Children.only(null):b.isValidElement(h)?h.props.children:null:m);return l.jsx(e,{...a,ref:s,children:b.isValidElement(h)?b.cloneElement(h,void 0,f):null})}return l.jsx(e,{...a,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}function X8e(t){const e=b.forwardRef((n,r)=>{const{children:s,...i}=n;if(b.isValidElement(s)){const a=J8e(s),o=Z8e(i,s.props);return s.type!==b.Fragment&&(o.ref=r?gc(r,a):a),b.cloneElement(s,o)}return b.Children.count(s)>1?b.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Y8e=Symbol("radix.slottable");function K8e(t){return b.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Y8e}function Z8e(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...o)=>{const c=i(...o);return s(...o),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function J8e(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Ek=["Enter"," "],eCe=["ArrowDown","PageUp","Home"],hU=["ArrowUp","PageDown","End"],tCe=[...eCe,...hU],nCe={ltr:[...Ek,"ArrowRight"],rtl:[...Ek,"ArrowLeft"]},rCe={ltr:["ArrowLeft"],rtl:["ArrowRight"]},yp="Menu",[T0,sCe,iCe]=jv(yp),[Uu,fU]=ua(yp,[iCe,Rh,Bv]),bp=Rh(),mU=Bv(),[pU,Lc]=Uu(yp),[aCe,wp]=Uu(yp),gU=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:a=!0}=t,o=bp(e),[c,h]=b.useState(null),f=b.useRef(!1),m=bs(i),g=M0(s);return b.useEffect(()=>{const x=()=>{f.current=!0,document.addEventListener("pointerdown",y,{capture:!0,once:!0}),document.addEventListener("pointermove",y,{capture:!0,once:!0})},y=()=>f.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",y,{capture:!0}),document.removeEventListener("pointermove",y,{capture:!0})}},[]),l.jsx(_v,{...o,children:l.jsx(pU,{scope:e,open:n,onOpenChange:m,content:c,onContentChange:h,children:l.jsx(aCe,{scope:e,onClose:b.useCallback(()=>m(!1),[m]),isUsingKeyboardRef:f,dir:g,modal:a,children:r})})})};gU.displayName=yp;var lCe="MenuAnchor",Aj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=bp(n);return l.jsx(Mv,{...s,...r,ref:e})});Aj.displayName=lCe;var Rj="MenuPortal",[oCe,xU]=Uu(Rj,{forceMount:void 0}),vU=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=Lc(Rj,e);return l.jsx(oCe,{scope:e,forceMount:n,children:l.jsx(Ps,{present:n||i.open,children:l.jsx(Ev,{asChild:!0,container:s,children:r})})})};vU.displayName=Rj;var ia="MenuContent",[cCe,Dj]=Uu(ia),yU=b.forwardRef((t,e)=>{const n=xU(ia,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Lc(ia,t.__scopeMenu),a=wp(ia,t.__scopeMenu);return l.jsx(T0.Provider,{scope:t.__scopeMenu,children:l.jsx(Ps,{present:r||i.open,children:l.jsx(T0.Slot,{scope:t.__scopeMenu,children:a.modal?l.jsx(uCe,{...s,ref:e}):l.jsx(dCe,{...s,ref:e})})})})}),uCe=b.forwardRef((t,e)=>{const n=Lc(ia,t.__scopeMenu),r=b.useRef(null),s=Dn(e,r);return b.useEffect(()=>{const i=r.current;if(i)return GD(i)},[]),l.jsx(zj,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Ze(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),dCe=b.forwardRef((t,e)=>{const n=Lc(ia,t.__scopeMenu);return l.jsx(zj,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),hCe=G8e("MenuContent.ScrollLock"),zj=b.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEntryFocus:c,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,disableOutsideScroll:y,...w}=t,S=Lc(ia,n),k=wp(ia,n),N=bp(n),C=mU(n),T=sCe(n),[_,E]=b.useState(null),M=b.useRef(null),q=Dn(e,M,S.onContentChange),L=b.useRef(0),I=b.useRef(""),$=b.useRef(0),V=b.useRef(null),ee=b.useRef("right"),z=b.useRef(0),H=y?XD:b.Fragment,P=y?{as:hCe,allowPinchZoom:!0}:void 0,W=X=>{const R=I.current+X,se=T().filter(Y=>!Y.disabled),G=document.activeElement,F=se.find(Y=>Y.ref.current===G)?.textValue,U=se.map(Y=>Y.textValue),te=OCe(U,R,F),ne=se.find(Y=>Y.textValue===te)?.ref.current;(function Y(ae){I.current=ae,window.clearTimeout(L.current),ae!==""&&(L.current=window.setTimeout(()=>Y(""),1e3))})(R),ne&&setTimeout(()=>ne.focus())};b.useEffect(()=>()=>window.clearTimeout(L.current),[]),YD();const J=b.useCallback(X=>ee.current===V.current?.side&&NCe(X,V.current?.area),[]);return l.jsx(cCe,{scope:n,searchRef:I,onItemEnter:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),onItemLeave:b.useCallback(X=>{J(X)||(M.current?.focus(),E(null))},[J]),onTriggerLeave:b.useCallback(X=>{J(X)&&X.preventDefault()},[J]),pointerGraceTimerRef:$,onPointerGraceIntentChange:b.useCallback(X=>{V.current=X},[]),children:l.jsx(H,{...P,children:l.jsx(KD,{asChild:!0,trapped:s,onMountAutoFocus:Ze(i,X=>{X.preventDefault(),M.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:l.jsx(Yk,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:h,onPointerDownOutside:f,onFocusOutside:m,onInteractOutside:g,onDismiss:x,children:l.jsx(Zz,{asChild:!0,...C,dir:k.dir,orientation:"vertical",loop:r,currentTabStopId:_,onCurrentTabStopIdChange:E,onEntryFocus:Ze(c,X=>{k.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Kk,{role:"menu","aria-orientation":"vertical","data-state":PU(S.open),"data-radix-menu-content":"",dir:k.dir,...N,...w,ref:q,style:{outline:"none",...w.style},onKeyDown:Ze(w.onKeyDown,X=>{const se=X.target.closest("[data-radix-menu-content]")===X.currentTarget,G=X.ctrlKey||X.altKey||X.metaKey,F=X.key.length===1;se&&(X.key==="Tab"&&X.preventDefault(),!G&&F&&W(X.key));const U=M.current;if(X.target!==U||!tCe.includes(X.key))return;X.preventDefault();const ne=T().filter(Y=>!Y.disabled).map(Y=>Y.ref.current);hU.includes(X.key)&&ne.reverse(),SCe(ne)}),onBlur:Ze(t.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(L.current),I.current="")}),onPointerMove:Ze(t.onPointerMove,E0(X=>{const R=X.target,se=z.current!==X.clientX;if(X.currentTarget.contains(R)&&se){const G=X.clientX>z.current?"right":"left";ee.current=G,z.current=X.clientX}}))})})})})})})});yU.displayName=ia;var fCe="MenuGroup",Pj=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(nn.div,{role:"group",...r,ref:e})});Pj.displayName=fCe;var mCe="MenuLabel",bU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(nn.div,{...r,ref:e})});bU.displayName=mCe;var wv="MenuItem",gD="menu.itemSelect",zy=b.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=b.useRef(null),a=wp(wv,t.__scopeMenu),o=Dj(wv,t.__scopeMenu),c=Dn(e,i),h=b.useRef(!1),f=()=>{const m=i.current;if(!n&&m){const g=new CustomEvent(gD,{bubbles:!0,cancelable:!0});m.addEventListener(gD,x=>r?.(x),{once:!0}),JD(m,g),g.defaultPrevented?h.current=!1:a.onClose()}};return l.jsx(wU,{...s,ref:c,disabled:n,onClick:Ze(t.onClick,f),onPointerDown:m=>{t.onPointerDown?.(m),h.current=!0},onPointerUp:Ze(t.onPointerUp,m=>{h.current||m.currentTarget?.click()}),onKeyDown:Ze(t.onKeyDown,m=>{const g=o.searchRef.current!=="";n||g&&m.key===" "||Ek.includes(m.key)&&(m.currentTarget.click(),m.preventDefault())})})});zy.displayName=wv;var wU=b.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,a=Dj(wv,n),o=mU(n),c=b.useRef(null),h=Dn(e,c),[f,m]=b.useState(!1),[g,x]=b.useState("");return b.useEffect(()=>{const y=c.current;y&&x((y.textContent??"").trim())},[i.children]),l.jsx(T0.ItemSlot,{scope:n,disabled:r,textValue:s??g,children:l.jsx(Jz,{asChild:!0,...o,focusable:!r,children:l.jsx(nn.div,{role:"menuitem","data-highlighted":f?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:h,onPointerMove:Ze(t.onPointerMove,E0(y=>{r?a.onItemLeave(y):(a.onItemEnter(y),y.defaultPrevented||y.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ze(t.onPointerLeave,E0(y=>a.onItemLeave(y))),onFocus:Ze(t.onFocus,()=>m(!0)),onBlur:Ze(t.onBlur,()=>m(!1))})})})}),pCe="MenuCheckboxItem",SU=b.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return l.jsx(CU,{scope:t.__scopeMenu,checked:n,children:l.jsx(zy,{role:"menuitemcheckbox","aria-checked":Sv(n)?"mixed":n,...s,ref:e,"data-state":Bj(n),onSelect:Ze(s.onSelect,()=>r?.(Sv(n)?!0:!n),{checkForDefaultPrevented:!1})})})});SU.displayName=pCe;var kU="MenuRadioGroup",[gCe,xCe]=Uu(kU,{value:void 0,onValueChange:()=>{}}),OU=b.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=bs(r);return l.jsx(gCe,{scope:t.__scopeMenu,value:n,onValueChange:i,children:l.jsx(Pj,{...s,ref:e})})});OU.displayName=kU;var jU="MenuRadioItem",NU=b.forwardRef((t,e)=>{const{value:n,...r}=t,s=xCe(jU,t.__scopeMenu),i=n===s.value;return l.jsx(CU,{scope:t.__scopeMenu,checked:i,children:l.jsx(zy,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":Bj(i),onSelect:Ze(r.onSelect,()=>s.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});NU.displayName=jU;var Lj="MenuItemIndicator",[CU,vCe]=Uu(Lj,{checked:!1}),TU=b.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=vCe(Lj,n);return l.jsx(Ps,{present:r||Sv(i.checked)||i.checked===!0,children:l.jsx(nn.span,{...s,ref:e,"data-state":Bj(i.checked)})})});TU.displayName=Lj;var yCe="MenuSeparator",EU=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return l.jsx(nn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});EU.displayName=yCe;var bCe="MenuArrow",_U=b.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=bp(n);return l.jsx(Zk,{...s,...r,ref:e})});_U.displayName=bCe;var Ij="MenuSub",[wCe,MU]=Uu(Ij),AU=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=Lc(Ij,e),a=bp(e),[o,c]=b.useState(null),[h,f]=b.useState(null),m=bs(s);return b.useEffect(()=>(i.open===!1&&m(!1),()=>m(!1)),[i.open,m]),l.jsx(_v,{...a,children:l.jsx(pU,{scope:e,open:r,onOpenChange:m,content:h,onContentChange:f,children:l.jsx(wCe,{scope:e,contentId:Ei(),triggerId:Ei(),trigger:o,onTriggerChange:c,children:n})})})};AU.displayName=Ij;var km="MenuSubTrigger",RU=b.forwardRef((t,e)=>{const n=Lc(km,t.__scopeMenu),r=wp(km,t.__scopeMenu),s=MU(km,t.__scopeMenu),i=Dj(km,t.__scopeMenu),a=b.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:c}=i,h={__scopeMenu:t.__scopeMenu},f=b.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return b.useEffect(()=>f,[f]),b.useEffect(()=>{const m=o.current;return()=>{window.clearTimeout(m),c(null)}},[o,c]),l.jsx(Aj,{asChild:!0,...h,children:l.jsx(wU,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":PU(n.open),...t,ref:gc(e,s.onTriggerChange),onClick:m=>{t.onClick?.(m),!(t.disabled||m.defaultPrevented)&&(m.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Ze(t.onPointerMove,E0(m=>{i.onItemEnter(m),!m.defaultPrevented&&!t.disabled&&!n.open&&!a.current&&(i.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{n.onOpenChange(!0),f()},100))})),onPointerLeave:Ze(t.onPointerLeave,E0(m=>{f();const g=n.content?.getBoundingClientRect();if(g){const x=n.content?.dataset.side,y=x==="right",w=y?-5:5,S=g[y?"left":"right"],k=g[y?"right":"left"];i.onPointerGraceIntentChange({area:[{x:m.clientX+w,y:m.clientY},{x:S,y:g.top},{x:k,y:g.top},{x:k,y:g.bottom},{x:S,y:g.bottom}],side:x}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(m),m.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Ze(t.onKeyDown,m=>{const g=i.searchRef.current!=="";t.disabled||g&&m.key===" "||nCe[r.dir].includes(m.key)&&(n.onOpenChange(!0),n.content?.focus(),m.preventDefault())})})})});RU.displayName=km;var DU="MenuSubContent",zU=b.forwardRef((t,e)=>{const n=xU(ia,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=Lc(ia,t.__scopeMenu),a=wp(ia,t.__scopeMenu),o=MU(DU,t.__scopeMenu),c=b.useRef(null),h=Dn(e,c);return l.jsx(T0.Provider,{scope:t.__scopeMenu,children:l.jsx(Ps,{present:r||i.open,children:l.jsx(T0.Slot,{scope:t.__scopeMenu,children:l.jsx(zj,{id:o.contentId,"aria-labelledby":o.triggerId,...s,ref:h,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:f=>{a.isUsingKeyboardRef.current&&c.current?.focus(),f.preventDefault()},onCloseAutoFocus:f=>f.preventDefault(),onFocusOutside:Ze(t.onFocusOutside,f=>{f.target!==o.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Ze(t.onEscapeKeyDown,f=>{a.onClose(),f.preventDefault()}),onKeyDown:Ze(t.onKeyDown,f=>{const m=f.currentTarget.contains(f.target),g=rCe[a.dir].includes(f.key);m&&g&&(i.onOpenChange(!1),o.trigger?.focus(),f.preventDefault())})})})})})});zU.displayName=DU;function PU(t){return t?"open":"closed"}function Sv(t){return t==="indeterminate"}function Bj(t){return Sv(t)?"indeterminate":t?"checked":"unchecked"}function SCe(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function kCe(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function OCe(t,e,n){const s=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let a=kCe(t,Math.max(i,0));s.length===1&&(a=a.filter(h=>h!==n));const c=a.find(h=>h.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function jCe(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function NCe(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return jCe(n,e)}function E0(t){return e=>e.pointerType==="mouse"?t(e):void 0}var CCe=gU,TCe=Aj,ECe=vU,_Ce=yU,MCe=Pj,ACe=bU,RCe=zy,DCe=SU,zCe=OU,PCe=NU,LCe=TU,ICe=EU,BCe=_U,qCe=AU,FCe=RU,$Ce=zU,qj="ContextMenu",[QCe]=ua(qj,[fU]),Ns=fU(),[HCe,LU]=QCe(qj),IU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,dir:s,modal:i=!0}=t,[a,o]=b.useState(!1),c=Ns(e),h=bs(r),f=b.useCallback(m=>{o(m),h(m)},[h]);return l.jsx(HCe,{scope:e,open:a,onOpenChange:f,modal:i,children:l.jsx(CCe,{...c,dir:s,open:a,onOpenChange:f,modal:i,children:n})})};IU.displayName=qj;var BU="ContextMenuTrigger",qU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,disabled:r=!1,...s}=t,i=LU(BU,n),a=Ns(n),o=b.useRef({x:0,y:0}),c=b.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),h=b.useRef(0),f=b.useCallback(()=>window.clearTimeout(h.current),[]),m=g=>{o.current={x:g.clientX,y:g.clientY},i.onOpenChange(!0)};return b.useEffect(()=>f,[f]),b.useEffect(()=>void(r&&f()),[r,f]),l.jsxs(l.Fragment,{children:[l.jsx(TCe,{...a,virtualRef:c}),l.jsx(nn.span,{"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,...s,ref:e,style:{WebkitTouchCallout:"none",...t.style},onContextMenu:r?t.onContextMenu:Ze(t.onContextMenu,g=>{f(),m(g),g.preventDefault()}),onPointerDown:r?t.onPointerDown:Ze(t.onPointerDown,Wx(g=>{f(),h.current=window.setTimeout(()=>m(g),700)})),onPointerMove:r?t.onPointerMove:Ze(t.onPointerMove,Wx(f)),onPointerCancel:r?t.onPointerCancel:Ze(t.onPointerCancel,Wx(f)),onPointerUp:r?t.onPointerUp:Ze(t.onPointerUp,Wx(f))})]})});qU.displayName=BU;var VCe="ContextMenuPortal",FU=t=>{const{__scopeContextMenu:e,...n}=t,r=Ns(e);return l.jsx(ECe,{...r,...n})};FU.displayName=VCe;var $U="ContextMenuContent",QU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=LU($U,n),i=Ns(n),a=b.useRef(!1);return l.jsx(_Ce,{...i,...r,ref:e,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:o=>{t.onCloseAutoFocus?.(o),!o.defaultPrevented&&a.current&&o.preventDefault(),a.current=!1},onInteractOutside:o=>{t.onInteractOutside?.(o),!o.defaultPrevented&&!s.modal&&(a.current=!0)},style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});QU.displayName=$U;var UCe="ContextMenuGroup",WCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(MCe,{...s,...r,ref:e})});WCe.displayName=UCe;var GCe="ContextMenuLabel",HU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(ACe,{...s,...r,ref:e})});HU.displayName=GCe;var XCe="ContextMenuItem",VU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(RCe,{...s,...r,ref:e})});VU.displayName=XCe;var YCe="ContextMenuCheckboxItem",UU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(DCe,{...s,...r,ref:e})});UU.displayName=YCe;var KCe="ContextMenuRadioGroup",ZCe=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(zCe,{...s,...r,ref:e})});ZCe.displayName=KCe;var JCe="ContextMenuRadioItem",WU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(PCe,{...s,...r,ref:e})});WU.displayName=JCe;var e9e="ContextMenuItemIndicator",GU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(LCe,{...s,...r,ref:e})});GU.displayName=e9e;var t9e="ContextMenuSeparator",XU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(ICe,{...s,...r,ref:e})});XU.displayName=t9e;var n9e="ContextMenuArrow",r9e=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(BCe,{...s,...r,ref:e})});r9e.displayName=n9e;var YU="ContextMenuSub",KU=t=>{const{__scopeContextMenu:e,children:n,onOpenChange:r,open:s,defaultOpen:i}=t,a=Ns(e),[o,c]=wo({prop:s,defaultProp:i??!1,onChange:r,caller:YU});return l.jsx(qCe,{...a,open:o,onOpenChange:c,children:n})};KU.displayName=YU;var s9e="ContextMenuSubTrigger",ZU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx(FCe,{...s,...r,ref:e})});ZU.displayName=s9e;var i9e="ContextMenuSubContent",JU=b.forwardRef((t,e)=>{const{__scopeContextMenu:n,...r}=t,s=Ns(n);return l.jsx($Ce,{...s,...r,ref:e,style:{...t.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});JU.displayName=i9e;function Wx(t){return e=>e.pointerType!=="mouse"?t(e):void 0}var a9e=IU,l9e=qU,o9e=FU,eW=QU,tW=HU,nW=VU,rW=UU,sW=WU,iW=GU,aW=XU,c9e=KU,lW=ZU,oW=JU;const u9e=a9e,d9e=l9e,h9e=c9e,cW=b.forwardRef(({className:t,inset:e,children:n,...r},s)=>l.jsxs(lW,{ref:s,className:ye("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...r,children:[n,l.jsx(Fu,{className:"ml-auto h-4 w-4"})]}));cW.displayName=lW.displayName;const uW=b.forwardRef(({className:t,...e},n)=>l.jsx(oW,{ref:n,className:ye("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e}));uW.displayName=oW.displayName;const dW=b.forwardRef(({className:t,...e},n)=>l.jsx(o9e,{children:l.jsx(eW,{ref:n,className:ye("z-50 max-h-[--radix-context-menu-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-context-menu-content-transform-origin]",t),...e})}));dW.displayName=eW.displayName;const ba=b.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(nW,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",t),...n}));ba.displayName=nW.displayName;const f9e=b.forwardRef(({className:t,children:e,checked:n,...r},s)=>l.jsxs(rW,{ref:s,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(iW,{children:l.jsx(so,{className:"h-4 w-4"})})}),e]}));f9e.displayName=rW.displayName;const m9e=b.forwardRef(({className:t,children:e,...n},r)=>l.jsxs(sW,{ref:r,className:ye("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[l.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(iW,{children:l.jsx(XK,{className:"h-2 w-2 fill-current"})})}),e]}));m9e.displayName=sW.displayName;const p9e=b.forwardRef(({className:t,inset:e,...n},r)=>l.jsx(tW,{ref:r,className:ye("px-2 py-1.5 text-sm font-semibold text-foreground",e&&"pl-8",t),...n}));p9e.displayName=tW.displayName;const Om=b.forwardRef(({className:t,...e},n)=>l.jsx(aW,{ref:n,className:ye("-mx-1 my-1 h-px bg-border",t),...e}));Om.displayName=aW.displayName;const Vd=({className:t,...e})=>l.jsx("span",{className:ye("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Vd.displayName="ContextMenuShortcut";var g9e=Symbol("radix.slottable");function x9e(t){const e=({children:n})=>l.jsx(l.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=g9e,e}var[Py]=ua("Tooltip",[Rh]),Ly=Rh(),hW="TooltipProvider",v9e=700,_k="tooltip.open",[y9e,Fj]=Py(hW),fW=t=>{const{__scopeTooltip:e,delayDuration:n=v9e,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,a=b.useRef(!0),o=b.useRef(!1),c=b.useRef(0);return b.useEffect(()=>{const h=c.current;return()=>window.clearTimeout(h)},[]),l.jsx(y9e,{scope:e,isOpenDelayedRef:a,delayDuration:n,onOpen:b.useCallback(()=>{window.clearTimeout(c.current),a.current=!1},[]),onClose:b.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r)},[r]),isPointerInTransitRef:o,onPointerInTransitChange:b.useCallback(h=>{o.current=h},[]),disableHoverableContent:s,children:i})};fW.displayName=hW;var _0="Tooltip",[b9e,Sp]=Py(_0),mW=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:a,delayDuration:o}=t,c=Fj(_0,t.__scopeTooltip),h=Ly(e),[f,m]=b.useState(null),g=Ei(),x=b.useRef(0),y=a??c.disableHoverableContent,w=o??c.delayDuration,S=b.useRef(!1),[k,N]=wo({prop:r,defaultProp:s??!1,onChange:M=>{M?(c.onOpen(),document.dispatchEvent(new CustomEvent(_k))):c.onClose(),i?.(M)},caller:_0}),C=b.useMemo(()=>k?S.current?"delayed-open":"instant-open":"closed",[k]),T=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,S.current=!1,N(!0)},[N]),_=b.useCallback(()=>{window.clearTimeout(x.current),x.current=0,N(!1)},[N]),E=b.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{S.current=!0,N(!0),x.current=0},w)},[w,N]);return b.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),l.jsx(_v,{...h,children:l.jsx(b9e,{scope:e,contentId:g,open:k,stateAttribute:C,trigger:f,onTriggerChange:m,onTriggerEnter:b.useCallback(()=>{c.isOpenDelayedRef.current?E():T()},[c.isOpenDelayedRef,E,T]),onTriggerLeave:b.useCallback(()=>{y?_():(window.clearTimeout(x.current),x.current=0)},[_,y]),onOpen:T,onClose:_,disableHoverableContent:y,children:n})})};mW.displayName=_0;var Mk="TooltipTrigger",pW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Sp(Mk,n),i=Fj(Mk,n),a=Ly(n),o=b.useRef(null),c=Dn(e,o,s.onTriggerChange),h=b.useRef(!1),f=b.useRef(!1),m=b.useCallback(()=>h.current=!1,[]);return b.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),l.jsx(Mv,{asChild:!0,...a,children:l.jsx(nn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Ze(t.onPointerMove,g=>{g.pointerType!=="touch"&&!f.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:Ze(t.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:Ze(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Ze(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Ze(t.onBlur,s.onClose),onClick:Ze(t.onClick,s.onClose)})})});pW.displayName=Mk;var $j="TooltipPortal",[w9e,S9e]=Py($j,{forceMount:void 0}),gW=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=Sp($j,e);return l.jsx(w9e,{scope:e,forceMount:n,children:l.jsx(Ps,{present:n||i.open,children:l.jsx(Ev,{asChild:!0,container:s,children:r})})})};gW.displayName=$j;var Ah="TooltipContent",xW=b.forwardRef((t,e)=>{const n=S9e(Ah,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,a=Sp(Ah,t.__scopeTooltip);return l.jsx(Ps,{present:r||a.open,children:a.disableHoverableContent?l.jsx(vW,{side:s,...i,ref:e}):l.jsx(k9e,{side:s,...i,ref:e})})}),k9e=b.forwardRef((t,e)=>{const n=Sp(Ah,t.__scopeTooltip),r=Fj(Ah,t.__scopeTooltip),s=b.useRef(null),i=Dn(e,s),[a,o]=b.useState(null),{trigger:c,onClose:h}=n,f=s.current,{onPointerInTransitChange:m}=r,g=b.useCallback(()=>{o(null),m(!1)},[m]),x=b.useCallback((y,w)=>{const S=y.currentTarget,k={x:y.clientX,y:y.clientY},N=T9e(k,S.getBoundingClientRect()),C=E9e(k,N),T=_9e(w.getBoundingClientRect()),_=A9e([...C,...T]);o(_),m(!0)},[m]);return b.useEffect(()=>()=>g(),[g]),b.useEffect(()=>{if(c&&f){const y=S=>x(S,f),w=S=>x(S,c);return c.addEventListener("pointerleave",y),f.addEventListener("pointerleave",w),()=>{c.removeEventListener("pointerleave",y),f.removeEventListener("pointerleave",w)}}},[c,f,x,g]),b.useEffect(()=>{if(a){const y=w=>{const S=w.target,k={x:w.clientX,y:w.clientY},N=c?.contains(S)||f?.contains(S),C=!M9e(k,a);N?g():C&&(g(),h())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,f,a,h,g]),l.jsx(vW,{...t,ref:i})}),[O9e,j9e]=Py(_0,{isInside:!1}),N9e=x9e("TooltipContent"),vW=b.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:a,...o}=t,c=Sp(Ah,n),h=Ly(n),{onClose:f}=c;return b.useEffect(()=>(document.addEventListener(_k,f),()=>document.removeEventListener(_k,f)),[f]),b.useEffect(()=>{if(c.trigger){const m=g=>{g.target?.contains(c.trigger)&&f()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[c.trigger,f]),l.jsx(Yk,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:m=>m.preventDefault(),onDismiss:f,children:l.jsxs(Kk,{"data-state":c.stateAttribute,...h,...o,ref:e,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[l.jsx(N9e,{children:r}),l.jsx(O9e,{scope:n,isInside:!0,children:l.jsx(kK,{id:c.contentId,role:"tooltip",children:s||r})})]})})});xW.displayName=Ah;var yW="TooltipArrow",C9e=b.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=Ly(n);return j9e(yW,n).isInside?null:l.jsx(Zk,{...s,...r,ref:e})});C9e.displayName=yW;function T9e(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function E9e(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function _9e(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function M9e(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,a=e.length-1;ir!=g>r&&n<(m-h)*(r-f)/(g-f)+h&&(s=!s)}return s}function A9e(t){const e=t.slice();return e.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),R9e(e)}function R9e(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r=2;){const i=e[e.length-1],a=e[e.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],a=n[n.length-2];if((i.x-a.x)*(s.y-a.y)>=(i.y-a.y)*(s.x-a.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var D9e=fW,z9e=mW,P9e=pW,L9e=gW,bW=xW;const I9e=D9e,B9e=z9e,q9e=P9e,wW=b.forwardRef(({className:t,sideOffset:e=4,...n},r)=>l.jsx(L9e,{children:l.jsx(bW,{ref:r,sideOffset:e,className:ye("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin]",t),...n})}));wW.displayName=bW.displayName;function F9e({children:t}){Gte();const[e,n]=b.useState(!0),[r,s]=b.useState(!1),[i,a]=b.useState(!1),{theme:o,setTheme:c}=f6(),h=aY(),f=Ma();b.useEffect(()=>{const w=S=>{(S.metaKey||S.ctrlKey)&&S.key==="k"&&(S.preventDefault(),a(!0))};return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[]);const m=[{title:"概览",items:[{icon:qm,label:"首页",path:"/"}]},{title:"麦麦配置编辑",items:[{icon:io,label:"麦麦主程序配置",path:"/config/bot"},{icon:lz,label:"AI模型厂商配置",path:"/config/modelProvider"},{icon:oz,label:"模型管理与分配",path:"/config/model"},{icon:qC,label:"麦麦适配器配置",path:"/config/adapter"}]},{title:"麦麦资源管理",items:[{icon:Jk,label:"表情包管理",path:"/resource/emoji"},{icon:A0,label:"表达方式管理",path:"/resource/expression"},{icon:cz,label:"人物信息管理",path:"/resource/person"},{icon:az,label:"知识库图谱可视化",path:"/resource/knowledge-graph"}]},{title:"扩展与监控",items:[{icon:mh,label:"插件市场",path:"/plugins"},{icon:qC,label:"插件配置",path:"/plugin-config"},{icon:j1,label:"日志查看器",path:"/logs"}]},{title:"系统",items:[{icon:yu,label:"系统设置",path:"/settings"}]}],x=o==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":o,y=()=>{localStorage.removeItem("access-token"),f({to:"/auth"})};return l.jsx(I9e,{delayDuration:300,children:l.jsxs("div",{className:"flex h-screen overflow-hidden",children:[l.jsxs("aside",{className:ye("fixed inset-y-0 left-0 z-50 flex flex-col border-r bg-card transition-all duration-300 lg:relative lg:z-0","w-64 lg:w-auto",e?"lg:w-64":"lg:w-16",r?"translate-x-0":"-translate-x-full lg:translate-x-0"),children:[l.jsx("div",{className:"flex h-16 items-center border-b px-4",children:l.jsxs("div",{className:ye("relative flex items-center justify-center flex-1 transition-all overflow-hidden","lg:flex-1",!e&&"lg:flex-none lg:w-8"),children:[l.jsxs("div",{className:ye("flex items-baseline gap-2",!e&&"lg:hidden"),children:[l.jsx("span",{className:"font-bold text-xl text-primary-gradient whitespace-nowrap",children:"MaiBot WebUI"}),l.jsx("span",{className:"text-xs text-primary/60 whitespace-nowrap",children:Ote()})]}),!e&&l.jsx("span",{className:"hidden lg:block font-bold text-primary-gradient text-2xl",children:"M"})]})}),l.jsx(on,{className:ye("flex-1 overflow-x-hidden",!e&&"lg:w-16"),children:l.jsx("nav",{className:ye("p-4",!e&&"lg:p-2 lg:w-16"),children:l.jsx("ul",{className:ye("space-y-6",!e&&"lg:space-y-3 lg:w-full"),children:m.map((w,S)=>l.jsxs("li",{children:[l.jsx("div",{className:ye("px-3 h-[1.25rem]","mb-2",!e&&"lg:mb-1 lg:invisible"),children:l.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground/60 whitespace-nowrap",children:w.title})}),!e&&S>0&&l.jsx("div",{className:"hidden lg:block mb-2 border-t border-border"}),l.jsx("ul",{className:"space-y-1",children:w.items.map(k=>{const N=h({to:k.path}),C=k.icon,T=l.jsxs(l.Fragment,{children:[N&&l.jsx("div",{className:"absolute left-0 top-1/2 h-8 w-1 -translate-y-1/2 rounded-r-full bg-primary transition-opacity duration-300"}),l.jsxs("div",{className:ye("flex items-center transition-all duration-300",e?"gap-3":"gap-3 lg:gap-0"),children:[l.jsx(C,{className:ye("h-5 w-5 flex-shrink-0",N&&"text-primary"),strokeWidth:2,fill:"none"}),l.jsx("span",{className:ye("text-sm font-medium whitespace-nowrap transition-all duration-300",N&&"font-semibold",e?"opacity-100 max-w-[200px]":"opacity-100 max-w-[200px] lg:opacity-0 lg:max-w-0 lg:overflow-hidden"),children:k.label})]})]});return l.jsx("li",{className:"relative",children:l.jsxs(B9e,{children:[l.jsx(q9e,{asChild:!0,children:l.jsx(lY,{to:k.path,className:ye("relative flex items-center rounded-lg py-2 transition-all duration-300","hover:bg-accent hover:text-accent-foreground",N?"bg-accent text-foreground":"text-muted-foreground hover:text-foreground",e?"px-3":"px-3 lg:px-0 lg:justify-center lg:w-12 lg:mx-auto"),onClick:()=>s(!1),children:T})}),!e&&l.jsx(wW,{side:"right",className:"hidden lg:block",children:l.jsx("p",{children:k.label})})]})},k.path)})})]},w.title))})})})]}),r&&l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 lg:hidden",onClick:()=>s(!1)}),l.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[l.jsxs("header",{className:"flex h-16 items-center justify-between border-b bg-card/80 backdrop-blur-md px-4 sticky top-0 z-10",children:[l.jsxs("div",{className:"flex items-center gap-4",children:[l.jsx("button",{onClick:()=>s(!r),className:"rounded-lg p-2 hover:bg-accent lg:hidden",children:l.jsx(YK,{className:"h-5 w-5"})}),l.jsx("button",{onClick:()=>n(!e),className:"hidden rounded-lg p-2 hover:bg-accent lg:block",title:e?"收起侧边栏":"展开侧边栏",children:l.jsx(qu,{className:ye("h-5 w-5 transition-transform",!e&&"rotate-180")})})]}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs("button",{onClick:()=>a(!0),className:"relative hidden md:flex items-center w-64 h-9 pl-9 pr-16 bg-background/50 border rounded-md hover:bg-accent/50 transition-colors text-left",children:[l.jsx(li,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),l.jsx("span",{className:"text-sm text-muted-foreground",children:"搜索..."}),l.jsxs(dU,{size:"sm",className:"absolute right-2 top-1/2 -translate-y-1/2",children:[l.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),l.jsx(W8e,{open:i,onOpenChange:a}),l.jsxs(fe,{variant:"ghost",size:"sm",onClick:()=>window.open("https://docs.mai-mai.org","_blank"),className:"gap-2",title:"查看麦麦文档",children:[l.jsx(KK,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"麦麦文档"})]}),l.jsx("button",{onClick:w=>{cte(x==="dark"?"light":"dark",c,w)},className:"rounded-lg p-2 hover:bg-accent",title:x==="dark"?"切换到浅色模式":"切换到深色模式",children:x==="dark"?l.jsx(T3,{className:"h-5 w-5"}):l.jsx(E3,{className:"h-5 w-5"})}),l.jsx("div",{className:"h-6 w-px bg-border"}),l.jsxs(fe,{variant:"ghost",size:"sm",onClick:y,className:"gap-2",title:"登出系统",children:[l.jsx(FC,{className:"h-4 w-4"}),l.jsx("span",{className:"hidden sm:inline",children:"登出"})]})]})]}),l.jsxs(u9e,{children:[l.jsx(d9e,{asChild:!0,children:l.jsx("main",{className:"flex-1 overflow-hidden bg-background",children:t})}),l.jsxs(dW,{className:"w-64",children:[l.jsxs(ba,{onClick:()=>f({to:"/"}),children:[l.jsx(qm,{className:"mr-2 h-4 w-4"}),"首页"]}),l.jsxs(ba,{onClick:()=>f({to:"/settings"}),children:[l.jsx(yu,{className:"mr-2 h-4 w-4"}),"系统设置"]}),l.jsxs(ba,{onClick:()=>f({to:"/logs"}),children:[l.jsx(j1,{className:"mr-2 h-4 w-4"}),"日志查看器"]}),l.jsx(Om,{}),l.jsxs(h9e,{children:[l.jsxs(cW,{children:[l.jsx(tz,{className:"mr-2 h-4 w-4"}),"切换主题"]}),l.jsxs(uW,{className:"w-48",children:[l.jsxs(ba,{onClick:()=>c("light"),disabled:o==="light",children:[l.jsx(T3,{className:"mr-2 h-4 w-4"}),"浅色",o==="light"&&l.jsx(Vd,{children:"✓"})]}),l.jsxs(ba,{onClick:()=>c("dark"),disabled:o==="dark",children:[l.jsx(E3,{className:"mr-2 h-4 w-4"}),"深色",o==="dark"&&l.jsx(Vd,{children:"✓"})]}),l.jsxs(ba,{onClick:()=>c("system"),disabled:o==="system",children:[l.jsx(yu,{className:"mr-2 h-4 w-4"}),"跟随系统",o==="system"&&l.jsx(Vd,{children:"✓"})]})]})]}),l.jsx(Om,{}),l.jsxs(ba,{onClick:()=>window.location.reload(),children:[l.jsx(ZK,{className:"mr-2 h-4 w-4"}),"刷新页面",l.jsx(Vd,{children:"⌘R"})]}),l.jsxs(ba,{onClick:()=>a(!0),children:[l.jsx(li,{className:"mr-2 h-4 w-4"}),"搜索",l.jsx(Vd,{children:"⌘K"})]}),l.jsx(Om,{}),l.jsxs(ba,{onClick:()=>window.open("https://docs.mai-mai.org","_blank"),children:[l.jsx(Kd,{className:"mr-2 h-4 w-4"}),"麦麦文档"]}),l.jsx(Om,{}),l.jsxs(ba,{onClick:y,className:"text-destructive focus:text-destructive",children:[l.jsx(FC,{className:"mr-2 h-4 w-4"}),"登出系统"]})]})]})]})]})})}var Iy="Collapsible",[$9e]=ua(Iy),[Q9e,Qj]=$9e(Iy),SW=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:a,...o}=t,[c,h]=wo({prop:r,defaultProp:s??!1,onChange:a,caller:Iy});return l.jsx(Q9e,{scope:n,disabled:i,contentId:Ei(),open:c,onOpenToggle:b.useCallback(()=>h(f=>!f),[h]),children:l.jsx(nn.div,{"data-state":Vj(c),"data-disabled":i?"":void 0,...o,ref:e})})});SW.displayName=Iy;var kW="CollapsibleTrigger",OW=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=Qj(kW,n);return l.jsx(nn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":Vj(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Ze(t.onClick,s.onOpenToggle)})});OW.displayName=kW;var Hj="CollapsibleContent",jW=b.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Qj(Hj,t.__scopeCollapsible);return l.jsx(Ps,{present:n||s.open,children:({present:i})=>l.jsx(H9e,{...r,ref:e,present:i})})});jW.displayName=Hj;var H9e=b.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,a=Qj(Hj,n),[o,c]=b.useState(r),h=b.useRef(null),f=Dn(e,h),m=b.useRef(0),g=m.current,x=b.useRef(0),y=x.current,w=a.open||o,S=b.useRef(w),k=b.useRef(void 0);return b.useEffect(()=>{const N=requestAnimationFrame(()=>S.current=!1);return()=>cancelAnimationFrame(N)},[]),Qk(()=>{const N=h.current;if(N){k.current=k.current||{transitionDuration:N.style.transitionDuration,animationName:N.style.animationName},N.style.transitionDuration="0s",N.style.animationName="none";const C=N.getBoundingClientRect();m.current=C.height,x.current=C.width,S.current||(N.style.transitionDuration=k.current.transitionDuration,N.style.animationName=k.current.animationName),c(r)}},[a.open,r]),l.jsx(nn.div,{"data-state":Vj(a.open),"data-disabled":a.disabled?"":void 0,id:a.contentId,hidden:!w,...i,ref:f,style:{"--radix-collapsible-content-height":g?`${g}px`:void 0,"--radix-collapsible-content-width":y?`${y}px`:void 0,...t.style},children:w&&s})});function Vj(t){return t?"open":"closed"}var V9e=SW;const xD=V9e,vD=OW,yD=jW;function U9e(t){const e=t.split(` +`).slice(1),n=[];for(const r of e){const s=r.trim();if(!s.startsWith("at "))continue;const i=s.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?$/);i?n.push({functionName:i[1]||"",fileName:i[2],lineNumber:i[3],columnNumber:i[4],raw:s}):n.push({functionName:"",fileName:"",lineNumber:"",columnNumber:"",raw:s})}return n}function W9e({error:t,errorInfo:e}){const[n,r]=b.useState(!0),[s,i]=b.useState(!1),[a,o]=b.useState(!1),c=t.stack?U9e(t.stack):[],h=async()=>{const f=` +Error: ${t.name} +Message: ${t.message} + +Stack Trace: +${t.stack||"No stack trace available"} + +Component Stack: +${e?.componentStack||"No component stack available"} + +URL: ${window.location.href} +User Agent: ${navigator.userAgent} +Time: ${new Date().toISOString()} + `.trim();try{await navigator.clipboard.writeText(f),o(!0),setTimeout(()=>o(!1),2e3)}catch(m){console.error("Failed to copy:",m)}};return l.jsxs("div",{className:"space-y-4",children:[l.jsxs(il,{variant:"destructive",className:"border-red-500/50 bg-red-500/10",children:[l.jsx(ja,{className:"h-4 w-4"}),l.jsxs(al,{className:"font-mono text-sm",children:[l.jsxs("span",{className:"font-semibold",children:[t.name,":"]})," ",t.message]})]}),c.length>0&&l.jsxs(xD,{open:n,onOpenChange:r,children:[l.jsx(vD,{asChild:!0,children:l.jsxs(fe,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[l.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[l.jsx(JK,{className:"h-4 w-4"}),"Stack Trace (",c.length," frames)"]}),n?l.jsx(Fm,{className:"h-4 w-4"}):l.jsx(Nu,{className:"h-4 w-4"})]})}),l.jsx(yD,{children:l.jsx(on,{className:"h-[280px] rounded-md border bg-muted/30",children:l.jsx("div",{className:"p-3 space-y-1",children:c.map((f,m)=>l.jsx("div",{className:"font-mono text-xs p-2 rounded hover:bg-muted/50 transition-colors",children:l.jsxs("div",{className:"flex items-start gap-2",children:[l.jsxs("span",{className:"text-muted-foreground w-6 text-right flex-shrink-0",children:[m+1,"."]}),l.jsxs("div",{className:"flex-1 min-w-0",children:[l.jsx("span",{className:"text-primary font-medium",children:f.functionName}),f.fileName&&l.jsxs("div",{className:"text-muted-foreground mt-0.5 break-all",children:[f.fileName,f.lineNumber&&l.jsxs("span",{className:"text-yellow-600 dark:text-yellow-400",children:[":",f.lineNumber,":",f.columnNumber]})]})]})]})},m))})})})]}),e?.componentStack&&l.jsxs(xD,{open:s,onOpenChange:i,children:[l.jsx(vD,{asChild:!0,children:l.jsxs(fe,{variant:"ghost",className:"w-full justify-between p-3 h-auto",children:[l.jsxs("span",{className:"font-semibold text-sm flex items-center gap-2",children:[l.jsx(ja,{className:"h-4 w-4"}),"Component Stack"]}),s?l.jsx(Fm,{className:"h-4 w-4"}):l.jsx(Nu,{className:"h-4 w-4"})]})}),l.jsx(yD,{children:l.jsx(on,{className:"h-[200px] rounded-md border bg-muted/30",children:l.jsx("pre",{className:"p-3 font-mono text-xs whitespace-pre-wrap text-muted-foreground",children:e.componentStack})})})]}),l.jsx(fe,{variant:"outline",size:"sm",onClick:h,className:"w-full",children:a?l.jsxs(l.Fragment,{children:[l.jsx(so,{className:"mr-2 h-4 w-4 text-green-500"}),"已复制到剪贴板"]}):l.jsxs(l.Fragment,{children:[l.jsx(k1,{className:"mr-2 h-4 w-4"}),"复制错误信息"]})})]})}function NW({error:t,errorInfo:e}){const n=()=>{window.location.href="/"},r=()=>{window.location.reload()};return l.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:l.jsxs(Tt,{className:"w-full max-w-2xl shadow-lg",children:[l.jsxs(vn,{className:"text-center pb-2",children:[l.jsx("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-full bg-red-100 dark:bg-red-900/30 mb-4",children:l.jsx(ja,{className:"h-8 w-8 text-red-600 dark:text-red-400"})}),l.jsx(yn,{className:"text-2xl font-bold",children:"页面出现了问题"}),l.jsx(zr,{className:"text-base mt-2",children:"应用程序遇到了意外错误。您可以尝试刷新页面或返回首页。"})]}),l.jsxs(En,{className:"space-y-4",children:[l.jsx(W9e,{error:t,errorInfo:e}),l.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 pt-2",children:[l.jsxs(fe,{onClick:r,className:"flex-1",children:[l.jsx(ti,{className:"mr-2 h-4 w-4"}),"刷新页面"]}),l.jsxs(fe,{onClick:n,variant:"outline",className:"flex-1",children:[l.jsx(qm,{className:"mr-2 h-4 w-4"}),"返回首页"]})]}),l.jsx("p",{className:"text-xs text-center text-muted-foreground pt-2",children:"如果问题持续存在,请将错误信息复制并反馈给开发者"})]})]})})}class G9e extends b.Component{constructor(e){super(e),this.state={hasError:!1,error:null,errorInfo:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){console.error("ErrorBoundary caught an error:",e,n),this.setState({errorInfo:n})}handleReset=()=>{this.setState({hasError:!1,error:null,errorInfo:null})};render(){return this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback:l.jsx(NW,{error:this.state.error,errorInfo:this.state.errorInfo}):this.props.children}}function CW({error:t}){return l.jsx(NW,{error:t,errorInfo:null})}const kp=oY({component:()=>l.jsxs(l.Fragment,{children:[l.jsx(wD,{}),!1]}),beforeLoad:()=>{if(window.location.pathname==="/"&&!dL())throw uY({to:"/auth"})}}),X9e=ss({getParentRoute:()=>kp,path:"/auth",component:Xte}),Y9e=ss({getParentRoute:()=>kp,path:"/setup",component:vne}),Is=ss({getParentRoute:()=>kp,id:"protected",component:()=>l.jsx(F9e,{children:l.jsx(wD,{})}),errorComponent:({error:t})=>l.jsx(CW,{error:t})}),K9e=ss({getParentRoute:()=>Is,path:"/",component:lte}),Z9e=ss({getParentRoute:()=>Is,path:"/config/bot",component:phe}),J9e=ss({getParentRoute:()=>Is,path:"/config/modelProvider",component:sfe}),eTe=ss({getParentRoute:()=>Is,path:"/config/model",component:Gme}),tTe=ss({getParentRoute:()=>Is,path:"/config/adapter",component:Yme}),nTe=ss({getParentRoute:()=>Is,path:"/resource/emoji",component:bwe}),rTe=ss({getParentRoute:()=>Is,path:"/resource/expression",component:Mwe}),sTe=ss({getParentRoute:()=>Is,path:"/resource/person",component:$we}),iTe=ss({getParentRoute:()=>Is,path:"/resource/knowledge-graph",component:AOe}),aTe=ss({getParentRoute:()=>Is,path:"/logs",component:k8e}),lTe=ss({getParentRoute:()=>Is,path:"/plugins",component:$8e}),oTe=ss({getParentRoute:()=>Is,path:"/plugin-config",component:Q8e}),cTe=ss({getParentRoute:()=>Is,path:"/plugin-mirrors",component:H8e}),uTe=ss({getParentRoute:()=>Is,path:"/settings",component:Fte}),dTe=ss({getParentRoute:()=>kp,path:"*",component:mL}),hTe=kp.addChildren([X9e,Y9e,Is.addChildren([K9e,Z9e,J9e,eTe,tTe,nTe,rTe,sTe,iTe,lTe,oTe,cTe,aTe,uTe]),dTe]),fTe=cY({routeTree:hTe,defaultNotFoundComponent:mL,defaultErrorComponent:({error:t})=>l.jsx(CW,{error:t})});function mTe({children:t,defaultTheme:e="system",storageKey:n="ui-theme",...r}){const[s,i]=b.useState(()=>localStorage.getItem(n)||e);b.useEffect(()=>{const o=window.document.documentElement;if(o.classList.remove("light","dark"),s==="system"){const c=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";o.classList.add(c);return}o.classList.add(s)},[s]),b.useEffect(()=>{const o=localStorage.getItem("accent-color");if(o){const c=document.documentElement,f={blue:{hsl:"221.2 83.2% 53.3%",darkHsl:"217.2 91.2% 59.8%",gradient:null},purple:{hsl:"271 91% 65%",darkHsl:"270 95% 75%",gradient:null},green:{hsl:"142 71% 45%",darkHsl:"142 76% 36%",gradient:null},orange:{hsl:"25 95% 53%",darkHsl:"20 90% 48%",gradient:null},pink:{hsl:"330 81% 60%",darkHsl:"330 85% 70%",gradient:null},red:{hsl:"0 84% 60%",darkHsl:"0 90% 70%",gradient:null},"gradient-sunset":{hsl:"15 95% 60%",darkHsl:"15 95% 65%",gradient:"linear-gradient(135deg, hsl(25 95% 53%) 0%, hsl(330 81% 60%) 100%)"},"gradient-ocean":{hsl:"200 90% 55%",darkHsl:"200 90% 60%",gradient:"linear-gradient(135deg, hsl(221.2 83.2% 53.3%) 0%, hsl(189 94% 43%) 100%)"},"gradient-forest":{hsl:"150 70% 45%",darkHsl:"150 75% 40%",gradient:"linear-gradient(135deg, hsl(142 71% 45%) 0%, hsl(158 64% 52%) 100%)"},"gradient-aurora":{hsl:"310 85% 65%",darkHsl:"310 90% 70%",gradient:"linear-gradient(135deg, hsl(271 91% 65%) 0%, hsl(330 81% 60%) 100%)"},"gradient-fire":{hsl:"15 95% 55%",darkHsl:"15 95% 60%",gradient:"linear-gradient(135deg, hsl(0 84% 60%) 0%, hsl(25 95% 53%) 100%)"},"gradient-twilight":{hsl:"250 90% 60%",darkHsl:"250 95% 65%",gradient:"linear-gradient(135deg, hsl(239 84% 67%) 0%, hsl(271 91% 65%) 100%)"}}[o];f&&(c.style.setProperty("--primary",f.hsl),f.gradient?(c.style.setProperty("--primary-gradient",f.gradient),c.classList.add("has-gradient")):(c.style.removeProperty("--primary-gradient"),c.classList.remove("has-gradient")))}},[]);const a={theme:s,setTheme:o=>{localStorage.setItem(n,o),i(o)}};return l.jsx(zP.Provider,{...r,value:a,children:t})}function pTe({children:t,defaultEnabled:e=!0,defaultWavesEnabled:n=!0,storageKey:r="enable-animations",wavesStorageKey:s="enable-waves-background"}){const[i,a]=b.useState(()=>{const f=localStorage.getItem(r);return f!==null?f==="true":e}),[o,c]=b.useState(()=>{const f=localStorage.getItem(s);return f!==null?f==="true":n});b.useEffect(()=>{const f=document.documentElement;i?f.classList.remove("no-animations"):f.classList.add("no-animations"),localStorage.setItem(r,String(i))},[i,r]),b.useEffect(()=>{localStorage.setItem(s,String(o))},[o,s]);const h={enableAnimations:i,setEnableAnimations:a,enableWavesBackground:o,setEnableWavesBackground:c};return l.jsx(PP.Provider,{value:h,children:t})}var Uj="ToastProvider",[Wj,gTe,xTe]=jv("Toast"),[TW]=ua("Toast",[xTe]),[vTe,By]=TW(Uj),EW=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:a}=t,[o,c]=b.useState(null),[h,f]=b.useState(0),m=b.useRef(!1),g=b.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Uj}\`. Expected non-empty \`string\`.`),l.jsx(Wj.Provider,{scope:e,children:l.jsx(vTe,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:h,viewport:o,onViewportChange:c,onToastAdd:b.useCallback(()=>f(x=>x+1),[]),onToastRemove:b.useCallback(()=>f(x=>x-1),[]),isFocusedToastEscapeKeyDownRef:m,isClosePausedRef:g,children:a})})};EW.displayName=Uj;var _W="ToastViewport",yTe=["F8"],Ak="toast.viewportPause",Rk="toast.viewportResume",MW=b.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=yTe,label:s="Notifications ({hotkey})",...i}=t,a=By(_W,n),o=gTe(n),c=b.useRef(null),h=b.useRef(null),f=b.useRef(null),m=b.useRef(null),g=Dn(e,m,a.onViewportChange),x=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),y=a.toastCount>0;b.useEffect(()=>{const S=k=>{r.length!==0&&r.every(C=>k[C]||k.code===C)&&m.current?.focus()};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[r]),b.useEffect(()=>{const S=c.current,k=m.current;if(y&&S&&k){const N=()=>{if(!a.isClosePausedRef.current){const E=new CustomEvent(Ak);k.dispatchEvent(E),a.isClosePausedRef.current=!0}},C=()=>{if(a.isClosePausedRef.current){const E=new CustomEvent(Rk);k.dispatchEvent(E),a.isClosePausedRef.current=!1}},T=E=>{!S.contains(E.relatedTarget)&&C()},_=()=>{S.contains(document.activeElement)||C()};return S.addEventListener("focusin",N),S.addEventListener("focusout",T),S.addEventListener("pointermove",N),S.addEventListener("pointerleave",_),window.addEventListener("blur",N),window.addEventListener("focus",C),()=>{S.removeEventListener("focusin",N),S.removeEventListener("focusout",T),S.removeEventListener("pointermove",N),S.removeEventListener("pointerleave",_),window.removeEventListener("blur",N),window.removeEventListener("focus",C)}}},[y,a.isClosePausedRef]);const w=b.useCallback(({tabbingDirection:S})=>{const N=o().map(C=>{const T=C.ref.current,_=[T,...ATe(T)];return S==="forwards"?_:_.reverse()});return(S==="forwards"?N.reverse():N).flat()},[o]);return b.useEffect(()=>{const S=m.current;if(S){const k=N=>{const C=N.altKey||N.ctrlKey||N.metaKey;if(N.key==="Tab"&&!C){const _=document.activeElement,E=N.shiftKey;if(N.target===S&&E){h.current?.focus();return}const L=w({tabbingDirection:E?"backwards":"forwards"}),I=L.findIndex($=>$===_);j3(L.slice(I+1))?N.preventDefault():E?h.current?.focus():f.current?.focus()}};return S.addEventListener("keydown",k),()=>S.removeEventListener("keydown",k)}},[o,w]),l.jsxs(OK,{ref:c,role:"region","aria-label":s.replace("{hotkey}",x),tabIndex:-1,style:{pointerEvents:y?void 0:"none"},children:[y&&l.jsx(Dk,{ref:h,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"forwards"});j3(S)}}),l.jsx(Wj.Slot,{scope:n,children:l.jsx(nn.ol,{tabIndex:-1,...i,ref:g})}),y&&l.jsx(Dk,{ref:f,onFocusFromOutsideViewport:()=>{const S=w({tabbingDirection:"backwards"});j3(S)}})]})});MW.displayName=_W;var AW="ToastFocusProxy",Dk=b.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=By(AW,n);return l.jsx(ez,{tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:a=>{const o=a.relatedTarget;!i.viewport?.contains(o)&&r()}})});Dk.displayName=AW;var Op="Toast",bTe="toast.swipeStart",wTe="toast.swipeMove",STe="toast.swipeCancel",kTe="toast.swipeEnd",RW=b.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...a}=t,[o,c]=wo({prop:r,defaultProp:s??!0,onChange:i,caller:Op});return l.jsx(Ps,{present:n||o,children:l.jsx(NTe,{open:o,...a,ref:e,onClose:()=>c(!1),onPause:bs(t.onPause),onResume:bs(t.onResume),onSwipeStart:Ze(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ze(t.onSwipeMove,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${m}px`)}),onSwipeCancel:Ze(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ze(t.onSwipeEnd,h=>{const{x:f,y:m}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${m}px`),c(!1)})})})});RW.displayName=Op;var[OTe,jTe]=TW(Op,{onClose(){}}),NTe=b.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:a,onEscapeKeyDown:o,onPause:c,onResume:h,onSwipeStart:f,onSwipeMove:m,onSwipeCancel:g,onSwipeEnd:x,...y}=t,w=By(Op,n),[S,k]=b.useState(null),N=Dn(e,z=>k(z)),C=b.useRef(null),T=b.useRef(null),_=s||w.duration,E=b.useRef(0),M=b.useRef(_),q=b.useRef(0),{onToastAdd:L,onToastRemove:I}=w,$=bs(()=>{S?.contains(document.activeElement)&&w.viewport?.focus(),a()}),V=b.useCallback(z=>{!z||z===1/0||(window.clearTimeout(q.current),E.current=new Date().getTime(),q.current=window.setTimeout($,z))},[$]);b.useEffect(()=>{const z=w.viewport;if(z){const H=()=>{V(M.current),h?.()},P=()=>{const W=new Date().getTime()-E.current;M.current=M.current-W,window.clearTimeout(q.current),c?.()};return z.addEventListener(Ak,P),z.addEventListener(Rk,H),()=>{z.removeEventListener(Ak,P),z.removeEventListener(Rk,H)}}},[w.viewport,_,c,h,V]),b.useEffect(()=>{i&&!w.isClosePausedRef.current&&V(_)},[i,_,w.isClosePausedRef,V]),b.useEffect(()=>(L(),()=>I()),[L,I]);const ee=b.useMemo(()=>S?qW(S):null,[S]);return w.viewport?l.jsxs(l.Fragment,{children:[ee&&l.jsx(CTe,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite",children:ee}),l.jsx(OTe,{scope:n,onClose:$,children:hu.createPortal(l.jsx(Wj.ItemSlot,{scope:n,children:l.jsx(jK,{asChild:!0,onEscapeKeyDown:Ze(o,()=>{w.isFocusedToastEscapeKeyDownRef.current||$(),w.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(nn.li,{tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":w.swipeDirection,...y,ref:N,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ze(t.onKeyDown,z=>{z.key==="Escape"&&(o?.(z.nativeEvent),z.nativeEvent.defaultPrevented||(w.isFocusedToastEscapeKeyDownRef.current=!0,$()))}),onPointerDown:Ze(t.onPointerDown,z=>{z.button===0&&(C.current={x:z.clientX,y:z.clientY})}),onPointerMove:Ze(t.onPointerMove,z=>{if(!C.current)return;const H=z.clientX-C.current.x,P=z.clientY-C.current.y,W=!!T.current,J=["left","right"].includes(w.swipeDirection),X=["left","up"].includes(w.swipeDirection)?Math.min:Math.max,R=J?X(0,H):0,se=J?0:X(0,P),G=z.pointerType==="touch"?10:2,F={x:R,y:se},U={originalEvent:z,delta:F};W?(T.current=F,Gx(wTe,m,U,{discrete:!1})):bD(F,w.swipeDirection,G)?(T.current=F,Gx(bTe,f,U,{discrete:!1}),z.target.setPointerCapture(z.pointerId)):(Math.abs(H)>G||Math.abs(P)>G)&&(C.current=null)}),onPointerUp:Ze(t.onPointerUp,z=>{const H=T.current,P=z.target;if(P.hasPointerCapture(z.pointerId)&&P.releasePointerCapture(z.pointerId),T.current=null,C.current=null,H){const W=z.currentTarget,J={originalEvent:z,delta:H};bD(H,w.swipeDirection,w.swipeThreshold)?Gx(kTe,x,J,{discrete:!0}):Gx(STe,g,J,{discrete:!0}),W.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),w.viewport)})]}):null}),CTe=t=>{const{__scopeToast:e,children:n,...r}=t,s=By(Op,e),[i,a]=b.useState(!1),[o,c]=b.useState(!1);return _Te(()=>a(!0)),b.useEffect(()=>{const h=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(h)},[]),o?null:l.jsx(Ev,{asChild:!0,children:l.jsx(ez,{...r,children:i&&l.jsxs(l.Fragment,{children:[s.label," ",n]})})})},TTe="ToastTitle",DW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(nn.div,{...r,ref:e})});DW.displayName=TTe;var ETe="ToastDescription",zW=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return l.jsx(nn.div,{...r,ref:e})});zW.displayName=ETe;var PW="ToastAction",LW=b.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?l.jsx(BW,{altText:n,asChild:!0,children:l.jsx(Gj,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${PW}\`. Expected non-empty \`string\`.`),null)});LW.displayName=PW;var IW="ToastClose",Gj=b.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=jTe(IW,n);return l.jsx(BW,{asChild:!0,children:l.jsx(nn.button,{type:"button",...r,ref:e,onClick:Ze(t.onClick,s.onClose)})})});Gj.displayName=IW;var BW=b.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return l.jsx(nn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function qW(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),MTe(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const a=r.dataset.radixToastAnnounceAlt;a&&e.push(a)}else e.push(...qW(r))}}),e}function Gx(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?JD(s,i):s.dispatchEvent(i)}var bD=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function _Te(t=()=>{}){const e=bs(t);Qk(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function MTe(t){return t.nodeType===t.ELEMENT_NODE}function ATe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function j3(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var RTe=EW,FW=MW,$W=RW,QW=DW,HW=zW,VW=LW,UW=Gj;const DTe=RTe,WW=b.forwardRef(({className:t,...e},n)=>l.jsx(FW,{ref:n,className:ye("fixed bottom-0 right-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:max-w-[420px] gap-2",t),...e}));WW.displayName=FW.displayName;const zTe=Ih("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-slide-in-from-right data-[state=open]:animate-fade-in data-[state=closed]:animate-slide-out-to-right data-[state=closed]:animate-fade-out data-[swipe=end]:animate-slide-out-to-right",{variants:{variant:{default:"border bg-primary/5 text-foreground backdrop-blur-sm",destructive:"destructive group border-destructive bg-destructive/10 text-destructive-foreground backdrop-blur-sm"}},defaultVariants:{variant:"default"}}),GW=b.forwardRef(({className:t,variant:e,...n},r)=>l.jsx($W,{ref:r,className:ye(zTe({variant:e}),t),...n}));GW.displayName=$W.displayName;const PTe=b.forwardRef(({className:t,...e},n)=>l.jsx(VW,{ref:n,className:ye("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));PTe.displayName=VW.displayName;const XW=b.forwardRef(({className:t,...e},n)=>l.jsx(UW,{ref:n,className:ye("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:l.jsx(R0,{className:"h-4 w-4"})}));XW.displayName=UW.displayName;const YW=b.forwardRef(({className:t,...e},n)=>l.jsx(QW,{ref:n,className:ye("text-sm font-semibold [&+div]:text-xs",t),...e}));YW.displayName=QW.displayName;const KW=b.forwardRef(({className:t,...e},n)=>l.jsx(HW,{ref:n,className:ye("text-sm opacity-90",t),...e}));KW.displayName=HW.displayName;function LTe(){const{toasts:t}=Gr();return l.jsxs(DTe,{children:[t.map(function({id:e,title:n,description:r,action:s,...i}){return l.jsxs(GW,{...i,children:[l.jsxs("div",{className:"grid gap-1",children:[n&&l.jsx(YW,{children:n}),r&&l.jsx(KW,{children:r})]}),s,l.jsx(XW,{})]},e)}),l.jsx(WW,{})]})}sZ.createRoot(document.getElementById("root")).render(l.jsx(b.StrictMode,{children:l.jsx(G9e,{children:l.jsx(mTe,{defaultTheme:"system",children:l.jsxs(pTe,{children:[l.jsx(dY,{router:fTe}),l.jsx(LTe,{})]})})})})); diff --git a/webui/dist/assets/index-BwXMDuHV.css b/webui/dist/assets/index-BwXMDuHV.css new file mode 100644 index 00000000..7aed6d76 --- /dev/null +++ b/webui/dist/assets/index-BwXMDuHV.css @@ -0,0 +1 @@ +*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[200px\]{height:200px}.h-\[250px\]{height:250px}.h-\[280px\]{height:280px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-red-500\/50{border-color:#ef444480}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-500\/10{background-color:#ef44441a}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-500\/5{background-color:#eab3080d}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-700{--tw-text-opacity: 1;color:rgb(161 98 7 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:text-yellow-800:hover{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-400:is(.dark *){--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:text-yellow-200:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-8{height:2rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-8{width:2rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/assets/index-C7HtKTTn.css b/webui/dist/assets/index-C7HtKTTn.css deleted file mode 100644 index e8d86284..00000000 --- a/webui/dist/assets/index-C7HtKTTn.css +++ /dev/null @@ -1 +0,0 @@ -*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 222.2 84% 4.9%;--card: 0 0% 100%;--card-foreground: 222.2 84% 4.9%;--popover: 0 0% 100%;--popover-foreground: 222.2 84% 4.9%;--primary: 221.2 83.2% 53.3%;--primary-foreground: 210 40% 98%;--primary-gradient: none;--secondary: 210 40% 96.1%;--secondary-foreground: 222.2 47.4% 11.2%;--muted: 210 40% 96.1%;--muted-foreground: 215.4 16.3% 46.9%;--accent: 210 40% 96.1%;--accent-foreground: 222.2 47.4% 11.2%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 210 40% 98%;--border: 214.3 31.8% 91.4%;--input: 214.3 31.8% 91.4%;--ring: 221.2 83.2% 53.3%;--radius: .5rem;--chart-1: 221.2 83.2% 53.3%;--chart-2: 160 60% 45%;--chart-3: 30 80% 55%;--chart-4: 280 65% 60%;--chart-5: 340 75% 55%}.dark{--background: 222.2 84% 4.9%;--foreground: 210 40% 98%;--card: 222.2 84% 4.9%;--card-foreground: 210 40% 98%;--popover: 222.2 84% 4.9%;--popover-foreground: 210 40% 98%;--primary: 217.2 91.2% 59.8%;--primary-foreground: 222.2 47.4% 11.2%;--primary-gradient: none;--secondary: 217.2 32.6% 17.5%;--secondary-foreground: 210 40% 98%;--muted: 217.2 32.6% 17.5%;--muted-foreground: 215 20.2% 65.1%;--accent: 217.2 32.6% 17.5%;--accent-foreground: 210 40% 98%;--destructive: 0 62.8% 30.6%;--destructive-foreground: 210 40% 98%;--border: 217.2 32.6% 17.5%;--input: 217.2 32.6% 17.5%;--ring: 224.3 76.3% 48%;--chart-1: 217.2 91.2% 59.8%;--chart-2: 160 60% 50%;--chart-3: 30 80% 60%;--chart-4: 280 65% 65%;--chart-5: 340 75% 60%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}input[type=number]{-moz-appearance:textfield;-webkit-appearance:textfield;appearance:textfield}.\!container{width:100%!important}.container{width:100%}@media(min-width:640px){.\!container{max-width:640px!important}.container{max-width:640px}}@media(min-width:768px){.\!container{max-width:768px!important}.container{max-width:768px}}@media(min-width:1024px){.\!container{max-width:1024px!important}.container{max-width:1024px}}@media(min-width:1280px){.\!container{max-width:1280px!important}.container{max-width:1280px}}@media(min-width:1536px){.\!container{max-width:1536px!important}.container{max-width:1536px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.invisible{visibility:hidden}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.bottom-1\/4{bottom:25%}.bottom-4{bottom:1rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-1\/4{left:25%}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-3{left:.75rem}.left-\[50\%\]{left:50%}.right-0{right:0}.right-1{right:.25rem}.right-1\.5{right:.375rem}.right-1\/4{right:25%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1{top:.25rem}.top-1\.5{top:.375rem}.top-1\/2{top:50%}.top-1\/4{top:25%}.top-2{top:.5rem}.top-2\.5{top:.625rem}.top-3{top:.75rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-40{z-index:40}.z-50{z-index:50}.z-\[100\]{z-index:100}.order-1{order:1}.order-2{order:2}.col-span-2{grid-column:span 2 / span 2}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.-mx-4{margin-left:-1rem;margin-right:-1rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-0\.5{margin-top:.125rem;margin-bottom:.125rem}.my-1{margin-top:.25rem;margin-bottom:.25rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.my-4{margin-top:1rem;margin-bottom:1rem}.-mt-2{margin-top:-.5rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-2{margin-right:.5rem}.mt-0{margin-top:0}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.line-clamp-1{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.line-clamp-2{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.aspect-auto{aspect-ratio:auto}.aspect-square{aspect-ratio:1 / 1}.aspect-video{aspect-ratio:16 / 9}.size-4{width:1rem;height:1rem}.size-\[--cell-size\]{width:var(--cell-size);height:var(--cell-size)}.h-0\.5{height:.125rem}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-32{height:8rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-60{height:15rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[--cell-size\]{height:var(--cell-size)}.h-\[1\.25rem\]{height:1.25rem}.h-\[1px\]{height:1px}.h-\[250px\]{height:250px}.h-\[300px\]{height:300px}.h-\[400px\]{height:400px}.h-\[calc\(100vh-200px\)\]{height:calc(100vh - 200px)}.h-\[calc\(100vh-240px\)\]{height:calc(100vh - 240px)}.h-\[calc\(100vh-260px\)\]{height:calc(100vh - 260px)}.h-\[calc\(100vh-4rem\)\]{height:calc(100vh - 4rem)}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-\[--radix-context-menu-content-available-height\]{max-height:var(--radix-context-menu-content-available-height)}.max-h-\[--radix-select-content-available-height\]{max-height:var(--radix-select-content-available-height)}.max-h-\[300px\]{max-height:300px}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(90vh-120px\)\]{max-height:calc(90vh - 120px)}.max-h-\[calc\(90vh-8rem\)\]{max-height:calc(90vh - 8rem)}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:0px}.min-h-10{min-height:2.5rem}.min-h-\[100px\]{min-height:100px}.min-h-\[300px\]{min-height:300px}.min-h-\[60px\]{min-height:60px}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-1\/4{width:25%}.w-10{width:2.5rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-3\/4{width:75%}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-64{width:16rem}.w-72{width:18rem}.w-8{width:2rem}.w-80{width:20rem}.w-9{width:2.25rem}.w-96{width:24rem}.w-\[--cell-size\]{width:var(--cell-size)}.w-\[100px\]{width:100px}.w-\[120px\]{width:120px}.w-\[130px\]{width:130px}.w-\[1px\]{width:1px}.w-\[65px\]{width:65px}.w-\[95vw\]{width:95vw}.w-auto{width:auto}.w-fit{width:-moz-fit-content;width:fit-content}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0px}.min-w-\[--cell-size\]{min-width:var(--cell-size)}.min-w-\[100px\]{min-width:100px}.min-w-\[120px\]{min-width:120px}.min-w-\[80px\]{min-width:80px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.min-w-full{min-width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-\[150px\]{max-width:150px}.max-w-\[200px\]{max-width:200px}.max-w-\[60px\]{max-width:60px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-xs{max-width:20rem}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow{flex-grow:1}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.origin-\[--radix-context-menu-content-transform-origin\]{transform-origin:var(--radix-context-menu-content-transform-origin)}.origin-\[--radix-popover-content-transform-origin\]{transform-origin:var(--radix-popover-content-transform-origin)}.origin-\[--radix-select-content-transform-origin\]{transform-origin:var(--radix-select-content-transform-origin)}.origin-\[--radix-tooltip-content-transform-origin\]{transform-origin:var(--radix-tooltip-content-transform-origin)}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-default{cursor:default}.cursor-grab{cursor:grab}.cursor-move{cursor:move}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.select-all{-webkit-user-select:all;-moz-user-select:all;user-select:all}.resize{resize:both}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.list-none{list-style-type:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-0{gap:0px}.gap-0\.5{gap:.125rem}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-0\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.125rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.125rem * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-visible{overflow:visible}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-\[2px\]{border-radius:2px}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-none{border-radius:0}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-l-md{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.rounded-r-full{border-top-right-radius:9999px;border-bottom-right-radius:9999px}.rounded-r-md{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-0{border-width:0px}.border-2{border-width:2px}.border-4{border-width:4px}.border-\[1\.5px\]{border-width:1.5px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-l-4{border-left-width:4px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-\[--color-border\]{border-color:var(--color-border)}.border-amber-200{--tw-border-opacity: 1;border-color:rgb(253 230 138 / var(--tw-border-opacity, 1))}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-700{--tw-border-opacity: 1;border-color:rgb(29 78 216 / var(--tw-border-opacity, 1))}.border-border{border-color:hsl(var(--border))}.border-border\/50{border-color:hsl(var(--border) / .5)}.border-current{border-color:currentColor}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-green-200{--tw-border-opacity: 1;border-color:rgb(187 247 208 / var(--tw-border-opacity, 1))}.border-green-700{--tw-border-opacity: 1;border-color:rgb(21 128 61 / var(--tw-border-opacity, 1))}.border-input{border-color:hsl(var(--input))}.border-muted{border-color:hsl(var(--muted))}.border-muted-foreground\/50{border-color:hsl(var(--muted-foreground) / .5)}.border-orange-600{--tw-border-opacity: 1;border-color:rgb(234 88 12 / var(--tw-border-opacity, 1))}.border-primary{border-color:hsl(var(--primary))}.border-primary\/20{border-color:hsl(var(--primary) / .2)}.border-primary\/30{border-color:hsl(var(--primary) / .3)}.border-primary\/50{border-color:hsl(var(--primary) / .5)}.border-red-500{--tw-border-opacity: 1;border-color:rgb(239 68 68 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-yellow-200{--tw-border-opacity: 1;border-color:rgb(254 240 138 / var(--tw-border-opacity, 1))}.border-yellow-500\/50{border-color:#eab30880}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-\[--color-bg\]{background-color:var(--color-bg)}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-50{--tw-bg-opacity: 1;background-color:rgb(255 251 235 / var(--tw-bg-opacity, 1))}.bg-background{background-color:hsl(var(--background))}.bg-background\/50{background-color:hsl(var(--background) / .5)}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity, 1))}.bg-black\/50{background-color:#00000080}.bg-black\/80{background-color:#000c}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity, 1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-card\/80{background-color:hsl(var(--card) / .8)}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-400{--tw-bg-opacity: 1;background-color:rgb(156 163 175 / var(--tw-bg-opacity, 1))}.bg-gray-800\/20{background-color:#1f293733}.bg-gray-800\/30{background-color:#1f29374d}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-50{--tw-bg-opacity: 1;background-color:rgb(240 253 244 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-green-600{--tw-bg-opacity: 1;background-color:rgb(22 163 74 / var(--tw-bg-opacity, 1))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/30{background-color:hsl(var(--muted) / .3)}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-orange-50{--tw-bg-opacity: 1;background-color:rgb(255 247 237 / var(--tw-bg-opacity, 1))}.bg-orange-500{--tw-bg-opacity: 1;background-color:rgb(249 115 22 / var(--tw-bg-opacity, 1))}.bg-orange-600{--tw-bg-opacity: 1;background-color:rgb(234 88 12 / var(--tw-bg-opacity, 1))}.bg-pink-500{--tw-bg-opacity: 1;background-color:rgb(236 72 153 / var(--tw-bg-opacity, 1))}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-primary\/20{background-color:hsl(var(--primary) / .2)}.bg-primary\/5{background-color:hsl(var(--primary) / .05)}.bg-purple-500{--tw-bg-opacity: 1;background-color:rgb(168 85 247 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/30{background-color:#7f1d1d4d}.bg-secondary{background-color:hsl(var(--secondary))}.bg-secondary\/5{background-color:hsl(var(--secondary) / .05)}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity, 1))}.bg-slate-300{--tw-bg-opacity: 1;background-color:rgb(203 213 225 / var(--tw-bg-opacity, 1))}.bg-slate-400{--tw-bg-opacity: 1;background-color:rgb(148 163 184 / var(--tw-bg-opacity, 1))}.bg-slate-700{--tw-bg-opacity: 1;background-color:rgb(51 65 85 / var(--tw-bg-opacity, 1))}.bg-slate-800{--tw-bg-opacity: 1;background-color:rgb(30 41 59 / var(--tw-bg-opacity, 1))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity, 1))}.bg-transparent{background-color:transparent}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-yellow-200{--tw-bg-opacity: 1;background-color:rgb(254 240 138 / var(--tw-bg-opacity, 1))}.bg-yellow-50{--tw-bg-opacity: 1;background-color:rgb(254 252 232 / var(--tw-bg-opacity, 1))}.bg-yellow-500\/10{background-color:#eab3081a}.bg-yellow-900\/20{background-color:#713f1233}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right,var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from: #3b82f6 var(--tw-gradient-from-position);--tw-gradient-to: rgb(59 130 246 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-green-500{--tw-gradient-from: #22c55e var(--tw-gradient-from-position);--tw-gradient-to: rgb(34 197 94 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-indigo-500{--tw-gradient-from: #6366f1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(99 102 241 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-orange-500{--tw-gradient-from: #f97316 var(--tw-gradient-from-position);--tw-gradient-to: rgb(249 115 22 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary\/5{--tw-gradient-from: hsl(var(--primary) / .05) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-purple-500{--tw-gradient-from: #a855f7 var(--tw-gradient-from-position);--tw-gradient-to: rgb(168 85 247 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-red-500{--tw-gradient-from: #ef4444 var(--tw-gradient-from-position);--tw-gradient-to: rgb(239 68 68 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-200{--tw-gradient-from: #e2e8f0 var(--tw-gradient-from-position);--tw-gradient-to: rgb(226 232 240 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-300{--tw-gradient-from: #cbd5e1 var(--tw-gradient-from-position);--tw-gradient-to: rgb(203 213 225 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-slate-400{--tw-gradient-from: #94a3b8 var(--tw-gradient-from-position);--tw-gradient-to: rgb(148 163 184 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-background{--tw-gradient-to: hsl(var(--background) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), hsl(var(--background)) var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-blue-600{--tw-gradient-to: #2563eb var(--tw-gradient-to-position)}.to-cyan-500{--tw-gradient-to: #06b6d4 var(--tw-gradient-to-position)}.to-emerald-500{--tw-gradient-to: #10b981 var(--tw-gradient-to-position)}.to-green-600{--tw-gradient-to: #16a34a var(--tw-gradient-to-position)}.to-orange-500{--tw-gradient-to: #f97316 var(--tw-gradient-to-position)}.to-pink-500{--tw-gradient-to: #ec4899 var(--tw-gradient-to-position)}.to-primary\/10{--tw-gradient-to: hsl(var(--primary) / .1) var(--tw-gradient-to-position)}.to-purple-500{--tw-gradient-to: #a855f7 var(--tw-gradient-to-position)}.to-secondary\/5{--tw-gradient-to: hsl(var(--secondary) / .05) var(--tw-gradient-to-position)}.to-slate-700{--tw-gradient-to: #334155 var(--tw-gradient-to-position)}.to-slate-800{--tw-gradient-to: #1e293b var(--tw-gradient-to-position)}.to-slate-900{--tw-gradient-to: #0f172a var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.fill-yellow-400{fill:#facc15}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.p-\[1px\]{padding:1px}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.px-\[--cell-size\]{padding-left:var(--cell-size);padding-right:var(--cell-size)}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-12{padding-top:3rem;padding-bottom:3rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-0{padding-bottom:0}.pb-2{padding-bottom:.5rem}.pb-3{padding-bottom:.75rem}.pl-10{padding-left:2.5rem}.pl-11{padding-left:2.75rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pl-6{padding-left:1.5rem}.pl-8{padding-left:2rem}.pl-9{padding-left:2.25rem}.pr-1{padding-right:.25rem}.pr-10{padding-right:2.5rem}.pr-16{padding-right:4rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.pr-6{padding-right:1.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.align-middle{vertical-align:middle}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[150px\]{font-size:150px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing: tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.tracking-tight{letter-spacing:-.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-accent-foreground{color:hsl(var(--accent-foreground))}.text-amber-600{--tw-text-opacity: 1;color:rgb(217 119 6 / var(--tw-text-opacity, 1))}.text-amber-900{--tw-text-opacity: 1;color:rgb(120 53 15 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity, 1))}.text-blue-800{--tw-text-opacity: 1;color:rgb(30 64 175 / var(--tw-text-opacity, 1))}.text-blue-900{--tw-text-opacity: 1;color:rgb(30 58 138 / var(--tw-text-opacity, 1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-cyan-400{--tw-text-opacity: 1;color:rgb(34 211 238 / var(--tw-text-opacity, 1))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-600{--tw-text-opacity: 1;color:rgb(22 163 74 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-muted-foreground\/50{color:hsl(var(--muted-foreground) / .5)}.text-muted-foreground\/60{color:hsl(var(--muted-foreground) / .6)}.text-orange-600{--tw-text-opacity: 1;color:rgb(234 88 12 / var(--tw-text-opacity, 1))}.text-orange-800{--tw-text-opacity: 1;color:rgb(154 52 18 / var(--tw-text-opacity, 1))}.text-orange-900{--tw-text-opacity: 1;color:rgb(124 45 18 / var(--tw-text-opacity, 1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-primary\/10{color:hsl(var(--primary) / .1)}.text-primary\/30{color:hsl(var(--primary) / .3)}.text-primary\/60{color:hsl(var(--primary) / .6)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-yellow-400{--tw-text-opacity: 1;color:rgb(250 204 21 / var(--tw-text-opacity, 1))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.text-yellow-600{--tw-text-opacity: 1;color:rgb(202 138 4 / var(--tw-text-opacity, 1))}.text-yellow-800{--tw-text-opacity: 1;color:rgb(133 77 14 / var(--tw-text-opacity, 1))}.text-yellow-900{--tw-text-opacity: 1;color:rgb(113 63 18 / var(--tw-text-opacity, 1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-none{--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary{--tw-ring-color: hsl(var(--primary))}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.blur-3xl{--tw-blur: blur(64px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-primary-gradient{color:hsl(var(--primary))}.has-gradient .text-primary-gradient{background:var(--primary-gradient);-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.\[--cell-size\:2rem\]{--cell-size: 2rem}.no-animations *,.no-animations *:before,.no-animations *:after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}.no-animations *:hover{transition-duration:.01ms!important}::view-transition-old(root),::view-transition-new(root){animation:none;mix-blend-mode:normal}::view-transition-old(root){z-index:1}::view-transition-new(root){z-index:999}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:border-primary\/50:hover{border-color:hsl(var(--primary) / .5)}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-accent\/50:hover{background-color:hsl(var(--accent) / .5)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-green-700:hover{--tw-bg-opacity: 1;background-color:rgb(21 128 61 / var(--tw-bg-opacity, 1))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-orange-700:hover{--tw-bg-opacity: 1;background-color:rgb(194 65 12 / var(--tw-bg-opacity, 1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-secondary\/90:hover{background-color:hsl(var(--secondary) / .9)}.hover\:bg-transparent:hover{background-color:transparent}.hover\:bg-white\/5:hover{background-color:#ffffff0d}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-green-700:hover{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.hover\:text-orange-700:hover{--tw-text-opacity: 1;color:rgb(194 65 12 / var(--tw-text-opacity, 1))}.hover\:text-primary\/80:hover{color:hsl(var(--primary) / .8)}.hover\:text-red-700:hover{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.hover\:text-yellow-300:hover{--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:ring-2:hover{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.hover\:ring-primary:hover{--tw-ring-color: hsl(var(--primary))}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-100:focus{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-1:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-0:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-red-500:focus-visible{--tw-ring-opacity: 1;--tw-ring-color: rgb(239 68 68 / var(--tw-ring-opacity, 1))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color: hsl(var(--background))}.active\:cursor-grabbing:active{cursor:grabbing}.active\:border-primary\/70:active{border-color:hsl(var(--primary) / .7)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.group[open] .group-open\:rotate-180{--tw-rotate: 180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity: 1;color:rgb(254 242 242 / var(--tw-text-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity: 1;--tw-ring-color: rgb(248 113 113 / var(--tw-ring-opacity, 1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color: #dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-disabled\:opacity-50[aria-disabled=true]{opacity:.5}.aria-selected\:text-muted-foreground[aria-selected=true]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y: -.25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-4[data-state=checked]{--tw-translate-x: 1rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x: var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x: var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes fade-out{0%{opacity:1}to{opacity:0}}.data-\[state\=closed\]\:animate-fade-out[data-state=closed]{animation:fade-out .15s ease-in}.data-\[state\=closed\]\:animate-slide-out-to-right[data-state=closed]{animation:slide-out-to-right .2s ease-in}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.data-\[state\=open\]\:animate-fade-in[data-state=open]{animation:fade-in .2s ease-out}@keyframes slide-in-from-right{0%{transform:translate(100%)}to{transform:translate(0)}}.data-\[state\=open\]\:animate-slide-in-from-right[data-state=open]{animation:slide-in-from-right .3s ease-out}@keyframes slide-out-to-right{0%{transform:translate(0)}to{transform:translate(100%)}}.data-\[swipe\=end\]\:animate-slide-out-to-right[data-swipe=end]{animation:slide-out-to-right .2s ease-in}.data-\[range-end\=true\]\:rounded-md[data-range-end=true]{border-radius:calc(var(--radius) - 2px)}.data-\[range-middle\=true\]\:rounded-none[data-range-middle=true]{border-radius:0}.data-\[range-start\=true\]\:rounded-md[data-range-start=true]{border-radius:calc(var(--radius) - 2px)}.data-\[selected\=true\]\:rounded-none[data-selected=true]{border-radius:0}.data-\[range-end\=true\]\:bg-primary[data-range-end=true]{background-color:hsl(var(--primary))}.data-\[range-middle\=true\]\:bg-accent[data-range-middle=true]{background-color:hsl(var(--accent))}.data-\[range-start\=true\]\:bg-primary[data-range-start=true],.data-\[selected-single\=true\]\:bg-primary[data-selected-single=true]{background-color:hsl(var(--primary))}.data-\[selected\=true\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=active\]\:bg-background[data-state=active]{background-color:hsl(var(--background))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[placeholder\]\:text-muted-foreground[data-placeholder]{color:hsl(var(--muted-foreground))}.data-\[range-end\=true\]\:text-primary-foreground[data-range-end=true]{color:hsl(var(--primary-foreground))}.data-\[range-middle\=true\]\:text-accent-foreground[data-range-middle=true]{color:hsl(var(--accent-foreground))}.data-\[range-start\=true\]\:text-primary-foreground[data-range-start=true],.data-\[selected-single\=true\]\:text-primary-foreground[data-selected-single=true]{color:hsl(var(--primary-foreground))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=active\]\:text-foreground[data-state=active]{color:hsl(var(--foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=open\]\:text-accent-foreground[data-state=open]{color:hsl(var(--accent-foreground))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[state\=active\]\:shadow[data-state=active]{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=active\]\:duration-300[data-state=active]{transition-duration:.3s}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:relative{position:relative}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:z-10{z-index:10}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:border-ring{border-color:hsl(var(--ring))}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-\[3px\]{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.group\/day[data-focused=true] .group-data-\[focused\=true\]\/day\:ring-ring\/50{--tw-ring-color: hsl(var(--ring) / .5)}.dark\:border-amber-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(146 64 14 / var(--tw-border-opacity, 1))}.dark\:border-blue-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 64 175 / var(--tw-border-opacity, 1))}.dark\:border-blue-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(30 58 138 / var(--tw-border-opacity, 1))}.dark\:border-gray-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(17 24 39 / var(--tw-border-opacity, 1))}.dark\:border-green-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(22 101 52 / var(--tw-border-opacity, 1))}.dark\:border-yellow-900:is(.dark *){--tw-border-opacity: 1;border-color:rgb(113 63 18 / var(--tw-border-opacity, 1))}.dark\:bg-amber-950\/30:is(.dark *){background-color:#451a034d}.dark\:bg-blue-500\/20:is(.dark *){background-color:#3b82f633}.dark\:bg-blue-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(30 58 138 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(23 37 84 / var(--tw-bg-opacity, 1))}.dark\:bg-blue-950\/20:is(.dark *){background-color:#17255433}.dark\:bg-blue-950\/30:is(.dark *){background-color:#1725544d}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/30:is(.dark *){background-color:#1f29374d}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-green-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(5 46 22 / var(--tw-bg-opacity, 1))}.dark\:bg-orange-950\/20:is(.dark *){background-color:#43140733}.dark\:bg-red-500\/20:is(.dark *){background-color:#ef444433}.dark\:bg-red-600\/30:is(.dark *){background-color:#dc26264d}.dark\:bg-red-950\/50:is(.dark *){background-color:#450a0a80}.dark\:bg-yellow-500\/20:is(.dark *){background-color:#eab30833}.dark\:bg-yellow-900:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(113 63 18 / var(--tw-bg-opacity, 1))}.dark\:bg-yellow-950\/30:is(.dark *){background-color:#4220064d}.dark\:text-amber-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 243 199 / var(--tw-text-opacity, 1))}.dark\:text-blue-100:is(.dark *){--tw-text-opacity: 1;color:rgb(219 234 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-200:is(.dark *){--tw-text-opacity: 1;color:rgb(191 219 254 / var(--tw-text-opacity, 1))}.dark\:text-blue-300:is(.dark *){--tw-text-opacity: 1;color:rgb(147 197 253 / var(--tw-text-opacity, 1))}.dark\:text-blue-400:is(.dark *){--tw-text-opacity: 1;color:rgb(96 165 250 / var(--tw-text-opacity, 1))}.dark\:text-cyan-500:is(.dark *){--tw-text-opacity: 1;color:rgb(6 182 212 / var(--tw-text-opacity, 1))}.dark\:text-gray-100:is(.dark *){--tw-text-opacity: 1;color:rgb(243 244 246 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-gray-600:is(.dark *){--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.dark\:text-green-400:is(.dark *){--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.dark\:text-orange-100:is(.dark *){--tw-text-opacity: 1;color:rgb(255 237 213 / var(--tw-text-opacity, 1))}.dark\:text-orange-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 215 170 / var(--tw-text-opacity, 1))}.dark\:text-red-400:is(.dark *){--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.dark\:text-red-500:is(.dark *){--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.dark\:text-yellow-100:is(.dark *){--tw-text-opacity: 1;color:rgb(254 249 195 / var(--tw-text-opacity, 1))}.dark\:text-yellow-200:is(.dark *){--tw-text-opacity: 1;color:rgb(254 240 138 / var(--tw-text-opacity, 1))}.dark\:text-yellow-300:is(.dark *){--tw-text-opacity: 1;color:rgb(253 224 71 / var(--tw-text-opacity, 1))}.dark\:text-yellow-500:is(.dark *){--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:focus\:bg-gray-800:focus:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}@media(min-width:640px){.sm\:right-2{right:.5rem}.sm\:right-3{right:.75rem}.sm\:top-2{top:.5rem}.sm\:top-3{top:.75rem}.sm\:order-1{order:1}.sm\:order-2{order:2}.sm\:col-span-2{grid-column:span 2 / span 2}.sm\:mx-0{margin-left:0;margin-right:0}.sm\:mb-3{margin-bottom:.75rem}.sm\:mb-4{margin-bottom:1rem}.sm\:mb-6{margin-bottom:1.5rem}.sm\:ml-1{margin-left:.25rem}.sm\:mr-1{margin-right:.25rem}.sm\:mr-2{margin-right:.5rem}.sm\:mt-0{margin-top:0}.sm\:mt-2{margin-top:.5rem}.sm\:mt-3{margin-top:.75rem}.sm\:mt-6{margin-top:1.5rem}.sm\:block{display:block}.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:grid{display:grid}.sm\:hidden{display:none}.sm\:h-10{height:2.5rem}.sm\:h-12{height:3rem}.sm\:h-2{height:.5rem}.sm\:h-24{height:6rem}.sm\:h-3{height:.75rem}.sm\:h-4{height:1rem}.sm\:h-8{height:2rem}.sm\:h-\[300px\]{height:300px}.sm\:h-\[400px\]{height:400px}.sm\:h-\[500px\]{height:500px}.sm\:h-\[calc\(100vh-280px\)\]{height:calc(100vh - 280px)}.sm\:w-10{width:2.5rem}.sm\:w-2{width:.5rem}.sm\:w-24{width:6rem}.sm\:w-3{width:.75rem}.sm\:w-4{width:1rem}.sm\:w-8{width:2rem}.sm\:w-\[140px\]{width:140px}.sm\:w-\[160px\]{width:160px}.sm\:w-\[200px\]{width:200px}.sm\:w-\[500px\]{width:500px}.sm\:w-auto{width:auto}.sm\:w-full{width:100%}.sm\:max-w-2xl{max-width:42rem}.sm\:max-w-\[420px\]{max-width:420px}.sm\:max-w-\[900px\]{max-width:900px}.sm\:max-w-md{max-width:28rem}.sm\:max-w-sm{max-width:24rem}.sm\:flex-1{flex:1 1 0%}.sm\:flex-none{flex:none}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.sm\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-wrap{flex-wrap:wrap}.sm\:items-start{align-items:flex-start}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-0{gap:0px}.sm\:gap-1{gap:.25rem}.sm\:gap-2{gap:.5rem}.sm\:gap-3{gap:.75rem}.sm\:gap-4{gap:1rem}.sm\:gap-6{gap:1.5rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.sm\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.sm\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-3{padding:.75rem}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:px-0{padding-left:0;padding-right:0}.sm\:px-3{padding-left:.75rem;padding-right:.75rem}.sm\:px-4{padding-left:1rem;padding-right:1rem}.sm\:pb-4{padding-bottom:1rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-\[200px\]{font-size:200px}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-lg{font-size:1.125rem;line-height:1.75rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}.sm\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:768px){.md\:top-4{top:1rem}.md\:mb-4{margin-bottom:1rem}.md\:mb-6{margin-bottom:1.5rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-8{margin-top:2rem}.md\:block{display:block}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-16{height:4rem}.md\:h-4{height:1rem}.md\:h-5{height:1.25rem}.md\:h-8{height:2rem}.md\:h-96{height:24rem}.md\:h-\[500px\]{height:500px}.md\:min-h-\[400px\]{min-height:400px}.md\:w-16{width:4rem}.md\:w-4{width:1rem}.md\:w-5{width:1.25rem}.md\:w-8{width:2rem}.md\:w-96{width:24rem}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-2{gap:.5rem}.md\:gap-3{gap:.75rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:whitespace-normal{white-space:normal}.md\:p-12{padding:3rem}.md\:p-4{padding:1rem}.md\:p-6{padding:1.5rem}.md\:p-8{padding:2rem}.md\:text-2xl{font-size:1.5rem;line-height:2rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-lg{font-size:1.125rem;line-height:1.75rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}.md\:text-xs{font-size:.75rem;line-height:1rem}}@media(min-width:1024px){.lg\:invisible{visibility:hidden}.lg\:relative{position:relative}.lg\:z-0{z-index:0}.lg\:mx-auto{margin-left:auto;margin-right:auto}.lg\:mb-1{margin-bottom:.25rem}.lg\:block{display:block}.lg\:hidden{display:none}.lg\:w-12{width:3rem}.lg\:w-16{width:4rem}.lg\:w-64{width:16rem}.lg\:w-8{width:2rem}.lg\:w-\[130px\]{width:130px}.lg\:w-\[160px\]{width:160px}.lg\:w-\[180px\]{width:180px}.lg\:w-\[200px\]{width:200px}.lg\:w-\[240px\]{width:240px}.lg\:w-\[75px\]{width:75px}.lg\:w-auto{width:auto}.lg\:w-full{width:100%}.lg\:max-w-0{max-width:0px}.lg\:flex-1{flex:1 1 0%}.lg\:flex-none{flex:none}.lg\:translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.lg\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}.lg\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}.lg\:justify-center{justify-content:center}.lg\:gap-0{gap:0px}.lg\:space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.lg\:overflow-hidden{overflow:hidden}.lg\:p-2{padding:.5rem}.lg\:p-6{padding:1.5rem}.lg\:px-0{padding-left:0;padding-right:0}.lg\:px-6{padding-left:1.5rem;padding-right:1.5rem}.lg\:pb-6{padding-bottom:1.5rem}.lg\:text-3xl{font-size:1.875rem;line-height:2.25rem}.lg\:opacity-0{opacity:0}}@media(min-width:1280px){.xl\:grid-cols-10{grid-template-columns:repeat(10,minmax(0,1fr))}.xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.xl\:grid-cols-8{grid-template-columns:repeat(8,minmax(0,1fr))}}.\[\&\+div\]\:text-xs+div{font-size:.75rem;line-height:1rem}.\[\&\:first-child\[data-selected\=true\]_button\]\:rounded-l-md:first-child[data-selected=true] button{border-top-left-radius:calc(var(--radius) - 2px);border-bottom-left-radius:calc(var(--radius) - 2px)}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\:last-child\[data-selected\=true\]_button\]\:rounded-r-md:last-child[data-selected=true] button{border-top-right-radius:calc(var(--radius) - 2px);border-bottom-right-radius:calc(var(--radius) - 2px)}.\[\&\>\[role\=checkbox\]\]\:translate-y-\[2px\]>[role=checkbox]{--tw-translate-y: 2px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>span\]\:line-clamp-1>span{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\[\&\>span\]\:text-xs>span{font-size:.75rem;line-height:1rem}.\[\&\>span\]\:opacity-70>span{opacity:.7}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y: -3px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:size-3\.5>svg{width:.875rem;height:.875rem}.\[\&\>svg\]\:h-2\.5>svg{height:.625rem}.\[\&\>svg\]\:h-3>svg{height:.75rem}.\[\&\>svg\]\:w-2\.5>svg{width:.625rem}.\[\&\>svg\]\:w-3>svg{width:.75rem}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\]\:text-muted-foreground>svg{color:hsl(var(--muted-foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_\.recharts-cartesian-axis-tick_text\]\:fill-muted-foreground .recharts-cartesian-axis-tick text{fill:hsl(var(--muted-foreground))}.\[\&_\.recharts-cartesian-grid_line\[stroke\=\'\#ccc\'\]\]\:stroke-border\/50 .recharts-cartesian-grid line[stroke="#ccc"]{stroke:hsl(var(--border) / .5)}.\[\&_\.recharts-curve\.recharts-tooltip-cursor\]\:stroke-border .recharts-curve.recharts-tooltip-cursor{stroke:hsl(var(--border))}.\[\&_\.recharts-dot\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-dot[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-layer\]\:outline-none .recharts-layer{outline:2px solid transparent;outline-offset:2px}.\[\&_\.recharts-polar-grid_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-polar-grid [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-radial-bar-background-sector\]\:fill-muted .recharts-radial-bar-background-sector,.\[\&_\.recharts-rectangle\.recharts-tooltip-cursor\]\:fill-muted .recharts-rectangle.recharts-tooltip-cursor{fill:hsl(var(--muted))}.\[\&_\.recharts-reference-line_\[stroke\=\'\#ccc\'\]\]\:stroke-border .recharts-reference-line [stroke="#ccc"]{stroke:hsl(var(--border))}.\[\&_\.recharts-sector\[stroke\=\'\#fff\'\]\]\:stroke-transparent .recharts-sector[stroke="#fff"]{stroke:transparent}.\[\&_\.recharts-sector\]\:outline-none .recharts-sector,.\[\&_\.recharts-surface\]\:outline-none .recharts-surface{outline:2px solid transparent;outline-offset:2px}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:invisible svg{visibility:hidden}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}[data-slot=card-content] .\[\[data-slot\=card-content\]_\&\]\:bg-transparent,[data-slot=popover-content] .\[\[data-slot\=popover-content\]_\&\]\:bg-transparent{background-color:transparent}@font-face{font-display:block;font-family:KaTeX_AMS;font-style:normal;font-weight:400;src:url(/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2) format("woff2"),url(/assets/KaTeX_AMS-Regular-DMm9YOAa.woff) format("woff"),url(/assets/KaTeX_AMS-Regular-DRggAlZN.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Caligraphic;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2) format("woff2"),url(/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff) format("woff"),url(/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff) format("woff"),url(/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Fraktur;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2) format("woff2"),url(/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff) format("woff"),url(/assets/KaTeX_Fraktur-Regular-CB_wures.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:700;src:url(/assets/KaTeX_Main-Bold-Cx986IdX.woff2) format("woff2"),url(/assets/KaTeX_Main-Bold-Jm3AIy58.woff) format("woff"),url(/assets/KaTeX_Main-Bold-waoOVXN0.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2) format("woff2"),url(/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff) format("woff"),url(/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2) format("woff2"),url(/assets/KaTeX_Main-Italic-BMLOBm91.woff) format("woff"),url(/assets/KaTeX_Main-Italic-3WenGoN9.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Main;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Main-Regular-B22Nviop.woff2) format("woff2"),url(/assets/KaTeX_Main-Regular-Dr94JaBh.woff) format("woff"),url(/assets/KaTeX_Main-Regular-ypZvNtVU.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:700;src:url(/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2) format("woff2"),url(/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff) format("woff"),url(/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Math;font-style:italic;font-weight:400;src:url(/assets/KaTeX_Math-Italic-t53AETM-.woff2) format("woff2"),url(/assets/KaTeX_Math-Italic-DA0__PXp.woff) format("woff"),url(/assets/KaTeX_Math-Italic-flOr_0UB.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:700;src:url(/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff) format("woff"),url(/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:italic;font-weight:400;src:url(/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff) format("woff"),url(/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_SansSerif;font-style:normal;font-weight:400;src:url(/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2) format("woff2"),url(/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff) format("woff"),url(/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Script;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Script-Regular-D3wIWfF6.woff2) format("woff2"),url(/assets/KaTeX_Script-Regular-D5yQViql.woff) format("woff"),url(/assets/KaTeX_Script-Regular-C5JkGWo-.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size1;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2) format("woff2"),url(/assets/KaTeX_Size1-Regular-C195tn64.woff) format("woff"),url(/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size2;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2) format("woff2"),url(/assets/KaTeX_Size2-Regular-oD1tc_U0.woff) format("woff"),url(/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size3;font-style:normal;font-weight:400;src:url(data:font/woff2;base64,d09GMgABAAAAAA4oAA4AAAAAHbQAAA3TAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAABmAAgRQIDgmcDBEICo1oijYBNgIkA14LMgAEIAWJAAeBHAyBHBvbGiMRdnO0IkRRkiYDgr9KsJ1NUAf2kILNxgUmgqIgq1P89vcbIcmsQbRps3vCcXdYOKSWEPEKgZgQkprQQsxIXUgq0DqpGKmIvrgkeVGtEQD9DzAO29fM9jYhxZEsL2FeURH2JN4MIcTdO049NCVdxQ/w9NrSYFEBKTDKpLKfNkCGDc1RwjZLQcm3vqJ2UW9Xfa3tgAHz6ivp6vgC2yD4/6352ndnN0X0TL7seypkjZlMsjmZnf0Mm5Q+JykRWQBKCVCVPbARPXWyQtb5VgLB6Biq7/Uixcj2WGqdI8tGSgkuRG+t910GKP2D7AQH0DB9FMDW/obJZ8giFI3Wg8Cvevz0M+5m0rTh7XDBlvo9Y4vm13EXmfttwI4mBo1EG15fxJhUiCLbiiyCf/ZA6MFAhg3pGIZGdGIVjtPn6UcMk9A/UUr9PhoNsCENw1APAq0gpH73e+M+0ueyHbabc3vkbcdtzcf/fiy+NxQEjf9ud/ELBHAXJ0nk4z+MXH2Ev/kWyV4k7SkvpPc9Qr38F6RPWnM9cN6DJ0AdD1BhtgABtmoRoFCvPsBAumNm6soZG2Gk5GyVTo2sJncSyp0jQTYoR6WDvTwaaEcHsxHfvuWhHA3a6bN7twRKtcGok6NsCi7jYRrM2jExsUFMxMQYuJbMhuWNOumEJy9hi29Dmg5zMp/A5+hhPG19j1vBrq8JTLr8ki5VLPmG/PynJHVul440bxg5xuymHUFPBshC+nA9I1FmwbRBTNHAcik3Oae0cxKoI3MOriM42UrPe51nsaGxJ+WfXubAsP84aabUlQSJ1IiE0iPETLUU4CATgfXSCSpuRFRmCGbO+wSpAnzaeaCYW1VNEysRtuXCEL1kUFUbbtMv3Tilt/1c11jt3Q5bbMa84cpWipp8Elw3MZhOHsOlwwVUQM3lAR35JiFQbaYCRnMF2lxAWoOg2gyoIV4PouX8HytNIfLhqpJtXB4vjiViUI8IJ7bkC4ikkQvKksnOTKICwnqWSZ9YS5f0WCxmpgjbIq7EJcM4aI2nmhLNY2JIUgOjXZFWBHb+x5oh6cwb0Tv1ackHdKi0I9OO2wE9aogIOn540CCCziyhN+IaejtgAONKznHlHyutPrHGwCx9S6B8kfS4Mfi4Eyv7OU730bT1SCBjt834cXsf43zVjPUqqJjgrjeGnBxSG4aYAKFuVbeCfkDIjAqMb6yLNIbCuvXhMH2/+k2vkNpkORhR59N1CkzoOENvneIosjYmuTxlhUzaGEJQ/iWqx4dmwpmKjrwTiTGTCVozNAYqk/zXOndWxuWSmJkQpJw3pK5KX6QrLt5LATMqpmPAQhkhK6PUjzHUn7E0gHE0kPE0iKkolgkUx9SZmVAdDgpffdyJKg3k7VmzYGCwVXGz/tXmkOIp+vcWs+EMuhhvN0h9uhfzWJziBQmCREGSIFmQIkgVpAnSBRmC//6hkLZwaVhwxlrJSOdqlFtOYxlau9F2QN5Y98xmIAsiM1HVp2VFX+DHHGg6Ecjh3vmqtidX3qHI2qycTk/iwxSt5UzTmEP92ZBnEWTk4Mx8Mpl78ZDokxg/KWb+Q0QkvdKVmq3TMW+RXEgrsziSAfNXFMhDc60N5N9jQzjfO0kBKpUZl0ZmwJ41j/B9Hz6wmRaJB84niNmQrzp9eSlQCDDzazGDdVi3P36VZQ+Jy4f9UBNp+3zTjqI4abaFAm+GShVaXlsGdF3FYzZcDI6cori4kMxUECl9IjJZpzkvitAoxKue+90pDMvcKRxLl53TmOKCmV/xRolNKSqqUxc6LStOETmFOiLZZptlZepcKiAzteG8PEdpnQpbOMNcMsR4RR2Bs0cKFEvSmIjAFcnarqwUL4lDhHmnVkwu1IwshbiCcgvOheZuYyOteufZZwlcTlLgnZ3o/WcYdzZHW/WGaqaVfmTZ1aWCceJjkbZqsfbkOtcFlUZM/jy+hXHDbaUobWqqXaeWobbLO99yG5N3U4wxco0rQGGcOLASFMXeJoham8M+/x6O2WywK2l4HGbq1CoUyC/IZikQhdq3SiuNrvAEj0AVu9x2x3lp/xWzahaxidezFVtdcb5uEnzyl0ZmYiuKI0exvCd4Xc9CV1KB0db00z92wDPde0kukbvZIWN6jUWFTmPIC/Y4UPCm8UfDTFZpZNon1qLFTkBhxzB+FjQRA2Q/YRJT8pQigslMaUpFyAG8TMlXigiqmAZX4xgijKjRlGpLE0GdplRfCaJo0JQaSxNBk6ZmMzcya0FmrcisDdn0Q3HI2sWSppYigmlM1XT/kLQZSNpMJG0WkjYbSZuDpM1F0uYhFc1HxU4m1QJjDK6iL0S5uSj5rgXc3RejEigtcRBtqYPQsiTskmO5vosV+q4VGIKbOkDg0jtRrq+Em1YloaTFar3EGr1EUC8R0kus1Uus00usL97ABr2BjXoDm/QGNhuWtMVBKOwg/i78lT7hBsAvDmwHc/ao3vmUbBmhjeYySZNWvGkfZAgISDSaDo1SVpzGDsAEkF8B+gEapViUoZgUWXcRIGFZNm6gWbAKk0bp0k1MHG9fLYtV4iS2SmLEQFARzRcnf9PUS0LVn05/J9MiRRBU3v2IrvW974v4N00L7ZMk0wXP1409CHo/an8zTRHD3eSJ6m8D4YMkZNl3M79sqeuAsr/m3f+8/yl7A50aiAEJgeBeMWzu7ui9UfUBCe2TIqZIoOd/3/udRBOQidQZUERzb2/VwZN1H/Sju82ew2H2Wfr6qvfVf3hqwDvAIpkQVFy4B9Pe9e4/XvPeceu7h3dvO56iJPf0+A6cqA2ip18ER+iFgggiuOkvj24bby0N9j2UHIkgqIt+sVgfodC4YghLSMjSZbH0VR/6dMDrYJeKHilKTemt6v6kvzvn3/RrdWtr0GoN/xL+Sex/cPYLUpepx9cz/D46UPU5KXgAQa+NDps1v6J3xP1i2HtaDB0M9aX2deA7SYff//+gUCovMmIK/qfsFcOk+4Y5ZN97XlG6zebqtMbKgeRFi51vnxTQYBUik2rS/Cn6PC8ADR8FGxsRPB82dzfND90gIcshOcYUkfjherBz53odpm6TP8txlwOZ71xmfHHOvq053qFF/MRlS3jP0ELudrf2OeN8DHvp6ZceLe8qKYvWz/7yp0u4dKPfli3CYq0O13Ih71mylJ80tOi10On8wi+F4+LWgDPeJ30msSQt9/vkmHq9/Lvo2b461mP801v3W4xTcs6CbvF9UDdrSt+A8OUbpSh55qAUFXWznBBfdeJ8a4d7ugT5tvxUza3h9m4H7ptTqiG4z0g5dc0X29OcGlhpGFMpQo9ytTS+NViZpNdvU4kWx+LKxNY10kQ1yqGXrhe4/1nvP7E+nd5A92TtaRplbHSqoIdOqtRWti+fkB5/n1+/VvCmz12pG1kpQWsfi1ftlBobm0bpngs16CHkbIwdLnParxtTV3QYRlfJ0KFskH7pdN/YDn+yRuSd7sNH3aO0DYPggk6uWuXrfOc+fa3VTxFVvKaNxHsiHmsXyCLIE5yuOeN3/Jdf8HBL/5M6shjyhxHx9BjB1O0+4NLOnjLLSxwO7ukN4jMbOIcD879KLSi6Pk61Oqm2377n8079PXEEQ7cy7OKEC9nbpet118fxweTafpt69x/Bt8UqGzNQt7aelpc44dn5cqhwf71+qKp/Zf/+a0zcizOUWpl/iBcSXip0pplkatCchoH5c5aUM8I7/dWxAej8WicPL1URFZ9BDJelUwEwTkGqUhgSlydVes95YdXvhh9Gfz/aeFWvgVb4tuLbcv4+wLdutVZv/cUonwBD/6eDlE0aSiKK/uoH3+J1wDE/jMVqY2ysGufN84oIXB0sPzy8ollX/LegY74DgJXJR57sn+VGza0x3DnuIgABFM15LmajjjsNlYj+JEZGbuRYcAMOWxFkPN2w6Wd46xo4gVWQR/X4lyI/R6K/YK0110GzudPRW7Y+UOBGTfNNzHeYT0fiH0taunBpq9HEW8OKSaBGj21L0MqenEmNRWBAWDWAk4CpNoEZJ2tTaPFgbQYj8HxtFilErs3BTRwT8uO1NXQaWfIotchmPkAF5mMBAliEmZiOGVgCG9LgRzpscMAOOwowlT3JhusdazXGSC/hxR3UlmWVwWHpOIKheqONvjyhSiTHIkVUco5bnji8m//zL7PKaT1Vl5I6UE609f+gkr6MZKVyKc7zJRmCahLsdlyA5fdQkRSan9LgnnLEyGSkaKJCJog0wAgvepWBt80+1yKln1bMVtCljfNWDueKLsWwaEbBSfSPTEmVRsUcYYMnEjcjeyCZzBXK9E9BYBXLKjOSpUDR+nEV3TFSUdQaz+ot98QxgXwx0GQ+EEUAKB2qZPkQQ0GqFD8UPFMqyaCHM24BZmSGic9EYMagKizOw9Hz50DMrDLrqqLkTAhplMictiCAx5S3BIUQdeJeLnBy2CNtMfz6cV4u8XKoFZQesbf9YZiIERiHjaNodDW6LgcirX/mPnJIkBGDUpTBhSa0EIr38D5hCIszhCM8URGBqImoWjpvpt1ebu/v3Gl3qJfMnNM+9V+kiRFyROTPHQWOcs1dNW94/ukKMPZBvDi55i5CttdeJz84DLngLqjcdwEZ87bFFR8CIG35OAkDVN6VRDZ7aq67NteYqZ2lpT8oYB2CytoBd6VuAx4WgiAsnuj3WohG+LugzXiQRDeM3XYXlULv4dp5VFYC) format("woff2"),url(/assets/KaTeX_Size3-Regular-CTq5MqoE.woff) format("woff"),url(/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Size4;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2) format("woff2"),url(/assets/KaTeX_Size4-Regular-BF-4gkZK.woff) format("woff"),url(/assets/KaTeX_Size4-Regular-DWFBv043.ttf) format("truetype")}@font-face{font-display:block;font-family:KaTeX_Typewriter;font-style:normal;font-weight:400;src:url(/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2) format("woff2"),url(/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff) format("woff"),url(/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf) format("truetype")}.katex{font: 1.21em KaTeX_Main,Times New Roman,serif;line-height:1.2;text-indent:0;text-rendering:auto}.katex *{-ms-high-contrast-adjust:none!important;border-color:currentColor}.katex .katex-version:after{content:"0.16.25"}.katex .katex-mathml{clip:rect(1px,1px,1px,1px);border:0;height:1px;overflow:hidden;padding:0;position:absolute;width:1px}.katex .katex-html>.newline{display:block}.katex .base{position:relative;white-space:nowrap;width:-moz-min-content;width:min-content}.katex .base,.katex .strut{display:inline-block}.katex .textbf{font-weight:700}.katex .textit{font-style:italic}.katex .textrm{font-family:KaTeX_Main}.katex .textsf{font-family:KaTeX_SansSerif}.katex .texttt{font-family:KaTeX_Typewriter}.katex .mathnormal{font-family:KaTeX_Math;font-style:italic}.katex .mathit{font-family:KaTeX_Main;font-style:italic}.katex .mathrm{font-style:normal}.katex .mathbf{font-family:KaTeX_Main;font-weight:700}.katex .boldsymbol{font-family:KaTeX_Math;font-style:italic;font-weight:700}.katex .amsrm,.katex .mathbb,.katex .textbb{font-family:KaTeX_AMS}.katex .mathcal{font-family:KaTeX_Caligraphic}.katex .mathfrak,.katex .textfrak{font-family:KaTeX_Fraktur}.katex .mathboldfrak,.katex .textboldfrak{font-family:KaTeX_Fraktur;font-weight:700}.katex .mathtt{font-family:KaTeX_Typewriter}.katex .mathscr,.katex .textscr{font-family:KaTeX_Script}.katex .mathsf,.katex .textsf{font-family:KaTeX_SansSerif}.katex .mathboldsf,.katex .textboldsf{font-family:KaTeX_SansSerif;font-weight:700}.katex .mathitsf,.katex .mathsfit,.katex .textitsf{font-family:KaTeX_SansSerif;font-style:italic}.katex .mainrm{font-family:KaTeX_Main;font-style:normal}.katex .vlist-t{border-collapse:collapse;display:inline-table;table-layout:fixed}.katex .vlist-r{display:table-row}.katex .vlist{display:table-cell;position:relative;vertical-align:bottom}.katex .vlist>span{display:block;height:0;position:relative}.katex .vlist>span>span{display:inline-block}.katex .vlist>span>.pstrut{overflow:hidden;width:0}.katex .vlist-t2{margin-right:-2px}.katex .vlist-s{display:table-cell;font-size:1px;min-width:2px;vertical-align:bottom;width:2px}.katex .vbox{align-items:baseline;display:inline-flex;flex-direction:column}.katex .hbox{width:100%}.katex .hbox,.katex .thinbox{display:inline-flex;flex-direction:row}.katex .thinbox{max-width:0;width:0}.katex .msupsub{text-align:left}.katex .mfrac>span>span{text-align:center}.katex .mfrac .frac-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline,.katex .hline,.katex .mfrac .frac-line,.katex .overline .overline-line,.katex .rule,.katex .underline .underline-line{min-height:1px}.katex .mspace{display:inline-block}.katex .clap,.katex .llap,.katex .rlap{position:relative;width:0}.katex .clap>.inner,.katex .llap>.inner,.katex .rlap>.inner{position:absolute}.katex .clap>.fix,.katex .llap>.fix,.katex .rlap>.fix{display:inline-block}.katex .llap>.inner{right:0}.katex .clap>.inner,.katex .rlap>.inner{left:0}.katex .clap>.inner>span{margin-left:-50%;margin-right:50%}.katex .rule{border:0 solid;display:inline-block;position:relative}.katex .hline,.katex .overline .overline-line,.katex .underline .underline-line{border-bottom-style:solid;display:inline-block;width:100%}.katex .hdashline{border-bottom-style:dashed;display:inline-block;width:100%}.katex .sqrt>.root{margin-left:.2777777778em;margin-right:-.5555555556em}.katex .fontsize-ensurer.reset-size1.size1,.katex .sizing.reset-size1.size1{font-size:1em}.katex .fontsize-ensurer.reset-size1.size2,.katex .sizing.reset-size1.size2{font-size:1.2em}.katex .fontsize-ensurer.reset-size1.size3,.katex .sizing.reset-size1.size3{font-size:1.4em}.katex .fontsize-ensurer.reset-size1.size4,.katex .sizing.reset-size1.size4{font-size:1.6em}.katex .fontsize-ensurer.reset-size1.size5,.katex .sizing.reset-size1.size5{font-size:1.8em}.katex .fontsize-ensurer.reset-size1.size6,.katex .sizing.reset-size1.size6{font-size:2em}.katex .fontsize-ensurer.reset-size1.size7,.katex .sizing.reset-size1.size7{font-size:2.4em}.katex .fontsize-ensurer.reset-size1.size8,.katex .sizing.reset-size1.size8{font-size:2.88em}.katex .fontsize-ensurer.reset-size1.size9,.katex .sizing.reset-size1.size9{font-size:3.456em}.katex .fontsize-ensurer.reset-size1.size10,.katex .sizing.reset-size1.size10{font-size:4.148em}.katex .fontsize-ensurer.reset-size1.size11,.katex .sizing.reset-size1.size11{font-size:4.976em}.katex .fontsize-ensurer.reset-size2.size1,.katex .sizing.reset-size2.size1{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size2.size2,.katex .sizing.reset-size2.size2{font-size:1em}.katex .fontsize-ensurer.reset-size2.size3,.katex .sizing.reset-size2.size3{font-size:1.1666666667em}.katex .fontsize-ensurer.reset-size2.size4,.katex .sizing.reset-size2.size4{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size2.size5,.katex .sizing.reset-size2.size5{font-size:1.5em}.katex .fontsize-ensurer.reset-size2.size6,.katex .sizing.reset-size2.size6{font-size:1.6666666667em}.katex .fontsize-ensurer.reset-size2.size7,.katex .sizing.reset-size2.size7{font-size:2em}.katex .fontsize-ensurer.reset-size2.size8,.katex .sizing.reset-size2.size8{font-size:2.4em}.katex .fontsize-ensurer.reset-size2.size9,.katex .sizing.reset-size2.size9{font-size:2.88em}.katex .fontsize-ensurer.reset-size2.size10,.katex .sizing.reset-size2.size10{font-size:3.4566666667em}.katex .fontsize-ensurer.reset-size2.size11,.katex .sizing.reset-size2.size11{font-size:4.1466666667em}.katex .fontsize-ensurer.reset-size3.size1,.katex .sizing.reset-size3.size1{font-size:.7142857143em}.katex .fontsize-ensurer.reset-size3.size2,.katex .sizing.reset-size3.size2{font-size:.8571428571em}.katex .fontsize-ensurer.reset-size3.size3,.katex .sizing.reset-size3.size3{font-size:1em}.katex .fontsize-ensurer.reset-size3.size4,.katex .sizing.reset-size3.size4{font-size:1.1428571429em}.katex .fontsize-ensurer.reset-size3.size5,.katex .sizing.reset-size3.size5{font-size:1.2857142857em}.katex .fontsize-ensurer.reset-size3.size6,.katex .sizing.reset-size3.size6{font-size:1.4285714286em}.katex .fontsize-ensurer.reset-size3.size7,.katex .sizing.reset-size3.size7{font-size:1.7142857143em}.katex .fontsize-ensurer.reset-size3.size8,.katex .sizing.reset-size3.size8{font-size:2.0571428571em}.katex .fontsize-ensurer.reset-size3.size9,.katex .sizing.reset-size3.size9{font-size:2.4685714286em}.katex .fontsize-ensurer.reset-size3.size10,.katex .sizing.reset-size3.size10{font-size:2.9628571429em}.katex .fontsize-ensurer.reset-size3.size11,.katex .sizing.reset-size3.size11{font-size:3.5542857143em}.katex .fontsize-ensurer.reset-size4.size1,.katex .sizing.reset-size4.size1{font-size:.625em}.katex .fontsize-ensurer.reset-size4.size2,.katex .sizing.reset-size4.size2{font-size:.75em}.katex .fontsize-ensurer.reset-size4.size3,.katex .sizing.reset-size4.size3{font-size:.875em}.katex .fontsize-ensurer.reset-size4.size4,.katex .sizing.reset-size4.size4{font-size:1em}.katex .fontsize-ensurer.reset-size4.size5,.katex .sizing.reset-size4.size5{font-size:1.125em}.katex .fontsize-ensurer.reset-size4.size6,.katex .sizing.reset-size4.size6{font-size:1.25em}.katex .fontsize-ensurer.reset-size4.size7,.katex .sizing.reset-size4.size7{font-size:1.5em}.katex .fontsize-ensurer.reset-size4.size8,.katex .sizing.reset-size4.size8{font-size:1.8em}.katex .fontsize-ensurer.reset-size4.size9,.katex .sizing.reset-size4.size9{font-size:2.16em}.katex .fontsize-ensurer.reset-size4.size10,.katex .sizing.reset-size4.size10{font-size:2.5925em}.katex .fontsize-ensurer.reset-size4.size11,.katex .sizing.reset-size4.size11{font-size:3.11em}.katex .fontsize-ensurer.reset-size5.size1,.katex .sizing.reset-size5.size1{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size5.size2,.katex .sizing.reset-size5.size2{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size5.size3,.katex .sizing.reset-size5.size3{font-size:.7777777778em}.katex .fontsize-ensurer.reset-size5.size4,.katex .sizing.reset-size5.size4{font-size:.8888888889em}.katex .fontsize-ensurer.reset-size5.size5,.katex .sizing.reset-size5.size5{font-size:1em}.katex .fontsize-ensurer.reset-size5.size6,.katex .sizing.reset-size5.size6{font-size:1.1111111111em}.katex .fontsize-ensurer.reset-size5.size7,.katex .sizing.reset-size5.size7{font-size:1.3333333333em}.katex .fontsize-ensurer.reset-size5.size8,.katex .sizing.reset-size5.size8{font-size:1.6em}.katex .fontsize-ensurer.reset-size5.size9,.katex .sizing.reset-size5.size9{font-size:1.92em}.katex .fontsize-ensurer.reset-size5.size10,.katex .sizing.reset-size5.size10{font-size:2.3044444444em}.katex .fontsize-ensurer.reset-size5.size11,.katex .sizing.reset-size5.size11{font-size:2.7644444444em}.katex .fontsize-ensurer.reset-size6.size1,.katex .sizing.reset-size6.size1{font-size:.5em}.katex .fontsize-ensurer.reset-size6.size2,.katex .sizing.reset-size6.size2{font-size:.6em}.katex .fontsize-ensurer.reset-size6.size3,.katex .sizing.reset-size6.size3{font-size:.7em}.katex .fontsize-ensurer.reset-size6.size4,.katex .sizing.reset-size6.size4{font-size:.8em}.katex .fontsize-ensurer.reset-size6.size5,.katex .sizing.reset-size6.size5{font-size:.9em}.katex .fontsize-ensurer.reset-size6.size6,.katex .sizing.reset-size6.size6{font-size:1em}.katex .fontsize-ensurer.reset-size6.size7,.katex .sizing.reset-size6.size7{font-size:1.2em}.katex .fontsize-ensurer.reset-size6.size8,.katex .sizing.reset-size6.size8{font-size:1.44em}.katex .fontsize-ensurer.reset-size6.size9,.katex .sizing.reset-size6.size9{font-size:1.728em}.katex .fontsize-ensurer.reset-size6.size10,.katex .sizing.reset-size6.size10{font-size:2.074em}.katex .fontsize-ensurer.reset-size6.size11,.katex .sizing.reset-size6.size11{font-size:2.488em}.katex .fontsize-ensurer.reset-size7.size1,.katex .sizing.reset-size7.size1{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size7.size2,.katex .sizing.reset-size7.size2{font-size:.5em}.katex .fontsize-ensurer.reset-size7.size3,.katex .sizing.reset-size7.size3{font-size:.5833333333em}.katex .fontsize-ensurer.reset-size7.size4,.katex .sizing.reset-size7.size4{font-size:.6666666667em}.katex .fontsize-ensurer.reset-size7.size5,.katex .sizing.reset-size7.size5{font-size:.75em}.katex .fontsize-ensurer.reset-size7.size6,.katex .sizing.reset-size7.size6{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size7.size7,.katex .sizing.reset-size7.size7{font-size:1em}.katex .fontsize-ensurer.reset-size7.size8,.katex .sizing.reset-size7.size8{font-size:1.2em}.katex .fontsize-ensurer.reset-size7.size9,.katex .sizing.reset-size7.size9{font-size:1.44em}.katex .fontsize-ensurer.reset-size7.size10,.katex .sizing.reset-size7.size10{font-size:1.7283333333em}.katex .fontsize-ensurer.reset-size7.size11,.katex .sizing.reset-size7.size11{font-size:2.0733333333em}.katex .fontsize-ensurer.reset-size8.size1,.katex .sizing.reset-size8.size1{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size8.size2,.katex .sizing.reset-size8.size2{font-size:.4166666667em}.katex .fontsize-ensurer.reset-size8.size3,.katex .sizing.reset-size8.size3{font-size:.4861111111em}.katex .fontsize-ensurer.reset-size8.size4,.katex .sizing.reset-size8.size4{font-size:.5555555556em}.katex .fontsize-ensurer.reset-size8.size5,.katex .sizing.reset-size8.size5{font-size:.625em}.katex .fontsize-ensurer.reset-size8.size6,.katex .sizing.reset-size8.size6{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size8.size7,.katex .sizing.reset-size8.size7{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size8.size8,.katex .sizing.reset-size8.size8{font-size:1em}.katex .fontsize-ensurer.reset-size8.size9,.katex .sizing.reset-size8.size9{font-size:1.2em}.katex .fontsize-ensurer.reset-size8.size10,.katex .sizing.reset-size8.size10{font-size:1.4402777778em}.katex .fontsize-ensurer.reset-size8.size11,.katex .sizing.reset-size8.size11{font-size:1.7277777778em}.katex .fontsize-ensurer.reset-size9.size1,.katex .sizing.reset-size9.size1{font-size:.2893518519em}.katex .fontsize-ensurer.reset-size9.size2,.katex .sizing.reset-size9.size2{font-size:.3472222222em}.katex .fontsize-ensurer.reset-size9.size3,.katex .sizing.reset-size9.size3{font-size:.4050925926em}.katex .fontsize-ensurer.reset-size9.size4,.katex .sizing.reset-size9.size4{font-size:.462962963em}.katex .fontsize-ensurer.reset-size9.size5,.katex .sizing.reset-size9.size5{font-size:.5208333333em}.katex .fontsize-ensurer.reset-size9.size6,.katex .sizing.reset-size9.size6{font-size:.5787037037em}.katex .fontsize-ensurer.reset-size9.size7,.katex .sizing.reset-size9.size7{font-size:.6944444444em}.katex .fontsize-ensurer.reset-size9.size8,.katex .sizing.reset-size9.size8{font-size:.8333333333em}.katex .fontsize-ensurer.reset-size9.size9,.katex .sizing.reset-size9.size9{font-size:1em}.katex .fontsize-ensurer.reset-size9.size10,.katex .sizing.reset-size9.size10{font-size:1.2002314815em}.katex .fontsize-ensurer.reset-size9.size11,.katex .sizing.reset-size9.size11{font-size:1.4398148148em}.katex .fontsize-ensurer.reset-size10.size1,.katex .sizing.reset-size10.size1{font-size:.2410800386em}.katex .fontsize-ensurer.reset-size10.size2,.katex .sizing.reset-size10.size2{font-size:.2892960463em}.katex .fontsize-ensurer.reset-size10.size3,.katex .sizing.reset-size10.size3{font-size:.337512054em}.katex .fontsize-ensurer.reset-size10.size4,.katex .sizing.reset-size10.size4{font-size:.3857280617em}.katex .fontsize-ensurer.reset-size10.size5,.katex .sizing.reset-size10.size5{font-size:.4339440694em}.katex .fontsize-ensurer.reset-size10.size6,.katex .sizing.reset-size10.size6{font-size:.4821600771em}.katex .fontsize-ensurer.reset-size10.size7,.katex .sizing.reset-size10.size7{font-size:.5785920926em}.katex .fontsize-ensurer.reset-size10.size8,.katex .sizing.reset-size10.size8{font-size:.6943105111em}.katex .fontsize-ensurer.reset-size10.size9,.katex .sizing.reset-size10.size9{font-size:.8331726133em}.katex .fontsize-ensurer.reset-size10.size10,.katex .sizing.reset-size10.size10{font-size:1em}.katex .fontsize-ensurer.reset-size10.size11,.katex .sizing.reset-size10.size11{font-size:1.1996142719em}.katex .fontsize-ensurer.reset-size11.size1,.katex .sizing.reset-size11.size1{font-size:.2009646302em}.katex .fontsize-ensurer.reset-size11.size2,.katex .sizing.reset-size11.size2{font-size:.2411575563em}.katex .fontsize-ensurer.reset-size11.size3,.katex .sizing.reset-size11.size3{font-size:.2813504823em}.katex .fontsize-ensurer.reset-size11.size4,.katex .sizing.reset-size11.size4{font-size:.3215434084em}.katex .fontsize-ensurer.reset-size11.size5,.katex .sizing.reset-size11.size5{font-size:.3617363344em}.katex .fontsize-ensurer.reset-size11.size6,.katex .sizing.reset-size11.size6{font-size:.4019292605em}.katex .fontsize-ensurer.reset-size11.size7,.katex .sizing.reset-size11.size7{font-size:.4823151125em}.katex .fontsize-ensurer.reset-size11.size8,.katex .sizing.reset-size11.size8{font-size:.578778135em}.katex .fontsize-ensurer.reset-size11.size9,.katex .sizing.reset-size11.size9{font-size:.6945337621em}.katex .fontsize-ensurer.reset-size11.size10,.katex .sizing.reset-size11.size10{font-size:.8336012862em}.katex .fontsize-ensurer.reset-size11.size11,.katex .sizing.reset-size11.size11{font-size:1em}.katex .delimsizing.size1{font-family:KaTeX_Size1}.katex .delimsizing.size2{font-family:KaTeX_Size2}.katex .delimsizing.size3{font-family:KaTeX_Size3}.katex .delimsizing.size4{font-family:KaTeX_Size4}.katex .delimsizing.mult .delim-size1>span{font-family:KaTeX_Size1}.katex .delimsizing.mult .delim-size4>span{font-family:KaTeX_Size4}.katex .nulldelimiter{display:inline-block;width:.12em}.katex .delimcenter,.katex .op-symbol{position:relative}.katex .op-symbol.small-op{font-family:KaTeX_Size1}.katex .op-symbol.large-op{font-family:KaTeX_Size2}.katex .accent>.vlist-t,.katex .op-limits>.vlist-t{text-align:center}.katex .accent .accent-body{position:relative}.katex .accent .accent-body:not(.accent-full){width:0}.katex .overlay{display:block}.katex .mtable .vertical-separator{display:inline-block;min-width:1px}.katex .mtable .arraycolsep{display:inline-block}.katex .mtable .col-align-c>.vlist-t{text-align:center}.katex .mtable .col-align-l>.vlist-t{text-align:left}.katex .mtable .col-align-r>.vlist-t{text-align:right}.katex .svg-align{text-align:left}.katex svg{fill:currentColor;stroke:currentColor;fill-rule:nonzero;fill-opacity:1;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;display:block;height:inherit;position:absolute;width:100%}.katex svg path{stroke:none}.katex img{border-style:none;max-height:none;max-width:none;min-height:0;min-width:0}.katex .stretchy{display:block;overflow:hidden;position:relative;width:100%}.katex .stretchy:after,.katex .stretchy:before{content:""}.katex .hide-tail{overflow:hidden;position:relative;width:100%}.katex .halfarrow-left{left:0;overflow:hidden;position:absolute;width:50.2%}.katex .halfarrow-right{overflow:hidden;position:absolute;right:0;width:50.2%}.katex .brace-left{left:0;overflow:hidden;position:absolute;width:25.1%}.katex .brace-center{left:25%;overflow:hidden;position:absolute;width:50%}.katex .brace-right{overflow:hidden;position:absolute;right:0;width:25.1%}.katex .x-arrow-pad{padding:0 .5em}.katex .cd-arrow-pad{padding:0 .55556em 0 .27778em}.katex .mover,.katex .munder,.katex .x-arrow{text-align:center}.katex .boxpad{padding:0 .3em}.katex .fbox,.katex .fcolorbox{border:.04em solid;box-sizing:border-box}.katex .cancel-pad{padding:0 .2em}.katex .cancel-lap{margin-left:-.2em;margin-right:-.2em}.katex .sout{border-bottom-style:solid;border-bottom-width:.08em}.katex .angl{border-right:.049em solid;border-top:.049em solid;box-sizing:border-box;margin-right:.03889em}.katex .anglpad{padding:0 .03889em}.katex .eqn-num:before{content:"(" counter(katexEqnNo) ")";counter-increment:katexEqnNo}.katex .mml-eqn-num:before{content:"(" counter(mmlEqnNo) ")";counter-increment:mmlEqnNo}.katex .mtr-glue{width:50%}.katex .cd-vert-arrow{display:inline-block;position:relative}.katex .cd-label-left{display:inline-block;position:absolute;right:calc(50% + .3em);text-align:left}.katex .cd-label-right{display:inline-block;left:calc(50% + .3em);position:absolute;text-align:right}.katex-display{display:block;margin:1em 0;text-align:center}.katex-display>.katex{display:block;text-align:center;white-space:nowrap}.katex-display>.katex>.katex-html{display:block;position:relative}.katex-display>.katex>.katex-html>.tag{position:absolute;right:0}.katex-display.leqno>.katex>.katex-html>.tag{left:0;right:auto}.katex-display.fleqn>.katex{padding-left:2em;text-align:left}body{counter-reset:katexEqnNo mmlEqnNo}.react-flow{direction:ltr}.react-flow__container{position:absolute;width:100%;height:100%;top:0;left:0}.react-flow__pane{z-index:1;cursor:grab}.react-flow__pane.selection{cursor:pointer}.react-flow__pane.dragging{cursor:grabbing}.react-flow__viewport{transform-origin:0 0;z-index:2;pointer-events:none}.react-flow__renderer{z-index:4}.react-flow__selection{z-index:6}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible{outline:none}.react-flow .react-flow__edges{pointer-events:none;overflow:visible}.react-flow__edge-path,.react-flow__connection-path{stroke:#b1b1b7;stroke-width:1;fill:none}.react-flow__edge{pointer-events:visibleStroke;cursor:pointer}.react-flow__edge.animated path{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__edge.animated path.react-flow__edge-interaction{stroke-dasharray:none;animation:none}.react-flow__edge.inactive{pointer-events:none}.react-flow__edge.selected,.react-flow__edge:focus,.react-flow__edge:focus-visible{outline:none}.react-flow__edge.selected .react-flow__edge-path,.react-flow__edge:focus .react-flow__edge-path,.react-flow__edge:focus-visible .react-flow__edge-path{stroke:#555}.react-flow__edge-textwrapper{pointer-events:all}.react-flow__edge-textbg{fill:#fff}.react-flow__edge .react-flow__edge-text{pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__connection{pointer-events:none}.react-flow__connection .animated{stroke-dasharray:5;animation:dashdraw .5s linear infinite}.react-flow__connectionline{z-index:1001}.react-flow__nodes{pointer-events:none;transform-origin:0 0}.react-flow__node{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;pointer-events:all;transform-origin:0 0;box-sizing:border-box;cursor:grab}.react-flow__node.dragging{cursor:grabbing}.react-flow__nodesselection{z-index:3;transform-origin:left top;pointer-events:none}.react-flow__nodesselection-rect{position:absolute;pointer-events:all;cursor:grab}.react-flow__handle{position:absolute;pointer-events:none;min-width:5px;min-height:5px;width:6px;height:6px;background:#1a192b;border:1px solid white;border-radius:100%}.react-flow__handle.connectionindicator{pointer-events:all;cursor:crosshair}.react-flow__handle-bottom{top:auto;left:50%;bottom:-4px;transform:translate(-50%)}.react-flow__handle-top{left:50%;top:-4px;transform:translate(-50%)}.react-flow__handle-left{top:50%;left:-4px;transform:translateY(-50%)}.react-flow__handle-right{right:-4px;top:50%;transform:translateY(-50%)}.react-flow__edgeupdater{cursor:move;pointer-events:all}.react-flow__panel{position:absolute;z-index:5;margin:15px}.react-flow__panel.top{top:0}.react-flow__panel.bottom{bottom:0}.react-flow__panel.left{left:0}.react-flow__panel.right{right:0}.react-flow__panel.center{left:50%;transform:translate(-50%)}.react-flow__attribution{font-size:10px;background:#ffffff80;padding:2px 3px;margin:0}.react-flow__attribution a{text-decoration:none;color:#999}@keyframes dashdraw{0%{stroke-dashoffset:10}}.react-flow__edgelabel-renderer{position:absolute;width:100%;height:100%;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.react-flow__edge.updating .react-flow__edge-path{stroke:#777}.react-flow__edge-text{font-size:10px}.react-flow__node.selectable:focus,.react-flow__node.selectable:focus-visible{outline:none}.react-flow__node-default,.react-flow__node-input,.react-flow__node-output,.react-flow__node-group{padding:10px;border-radius:3px;width:150px;font-size:12px;color:#222;text-align:center;border-width:1px;border-style:solid;border-color:#1a192b;background-color:#fff}.react-flow__node-default.selectable:hover,.react-flow__node-input.selectable:hover,.react-flow__node-output.selectable:hover,.react-flow__node-group.selectable:hover{box-shadow:0 1px 4px 1px #00000014}.react-flow__node-default.selectable.selected,.react-flow__node-default.selectable:focus,.react-flow__node-default.selectable:focus-visible,.react-flow__node-input.selectable.selected,.react-flow__node-input.selectable:focus,.react-flow__node-input.selectable:focus-visible,.react-flow__node-output.selectable.selected,.react-flow__node-output.selectable:focus,.react-flow__node-output.selectable:focus-visible,.react-flow__node-group.selectable.selected,.react-flow__node-group.selectable:focus,.react-flow__node-group.selectable:focus-visible{box-shadow:0 0 0 .5px #1a192b}.react-flow__node-group{background-color:#f0f0f040}.react-flow__nodesselection-rect,.react-flow__selection{background:#0059dc14;border:1px dotted rgba(0,89,220,.8)}.react-flow__nodesselection-rect:focus,.react-flow__nodesselection-rect:focus-visible,.react-flow__selection:focus,.react-flow__selection:focus-visible{outline:none}.react-flow__controls{box-shadow:0 0 2px 1px #00000014}.react-flow__controls-button{border:none;background:#fefefe;border-bottom:1px solid #eee;box-sizing:content-box;display:flex;justify-content:center;align-items:center;width:16px;height:16px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:5px}.react-flow__controls-button:hover{background:#f4f4f4}.react-flow__controls-button svg{width:100%;max-width:12px;max-height:12px}.react-flow__controls-button:disabled{pointer-events:none}.react-flow__controls-button:disabled svg{fill-opacity:.4}.react-flow__minimap{background-color:#fff}.react-flow__minimap svg{display:block}.react-flow__resize-control{position:absolute}.react-flow__resize-control.left,.react-flow__resize-control.right{cursor:ew-resize}.react-flow__resize-control.top,.react-flow__resize-control.bottom{cursor:ns-resize}.react-flow__resize-control.top.left,.react-flow__resize-control.bottom.right{cursor:nwse-resize}.react-flow__resize-control.bottom.left,.react-flow__resize-control.top.right{cursor:nesw-resize}.react-flow__resize-control.handle{width:4px;height:4px;border:1px solid #fff;border-radius:1px;background-color:#3367d9;transform:translate(-50%,-50%)}.react-flow__resize-control.handle.left{left:0;top:50%}.react-flow__resize-control.handle.right{left:100%;top:50%}.react-flow__resize-control.handle.top{left:50%;top:0}.react-flow__resize-control.handle.bottom{left:50%;top:100%}.react-flow__resize-control.handle.top.left,.react-flow__resize-control.handle.bottom.left{left:0}.react-flow__resize-control.handle.top.right,.react-flow__resize-control.handle.bottom.right{left:100%}.react-flow__resize-control.line{border-color:#3367d9;border-width:0;border-style:solid}.react-flow__resize-control.line.left,.react-flow__resize-control.line.right{width:1px;transform:translate(-50%);top:0;height:100%}.react-flow__resize-control.line.left{left:0;border-left-width:1px}.react-flow__resize-control.line.right{left:100%;border-right-width:1px}.react-flow__resize-control.line.top,.react-flow__resize-control.line.bottom{height:1px;transform:translateY(-50%);left:0;width:100%}.react-flow__resize-control.line.top{top:0;border-top-width:1px}.react-flow__resize-control.line.bottom{border-bottom-width:1px;top:100%} diff --git a/webui/dist/index.html b/webui/dist/index.html index 90f01307..8a7238d5 100644 --- a/webui/dist/index.html +++ b/webui/dist/index.html @@ -1,19 +1,21 @@ - + + + MaiBot Dashboard - + - - + + -
+