@luckylillia-dev/plugin-webqq 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,110 @@
1
+ import{a as ci,c as ht,d as T,e as Ge}from"./chunk-OQTWS3NO.js";import{useEffect as Yc,useState as ef}from"react";import{forwardRef as Df,createElement as Ef}from"react";var fi=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function mi(e,a,t=[]){if(a==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:fi(e),size:24,node:a,...t.length>0?{aliases:t}:{}}}var pi=e=>{let a="",t=!1;for(let r of e){if(r==="-"||r==="_"||r<=" "){t=a.length>0;continue}a.length===0?a+=r.toLowerCase():a+=t?r.toUpperCase():r,t=!1}return a};var hi=e=>{let a=pi(e);return a.charAt(0).toUpperCase()+a.slice(1)};import{forwardRef as Pf,createElement as Ii}from"react";var ar=(...e)=>e.filter((a,t,r)=>!!a&&a.trim()!==""&&r.indexOf(a)===t).join(" ").trim();var ta={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function Cs(e){return e!=null}function gi(e,a={}){let t=a.attributeNames??{},r=m=>t[m]??m,o=e.size??e.width??ta.width,s=e.size??e.height??ta.height,i=e.aliases?.filter(m=>typeof m=="string"&&m.trim()!=="").map(m=>`lucide-${m}`)??[],n=[...e.name?[`lucide-${e.name}`]:[],...i],l=a.className?.split(" ").filter(Boolean)??[],u=a.includeDefaultClasses===!1?ar(...l):ar("lucide",...n,...l),d=a.absoluteStrokeWidth?Number(a.strokeWidth??ta["stroke-width"])*Number(e.size??e.width??ta.width)/Number(a.size??a.width??ta.width):a.strokeWidth??ta["stroke-width"];return["svg",{...Object.entries(ta).reduce((m,[p,f])=>(m[r(p)]=f,m),{}),..."color"in a&&a.color&&{[r("stroke")]:a.color},..."size"in a&&Cs(a.size)&&{[r("width")]:a.size,[r("height")]:a.size},..."width"in a&&Cs(a.width)&&{[r("width")]:a.width},..."height"in a&&Cs(a.height)&&{[r("height")]:a.height},[r("stroke-width")]:d,...u&&{[r("class")]:u},[r("viewBox")]:`0 0 ${o} ${s}`,...a.hasA11yProp===!1?{[r("aria-hidden")]:"true"}:{},..."attributes"in a&&a.attributes},e.node.map(m=>{let[p,f,h]=m,g=a.nonScalingStroke?{[r("vector-effect")]:"non-scaling-stroke",...f}:f;return h?[p,g,h]:[p,g]})]}function xi(e,a={}){return gi(e,{...a,attributeNames:{...a.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Ci=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};import{createContext as Rf,useContext as Mf,useMemo as sC,createElement as nC}from"react";var Af=Rf({});var Li=()=>Mf(Af);var bi=Pf(({color:e,size:a,width:t,height:r,strokeWidth:o,absoluteStrokeWidth:s,nonScalingStroke:i,className:n="",children:l,iconNode:u=[],icon:d={node:u,aliases:[],size:24},...c},m)=>{let{size:p=24,strokeWidth:f=2,absoluteStrokeWidth:h=!1,nonScalingStroke:g=!1,color:C="currentColor",className:L=""}=Li()??{},x=!!l||Ci(c),[v,I,k=[]]=xi(d,{color:e??C,width:t??a??p,height:r??a??p,strokeWidth:o??f,absoluteStrokeWidth:s??h,nonScalingStroke:i??g,className:ar(L,n),hasA11yProp:x,attributes:c});return Ii(v,{ref:m,...I},[...k.map(([y,N])=>Ii(y,N)),...Array.isArray(l)?l:[l]])});function A(e,a=[],t=[]){let r=typeof e=="string"?mi(e,a,t):e,o=Df(({className:s,...i},n)=>Ef(bi,{ref:n,icon:r,className:s,...i}));return r.name&&(o.displayName=hi(r.name)),o}var vi={name:"archive",size:24,node:[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]};vi.node;var rr=A(vi);var wi={name:"arrow-down",size:24,node:[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]};wi.node;var or=A(wi);var yi={name:"arrow-left",size:24,node:[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]};yi.node;var sr=A(yi);var ki={name:"at-sign",size:24,node:[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]};ki.node;var nr=A(ki);var Si={name:"award",size:24,node:[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]};Si.node;var ir=A(Si);var Ri={name:"ban",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}]]};Ri.node;var lr=A(Ri);var Mi={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Mi.node;var ur=A(Mi);var Ai={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]};Ai.node;var aa=A(Ai);var Pi={name:"calendar",size:24,node:[["path",{d:"M8 2v3",key:"1ioesn"}],["path",{d:"M16 2v3",key:"otl347"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["path",{d:"M3 9h18",key:"1pudct"}]]};Pi.node;var dr=A(Pi);var Di={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Di.node;var xa=A(Di);var Ei={name:"chevron-down",size:24,node:[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]};Ei.node;var cr=A(Ei);var Ti={name:"chevron-right",size:24,node:[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]};Ti.node;var nt=A(Ti);var Fi={name:"circle-exclamation-point",size:24,node:[["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"}]],aliases:["alert-circle","circle-alert"]};Fi.node;var bt=A(Fi);var Ni={name:"clock",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]};Ni.node;var fr=A(Ni);var _i={name:"crown",size:24,node:[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]};_i.node;var vt=A(_i);var Bi={name:"download",size:24,node:[["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"}]]};Bi.node;var $t=A(Bi);var qi={name:"face-slightly-smiling",size:24,node:[["path",{d:"M15 10V9",key:"4dkmfx"}],["path",{d:"M16.472 15a6 6 0 01-8.943 0",key:"7qomzy"}],["path",{d:"M9 10V9",key:"1lazqi"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],aliases:["smile"]};qi.node;var Tt=A(qi);var Ui={name:"file-text",size:24,node:[["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"}]]};Ui.node;var wt=A(Ui);var Oi={name:"folder-open",size:24,node:[["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"}]]};Oi.node;var mr=A(Oi);var zi={name:"folder-plus",size:24,node:[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};zi.node;var pr=A(zi);var Hi={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};Hi.node;var Ea=A(Hi);var ji={name:"forward",size:24,node:[["path",{d:"m15 17 5-5-5-5",key:"nf172w"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]};ji.node;var Ca=A(ji);var Gi={name:"hand",size:24,node:[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]};Gi.node;var hr=A(Gi);var Wi={name:"hash",size:24,node:[["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"}]]};Wi.node;var gr=A(Wi);var $i={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};$i.node;var xr=A($i);var Vi={name:"list-checks",size:24,node:[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]};Vi.node;var Cr=A(Vi);var Ji={name:"loader-circle",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],aliases:["loader-2"]};Ji.node;var ee=A(Ji);var Xi={name:"log-out",size:24,node:[["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"}]]};Xi.node;var La=A(Xi);var Qi={name:"maximize-2",size:24,node:[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]};Qi.node;var Lr=A(Qi);var Ki={name:"message-circle",size:24,node:[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]]};Ki.node;var Ta=A(Ki);var Zi={name:"moon",size:24,node:[["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"}]]};Zi.node;var Ir=A(Zi);var Yi={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};Yi.node;var br=A(Yi);var el={name:"pause",size:24,node:[["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"}]]};el.node;var vr=A(el);var tl={name:"pencil",size:24,node:[["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"}]]};tl.node;var Fa=A(tl);var al={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};al.node;var ra=A(al);var rl={name:"play",size:24,node:[["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"}]]};rl.node;var Ia=A(rl);var ol={name:"refresh-cw",size:24,node:[["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"}]]};ol.node;var ba=A(ol);var sl={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};sl.node;var va=A(sl);var nl={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};nl.node;var Vt=A(nl);var il={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};il.node;var wr=A(il);var ll={name:"shield-exclamation-point",size:24,node:[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]],aliases:["shield-alert"]};ll.node;var oa=A(ll);var ul={name:"shield-off",size:24,node:[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]};ul.node;var yr=A(ul);var dl={name:"shield",size:24,node:[["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"}]]};dl.node;var yt=A(dl);var cl={name:"star",size:24,node:[["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"}]]};cl.node;var wa=A(cl);var fl={name:"sticker",size:24,node:[["path",{d:"M21 9a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 15 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2z",key:"1dfntj"}],["path",{d:"M15 3v5a1 1 0 0 0 1 1h5",key:"6s6qgf"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]};fl.node;var kr=A(fl);var ml={name:"sun",size:24,node:[["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"}]]};ml.node;var Sr=A(ml);var pl={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]};pl.node;var We=A(pl);var hl={name:"triangle-exclamation-point",size:24,node:[["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"}]],aliases:["alert-triangle","triangle-alert"]};hl.node;var kt=A(hl);var gl={name:"upload",size:24,node:[["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"}]]};gl.node;var Rr=A(gl);var xl={name:"user-minus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};xl.node;var Mr=A(xl);var Cl={name:"user-plus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};Cl.node;var Ar=A(Cl);var Ll={name:"user",size:24,node:[["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"}]]};Ll.node;var Pr=A(Ll);var Il={name:"users",size:24,node:[["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"}]]};Il.node;var St=A(Il);var bl={name:"volume-x",size:24,node:[["path",{d:"M11 4.702a.7.7 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.7.7 0 0 0 11 19.298z",key:"1p7khw"}],["path",{d:"m16.5 14.5 5-5",key:"cul3yw"}],["path",{d:"m16.5 9.5 5 5",key:"1akey5"}]]};bl.node;var Dr=A(bl);var vl={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};vl.node;var Re=A(vl);import{useBots as qx,usePageView as Ux,useSidebar as Ox}from"@luckylillia-dev/plugin-sdk/webui";import pt,{useEffect as is,useCallback as zt,useState as Tx}from"react";import{useState as Hs,useMemo as Ft,useRef as am}from"react";import{createPortal as rm}from"react-dom";async function X(e,a={}){let t=await ht().fetch(e,a);if(!t.ok){let r=`HTTP error! status: ${t.status}`;try{r=(await t.json()).message||r}catch{}throw new Error(r)}return t.json()}function wl(e,a){let t=e.senderUid?!!a.uid&&e.senderUid===a.uid:!!a.uin&&String(e.senderUin)===a.uin;return e.sendMemberName||e.sendNickName||(t?a.nick:"")||String(e.senderUin)}var Ls=null,Is=null,yl="";function kl(e,a,t=""){Ls=e,Is=a,yl=t}function Er(e){return wl(e,{uid:Ls,uin:Is,nick:yl})}function ot(){return Ls}function gt(){return Is}function Oe(e,a=140){return`https://q1.qlogo.cn/g?b=qq&nk=${e}&s=${a}`}function Tr(e){return`https://p.qlogo.cn/gh/${e}/${e}/640/`}async function Sl(){let e=await X("/api/webqq/rkey");if(!e.success)throw new Error(e.message||"\u83B7\u53D6 rkey \u5931\u8D25");return e.data}async function Rl(e){let a=await X("/api/webqq/self",{signal:e});if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u767B\u5F55\u4FE1\u606F\u5931\u8D25");return a.data}async function bs(){let e=await X("/api/webqq/friends");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u597D\u53CB\u5217\u8868\u5931\u8D25");let a=e.data,t=Object.values(a.categories).map(r=>{let o=a.friends.filter(s=>s.categoryId===r.categoryId).map(s=>({uid:s.uid,uin:s.uin.toString(),nickname:s.nick,remark:s.remark,avatar:Oe(s.uin),online:s.status!==0}));return{categoryId:r.categoryId,categoryName:r.categoryName,categorySort:r.categorySortId,onlineCount:o.filter(s=>s.online).length,memberCount:r.categoryMemberCount,friends:o}});return t.sort((r,o)=>r.categorySort-o.categorySort),t}async function vs(){let e=await X("/api/webqq/groups");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u7FA4\u7EC4\u5217\u8868\u5931\u8D25");return(e.data||[]).map(t=>({groupCode:t.groupCode.toString(),groupName:t.groupName,remarkName:t.remarkName||"",avatar:Tr(t.groupCode),memberCount:t.memberCount,isTop:t.isTop||!1,msgMask:t.cmdUinMsgMask||1}))}async function ws(){return[]}async function ho(e,a,t,r=20,o){let s=new URLSearchParams({chatType:String(e),peerId:a,limit:r.toString()});t&&s.append("beforeMsgSeq",String(t)),o&&s.append("afterMsgSeq",String(o));let i=await X(`/api/webqq/messages?${s}`);if(!i.success)throw new Error(i.message||"\u83B7\u53D6\u6D88\u606F\u5386\u53F2\u5931\u8D25");return i.data||{messages:[],hasMore:!1}}async function ys(e){let a=await X("/api/webqq/messages",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!a.success)throw new Error(a.message||"\u53D1\u9001\u6D88\u606F\u5931\u8D25");return a.data||{msgId:""}}async function Ml(e,a,t){let r=await X("/api/webqq/messages/forward",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({srcChatType:e.chatType,srcPeerId:e.peerId,msgSeq:a,targetChatType:t.chatType,targetPeerId:t.peerId})});if(!r.success)throw new Error(r.message||"\u8F6C\u53D1\u5931\u8D25")}async function Al(e,a,t){let r=await X("/api/webqq/messages/forward-multi",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({srcChatType:e.chatType,srcPeerId:e.peerId,msgSeqs:a,targetChatType:t.chatType,targetPeerId:t.peerId})});if(!r.success)throw new Error(r.message||"\u5408\u5E76\u8F6C\u53D1\u5931\u8D25")}async function Pl(e){let a=new FormData;a.append("image",e);let t=await X("/api/webqq/upload",{method:"POST",body:a});if(!t.success)throw new Error(t.message||"\u4E0A\u4F20\u56FE\u7247\u5931\u8D25");return t.data}async function Dl(e){let a=await X("/api/webqq/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({imageUrl:e})});if(!a.success)throw new Error(a.message||"\u4E0A\u4F20\u56FE\u7247\u5931\u8D25");return a.data}async function ks(e){let a=new FormData;a.append("file",e);let t=await X("/api/webqq/upload-file",{method:"POST",body:a});if(!t.success)throw new Error(t.message||"\u4E0A\u4F20\u6587\u4EF6\u5931\u8D25");return t.data}async function El(e){let a=await X(`/api/webqq/members?groupCode=${e}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u7FA4\u6210\u5458\u5931\u8D25");return a.data||[]}async function Tl(e,a){if(!e)throw new Error("getVideoUrl: \u9700\u8981 fileUuid");let t=new URLSearchParams({fileUuid:e,isGroup:String(a??!1)}),r=await X(`/api/webqq/video-url?${t}`);if(!r.success)throw new Error(r.message||"\u83B7\u53D6\u89C6\u9891 URL \u5931\u8D25");return r.data||""}async function Fl(e,a,t){let r=await X("/api/webqq/messages/recall",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatType:e,peerUid:a,msgId:t})});if(!r.success)throw new Error(r.message||"\u64A4\u56DE\u5931\u8D25")}async function Fr(e,a,t,r,o){let i=await X("/api/webqq/messages/emoji-like",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:a,msgSeq:t,emojiId:r,set:o})});if(!i.success)throw new Error(i.message||"\u8D34\u8868\u60C5\u5931\u8D25")}async function Nl(e,a){let t=new URLSearchParams({groupCode:e,uid:a}),r=await X(`/api/webqq/group-member?${t}`);if(!r.success)throw new Error(r.message||"\u83B7\u53D6\u7FA4\u6210\u5458\u5931\u8D25");return r.data??null}async function Ss(e,a){let t=new URLSearchParams;e&&t.set("uid",e),a&&t.set("uin",a);let r=await X(`/api/webqq/user?${t}`);if(!r.success)throw new Error(r.message||"\u83B7\u53D6\u7528\u6237\u8BE6\u60C5\u5931\u8D25");return r.data}async function _l(e,a){let t=new URLSearchParams({uin:e});a&&t.set("groupCode",a);let r=await X(`/api/webqq/uid?${t}`);if(!r.success)throw new Error(r.message||"uin \u8F6C uid \u5931\u8D25");return r.data||""}async function Bl(e){let a=new URLSearchParams({uid:e}),t=await X(`/api/webqq/uin?${a}`);if(!t.success)throw new Error(t.message||"uid \u8F6C uin \u5931\u8D25");return t.data||""}async function ql(e,a){try{if(a){let r=await Nl(a,e);if(r)return r.cardName||r.nick||"\u672A\u77E5\u7528\u6237"}let t=await Ss(e);return t.remark||t.nick||"\u672A\u77E5\u7528\u6237"}catch{return"\u672A\u77E5\u7528\u6237"}}async function Rs(e,a,t){let s=await X(e===2?"/api/webqq/group/poke":"/api/webqq/friend/poke",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e===2?{groupCode:t,uin:a}:{uin:a})});if(!s.success)throw new Error(s.message||"\u6233\u4E00\u6233\u5931\u8D25")}async function Ul(e,a,t,r){let o=await X("/api/webqq/messages/ptt-to-text",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({msgId:e,chatType:a,peerUid:t})});if(!o.success)throw new Error(o.message||"\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25");return o.data||""}async function go(e,a,t=!1){let r=await X("/api/webqq/group/kick",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:a,refuseForever:t})});if(!r.success)throw new Error(r.message||"\u8E22\u51FA\u5931\u8D25")}async function xo(e,a,t){let r=await X("/api/webqq/group/ban",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:a,duration:t})});if(!r.success)throw new Error(r.message||"\u7981\u8A00\u5931\u8D25")}async function Co(e,a,t){let r=await X("/api/webqq/group/special-title",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:a,title:t})});if(!r.success)throw new Error(r.message||"\u8BBE\u7F6E\u5934\u8854\u5931\u8D25")}async function Ol(e,a,t){let r=await X("/api/webqq/group/member-role",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,uid:a,isAdmin:t})});if(!r.success)throw new Error(r.message||"\u8BBE\u7F6E\u7BA1\u7406\u5458\u5931\u8D25")}async function zl(){let e=await X("/api/webqq/fav-emoji");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u6536\u85CF\u8868\u60C5\u5931\u8D25");return e.data?.emojiInfoList||[]}async function Hl(e){let a=await X("/api/webqq/fav-emoji/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({emojiIds:[e]})});if(!a.success)throw new Error(a.message||"\u5220\u9664\u6536\u85CF\u8868\u60C5\u5931\u8D25");return a.data}async function jl(e){let a=await X("/api/webqq/fav-emoji/add-from-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:e})});if(!a.success)throw new Error(a.message||"\u6DFB\u52A0\u6536\u85CF\u8868\u60C5\u5931\u8D25");return a.data}function Tf(e,a,t){let r=`/api/webqq/audio-proxy?fileUuid=${encodeURIComponent(e)}&isGroup=${a}`;return t&&(r+=`&filePath=${encodeURIComponent(t)}`),r}async function Gl(e,a,t,r){let o=await ht().fetch(Tf(e,a,t),{signal:r});if(!o.ok){let s="\u83B7\u53D6\u8BED\u97F3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5";try{let i=await o.json();typeof i.message=="string"&&i.message&&(s=i.message)}catch{}throw new Error(s)}return o.blob()}async function Wl(e){let a=await X("/api/webqq/group/quit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e})});if(!a.success)throw new Error(a.message||"\u9000\u7FA4\u5931\u8D25")}async function Ms(e,a="/"){let t=await X(`/api/webqq/group-files?groupCode=${encodeURIComponent(e)}&folderId=${encodeURIComponent(a)}`);if(!t.success)throw new Error(t.message||"\u83B7\u53D6\u7FA4\u6587\u4EF6\u5217\u8868\u5931\u8D25");return t.data||{files:[],folders:[]}}async function $l(e,a){let t=await X(`/api/webqq/group-file-url?groupCode=${encodeURIComponent(e)}&fileId=${encodeURIComponent(a)}`);if(!t.success)throw new Error(t.message||"\u83B7\u53D6\u4E0B\u8F7D\u94FE\u63A5\u5931\u8D25");return t.data.url}async function Vl(e,a,t){let r=await X(`/api/webqq/private-file-url?peerUid=${encodeURIComponent(e)}&fileId=${encodeURIComponent(a)}&isSelfSend=${t}`);if(!r.success)throw new Error(r.message||"\u83B7\u53D6\u4E0B\u8F7D\u94FE\u63A5\u5931\u8D25");return r.data.url}async function Lo(e,a){let r=e.startsWith("blob:")||e.startsWith("data:")?await fetch(e):await ht().fetch(`/api/webqq/image-proxy?url=${encodeURIComponent(e)}`);if(!r.ok)throw new Error("\u4E0B\u8F7D\u56FE\u7247\u5931\u8D25");let o=await r.blob(),s=a||"image";if(!/\.[a-z0-9]+$/i.test(s)){let l=(o.type.split("/")[1]||"jpg").replace("jpeg","jpg");s=`${s}.${l}`}let i=URL.createObjectURL(o),n=document.createElement("a");n.href=i,n.download=s,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(i)}async function Jl(e,a,t="/"){let{filePath:r,fileName:o}=await ks(a),s=await X("/api/webqq/group-file/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,filePath:r,fileName:o,folderId:t})});if(!s.success)throw new Error(s.message||"\u4E0A\u4F20\u7FA4\u6587\u4EF6\u5931\u8D25");return s.data.fileId}async function Xl(e,a,t){let r=await X("/api/webqq/group-file/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,fileId:a,busId:t})});if(!r.success)throw new Error(r.message||"\u5220\u9664\u7FA4\u6587\u4EF6\u5931\u8D25")}async function Ql(e,a,t,r){let o=await X("/api/webqq/group-file/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,fileId:a,parentFolderId:t,newName:r})});if(!o.success)throw new Error(o.message||"\u91CD\u547D\u540D\u7FA4\u6587\u4EF6\u5931\u8D25")}async function Kl(e,a){let t=await X("/api/webqq/group-folder/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,folderName:a})});if(!t.success)throw new Error(t.message||"\u65B0\u5EFA\u6587\u4EF6\u5939\u5931\u8D25")}async function Zl(e,a){let t=await X("/api/webqq/group-folder/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,folderId:a})});if(!t.success)throw new Error(t.message||"\u5220\u9664\u6587\u4EF6\u5939\u5931\u8D25")}async function Yl(e,a,t){let r=await X("/api/webqq/group-folder/rename",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,folderId:a,newName:t})});if(!r.success)throw new Error(r.message||"\u91CD\u547D\u540D\u6587\u4EF6\u5939\u5931\u8D25")}async function Nr(e,a,t){let r=e;if(!r&&a&&(r=await _l(a)),!r)throw new Error("\u65E0\u6CD5\u83B7\u53D6\u7528\u6237\u4FE1\u606F");let o=await Ss(r),s=a||o.uin||await Bl(r),i={uid:r,uin:s||"",nickname:o.nick||"",remark:o.remark||"",signature:o.bio||"",sex:o.gender??0,birthday:o.birthdayYear?`${o.birthdayYear}-${o.birthdayMonth}-${o.birthdayDay}`:"",location:[o.country,o.city].filter(Boolean).join(" ")||"",qid:o.qid||"",level:o.level||0,regTime:o.registerTime||void 0,avatar:Oe(s||"")};if(t)try{let n=await Nl(t,r);n&&(i.groupCard=n.cardName||"",i.groupRole=n.role===4?"owner":n.role===3?"admin":"member",i.groupTitle=n.specialTitle||"",i.groupLevel=n.level||0,i.joinTime=n.joinedAt,i.lastSpeakTime=n.lastSpokeAt)}catch{}return i}function eu(e,a,t){let r=ht().authUrl("/api/webqq/events"),o,s=0,i=null,n=!1,l=()=>(o=new EventSource(r),o.addEventListener("message",d=>{try{let c=JSON.parse(d.data);e(c)}catch(c){console.error("\u89E3\u6790 SSE \u6D88\u606F\u5931\u8D25:",c)}}),o.addEventListener("connected",()=>{console.log("[SSE] \u8FDE\u63A5\u5DF2\u5EFA\u7ACB"),s=0}),o.onopen=()=>{console.log("[SSE] \u8FDE\u63A5\u6253\u5F00"),s>0&&(console.log("[SSE] \u91CD\u8FDE\u6210\u529F"),t?.()),s=0},o.onerror=d=>{if(console.error("[SSE] \u8FDE\u63A5\u9519\u8BEF:",d),n)return;o.close();let c=Math.min(1e3*Math.pow(2,s),3e4);s++,console.log(`[SSE] \u5C06\u5728 ${c}ms \u540E\u5C1D\u8BD5\u7B2C ${s} \u6B21\u91CD\u8FDE...`),i=setTimeout(()=>{n||(console.log("[SSE] \u6B63\u5728\u91CD\u8FDE..."),l())},c),a?.(d)},o);return o=l(),{close:()=>{n=!0,i&&(clearTimeout(i),i=null),o.close(),console.log("[SSE] \u8FDE\u63A5\u5DF2\u5173\u95ED")},get readyState(){return o.readyState},get url(){return o.url},addEventListener:o.addEventListener.bind(o),removeEventListener:o.removeEventListener.bind(o),dispatchEvent:o.dispatchEvent.bind(o),onerror:o.onerror,onmessage:o.onmessage,onopen:o.onopen,CONNECTING:EventSource.CONNECTING,OPEN:EventSource.OPEN,CLOSED:EventSource.CLOSED,withCredentials:o.withCredentials}}async function tu(e){let a=await X(`/api/webqq/forward-msg?resId=${encodeURIComponent(e)}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u5408\u5E76\u8F6C\u53D1\u6D88\u606F\u5931\u8D25");return a.data||[]}function au(e,a){if(!a.trim())return e;let t=a.toLowerCase();return e.filter(r=>r.groupName.toLowerCase().includes(t)||r.groupCode.includes(a))}function ru(e,a){if(!a.trim())return e;let t=a.toLowerCase();return e.filter(r=>r.nickname.toLowerCase().includes(t)||r.card.toLowerCase().includes(t)||r.uin.includes(a))}function ou(e){let a=e.toLowerCase().split(".").pop()||"";return["jpg","jpeg","png","gif"].includes(a)}async function su(e){let a=await X(`/api/webqq/group-detail?groupCode=${e}`);if(!a.success)throw new Error(a.message||"\u83B7\u53D6\u7FA4\u8BE6\u60C5\u5931\u8D25");let t=a.data,r="",o="";if(t.ownerUid)try{o=await Bl(t.ownerUid),r=(await Ss(t.ownerUid)).nick||o||""}catch{}return{groupCode:String(t.groupCode),groupName:t.groupName,remarkName:t.remark||"",avatar:Tr(String(t.groupCode)),memberCount:t.memberCount??0,maxMemberCount:t.maxMemberCount,ownerUin:o,ownerName:r,createTime:t.createdAt||void 0,description:t.description||"",announcement:t.announcementPreview||""}}function _r(e){let a=new Date(e),t=new Date;if(a.toDateString()===t.toDateString())return a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"});let o=new Date(t);return o.setDate(o.getDate()-1),a.toDateString()===o.toDateString()?`\u6628\u5929 ${a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"})}`:a.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}async function nu(e){let a=await X("/api/webqq/friend/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uid:e})});if(!a.success)throw new Error(a.message||"\u5220\u9664\u597D\u53CB\u5931\u8D25")}async function iu(e,a,t){if(e===2){let r=await X("/api/webqq/group/set-top",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:a,isTop:t})});if(!r.success)throw new Error(r.message||"\u8BBE\u7F6E\u7F6E\u9876\u5931\u8D25")}else{let r=await _l(a);if(!r)throw new Error("\u65E0\u6CD5\u83B7\u53D6\u7528\u6237\u4FE1\u606F");let o=await X("/api/webqq/friend/set-top",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uid:r,isTop:t})});if(!o.success)throw new Error(o.message||"\u8BBE\u7F6E\u7F6E\u9876\u5931\u8D25")}}async function lu(e,a){let t=await X("/api/webqq/group/msg-mask",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({groupCode:e,msgMask:a})});if(!t.success)throw new Error(t.message||"\u8BBE\u7F6E\u6D88\u606F\u63A5\u6536\u65B9\u5F0F\u5931\u8D25")}async function uu(){let e=await X("/api/webqq/notifications/group");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u7FA4\u901A\u77E5\u5931\u8D25");return e.data||[]}async function du(e,a,t){let r=await X("/api/webqq/notifications/group/handle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flag:e,action:a,reason:t})});if(!r.success)throw new Error(r.message||"\u5904\u7406\u7FA4\u901A\u77E5\u5931\u8D25")}async function As(e,a){let t=await X("/api/webqq/notifications/friend/handle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({flag:e,action:a})});if(!t.success)throw new Error(t.message||"\u5904\u7406\u597D\u53CB\u7533\u8BF7\u5931\u8D25")}async function cu(){let e=await X("/api/webqq/notifications/friend");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u597D\u53CB\u7533\u8BF7\u5931\u8D25");return e.data||[]}async function fu(){let e=await X("/api/webqq/notifications/friend/doubt");if(!e.success)throw new Error(e.message||"\u83B7\u53D6\u88AB\u8FC7\u6EE4\u597D\u53CB\u7533\u8BF7\u5931\u8D25");return e.data||[]}async function mu(e){let a=await X("/api/webqq/notifications/friend/doubt/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({uid:e})});if(!a.success)throw new Error(a.message||"\u5904\u7406\u88AB\u8FC7\u6EE4\u597D\u53CB\u7533\u8BF7\u5931\u8D25")}var pu=e=>{let a,t=new Set,r=(u,d)=>{let c=typeof u=="function"?u(a):u;if(!Object.is(c,a)){let m=a;a=d??(typeof c!="object"||c===null)?c:Object.assign({},a,c),t.forEach(p=>p(a,m))}},o=()=>a,n={setState:r,getState:o,getInitialState:()=>l,subscribe:u=>(t.add(u),()=>t.delete(u))},l=a=e(r,o,n);return n},hu=(e=>e?pu(e):pu);import Ps from"react";var Ff=e=>e;function Nf(e,a=Ff){let t=Ps.useSyncExternalStore(e.subscribe,Ps.useCallback(()=>a(e.getState()),[e,a]),()=>a(e.getInitialState()));return Ps.useDebugValue(t),t}var gu=e=>{let a=hu(e),t=r=>Nf(a,r);return Object.assign(t,a),t},Io=(e=>e?gu(e):gu);function Ds(e,a){let t;try{t=e()}catch{return}return{getItem:o=>{var s;let i=l=>l===null?null:JSON.parse(l,a?.reviver),n=(s=t.getItem(o))!=null?s:null;return Es(n)?n.then(i):i(n)},setItem:(o,s)=>t.setItem(o,JSON.stringify(s,a?.replacer)),removeItem:o=>t.removeItem(o)}}var Es=e=>typeof e?.then=="function",_f=e=>({then(a){return a?Ts(a)(e):this}}),Ts=e=>a=>{try{let t=e(a);return Es(t)?t:_f(t)}catch(t){return{then(r,o){return o?Ts(o)(t):this}}}},Bf=(e,a)=>(t,r,o)=>{let s={storage:Ds(()=>window.localStorage),partialize:g=>g,version:0,merge:(g,C)=>({...C,...g}),...a},i=!1,n=0,l=new Set,u=new Set,d=s.storage;if(!d)return e((...g)=>{console.warn(`[zustand persist middleware] Unable to update item '${s.name}', the given storage is currently unavailable.`),t(...g)},r,o);let c=()=>{let g=s.partialize({...r()});return d.setItem(s.name,{state:g,version:s.version})},m=o.setState;o.setState=(...g)=>(m(...g),c());let p=e((...g)=>(t(...g),c()),r,o);o.getInitialState=()=>p;let f,h=()=>{var g,C;if(!d)return;let L=++n;i=!1,l.forEach(v=>{var I;return v((I=r())!=null?I:p)});let x=((C=s.onRehydrateStorage)==null?void 0:C.call(s,(g=r())!=null?g:p))||void 0;return Ts(d.getItem.bind(d))(s.name).then(v=>{if(v)if(typeof v.version=="number"&&v.version!==s.version){if(s.migrate){let I=s.migrate(v.state,v.version);return Es(I)?I.then(k=>[!0,k]):[!0,I]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,v.state];return[!1,void 0]}).then(v=>{var I;if(L!==n)return;let[k,y]=v;if(f=s.merge(y,(I=r())!=null?I:p),t(f,!0),k)return c()}).then(()=>{L===n&&(x?.(r(),void 0),f=r(),i=!0,u.forEach(v=>v(f)))}).then(()=>{},v=>{L===n&&x?.(void 0,v)})};return o.persist={setOptions:g=>{s={...s,...g},g.storage&&(d=g.storage)},clearStorage:()=>{++n,d?.removeItem(s.name)},getOptions:()=>s,rehydrate:()=>{try{return Promise.resolve(h())}catch(g){return Promise.reject(g)}},hasHydrated:()=>i,onHydrate:g=>(l.add(g),()=>{l.delete(g)}),onFinishHydration:g=>(u.add(g),()=>{u.delete(g)})},s.skipHydration||h(),f||p},xu=Bf;var bu="webqq-storage",Jt="",Ye=0,qf=Ds(()=>({getItem:e=>Jt?localStorage.getItem(`${Jt}-${e}`):null,setItem:(e,a)=>{Jt&&localStorage.setItem(`${Jt}-${e}`,a)},removeItem:e=>{Jt&&localStorage.removeItem(`${Jt}-${e}`)}})),Uf=3600*1e3,Cu=1800*1e3,Br=new Map,Fs=new Set,Ns=new Set,bo=()=>{Fs=new Set,Ns=new Set},Na=(e,a)=>Fs.has(`${e}_${a}`),vu=(e,a)=>{Fs.add(`${e}_${a}`)};var wu=e=>Ns.has(e),yu=e=>{Ns.add(e)},Lu={friendCategories:[],groups:[],recentChats:[],groupLastTimeMap:{},groupLastMessageMap:{},expandedCategories:[],membersCache:{},showMemberPanel:!1,scrollPositions:{},contactsCacheTimestamp:0,unreadCounts:{},activeTab:"recent",currentChat:null},Iu={contactsLoading:!1,contactsError:null,groupAssistantMode:"normal",notifications:[],notificationUnreadCount:0},ne=Io()(xu((e,a)=>({...Lu,...Iu,setFriendCategories:t=>e({friendCategories:t}),setGroups:t=>e({groups:t}),setRecentChats:t=>e({recentChats:t}),setContactsLoading:t=>e({contactsLoading:t}),setContactsError:t=>e({contactsError:t}),setCurrentChat:t=>e({currentChat:t}),setActiveTab:t=>e({activeTab:t}),setGroupAssistantMode:t=>e({groupAssistantMode:t}),enterGroupAssistant:()=>e({groupAssistantMode:"assistant"}),exitGroupAssistant:()=>e({groupAssistantMode:"normal"}),setUnreadCount:(t,r)=>e(o=>({unreadCounts:{...o.unreadCounts,[t]:r}})),incrementUnreadCount:t=>e(r=>({unreadCounts:{...r.unreadCounts,[t]:(r.unreadCounts[t]||0)+1}})),clearUnreadCount:t=>e(r=>{let{[t]:o,...s}=r.unreadCounts;return{unreadCounts:s}}),initUnreadCounts:t=>{let r={};t.forEach(o=>{o.unreadCount>0&&(r[`${o.chatType}_${o.peerId}`]=o.unreadCount)}),e({unreadCounts:r})},toggleCategory:t=>e(r=>{let o=new Set(r.expandedCategories);return o.has(t)?o.delete(t):o.add(t),{expandedCategories:Array.from(o)}}),setExpandedCategories:t=>e({expandedCategories:t}),getCachedMembers:t=>{let o=a().membersCache[t];return o&&Date.now()-o.timestamp<Cu?o.members:null},setCachedMembers:(t,r)=>e(o=>{let s=Date.now(),i={};for(let[n,l]of Object.entries(o.membersCache))s-l.timestamp<Cu&&(i[n]=l);return{membersCache:{...i,[t]:{members:r,timestamp:s}}}}),fetchGroupMembers:async(t,r=!1)=>{let o=Ye,s=a();if(console.log("[Store] fetchGroupMembers called:",t,"forceRefresh:",r),!r){let l=s.getCachedMembers(t);if(l)return console.log("[Store] Cache hit, returning cached members"),l}let i=Br.get(t);if(i)return console.log("[Store] Already loading, returning existing promise"),i;console.log("[Store] Fetching from API");let n=(async()=>{let l=await El(t);return o!==Ye?[]:(console.log("[Store] API success, caching members"),a().setCachedMembers(t,l),l)})().catch(l=>{if(o!==Ye)return[];throw console.log("[Store] API error:",l.message),l}).finally(()=>{Br.get(t)===n&&Br.delete(t)});return Br.set(t,n),n},setShowMemberPanel:t=>e({showMemberPanel:t}),addNotification:t=>e(r=>r.notifications.some(s=>s.type==="group-notify"&&t.type==="group-notify"||s.type==="friend-request"&&t.type==="friend-request"?s.data.flag===t.data.flag:!1)?{notifications:r.notifications.map(s=>s.type===t.type&&(s.type==="group-notify"&&t.type==="group-notify"&&s.data.flag===t.data.flag||s.type==="friend-request"&&t.type==="friend-request"&&s.data.flag===t.data.flag)?t:s)}:{notifications:[t,...r.notifications].slice(0,200),notificationUnreadCount:r.notificationUnreadCount+1}),setNotifications:t=>e({notifications:t}),clearNotificationUnread:()=>e({notificationUnreadCount:0}),updateNotificationStatus:(t,r,o)=>e(s=>({notifications:s.notifications.map(i=>{if(i.type===t){if(i.type==="group-notify"&&i.data.flag===r)return{...i,data:{...i.data,status:o}};if(i.type==="friend-request"&&i.data.flag===r)return{...i,data:{...i.data,isDecide:!0}}}return i})})),loadGroupNotifications:async()=>{let t=Ye;try{let[r,o,s]=await Promise.all([uu().catch(()=>[]),cu().catch(()=>[]),fu().catch(()=>[])]);if(t!==Ye)return;let i=r.map(m=>({type:"group-notify",data:m,time:m.actionTime?parseInt(m.actionTime)*1e3:parseInt(m.seq)/1e3})),n=o.map(m=>({type:"friend-request",data:m,time:m.reqTime?parseInt(m.reqTime)*1e3:Date.now()})),l=s.map(m=>({type:"doubt-buddy",data:m,time:m.reqTime?parseInt(m.reqTime)*1e3:Date.now()})),d=a().notifications.filter(m=>m.type!=="group-notify"&&m.type!=="friend-request"&&m.type!=="doubt-buddy"),c=[...i,...n,...l,...d].sort((m,p)=>p.time-m.time).slice(0,200);e({notifications:c})}catch(r){if(t!==Ye)return;console.error("\u52A0\u8F7D\u901A\u77E5\u5931\u8D25:",r)}},getScrollPosition:(t,r)=>{let o=a(),s=`${t}_${r}`;return o.scrollPositions[s]||null},setScrollPosition:(t,r,o)=>e(s=>({scrollPositions:{...s.scrollPositions,[`${t}_${r}`]:o}})),clearScrollPosition:(t,r)=>e(o=>{let{[`${t}_${r}`]:s,...i}=o.scrollPositions;return{scrollPositions:i}}),isContactsCacheValid:()=>{let t=a();return t.contactsCacheTimestamp>0&&Date.now()-t.contactsCacheTimestamp<Uf&&(t.friendCategories.length>0||t.groups.length>0)},loadContacts:async()=>{let t=Ye,r=a();if(r.isContactsCacheValid()){r.refreshContacts();return}e({contactsLoading:!0,contactsError:null});try{let[o,s,i]=await Promise.all([bs(),vs(),ws()]);if(t!==Ye)return;let n=i.filter(f=>f.peerId&&f.peerId!=="0"&&f.peerId!==""),l=new Map;r.recentChats.forEach(f=>{f.peerId&&f.peerId!=="0"&&f.peerId!==""&&l.set(`${f.chatType}_${f.peerId}`,f)}),n.forEach(f=>{let h=`${f.chatType}_${f.peerId}`,g=l.get(h);g?(f.lastTime>g.lastTime||f.lastTime===g.lastTime&&!g.lastMessage&&f.lastMessage)&&l.set(h,f):l.set(h,f)});let u=Array.from(l.values()).sort((f,h)=>h.lastTime-f.lastTime),d={},c={};n.forEach(f=>{f.chatType===2&&(d[f.peerId]=f.lastTime,f.lastMessage&&(c[f.peerId]=f.lastMessage))}),e({friendCategories:o,groups:s,recentChats:u,groupLastTimeMap:d,groupLastMessageMap:c,contactsCacheTimestamp:Date.now(),contactsLoading:!1});let p={...a().unreadCounts};n.forEach(f=>{let h=`${f.chatType}_${f.peerId}`;!(h in p)&&f.unreadCount>0&&(p[h]=f.unreadCount)}),e({unreadCounts:p})}catch(o){if(t!==Ye)return;e({contactsError:o.message||"\u52A0\u8F7D\u8054\u7CFB\u4EBA\u5931\u8D25",contactsLoading:!1})}},refreshContacts:async()=>{let t=Ye;try{let[r,o,s]=await Promise.all([bs(),vs(),ws()]);if(t!==Ye)return;let i=s.filter(f=>f.peerId&&f.peerId!=="0"&&f.peerId!==""),n=a(),l=new Map;n.recentChats.forEach(f=>{f.peerId&&f.peerId!=="0"&&f.peerId!==""&&l.set(`${f.chatType}_${f.peerId}`,f)}),i.forEach(f=>{let h=`${f.chatType}_${f.peerId}`,g=l.get(h);g?(f.lastTime>g.lastTime||f.lastTime===g.lastTime&&!g.lastMessage&&f.lastMessage)&&l.set(h,f):l.set(h,f)});let u=Array.from(l.values()).sort((f,h)=>h.lastTime-f.lastTime),d={...n.groupLastTimeMap},c={...n.groupLastMessageMap};i.forEach(f=>{f.chatType===2&&(d[f.peerId]=f.lastTime,f.lastMessage&&(c[f.peerId]=f.lastMessage))}),e({friendCategories:r,groups:o,recentChats:u,groupLastTimeMap:d,groupLastMessageMap:c,contactsCacheTimestamp:Date.now()});let p={...a().unreadCounts};i.forEach(f=>{let h=`${f.chatType}_${f.peerId}`;!(h in p)&&f.unreadCount>0&&(p[h]=f.unreadCount)}),e({unreadCounts:p})}catch(r){if(t!==Ye)return;console.error("Failed to refresh contacts:",r)}},updateRecentChat:(t,r,o,s,i,n)=>e(l=>{let u=l.recentChats.filter((h,g,C)=>C.findIndex(L=>L.chatType===h.chatType&&L.peerId===h.peerId)===g),d=u.find(h=>h.chatType===t&&h.peerId===r),c=l.currentChat,m=c?.chatType===t&&c?.peerId===r,p=t===2?{...l.groupLastTimeMap,[r]:s}:l.groupLastTimeMap,f=t===2?{...l.groupLastMessageMap,[r]:o||"[\u6D88\u606F]"}:l.groupLastMessageMap;if(d){let h=u.filter(x=>!(x.chatType===t&&x.peerId===r)),g={...d,lastMessage:o,lastTime:s,unreadCount:m?0:d.unreadCount+1};if(d.pinned){let x=h.filter(I=>I.pinned),v=h.filter(I=>!I.pinned);return{recentChats:[g,...x,...v],groupLastTimeMap:p,groupLastMessageMap:f}}let C=h.filter(x=>x.pinned),L=h.filter(x=>!x.pinned);return{recentChats:[...C,g,...L],groupLastTimeMap:p,groupLastMessageMap:f}}else{let h=i||r,g=n||"";if(t===1||t===100){for(let L of l.friendCategories){let x=L.friends.find(v=>v.uin===r);if(x){h=x.remark||x.nickname,g=x.avatar;break}}g||(g=Oe(r))}else if(t===2){let L=l.groups.find(x=>x.groupCode===r);if(L){if(L.msgMask===2)return{groupLastTimeMap:p,groupLastMessageMap:f};h=L.groupName,g=L.avatar}g||(g=`https://p.qlogo.cn/gh/${r}/${r}/640/`)}return{recentChats:[{chatType:t,peerId:r,peerName:h,peerAvatar:g,lastMessage:o,lastTime:s,unreadCount:m?0:1},...u],groupLastTimeMap:p,groupLastMessageMap:f}}}),togglePinChat:async(t,r)=>{let o=Ye,i=a().recentChats.find(l=>l.chatType===t&&l.peerId===r);if(!i)return;let n=!i.pinned;try{if(await iu(t,r,n),o!==Ye)return;e(l=>{let u=l.recentChats.map(d=>d.chatType===t&&d.peerId===r?{...d,pinned:n}:d);return u.sort((d,c)=>d.pinned&&!c.pinned?-1:!d.pinned&&c.pinned?1:c.lastTime-d.lastTime),{recentChats:u}})}catch(l){if(o!==Ye)return;throw console.error("\u8BBE\u7F6E\u7F6E\u9876\u5931\u8D25:",l),l}},removeRecentChat:(t,r)=>e(o=>({recentChats:o.recentChats.filter(s=>!(s.chatType===t&&s.peerId===r))})),removeFriend:t=>e(r=>({friendCategories:r.friendCategories.map(s=>({...s,friends:s.friends.filter(i=>i.uid!==t),memberCount:s.friends.filter(i=>i.uid!==t).length}))}))}),{name:bu,storage:qf,skipHydration:!0,partialize:e=>({_uin:Jt,friendCategories:e.friendCategories,groups:e.groups,recentChats:e.recentChats,groupLastTimeMap:e.groupLastTimeMap,groupLastMessageMap:e.groupLastMessageMap,expandedCategories:e.expandedCategories,membersCache:e.membersCache,showMemberPanel:e.showMemberPanel,scrollPositions:e.scrollPositions,contactsCacheTimestamp:e.contactsCacheTimestamp,unreadCounts:e.unreadCounts,activeTab:e.activeTab,currentChat:e.currentChat}),merge:(e,a)=>{let{_uin:t,...r}=e??{};return{...a,...Lu,...r,...Iu}},onRehydrateStorage:()=>e=>{if(e&&e.recentChats){let a=new Set;e.recentChats=e.recentChats.filter(t=>{if(!t.peerId||t.peerId==="0"||t.peerId==="")return!1;let r=`${t.chatType}_${t.peerId}`;return a.has(r)?!1:(a.add(r),!0)})}}}));function ku(e){if(!e||e===Jt)return;Jt=e,Ye++,Br.clear(),bo();let a=`${e}-${bu}`;try{let t=localStorage.getItem(a);t&&JSON.parse(t)?.state?._uin!==e&&localStorage.removeItem(a)}catch{localStorage.removeItem(a)}ne.persist.rehydrate()}import{useState as vo,useRef as _s,useEffect as Bs}from"react";import{createPortal as Su}from"react-dom";import{Fragment as Au,jsx as ge,jsxs as ze}from"react/jsx-runtime";function wo(e,a,t){let[r,o]=vo({left:-9999,top:-9999,ready:!1});return Bs(()=>{o({left:-9999,top:-9999,ready:!1});let s=requestAnimationFrame(()=>{if(!t.current){o({left:e,top:a,ready:!0});return}let i=t.current.getBoundingClientRect(),n=10,l=e,u=a;e+i.width>window.innerWidth-n&&(l=e-i.width),l<n&&(l=n),a+i.height>window.innerHeight-n&&(u=a-i.height),u<n&&(u=n),o({left:l,top:u,ready:!0})});return()=>cancelAnimationFrame(s)},[e,a]),r}var qs=({groupCode:e,onClose:a})=>{let{groups:t,setGroups:r}=ne(),[o,s]=vo(!1),i=_s(null),n=async u=>{try{await lu(e,u);let d=t.map(c=>c.groupCode===e?{...c,msgMask:u}:c);r(d)}catch(d){console.error("\u8BBE\u7F6E\u6D88\u606F\u63A5\u6536\u65B9\u5F0F\u5931\u8D25:",d),alert(`\u8BBE\u7F6E\u5931\u8D25: ${d.message||"\u672A\u77E5\u9519\u8BEF"}`)}a()},l=t.find(u=>u.groupCode===e)?.msgMask;return ze("div",{className:"relative",children:[ze("button",{onMouseEnter:()=>s(!0),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(aa,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u6D88\u606F\u63A5\u6536\u65B9\u5F0F"}),ge(nt,{size:14,className:"flex-shrink-0"})]}),o&&ze("div",{ref:i,className:"absolute left-full top-0 ml-1 bg-popup r-control glass-pop origin-top-left py-1 min-w-[140px] z-[10000]",onMouseLeave:()=>s(!1),children:[ze("button",{onClick:()=>n(1),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(aa,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u63A5\u6536\u5E76\u63D0\u9192"}),l===1&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]}),ze("button",{onClick:()=>n(4),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(ur,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u63A5\u6536\u4F46\u4E0D\u63D0\u9192"}),l===4&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]}),ze("button",{onClick:()=>n(2),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(rr,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u6536\u8FDB\u7FA4\u52A9\u624B"}),l===2&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]}),ze("button",{onClick:()=>n(3),className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[ge(lr,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:"\u5C4F\u853D\u7FA4\u6D88\u606F"}),l===3&&ge("span",{className:"flex-shrink-0 text-pink-500",children:"\u2713"})]})]})]})},Ru=({friend:e,isSelected:a,onClick:t})=>{let{togglePinChat:r}=ne(),[o,s]=vo(null),i=_s(null),n=wo(o?.x||0,o?.y||0,i),l=c=>{c.preventDefault(),c.stopPropagation(),s({x:c.clientX,y:c.clientY})},u=()=>s(null),d=async()=>{try{await r(1,e.uin)}catch(c){console.error("\u7F6E\u9876\u5931\u8D25:",c),alert(`\u7F6E\u9876\u5931\u8D25: ${c.message||"\u672A\u77E5\u9519\u8BEF"}`)}u()};return Bs(()=>{if(!o)return;let c=()=>u();return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[o]),ze(Au,{children:[ze("div",{onClick:t,onContextMenu:l,className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors ${a?"bg-pink-500/20":"hover:bg-theme-item-hover"}`,children:[ze("div",{className:"relative flex-shrink-0",children:[ge("img",{src:e.avatar,alt:e.nickname,className:"w-10 h-10 rounded-full object-cover",onError:c=>{c.currentTarget.src=Oe(e.uin)}}),e.online&&ge("div",{className:"absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white dark:border-neutral-800"})]}),ze("div",{className:"flex-1 min-w-0",children:[ge("div",{className:"text-sm font-medium text-theme truncate",children:e.remark||e.nickname}),e.remark&&ge("div",{className:"text-xs text-theme-hint truncate",children:e.nickname})]})]}),o&&Su(ge("div",{ref:i,className:"fixed glass glass-thick r-control glass-pop origin-top-left py-1 min-w-[120px] z-[9999]",style:{left:`${n.left}px`,top:`${n.top}px`,opacity:n.ready?1:0,pointerEvents:n.ready?"auto":"none"},onClick:c=>c.stopPropagation(),children:ze("button",{onClick:d,className:"w-full px-3 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center gap-2 text-theme",children:[ge(ra,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:e.topTime&&e.topTime!=="0"?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"})]})}),document.body)]})},Mu=({group:e,isSelected:a,onClick:t,showPinnedStyle:r=!1,unreadCount:o=0,subtitle:s})=>{let{togglePinChat:i}=ne(),[n,l]=vo(null),u=_s(null),d=wo(n?.x||0,n?.y||0,u),c=f=>{f.preventDefault(),f.stopPropagation(),l({x:f.clientX,y:f.clientY})},m=()=>{l(null)},p=async()=>{try{await i(2,e.groupCode)}catch(f){console.error("\u7F6E\u9876\u5931\u8D25:",f),alert(`\u7F6E\u9876\u5931\u8D25: ${f.message||"\u672A\u77E5\u9519\u8BEF"}`)}m()};return Bs(()=>{if(!n)return;let f=()=>m();return document.addEventListener("click",f),()=>document.removeEventListener("click",f)},[n]),ze(Au,{children:[ze("div",{onClick:t,onContextMenu:c,className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors ${a?"bg-pink-500/20":r&&e.isTop?"bg-theme-item-hover":"hover:bg-theme-item-hover"}`,children:[ze("div",{className:"relative flex-shrink-0",children:[ge("img",{src:e.avatar,alt:e.groupName,className:"w-10 h-10 rounded-full object-cover",onError:f=>{f.currentTarget.src=`https://p.qlogo.cn/gh/${e.groupCode}/${e.groupCode}/640/`}}),o>0&&ge("div",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-xs font-medium rounded-full flex items-center justify-center px-1",children:o})]}),ze("div",{className:"flex-1 min-w-0",children:[ge("div",{className:"text-sm font-medium text-theme truncate",children:e.groupName}),ge("div",{className:"text-xs text-theme-hint truncate",children:s||`${e.memberCount} \u4EBA`})]})]}),n&&Su(ze("div",{ref:u,className:"fixed glass glass-thick r-control glass-pop origin-top-left py-1 min-w-[160px] z-[9999]",style:{left:`${d.left}px`,top:`${d.top}px`,opacity:d.ready?1:0,pointerEvents:d.ready?"auto":"none"},onClick:f=>f.stopPropagation(),children:[ze("button",{onClick:p,className:"w-full px-3 py-2 text-left text-sm hover:bg-neutral-100 dark:hover:bg-neutral-700 flex items-center gap-2 text-theme",children:[ge(ra,{size:14,className:"flex-shrink-0"}),ge("span",{className:"flex-1",children:e.isTop?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"})]}),ge(qs,{groupCode:e.groupCode,onClose:m})]}),document.body)]})};import{useState as Rt,useEffect as $f}from"react";import{useEffect as Hf,useRef as jf}from"react";import{createPortal as Gf}from"react-dom";var Wf=({children:e})=>{let a=jf(null);return a.current||(a.current=document.createElement("div")),Hf(()=>{let t=a.current;return document.body.appendChild(t),()=>{document.body.removeChild(t)}},[]),Gf(e,a.current)},Us=Wf;import{jsx as Q,jsxs as le}from"react/jsx-runtime";function yo(e){if(!e||e<=0)return"";let a=new Date(e),t=new Date;return a.toDateString()===t.toDateString()?a.toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):a.toLocaleDateString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Vf(e){let a=e.user1.nickName||e.user1.uin||"\u672A\u77E5\u7528\u6237",t=e.user2.nickName||e.user2.uin||"";switch(e.notifyType){case 7:return`${a} \u7533\u8BF7\u52A0\u5165\u7FA4`;case 1:return`${t} \u9080\u8BF7\u4F60\u52A0\u5165\u7FA4`;case 5:return`${t} \u9080\u8BF7 ${a} \u52A0\u5165\u7FA4`;case 4:return`${a} \u5DF2\u52A0\u5165\u7FA4`;case 6:return`\u7BA1\u7406\u5458\u5DF2\u540C\u610F ${a} \u52A0\u5165\u7FA4`;case 2:return`${a} \u62D2\u7EDD\u4E86\u9080\u8BF7`;case 3:return`\u7BA1\u7406\u5458\u62D2\u7EDD\u4E86 ${a} \u7684\u52A0\u7FA4\u8BF7\u6C42`;case 8:return`${a} \u88AB\u8BBE\u4E3A\u7BA1\u7406\u5458`;case 9:return`${a} \u88AB ${t} \u79FB\u51FA\u7FA4`;case 10:return`\u4F60\u88AB ${t} \u79FB\u51FA\u7FA4`;case 11:return`${a} \u9000\u51FA\u4E86\u7FA4`;case 12:return"\u4F60\u88AB\u53D6\u6D88\u4E86\u7BA1\u7406\u5458";case 13:return`${a} \u88AB\u53D6\u6D88\u4E86\u7BA1\u7406\u5458`;case 14:return`\u7FA4\u4E3B\u5DF2\u8F6C\u8BA9\u7ED9 ${t}`;case 15:return`${a} \u5C06\u7FA4\u4E3B\u8F6C\u8BA9\u7ED9 ${t}`;default:return"\u7FA4\u901A\u77E5"}}function Pu(e){return e.status===1&&(e.notifyType===7||e.notifyType===1||e.notifyType===5)}function Jf(e){switch(e.status){case 2:return"\u5DF2\u540C\u610F";case 3:return"\u5DF2\u62D2\u7EDD";case 4:return"\u5DF2\u5FFD\u7565";default:return null}}var Os="flex items-center gap-1 px-3 py-1 text-xs text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30 rounded-md transition-colors disabled:opacity-50",zs="flex items-center gap-1 px-3 py-1 text-xs text-theme-secondary hover:bg-neutral-100 dark:hover:bg-neutral-700/50 rounded-md transition-colors disabled:opacity-50",Xf="flex items-center gap-1 px-3 py-1 text-xs text-red-500 hover:bg-red-50 dark:hover:bg-red-900/30 rounded-md transition-colors disabled:opacity-50",Qf="px-3 py-1 text-xs text-theme-muted hover:text-theme hover:bg-theme-item rounded-md transition-colors",Kf=({item:e,time:a})=>{let[t,r]=Rt(null),[o,s]=Rt(!1),[i,n]=Rt(""),l=ne(p=>p.updateNotificationStatus),u=async(p,f)=>{r(p);try{await du(e.flag,p,f),l("group-notify",e.flag,p==="approve"?2:3),T(p==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD","success"),s(!1)}catch(h){T(h.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{r(null)}},d=Jf(e),c=Pu(e),m=Tr(e.group.groupCode);return le("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[Q("img",{src:m,alt:"",className:"w-10 h-10 rounded-full flex-shrink-0 object-cover"}),le("div",{className:"flex-1 min-w-0",children:[le("div",{className:"flex items-center gap-2",children:[Q("span",{className:"text-sm font-medium text-theme truncate",children:e.group.groupName}),e.doubt&&Q("span",{className:"text-xs text-amber-500 flex-shrink-0",children:"\u88AB\u8FC7\u6EE4"}),Q("span",{className:"text-xs text-theme-hint flex-shrink-0",children:yo(a)})]}),Q("div",{className:"text-xs text-theme-secondary mt-0.5",children:Vf(e)}),e.postscript&&le("div",{className:"text-xs text-theme-hint mt-1 bg-theme-input rounded px-2 py-1 break-words whitespace-pre-wrap",children:["\u9A8C\u8BC1\u4FE1\u606F\uFF1A",e.postscript]}),c&&!o&&le("div",{className:"flex gap-2 mt-2",children:[le("button",{onClick:()=>u("approve"),disabled:t!==null,className:Os,children:[t==="approve"?Q(ee,{size:12,className:"animate-spin"}):Q(xa,{size:12}),"\u540C\u610F"]}),le("button",{onClick:()=>s(!0),disabled:t!==null,className:zs,children:[Q(Re,{size:12}),"\u62D2\u7EDD"]})]}),c&&o&&le("div",{className:"mt-2 space-y-1.5",children:[Q("input",{type:"text",value:i,onChange:p=>n(p.target.value),placeholder:"\u62D2\u7EDD\u7406\u7531\uFF08\u53EF\u9009\uFF09",className:"w-full px-2 py-1 text-xs bg-theme-input text-theme rounded border border-theme-divider focus:outline-none focus:border-pink-400",onKeyDown:p=>{p.key==="Enter"&&u("reject",i)},autoFocus:!0}),le("div",{className:"flex gap-2",children:[le("button",{onClick:()=>u("reject",i),disabled:t!==null,className:Xf,children:[t==="reject"?Q(ee,{size:12,className:"animate-spin"}):Q(Re,{size:12}),"\u786E\u8BA4\u62D2\u7EDD"]}),Q("button",{onClick:()=>{s(!1),n("")},disabled:t!==null,className:Qf,children:"\u53D6\u6D88"})]})]}),d&&Q("div",{className:`text-xs mt-1 ${e.status===2?"text-pink-500":e.status===3?"text-theme-secondary":"text-theme-hint"}`,children:d})]})]})},Zf=({item:e,time:a})=>{let[t,r]=Rt(null),[o,s]=Rt(e.isDecide),[i,n]=Rt(null),l=ne(c=>c.updateNotificationStatus),u=async c=>{r(c);try{await As(e.flag,c),l("friend-request",e.flag,0),s(!0),n(c),T(c==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD","success")}catch(m){T(m.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{r(null)}},d=Oe(e.friendUin);return le("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[Q("img",{src:d,alt:"",className:"w-10 h-10 rounded-full flex-shrink-0 object-cover"}),le("div",{className:"flex-1 min-w-0",children:[le("div",{className:"flex items-center gap-2",children:[Q("span",{className:"text-sm font-medium text-theme truncate",children:e.friendNick||e.friendUin}),Q("span",{className:"text-xs text-theme-hint flex-shrink-0",children:yo(a)})]}),Q("div",{className:"text-xs text-theme-secondary mt-0.5",children:"\u8BF7\u6C42\u6DFB\u52A0\u4F60\u4E3A\u597D\u53CB"}),e.extWords&&le("div",{className:"text-xs text-theme-hint mt-1 bg-theme-input rounded px-2 py-1 break-words whitespace-pre-wrap",children:["\u9A8C\u8BC1\u4FE1\u606F\uFF1A",e.extWords]}),e.addSource&&le("div",{className:"text-xs text-theme-hint mt-0.5",children:["\u6765\u6E90\uFF1A",e.addSource]}),!o&&le("div",{className:"flex gap-2 mt-2",children:[le("button",{onClick:()=>u("approve"),disabled:t!==null,className:Os,children:[t==="approve"?Q(ee,{size:12,className:"animate-spin"}):Q(xa,{size:12}),"\u540C\u610F"]}),le("button",{onClick:()=>u("reject"),disabled:t!==null,className:zs,children:[t==="reject"?Q(ee,{size:12,className:"animate-spin"}):Q(Re,{size:12}),"\u62D2\u7EDD"]})]}),o&&Q("div",{className:`text-xs mt-1 ${i==="approve"?"text-pink-500":i==="reject"?"text-theme-secondary":"text-theme-hint"}`,children:i==="approve"?"\u5DF2\u540C\u610F":i==="reject"?"\u5DF2\u62D2\u7EDD":"\u5DF2\u5904\u7406"})]})]})},Yf=({item:e,time:a})=>{let[t,r]=Rt(null),[o,s]=Rt(!1),[i,n]=Rt(null),l=ne(c=>c.updateNotificationStatus),u=async c=>{r(c);try{c==="approve"?await mu(e.uid):await As(e.uid,"reject"),l("doubt-buddy",e.flag,0),s(!0),n(c),T(c==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD","success")}catch(m){T(m.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{r(null)}},d=Oe(e.uid);return le("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[le("div",{className:"relative flex-shrink-0",children:[Q("img",{src:d,alt:"",className:"w-10 h-10 rounded-full object-cover"}),Q("div",{className:"absolute -bottom-0.5 -right-0.5 bg-amber-500 rounded-full p-0.5",children:Q(oa,{size:10,className:"text-white"})})]}),le("div",{className:"flex-1 min-w-0",children:[le("div",{className:"flex items-center gap-2",children:[Q("span",{className:"text-sm font-medium text-theme truncate",children:e.nick||e.uid}),Q("span",{className:"text-xs text-amber-500 flex-shrink-0",children:"\u88AB\u8FC7\u6EE4"}),Q("span",{className:"text-xs text-theme-hint flex-shrink-0",children:yo(a)})]}),Q("div",{className:"text-xs text-theme-secondary mt-0.5",children:"\u8BF7\u6C42\u6DFB\u52A0\u4F60\u4E3A\u597D\u53CB"}),e.msg&&le("div",{className:"text-xs text-theme-hint mt-1 bg-theme-input rounded px-2 py-1 break-words whitespace-pre-wrap",children:["\u9A8C\u8BC1\u4FE1\u606F\uFF1A",e.msg]}),e.source&&le("div",{className:"text-xs text-theme-hint mt-0.5",children:["\u6765\u6E90\uFF1A",e.source]}),e.reason&&le("div",{className:"text-xs text-amber-500/80 mt-0.5",children:["\u8FC7\u6EE4\u539F\u56E0\uFF1A",e.reason]}),!o&&le("div",{className:"flex gap-2 mt-2",children:[le("button",{onClick:()=>u("approve"),disabled:t!==null,className:Os,children:[t==="approve"?Q(ee,{size:12,className:"animate-spin"}):Q(xa,{size:12}),"\u540C\u610F"]}),le("button",{onClick:()=>u("reject"),disabled:t!==null,className:zs,children:[t==="reject"?Q(ee,{size:12,className:"animate-spin"}):Q(Re,{size:12}),"\u62D2\u7EDD"]})]}),o&&Q("div",{className:`text-xs mt-1 ${i==="approve"?"text-pink-500":"text-theme-secondary"}`,children:i==="approve"?"\u5DF2\u540C\u610F":"\u5DF2\u62D2\u7EDD"})]})]})},em=({type:e,data:a,time:t})=>{let r=Tr(a.groupCode),o=e==="group-dismiss"?kt:La,s=e==="group-dismiss"?"\u7FA4\u5DF2\u89E3\u6563":"\u5DF2\u9000\u51FA\u7FA4\u804A";return le("div",{className:"flex items-start gap-3 px-3 py-3 hover:bg-theme-item-hover transition-colors",children:[le("div",{className:"relative flex-shrink-0",children:[Q("img",{src:r,alt:"",className:"w-10 h-10 rounded-full object-cover"}),Q("div",{className:"absolute -bottom-0.5 -right-0.5 bg-orange-500 rounded-full p-0.5",children:Q(o,{size:10,className:"text-white"})})]}),le("div",{className:"flex-1 min-w-0",children:[le("div",{className:"flex items-center gap-2",children:[Q("span",{className:"text-sm font-medium text-theme truncate",children:a.groupName||a.groupCode}),Q("span",{className:"text-xs text-theme-hint flex-shrink-0",children:yo(t)})]}),Q("div",{className:"text-xs text-orange-500 mt-0.5",children:s})]})]})},tm=()=>{let e=ne(m=>m.notifications),a=ne(m=>m.clearNotificationUnread),t=ne(m=>m.loadGroupNotifications),[r,o]=Rt(!1),[s,i]=Rt("friend");$f(()=>{a()},[a]);let n=async()=>{o(!0);try{await t()}finally{o(!1)}},l=e.filter(m=>m.type==="friend-request"||m.type==="doubt-buddy"),u=e.filter(m=>m.type==="group-notify"||m.type==="group-dismiss"||m.type==="group-quit"),d=l.filter(m=>m.type==="friend-request"&&!m.data.isDecide||m.type==="doubt-buddy").length,c=u.filter(m=>m.type==="group-notify"&&Pu(m.data)).length;return le("div",{className:"flex flex-col h-full",children:[le("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-theme-divider",children:[le("div",{className:"flex items-center gap-1",children:[le("button",{onClick:()=>i("friend"),className:`flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium rounded-md transition-colors ${s==="friend"?"text-pink-600 dark:text-pink-400 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[Q(Ar,{size:13}),"\u597D\u53CB\u7533\u8BF7",d>0&&Q("span",{className:"ml-0.5 min-w-[16px] h-[16px] bg-red-500 text-white text-[10px] font-medium rounded-full flex items-center justify-center px-1",children:d})]}),le("button",{onClick:()=>i("group"),className:`flex items-center gap-1 px-2.5 py-1.5 text-xs font-medium rounded-md transition-colors ${s==="group"?"text-pink-600 dark:text-pink-400 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[Q(St,{size:13}),"\u7FA4\u901A\u77E5",c>0&&Q("span",{className:"ml-0.5 min-w-[16px] h-[16px] bg-red-500 text-white text-[10px] font-medium rounded-full flex items-center justify-center px-1",children:c})]})]}),Q("div",{className:"flex items-center gap-1.5",children:Q("button",{onClick:n,disabled:r,className:"text-xs text-pink-500 hover:text-pink-600 disabled:opacity-50",children:r?Q(ee,{size:14,className:"animate-spin"}):"\u5237\u65B0"})})]}),Q("div",{className:"flex-1 min-h-0 overflow-y-auto",children:(s==="friend"?l:u).length===0?Q("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:s==="friend"?"\u6682\u65E0\u597D\u53CB\u7533\u8BF7":"\u6682\u65E0\u7FA4\u901A\u77E5"}):Q("div",{className:"divide-y divide-theme-divider",children:s==="friend"?l.map((m,p)=>m.type==="friend-request"?Q(Zf,{item:m.data,time:m.time},`fr-${m.data.flag}-${p}`):m.type==="doubt-buddy"?Q(Yf,{item:m.data,time:m.time},`db-${m.data.flag}-${p}`):null):u.map((m,p)=>m.type==="group-notify"?Q(Kf,{item:m.data,time:m.time},`gn-${m.data.flag}-${p}`):m.type==="group-dismiss"||m.type==="group-quit"?Q(em,{type:m.type,data:m.data,time:m.time},`info-${m.type}-${p}`):null)})})]})},Du=tm;import{Fragment as Fu,jsx as re,jsxs as be}from"react/jsx-runtime";var om=({activeTab:e,onTabChange:a,friendCategories:t,groups:r,recentChats:o,unreadCounts:s,selectedPeerId:i,onSelectFriend:n,onSelectGroup:l,onSelectRecent:u})=>{let[d,c]=Hs(""),{groupAssistantMode:m,enterGroupAssistant:p,exitGroupAssistant:f}=ne(),h=ne(y=>y.groupLastTimeMap),g=ne(y=>y.groupLastMessageMap),C=Ft(()=>{if(!d.trim())return t;let y=d.toLowerCase();return t.map(N=>({...N,friends:N.friends.filter(q=>q.nickname.toLowerCase().includes(y)||q.remark.toLowerCase().includes(y)||q.uin.includes(d))})).filter(N=>N.friends.length>0)},[t,d]),L=Ft(()=>au(r,d),[r,d]),x=[{id:"recent",icon:fr,label:"\u6700\u8FD1"},{id:"friends",icon:St,label:"\u597D\u53CB"},{id:"groups",icon:Ta,label:"\u7FA4\u7EC4"}],v=ne(y=>y.notificationUnreadCount),[I,k]=Hs(!1);return be("div",{className:"flex flex-col h-full",children:[be("div",{className:"flex items-center border-b border-theme-divider px-2 pt-2",children:[re("div",{className:"flex flex-1",children:x.map(y=>{let N=y.icon,q=!I&&e===y.id;return be("button",{onClick:()=>{k(!1),a(y.id)},className:`flex-1 flex items-center justify-center gap-1.5 py-2.5 text-sm font-medium transition-colors rounded-t-lg ${q?"text-pink-600 dark:text-pink-400 bg-pink-50/50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[re(N,{size:16}),y.label]},y.id)})}),be("button",{onClick:()=>k(!I),className:`relative flex items-center justify-center w-9 h-9 rounded-lg transition-colors flex-shrink-0 ${I?"text-pink-600 dark:text-pink-400 bg-pink-50/50 dark:bg-pink-900/30":"text-theme-muted hover:text-theme hover:bg-theme-item"}`,children:[re(aa,{size:16}),v>0&&re("div",{className:"absolute top-1 right-1 min-w-[14px] h-[14px] bg-red-500 text-white text-[10px] font-medium rounded-full flex items-center justify-center px-0.5",children:v>99?"99+":v})]})]}),I?re("div",{className:"flex-1 min-h-0",children:re(Du,{onClose:()=>k(!1)})}):be(Fu,{children:[(e==="friends"||e==="groups")&&re("div",{className:"p-3",children:be("div",{className:"relative",children:[re(Vt,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-theme-hint"}),re("input",{type:"text",value:d,onChange:y=>c(y.target.value),placeholder:e==="friends"?"\u641C\u7D22\u597D\u53CB...":"\u641C\u7D22\u7FA4\u7EC4...",className:"w-full pl-9 pr-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme placeholder:text-theme-hint"})]})}),be("div",{className:"flex-1 overflow-y-auto",children:[e==="recent"&&m==="normal"&&re(nm,{items:o,unreadCounts:s,selectedPeerId:i,onSelect:u,onEnterGroupAssistant:p}),e==="recent"&&m==="assistant"&&re(lm,{groups:r,recentChats:o,groupLastTimeMap:h,groupLastMessageMap:g,unreadCounts:s,selectedPeerId:i,onSelect:l,onBack:f}),e==="friends"&&re(sm,{categories:C,selectedPeerId:i,onSelect:n}),e==="groups"&&re(Eu,{items:L,unreadCounts:s,groupLastTimeMap:h,selectedPeerId:i,onSelect:l})]})]})]})},sm=({categories:e,selectedPeerId:a,onSelect:t})=>{let{expandedCategories:r,toggleCategory:o}=ne(),s=Ft(()=>new Set(r),[r]),i=Ft(()=>e.map(n=>({...n,friends:[...n.friends].sort((l,u)=>{let d=!!(l.topTime&&l.topTime!=="0"),c=!!(u.topTime&&u.topTime!=="0");return d&&!c?-1:!d&&c?1:0})})),[e]);return i.length===0?re("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u597D\u53CB"}):re("div",{className:"py-1",children:i.map(n=>{let l=s.has(n.categoryId);return be("div",{children:[be("div",{onClick:()=>o(n.categoryId),className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-theme-item-hover text-theme-secondary",children:[l?re(cr,{size:14}):re(nt,{size:14}),re("span",{className:"text-xs font-medium",children:n.categoryName}),be("span",{className:"text-xs text-theme-hint",children:[n.onlineCount,"/",n.memberCount]})]}),l&&n.friends.map(u=>re(Ru,{friend:u,isSelected:a===u.uin,onClick:()=>t(u)},u.uid))]},n.categoryId)})})},Eu=({items:e,unreadCounts:a,selectedPeerId:t,onSelect:r,groupLastTimeMap:o,subtitleMap:s,showPinnedStyle:i=!1})=>{let n=Ft(()=>[...e].sort((u,d)=>{if(u.isTop&&!d.isTop)return-1;if(!u.isTop&&d.isTop)return 1;if(o){let c=o[u.groupCode]||0,m=o[d.groupCode]||0;if(c!==m)return m-c}return 0}),[e,o]);return n.length===0?re("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u7FA4\u7EC4"}):re("div",{className:"py-1",children:n.map(l=>{let u=a.get(`2_${l.groupCode}`)||0;return re(Mu,{group:l,isSelected:t===l.groupCode,onClick:()=>r(l),showPinnedStyle:i,unreadCount:u,subtitle:s?.[l.groupCode]},l.groupCode)})})},nm=({items:e,unreadCounts:a,selectedPeerId:t,onSelect:r,onEnterGroupAssistant:o})=>{let{togglePinChat:s,removeRecentChat:i,friendCategories:n,groups:l}=ne(),[u,d]=Hs(null),c=am(null),m=wo(u?.x||0,u?.y||0,c),p=Ft(()=>{let I=l.filter(y=>y.msgMask===2),k=0;return I.forEach(y=>{let N=a.get(`2_${y.groupCode}`)||0;k+=N}),k},[l,a]),f=Ft(()=>l.filter(I=>I.msgMask===2).length,[l]),h=Ft(()=>e.filter(I=>I.chatType!==2?!0:l.find(y=>y.groupCode===I.peerId)?.msgMask!==2),[e,l]),g=I=>{if(I.chatType===2){let k=l.find(y=>y.groupCode===I.peerId);if(k?.remarkName&&k.remarkName!==k.groupName)return k.remarkName}else if(I.chatType===1||I.chatType===100)for(let k of n){let y=k.friends.find(N=>N.uin===I.peerId);if(y?.remark&&y.remark!==y.nickname)return y.remark}return I.peerName},C=(I,k)=>{I.preventDefault(),d({x:I.clientX,y:I.clientY,item:k})},L=()=>{d(null)},x=async()=>{if(u){try{await s(u.item.chatType,u.item.peerId)}catch(I){console.error("\u7F6E\u9876\u5931\u8D25:",I),alert(`\u7F6E\u9876\u5931\u8D25: ${I.message||"\u672A\u77E5\u9519\u8BEF"}`)}L()}},v=()=>{u&&(i(u.item.chatType,u.item.peerId),L())};return h.length===0&&f===0?re("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u6700\u8FD1\u4F1A\u8BDD"}):be("div",{className:"py-1",onClick:L,children:[f>0&&be("div",{onClick:o,className:"flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors hover:bg-theme-item-hover",children:[be("div",{className:"relative flex-shrink-0",children:[re("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-blue-400 to-blue-600 flex items-center justify-center",children:re(Ta,{size:20,className:"text-white"})}),p>0&&re("div",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-xs font-medium rounded-full flex items-center justify-center px-1",children:p})]}),be("div",{className:"flex-1 min-w-0",children:[re("div",{className:"flex items-center justify-between",children:re("span",{className:"text-sm font-medium text-theme",children:"\u7FA4\u52A9\u624B"})}),be("div",{className:"text-xs text-theme-hint truncate mt-0.5",children:[f," \u4E2A\u7FA4\u804A"]})]})]}),h.map(I=>re(im,{item:I,displayName:g(I),unreadCount:a.get(`${I.chatType}_${I.peerId}`)||I.unreadCount,isSelected:t===I.peerId,onClick:()=>r(I),onContextMenu:k=>C(k,I)},`${I.chatType}_${I.peerId}`)),u&&rm(be(Fu,{children:[re("div",{className:"fixed inset-0 z-40",onClick:L,onContextMenu:I=>{I.preventDefault(),L()}}),be("div",{ref:c,className:"fixed z-50 bg-popup r-control glass-pop origin-top-left py-1 min-w-[160px]",style:{left:m.left,top:m.top,visibility:m.ready?"visible":"hidden"},onContextMenu:I=>I.preventDefault(),children:[be("button",{onClick:x,className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-theme",children:[re(ra,{size:14,className:"flex-shrink-0"}),re("span",{className:"flex-1",children:u.item.pinned?"\u53D6\u6D88\u7F6E\u9876":"\u7F6E\u9876"})]}),u.item.chatType===2&&re(qs,{groupCode:u.item.peerId,onClose:L}),be("button",{onClick:v,className:"w-full px-3 py-2 text-left text-sm hover:bg-theme-item-hover flex items-center gap-2 text-red-500",children:[re(We,{size:14,className:"flex-shrink-0"}),re("span",{className:"flex-1",children:"\u5220\u9664"})]})]})]}),document.body)]})},im=({item:e,displayName:a,unreadCount:t,isSelected:r,onClick:o,onContextMenu:s})=>be("div",{onClick:o,onContextMenu:s,className:`flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors ${r?"bg-pink-500/20":e.pinned?"bg-theme-item-hover":"hover:bg-theme-item-hover"}`,children:[be("div",{className:"relative flex-shrink-0",children:[re("img",{src:e.peerAvatar,alt:a,className:"w-10 h-10 rounded-full object-cover"}),t>0&&re("div",{className:"absolute -top-1 -right-1 min-w-[18px] h-[18px] bg-red-500 text-white text-xs font-medium rounded-full flex items-center justify-center px-1",children:t})]}),be("div",{className:"flex-1 min-w-0",children:[be("div",{className:"flex items-center justify-between",children:[re("span",{className:"text-sm font-medium text-theme truncate",children:a}),re("span",{className:"text-xs text-theme-hint flex-shrink-0 ml-2",children:_r(e.lastTime)})]}),re("div",{className:"text-xs text-theme-hint truncate mt-0.5",children:e.lastMessage})]})]}),lm=({groups:e,recentChats:a,groupLastTimeMap:t,groupLastMessageMap:r,unreadCounts:o,selectedPeerId:s,onSelect:i,onBack:n})=>{let l=Ft(()=>e.filter(d=>d.msgMask===2),[e]),u=Ft(()=>{let d={...r};return a.forEach(c=>{c.chatType===2&&c.lastMessage&&(d[c.peerId]=c.lastMessage)}),d},[r,a]);return be("div",{className:"py-1",children:[be("div",{onClick:n,className:"flex items-center gap-3 px-3 py-2.5 cursor-pointer transition-colors hover:bg-theme-item-hover border-b border-theme-divider",children:[re(nt,{size:16,className:"transform rotate-180 text-theme-secondary"}),re("span",{className:"text-sm font-medium text-theme",children:"\u8FD4\u56DE\u6700\u8FD1\u4F1A\u8BDD"})]}),be("div",{className:"px-3 py-2 text-xs text-theme-hint",children:["\u7FA4\u52A9\u624B (",l.length,")"]}),l.length===0?re("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6682\u65E0\u7FA4\u804A"}):re(Eu,{items:l,unreadCounts:o,groupLastTimeMap:t,subtitleMap:u,selectedPeerId:s,onSelect:i,showPinnedStyle:!0})]})},Tu=om;import{useState as Le,useEffect as ut,useLayoutEffect as Cx,useRef as Ne,useCallback as Te,useMemo as mt}from"react";import{createPortal as Lx}from"react-dom";import*as Mt from"react";import{flushSync as Im}from"react-dom";function Nu(e){return typeof e=="object"?e.key:e}function _u(e,a){let t=e.length;return new Proxy(e,{get(r,o,s){if(typeof o=="string"){let i=o.charCodeAt(0);if(i>=48&&i<=57){let n=+o;if(Number.isInteger(n)&&n>=0&&n<t){let l=r[n];if(typeof l!="object"){let u=a[n*2];l=r[n]={index:n,key:l,start:u,size:a[n*2+1],end:u+a[n*2+1],lane:0}}return l}}if(o==="length")return t}return Reflect.get(r,o,s)}})}function ya(e,a,t){let r=t.initialDeps??[],o,s=!0;function i(){var n;let u=0,d=e();if(!(d.length!==r.length||d.some((p,f)=>r[f]!==p)))return o;r=d;let m=0;return o=a(...d),t?.onChange&&!(s&&t.skipInitialOnChange)&&t.onChange(o),s=!1,o}return i.updateDeps=n=>{r=n},i}function js(e,a){if(e===void 0)throw new Error(`Unexpected undefined${a?`: ${a}`:""}`);return e}var Xt=(e,a)=>Math.abs(e-a)<1.01,Bu=(e,a,t)=>{let r;return Object.assign(function(...o){e.clearTimeout(r),r=e.setTimeout(()=>a.apply(this,o),t)},{cancel:()=>{e.clearTimeout(r)}})};function qu({offset:e,isScrolling:a,elementMax:t,holdOffset:r,scrollOffset:o,pendingWrite:s,clampedMaxAtWrite:i}){var n;return a&&s===null&&e===o?"spurious":s!==null&&Math.abs(e-s.target)<1.5?"readBack":s!==null&&!s.smooth&&t!==null&&s.target>t+r+.5&&Math.abs(e-(t+r))<1.5||s!==null&&!s.smooth&&((n=s.lowMaxes)!=null&&n.some(l=>Math.abs(e-l)<1.5))?"clampedReadBack":i!==null&&Math.abs(e-i)<1.5?"clampedEcho":"external"}var um=e=>e==="smooth"||e==="smoothFinishing";function Uu({kind:e,offset:a,command:t,target:r}){return e!=="spurious"&&e!=="readBack"&&e!=="clampedReadBack"&&t?.index!=null&&t.phase!=="queued"&&!um(t.phase)&&!Xt(a,t.lastTargetOffset)&&!Xt(a,r())&&e!=="clampedEcho"}var Gs=40;function Ou(e){let a=e[e.length-1];if(a===void 0)return!1;let t=e.length-2;for(;t>=0&&a.t-e[t].t<Gs;)t--;if(t<0)return!1;let r=e[t],o=t-1;for(;o>=0&&r.t-e[o].t<Gs;)o--;if(o<0)return!1;let s=e[o],i=(a.offset-r.offset)/(a.t-r.t),n=(r.offset-s.offset)/(r.t-s.t);return i*n>=0&&Math.abs(i)>=2*Math.abs(n)&&Math.abs(i)-Math.abs(n)>=.8}function zu(e){let a=e[e.length-1];if(a===void 0)return!1;let t=e.length-2;for(;t>=0&&a.t-e[t].t<Gs;)t--;if(t<0)return!1;let r=e[t];return Math.abs(a.offset-r.offset)/(a.t-r.t)>=.05}var qr,Ur=()=>{if(qr!==void 0)return qr;if(typeof navigator>"u")return qr=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return qr=!0;let e=navigator.maxTouchPoints;return qr=navigator.platform==="MacIntel"&&e!==void 0&&e>0},Ws,dm=()=>Ws!==void 0?Ws:Ws=Ur()&&typeof CSS<"u"&&typeof CSS.supports=="function"&&CSS.supports("overflow-anchor: auto"),Hu=()=>!Ur()||dm();var _a={capture:!0,passive:!0},ko=class{constructor(a){this.host=a,this._touch=null,this.inMotion=()=>this._touch!==null&&this._touch.phase!=="lateFling",this.dragging=()=>{var t;return((t=this._touch)==null?void 0:t.phase)==="down"&&this._touch.moved},this.tail=()=>{var t;return((t=this._touch)==null?void 0:t.phase)==="tail"?this._touch.moved?"fling":"tap":null},this.onScroll=({isScrolling:t,ownReadBack:r,moved:o,external:s})=>{var i,n,l;return t&&((i=this._touch)==null?void 0:i.phase)==="tail"?this._openTail(this._touch.moved||!r,!1):((n=this._touch)==null?void 0:n.phase)==="lateFling"&&(this.host.now()>this._touch.until?this._touch=null:s&&t&&o&&this._openTail(!0,!1)),!r&&t&&o&&((l=this._touch)==null?void 0:l.phase)==="down"?(this._touch.moved=!0,!0):!1},this.touchStart=()=>{this.end(),this._touch={phase:"down",moved:!1}},this.touchEnd=()=>{var t;let r=((t=this._touch)==null?void 0:t.phase)==="down"&&this._touch.moved;this.end(),this._openTail(r,r)},this.end=()=>{var t;let r=this.host.getWindow();((t=this._touch)==null?void 0:t.phase)==="tail"&&r!=null&&r.clearTimeout(this._touch.timerId),this._touch=null},this.listen=t=>{let r=()=>this.touchStart(),o=()=>this.touchEnd();return t.addEventListener("touchstart",r,_a),t.addEventListener("touchend",o,_a),t.addEventListener("touchcancel",o,_a),()=>{t.removeEventListener("touchstart",r,_a),t.removeEventListener("touchend",o,_a),t.removeEventListener("touchcancel",o,_a),this.end()}},this._openTail=(t,r)=>{let o=this.host.getWindow();if(o==null)return;this.end();let s={phase:"tail",moved:t,awaitingFling:r,timerId:o.setTimeout(()=>{if(this.host.tailStillMoving()){this._openTail(s.moved,s.awaitingFling);return}this._touch=s.awaitingFling?{phase:"lateFling",until:this.host.now()+1e3}:null,this.host.onTailClosed()},150)};this._touch=s}}get touch(){return this._touch}};var ju=e=>{let{clientWidth:a,clientHeight:t}=e;return{width:a,height:t}},$u=e=>{let a=new Set;return{schedule:t=>{let r=e.requestAnimationFrame(()=>{a.delete(r),t()});a.add(r)},cancel:()=>{a.forEach(t=>e.cancelAnimationFrame(t)),a.clear()}}},cm=e=>e,fm=e=>{let a=e.overscan*Math.max(e.lanes??1,1),t=Math.max(e.startIndex-a,0),o=Math.min(e.endIndex+a,e.count-1)-t+1,s=new Array(o);for(let i=0;i<o;i++)s[i]=t+i;return s},Vu=(e,a)=>{let t=e.scrollElement;if(!t)return;let r=e.targetWindow;if(!r)return;let o=n=>{let{width:l,height:u}=n;a({width:Math.round(l),height:Math.round(u)})};if(o(ju(t)),!r.ResizeObserver)return()=>{};let s=$u(r),i=new r.ResizeObserver(()=>{let n=()=>{o(ju(t))};e.options.useAnimationFrameWithResizeObserver?s.schedule(n):n()});return i.observe(t,{box:"content-box"}),()=>{i.unobserve(t),s.cancel()}},Gu={passive:!0};var mm=typeof window>"u"?!0:"onscrollend"in window,pm=(e,a,t)=>{let r=e.scrollElement;if(!r)return;let o=e.targetWindow;if(!o)return;let s=e.options.useScrollendEvent&&mm,i=0,n=s?null:Bu(o,()=>a(t(r),!1),e.options.isScrollingResetDelay),l=c=>()=>{i=t(r),n?.(),a(i,c)},u=l(!0),d=l(!1);return r.addEventListener("scroll",u,Gu),s&&r.addEventListener("scrollend",d,Gu),()=>{r.removeEventListener("scroll",u),s&&r.removeEventListener("scrollend",d),n?.cancel()}},Ju=(e,a)=>pm(e,a,t=>{let{horizontal:r,isRtl:o}=e.options;return r?t.scrollLeft*(o&&-1||1):t.scrollTop});var hm=(e,a,t)=>{if(t.options.useCachedMeasurements){let r=t.indexFromElement(e),o=t.options.getItemKey(r);return t.itemSizeCache.get(o)??t.options.estimateSize(r)}if(a?.borderBoxSize){let r=a.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}if(!a){let r=t.indexFromElement(e),o=t.options.getItemKey(r),s=t.itemSizeCache.get(o);if(s!==void 0)return s}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},gm=(e,{adjustments:a=0,behavior:t},r)=>{var o;let{scrollElement:s,options:i}=r,n=e+a,l=i.horizontal&&i.isRtl&&s!==null&&"ownerDocument"in s;(o=s?.scrollTo)==null||o.call(s,{[i.horizontal?"left":"top"]:l?-n:n,behavior:t})};var Xu=gm,Wu=(e,a)=>e==="smooth"?a?"smoothLanded":"smooth":"instant",Or=e=>e?.phase==="smooth"||e?.phase==="smoothLanded";function xm(e,a,t,r){if(a===0)return!1;let o=r(0),s=new Set,i=0;for(;i<e;){let l=t(i);if(l===o)break;s.add(l),i++}let n=e-i;if(n===0||n>=a)return!1;for(let l=0;l<n;l++)if(r(l)!==t(i+l))return!1;for(let l=n;l<a;l++)if(s.has(r(l)))return!1;return!0}var So=class{constructor(a){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._iosGesture=new ko({getWindow:()=>this.targetWindow,now:()=>this.now(),tailStillMoving:()=>{let t=this.scrollState;if(t?.phase!=="queued"||this.pendingWrite!==null)return!1;let r=this._readElementOffset();return r===null||this._lastElementOffset===null||Math.abs(r-this._lastElementOffset)<1?!1:(this._lastElementOffset=r,t.samples=[...t.samples??[],{t:this.now(),offset:r}],!0)},onTailClosed:()=>{let t=this.scrollState;t?.phase==="queued"&&zu(t.samples??[])&&(this.scrollState=null),this._flushHoldIfReady(!0),this._writeAwaitingCommand(),this._retryClampedAdjustment()}}),this._lastElementOffset=null,this.pendingWrite=null,this._clampedAdjustment=null,this.elementsCache=new Map,this._resizeBatch=null,this.now=()=>{var t,r,o;return((o=(r=(t=this.targetWindow)==null?void 0:t.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let t=null,r=null,o=!1,s=!1,i=new Set,n=()=>{if(t)return t;let u=this.targetWindow;if(!u||!u.ResizeObserver)return null;let d=r=$u(u);return t=new u.ResizeObserver(c=>{let m=()=>{let p={sync:!1};this._resizeBatch=p;try{c.forEach(l)}finally{this._resizeBatch=null,p.notify&&(this.notify(p.sync),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment(),this.measureElement(null))}};if(this.options.useAnimationFrameWithResizeObserver)d.schedule(m);else{o=!0;try{m()}finally{o=!1}}})},l=u=>{let d=u.target,c=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(let[m,p]of this.elementsCache)if(p===d){this.elementsCache.delete(m);break}return}this.isIndexInRange(c)&&this.shouldMeasureDuringScroll(c)&&this.resizeItem(c,this.options.measureElement(d,u,this))};return{disconnect:()=>{var u;(u=n())==null||u.disconnect(),r?.cancel(),i.clear(),s=!1,t=null,r=null},observe:u=>{let d=n();if(d){if(!o){d.observe(u,{box:"border-box"});return}i.add(u),s||(s=!0,r?.schedule(()=>{s=!1,i.forEach(c=>{c.isConnected&&t?.observe(c,{box:"border-box"})}),i.clear()}))}},unobserve:u=>{var d;i.delete(u),(d=n())==null||d.unobserve(u)}}})(),this.range=null,this.setOptions=t=>{var r;let o={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:cm,rangeExtractor:fm,onChange:()=>{},measureElement:hm,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let d in t){let c=t[d];c!==void 0&&(o[d]=c)}let s=this.options,i=null,n=null,l=!1;if(s!==void 0&&s.enabled&&o.enabled&&o.anchorTo==="end"&&this.scrollElement!==null){let d=s.count,c=o.count,m=this.getMeasurements(),p=((r=this._singleLaneMeasurements)==null?void 0:r.items)??m,f=x=>Nu(p[x]),h=d>0?f(0):null,g=d>0?f(d-1):null;if(c!==d||d>0&&c>0&&(o.getItemKey(0)!==h||o.getItemKey(c-1)!==g)){l=!0;let x=d>0?this.getVirtualItemForOffset(this.getScrollOffset())??m[0]:null;x&&(i=[x.key,this.getScrollOffset()-x.start]);let v=o.followOnAppend===!0?"auto":o.followOnAppend||null;v&&c>0&&this.isAtEnd(s.scrollEndThreshold)&&(d===0||o.getItemKey(c-1)!==g)&&(c>d||xm(d,c,f,o.getItemKey))&&(n=v)}}this.options=o,l&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=null;if(i&&this.scrollOffset!==null&&!this._awaitingCommandReadBack()){let[d,c]=i,m=this.getMeasurements(),{count:p,getItemKey:f}=this.options,h=0;for(;h<p&&f(h)!==d;)h++;if(h<p){let g=m[h];if(g){let C=Math.max(0,g.start+c);!n&&C!==this.scrollOffset&&(u=C-this.scrollOffset,this.scrollOffset=C)}}}n?this.pendingScrollAnchor={kind:"follow",behavior:n}:u!==null&&(this._canWriteScroll()?this.pendingScrollAnchor={kind:"anchor",delta:u}:(this._holdOffset+=u,this._followOffsetTarget(u)))},this.notify=t=>{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,t)},this.maybeNotify=ya(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{var t;this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,(t=this._momentumStop)==null||t.restore(),this._momentumStop=null,this.isScrolling=!1,this.scrollDirection=null,this._holdOffset=0,this._reportedOverscroll=!1,this._clampedAdjustment=null,this.pendingWrite=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;let 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=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{var n,l,u,d;let c=i?this._elementMaxScrollOffset():null,m=this._reportedOverscroll;this._reportedOverscroll=s<0||c!==null&&s>c+1;let p=s;this._lastElementOffset=p,s=this._toLayoutOffset(s);let f=this._classifyScrollEvent(s,i,c);if(f==="spurious")return;f==="readBack"?s=this.pendingWrite.target:f==="clampedReadBack"&&((n=this.scrollState)==null?void 0:n.index)!=null&&s<this.getMaxScrollOffset()-1.5?this.scrollState.lastTargetOffset=s:Uu({kind:f,offset:s,command:this.scrollState,target:()=>this.getScrollStateTarget(this.scrollState)})&&(this.scrollState=null),this.pendingWrite=null,this._clampedAdjustment!==null&&Math.abs(s-this._clampedAdjustment.maxAtWrite)>=1.5&&(this._clampedAdjustment=null);let h=this.getScrollOffset(),g=this.scrollDirection;this.scrollDirection=i?h===s?this.scrollDirection:h<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=i;let C=this.scrollState;if(C?.phase==="queued"&&f==="external"&&i)if(m||this._reportedOverscroll)C.samples=[];else{let L=this.now();C.samples=[...(C.samples??[]).filter(x=>L-x.t<=200),{t:L,offset:p}],(g!==null&&this.scrollDirection!==g||Ou(C.samples))&&(this.scrollState=null)}this._iosGesture.onScroll({isScrolling:i,ownReadBack:f==="readBack",moved:s!==h,external:f==="external"&&((l=this.scrollState)==null?void 0:l.phase)!=="smooth"&&((u=this.scrollState)==null?void 0:u.phase)!=="smoothFinishing"})&&((d=this.scrollState)==null?void 0:d.phase)==="queued"&&(this.scrollState=null),this._flushHoldIfReady(!0),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement&&this.unsubs.push(this._iosGesture.listen(this.scrollElement)),this._scrollToOffset(this.getScrollOffset())}this._noteClampMax();let o=this.pendingScrollAnchor;this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled&&(o.kind==="anchor"?this._canWriteScroll()?Or(this.scrollState)&&!Xt(this.getScrollOffset()-o.delta,this.scrollState.lastTargetOffset)||(this._followOffsetTarget(o.delta),this._scrollToOffset(this.getScrollOffset())):(this._holdOffset+=o.delta,this._followOffsetTarget(o.delta),this.notify(!1)):this.scrollToEnd({behavior:o.behavior})),this._flushHoldIfReady(!1),this._retryClampedAdjustment()},this._classifyScrollEvent=(t,r,o)=>{var s;return qu({offset:t,isScrolling:r,elementMax:o,holdOffset:this._holdOffset,scrollOffset:this.scrollOffset,pendingWrite:this.pendingWrite,clampedMaxAtWrite:((s=this._clampedAdjustment)==null?void 0:s.maxAtWrite)??null})},this._retryClampedAdjustment=()=>{if(this._clampedAdjustment===null||!this.scrollElement||!this.options.enabled||!this._canWriteScroll())return;let{target:t,maxAtWrite:r}=this._clampedAdjustment,o=this.getMaxScrollOffset();o>r+.5&&(this._clampedAdjustment=t>o+.5?{target:t,maxAtWrite:o}:null,this._scrollToOffset(t))},this._writeAwaitingCommand=()=>{let t=this.scrollState;if(t===null||t.phase!=="queued")return;let{behavior:r}=t;this.getMeasurements();let o=this.getScrollStateTarget(t);t.lastTargetOffset=o,this._clampedAdjustment=null,t.phase=Wu(r,t.index!=null&&Xt(o,this.getScrollOffset())),this._scrollToOffset(o,{behavior:r}),this.scheduleScrollReconcile()},this._readElementOffset=()=>{let t=this.scrollElement;if(t==null)return null;let{horizontal:r,isRtl:o}=this.options;return typeof t.scrollTop=="number"?r?t.scrollLeft*(o&&-1||1):t.scrollTop:typeof t.scrollY=="number"?r?t.scrollX:t.scrollY:null},this._canWriteScroll=()=>!(Ur()&&this._iosGesture.inMotion())&&!this._reportedOverscroll,this._flushHoldIfReady=t=>{var r;if(this._holdOffset===0||!this.scrollElement||!this.options.enabled||!this._canWriteScroll()||((r=this.scrollState)==null?void 0:r.phase)==="smooth")return;this._holdOffset=0,this.scrollOffset!==null&&this.scrollOffset<0&&(this.scrollOffset=0),this.notify(t);let o=this.getCommandWrittenOffset()??this.getScrollOffset();this._clampedAdjustment=this._clampedBy(o),this._scrollToOffset(o)},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=ya(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(t,r,o,s,i,n,l,u)=>(this.prevLanes!==void 0&&this.prevLanes!==n&&(this.lanesChangedFlag=!0),this.prevLanes=n,this.pendingMin=null,{count:t,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:n,laneAssignmentMode:l,gap:u}),{key:!1}),this.isIndexInRange=t=>t>=0&&t<this.options.count,this.getMeasurements=ya(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:t,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:i,lanes:n,laneAssignmentMode:l,gap:u},d)=>{var c;let m=this.itemSizeCache;if(!i)return this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>t)for(let L of this.laneAssignments.keys())L>=t&&this.laneAssignments.delete(L);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this._singleLaneMeasurements=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(L=>{this.itemSizeCache.set(L.key,L.size)}));let p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===t&&(this.lanesSettling=!1),n===1){let L=t*2,x=(c=this._singleLaneMeasurements)==null?void 0:c.flat;if(!x||x.length<L){let y=new Float64Array(L);x&&p>0&&y.set(x.subarray(0,p*2)),x=y}let v=p===0?new Array(t):this._singleLaneMeasurements.items.slice(),I;if(p===0)I=r+o;else{let y=p-1;I=x[y*2]+x[y*2+1]+u}for(let y=p;y<t;y++){let N=s(y);v[y]=N;let q=m.get(N),_=typeof q=="number"?q:this.options.estimateSize(y);x[y*2]=I,x[y*2+1]=_,I+=_+u}this._singleLaneMeasurements={flat:x,items:v};let k=_u(v,x);return this.measurementsCache=k,k}let f=this.measurementsCache.slice(0,p),h=new Array(n).fill(void 0),g=new Float64Array(n),C=0;for(let L=0;L<p;L++){let x=f[L];x&&(h[x.lane]===void 0&&C++,h[x.lane]=L,g[x.lane]=x.end)}for(let L=p;L<t;L++){let x=s(L),v=this.laneAssignments.get(L),I,k,y=l==="estimate"||m.has(x);if(v!==void 0&&this.options.lanes>1){I=v;let B=h[I],K=B!==void 0?f[B]:void 0;k=K?K.end+u:r+o}else if(C===n){let B=0,K=g[0],P=h[0];for(let F=1;F<n;F++){let S=g[F];(S<K||S===K&&h[F]<P)&&(B=F,K=S,P=h[F])}I=B,k=K+u,y&&this.laneAssignments.set(L,I)}else I=L%this.options.lanes,k=r+o,y&&this.laneAssignments.set(L,I);let N=m.get(x),q=typeof N=="number"?N:this.options.estimateSize(L),_=k+q;f[L]={index:L,start:k,size:q,end:_,key:x,lane:I},h[I]===void 0&&C++,h[I]=L,g[I]=_}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=ya(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes,this._getLayoutTotalSize()+this.options.scrollMargin],(t,r,o,s,i)=>{if(t.length===0||r===0)return this.range=null,null;let n=Math.max(i-r,0);return this.range=Lm(t,r,Math.min(o,n),s,s===1&&this._singleLaneMeasurements!==null?this._singleLaneMeasurements.flat:null),this.range},{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=ya(()=>{let t=null,r=null,o=this.calculateRange();return o&&(t=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r,this.options.lanes]},(t,r,o,s,i,n)=>s===null||i===null?[]:t({startIndex:s,endIndex:i,overscan:r,count:o,lanes:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{let r=this.options.indexAttribute,o=t.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=t=>{var r;if(!Or(this.scrollState))return!0;let o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){let s=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-s),n=Math.min(this.options.count-1,o+s);return t>=i&&t<=n}return!0},this.measureElement=t=>{if(!t){this.elementsCache.forEach((i,n)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(n))});return}let r=this.indexFromElement(t);if(!this.isIndexInRange(r))return;let o=this.options.getItemKey(r),s=this.elementsCache.get(o);s!==t&&(s&&this.observer.unobserve(s),this.observer.observe(t),this.elementsCache.set(o,t)),t.isConnected&&(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(t,void 0,this))},this.resizeItem=(t,r)=>{var o,s,i;if(!this.isIndexInRange(t))return;(o=this._resizeBatch)!=null&&o.sync&&this.getMeasurements();let n,l,u,d=(s=this._singleLaneMeasurements)==null?void 0:s.flat;if(this.options.lanes===1&&d!=null)u=this.options.getItemKey(t),l=d[t*2],n=d[t*2+1];else{let p=this.measurementsCache[t];if(!p)return;u=p.key,l=p.start,n=p.size}let c=this.itemSizeCache.get(u)??n,m=r-c;if(m!==0){let p=this.options.anchorTo==="end"&&!Or(this.scrollState)&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,f=p?this._getLayoutTotalSize():0,h=this.getScrollOffset(),C=!this.itemSizeCache.has(u)?l<h:l+c<=h&&this.scrollDirection!=="backward",L=!Or(this.scrollState)&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[t]??{index:t,key:u,start:l,size:n,end:l+n,lane:0},m,this):C);(this.pendingMin===null||t<this.pendingMin)&&(this.pendingMin=t),this.itemSizeCache.set(u,r),this.itemSizeCacheVersion++;let x=!1;if(this._awaitingCommandReadBack()||(p?x=this.applyScrollAdjustment(this._getLayoutTotalSize()-f):L&&(x=this.applyScrollAdjustment(m))),this._resizeBatch){this._resizeBatch.notify=!0,(i=this._resizeBatch).sync||(i.sync=x);return}this.notify(x),this._noteClampMax(),this._flushHoldIfReady(!0),this._retryClampedAdjustment()}},this.getVirtualItems=ya(()=>[this.getVirtualIndexes(),this.getMeasurements(),this._holdOffset],(t,r,o)=>{let s=[];for(let i=0,n=t.length;i<n;i++){let l=t[i],u=r[l];s.push(o===0?u:{...u,start:u.start-o,end:u.end-o})}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{var r;let o=this.getMeasurements();if(o.length===0)return;let s=(r=this._singleLaneMeasurements)==null?void 0:r.flat,i=this.options.lanes===1&&s!=null,n=Qu(0,o.length-1,i?l=>s[l*2]:l=>js(o[l]).start,t);return js(o[n])},this._noteClampMax=()=>{if(!this._awaitingCommandReadBack())return;let t=this._elementMaxScrollOffset();if(t===null)return;let r=this.pendingWrite,o=Math.max(t,0)+this._holdOffset;if(o>=r.target)return;let s=r.lowMaxes??(r.lowMaxes=[]);s[s.length-1]!==o&&s.push(o)},this.getMaxScrollOffset=()=>(this._elementMaxScrollOffset()??0)+this._holdOffset,this._toLayoutOffset=t=>{var r;let o=t+this._holdOffset;return((r=this.pendingScrollAnchor)==null?void 0:r.kind)==="anchor"&&(o+=this.pendingScrollAnchor.delta),o},this._elementMaxScrollOffset=()=>{let t=this.scrollElement;if(t===null)return null;if("scrollHeight"in t)return this.options.horizontal?t.scrollWidth-t.clientWidth:t.scrollHeight-t.clientHeight;if("document"in t){let r=t.document.documentElement;return this.options.horizontal?r.scrollWidth-t.innerWidth:r.scrollHeight-t.innerHeight}return null},this._momentumStop=null,this._stopMomentum=t=>{let r=this.scrollElement,o=this.targetWindow;if(r===null||o===null)return;let s="document"in r?r.document.scrollingElement:r;if(!s?.style)return;if(this._momentumStop){this._momentumStop.done=t;return}let{style:i}=s,n=this.options.horizontal?"overflow-x":"overflow-y",l=i.getPropertyValue(n),u=i.getPropertyPriority(n),d=()=>this.options.horizontal?s.clientHeight:s.clientWidth,c=d();if(i.setProperty(n,"hidden","important"),d()!==c){i.setProperty(n,l,u);return}let m={restore:()=>i.getPropertyValue(n)!=="hidden"||i.getPropertyPriority(n)!=="important"?!1:(i.setProperty(n,l,u),!0),done:t};this._momentumStop=m,o.requestAnimationFrame(()=>o.requestAnimationFrame(()=>{this._momentumStop===m&&(this._momentumStop=null,m.restore()&&m.done())}))},this._clampedBy=t=>{let r=this._elementMaxScrollOffset();if(r===null)return null;let o=r+this._holdOffset;return t>o+.5?{target:t,maxAtWrite:o}:null},this.getVirtualDistanceFromEnd=()=>Math.max(this._getLayoutTotalSize()+this.options.scrollMargin-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(t=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=t,this.getOffsetForAlignment=(t,r,o=0)=>{if(!this.scrollElement)return 0;let s=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=t>=i+s?"end":"start"),r==="center"?t+=(o-s)/2:r==="end"&&(t-=s);let n=this.getMaxScrollOffset();return Math.max(Math.min(n,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));let o=this.getSize(),s=this.getScrollOffset(),i=this.getMeasurements()[t];if(!i)return;if(r==="auto")if(i.end>=s+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=s+this.options.scrollPaddingStart)r="start";else return[s,r];if(r==="end"&&t===this.options.count-1){let l=this.getMaxScrollOffset(),u=l-this.options.paddingEnd+this.options.scrollPaddingEnd;return[Math.max(Math.min(u,l),0),r]}let n=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(n,r,i.size),r]},this.scrollToOffset=(t,{align:r="start",behavior:o="auto"}={})=>{this._startScroll({index:null,align:r},this.getOffsetForAlignment(t,r),o,"absolute")},this.scrollToIndex=(t,{align:r="auto",behavior:o="auto"}={})=>{t=Math.max(0,Math.min(t,this.options.count-1));let s=this.getOffsetForIndex(t,r);if(!s)return;let[i,n]=s;this._startScroll({index:t,align:n},i,o,"absolute")},this.scrollBy=(t,{behavior:r="auto"}={})=>{let o=this.getOffsetForAlignment((this.getCommandWrittenOffset()??this.getScrollOffset())+t,"start");this._startScroll({index:null,align:"start"},o,r,"relative")},this.scrollToEnd=({behavior:t="auto"}={})=>{if(this.options.count>0){this._startScroll({index:this.options.count-1,align:"end",toEnd:!0},Math.max(this.getMaxScrollOffset(),0),t,"absolute");return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:t})},this.cancelScroll=()=>{this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null},this.getTotalSize=()=>Math.max(this._getLayoutTotalSize()-this._holdOffset,0),this._getLayoutTotalSize=()=>{var t,r;let o=this.getMeasurements(),s;if(o.length===0)s=this.options.paddingStart;else if(this.options.lanes===1){let i=o.length-1,n=(t=this._singleLaneMeasurements)==null?void 0:t.flat;n!=null?s=n[i*2]+n[i*2+1]:s=((r=o[i])==null?void 0:r.end)??0}else{let i=Array(this.options.lanes).fill(null),n=o.length-1;for(;n>=0&&i.some(l=>l===null);){let l=o[n];i[l.lane]===null&&(i[l.lane]=l.end),n--}s=Math.max(...i.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let t=[];if(this.itemSizeCache.size===0)return t;let r=this.getMeasurements();for(let o of r)o&&this.itemSizeCache.has(o.key)&&t.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return t},this._scrollToOffset=(t,{adjustments:r,behavior:o}={})=>{let s={target:t+(r??0),smooth:o==="smooth"};return this.pendingWrite=s,this.options.scrollToFn(t-this._holdOffset,{behavior:o,adjustments:r},this),s},this.getCommandWrittenOffset=()=>this.scrollState!==null&&this.pendingWrite!==null&&!this.pendingWrite.smooth?this.pendingWrite.target:null,this._awaitingCommandReadBack=()=>{let t=this.getCommandWrittenOffset();return!(Ur()&&this._iosGesture.dragging())&&t!==null&&!Xt(t,this.getScrollOffset())},this._followOffsetTarget=t=>{this.scrollState!==null&&this.scrollState.index==null&&(this.scrollState.lastTargetOffset+=t)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(a)}get scrollAdjustments(){return 0}applyScrollAdjustment(a,t){if(a===0)return!1;if(this._followOffsetTarget(a),this._canWriteScroll()){let r=this.getScrollOffset();this._clampedAdjustment=this._clampedBy(r+a);let o=this._scrollToOffset(r,{adjustments:a,behavior:t});return this.scrollOffset!==null&&(this.pendingWrite===o&&(this.scrollOffset+=a),this.scrollOffset<0&&(this.scrollOffset=0)),!0}else return this._holdOffset+=a,this.scrollOffset!==null&&(this.scrollOffset+=a),!0}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}getScrollStateTarget(a){let t=a.toEnd?[Math.max(this.getMaxScrollOffset(),0)]:a.index!=null?this.getOffsetForIndex(a.index,a.align):void 0;return t?t[0]:a.lastTargetOffset}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}if(this.scrollState.phase==="queued"){this.scheduleScrollReconcile();return}this.getMeasurements();let r=this.getScrollStateTarget(this.scrollState),o=this.scrollState.index==null?1:this.options.useAnimationFrameWithResizeObserver?3:2,s=r!==this.scrollState.lastTargetOffset;if(!s&&Xt(r,this.getScrollOffset())){if(this.scrollState.phase==="smooth"?this.scrollState.phase="smoothLanded":this.scrollState.phase==="smoothFinishing"&&(this.scrollState.phase="instant"),this.scrollState.stableFrames++,this.scrollState.stableFrames>=o){this.getScrollOffset()!==r&&this._scrollToOffset(r,{behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,s){let i=this.getSize()||600,n=Math.abs(r-this.getScrollOffset()),l=Or(this.scrollState)&&n>i;this.scrollState.lastTargetOffset=r,l?this.scrollState.phase="smooth":this.scrollState.phase==="smooth"?this.scrollState.phase="smoothFinishing":this.scrollState.phase==="smoothLanded"&&(this.scrollState.phase="instant"),this._scrollToOffset(r,{behavior:l?"smooth":"auto"})}this.scheduleScrollReconcile()}_startScroll(a,t,r,o){this.pendingScrollAnchor=null,this._clampedAdjustment=null;let s=this._iosGesture.tail();if(o==="absolute"&&s!==null){if(s==="fling"&&Hu()){this._stopMomentum(()=>{let i=this.scrollState;i?.phase!=="queued"||this._iosGesture.tail()!=="fling"||this._reportedOverscroll||(this._iosGesture.end(),this._flushHoldIfReady(!0),this._writeAwaitingCommand())}),this.scrollState={...a,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,phase:"queued",behavior:r,samples:[]},this.scheduleScrollReconcile();return}this._iosGesture.end()}this.scrollState={...a,startedAt:this.now(),lastTargetOffset:t,stableFrames:0,behavior:r,phase:Wu(r,a.index!=null&&Xt(t,this.getScrollOffset()))},this._scrollToOffset(t,{behavior:r}),this.scheduleScrollReconcile()}},Qu=(e,a,t,r)=>{for(;e<=a;){let o=(e+a)/2|0,s=t(o);if(s<r)e=o+1;else if(s>r)a=o-1;else return o}return e>0?e-1:0};function Cm(e,a,t){let r=0;for(;r<=a;){let o=(r+a)/2|0,s=e[o*2];if(s<t)r=o+1;else if(s>t)a=o-1;else return o}return r>0?r-1:0}function Lm(e,a,t,r,o){let s=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:s};if(r===1&&o!==null){let u=Cm(o,s,t),d=u,c=t+a;for(;d<s&&o[d*2]+o[d*2+1]<c;)d++;return{startIndex:u,endIndex:d}}let n=Qu(0,s,u=>e[u].start,t),l=n;if(r===1)for(;l<s&&e[l].end<t+a;)l++;else if(r>1){let u=Array(r).fill(0);for(;l<s&&u.some(c=>c<t+a);){let c=e[l];u[c.lane]=c.end,l++}let d=Array(r).fill(t+a);for(;n>=0&&d.some(c=>c>=t);){let c=e[n];d[c.lane]=c.start,n--}n=Math.max(0,n-n%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:n,endIndex:l}}var $s=typeof document<"u"?Mt.useLayoutEffect:Mt.useEffect;function bm({useFlushSync:e=!0,directDomUpdates:a=!1,directDomUpdatesMode:t="transform",...r}){let o=Mt.useReducer(m=>m+1,0)[1],s=Mt.useRef({enabled:a,mode:t,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});s.current.enabled=a,s.current.mode=t;let i=Mt.useRef(!1),n=m=>{let p=s.current;if(!p.enabled||!p.container)return;let f=m.getTotalSize();if(f!==p.lastSize){p.lastSize=f;let h=m.options.horizontal?"width":"height";p.container.style[h]=`${f}px`}},l=(m,p,f)=>{let h=s.current,g=!!m.options.horizontal,C=p.start-m.options.scrollMargin;h.lastPositions.get(f)!==C&&(h.lastPositions.set(f,C),h.mode==="transform"?f.style.transform=g?`translate3d(${C}px, 0, 0)`:`translate3d(0, ${C}px, 0)`:f.style[g?"left":"top"]=`${C}px`)},u=m=>{let p=s.current;if(!(!p.enabled||!p.container)){n(m);for(let f of m.getVirtualItems()){let h=m.elementsCache.get(f.key);h&&l(m,f,h)}}},d={...r,onChange:(m,p)=>{var f;let h=s.current,g=!0;if(h.enabled){u(m);let C=m.range,L=h.prevRange;g=!L||L.isScrolling!==m.isScrolling||L.startIndex!==C?.startIndex||L.endIndex!==C?.endIndex,g&&(h.prevRange=C?{startIndex:C.startIndex,endIndex:C.endIndex,isScrolling:m.isScrolling}:null)}g&&(e&&p&&!i.current?Im(o):o()),(f=r.onChange)==null||f.call(r,m,p)}},[c]=Mt.useState(()=>{let m=new So(d),p=m.measureElement;return m.measureElement=f=>{i.current=!0;try{p(f)}finally{i.current=!1}let h=s.current;if(f!==null&&h.enabled&&h.container){let g=m.measurementsCache[m.indexFromElement(f)];g&&l(m,g,f)}},Object.assign(m,{containerRef:f=>{let h=s.current;h.container=f,h.lastSize=null,f!==null&&u(m)}})});return c.setOptions(d),$s(()=>c._didMount(),[]),$s(()=>(n(c),c._willUpdate())),$s(()=>{u(c)}),c}function Ro(e){return bm({observeElementRect:Vu,observeElementOffset:Ju,scrollToFn:Xu,...e})}import{Slot as Ix}from"@luckylillia-dev/plugin-sdk/webui";var Ba="current-uin",vm=/^\/i\/([^/]+)(?:\/|$)/;function Ku(){if(typeof location>"u")return Ba;let e=vm.exec(location.pathname);if(!e)return Ba;try{return`${Ba}:${decodeURIComponent(e[1])}`}catch{return`${Ba}:${e[1]}`}}function qa(){let e=Ku();return localStorage.getItem(e)||e!==Ba&&localStorage.getItem(Ba)||""}function Zu(e){localStorage.setItem(Ku(),e)}var wm="webqq-messages",ym="webqq-messages-",km=1,Ua="messages",td=100,ka=null,Yu="";function Sm(e){return`${ym}${e||"anon"}`}var ed=!1;function Rm(){if(!ed){ed=!0;try{indexedDB.deleteDatabase(wm)}catch{}}}function ad(){Rm();let e=qa();if(ka&&Yu!==e){try{ka.close()}catch{}ka=null}return ka?Promise.resolve(ka):new Promise((a,t)=>{let r=indexedDB.open(Sm(e),km);r.onerror=()=>t(r.error),r.onsuccess=()=>{ka=r.result,Yu=e,a(ka)},r.onupgradeneeded=o=>{let s=o.target.result;s.objectStoreNames.contains(Ua)||s.createObjectStore(Ua,{keyPath:"chatKey"})}})}async function Oa(e,a){try{let t=await ad(),r=`${e}_${a}`;return new Promise(o=>{let n=t.transaction(Ua,"readonly").objectStore(Ua).get(r);n.onsuccess=()=>{let l=n.result;l&&l.messages?o(l.messages):o(null)},n.onerror=()=>o(null)})}catch{return null}}async function sa(e,a,t){try{let r=await ad(),o=`${e}_${a}`,s=t.slice(-td);return new Promise((i,n)=>{let d=r.transaction(Ua,"readwrite").objectStore(Ua).put({chatKey:o,messages:s,timestamp:Date.now()});d.onsuccess=()=>i(),d.onerror=()=>n(d.error)})}catch(r){console.error("Failed to cache messages:",r)}}async function Mo(e,a,t){try{let r=await Oa(e,a);if(r){let o=[...r.slice(-(td-1)),t];await sa(e,a,o)}}catch(r){console.error("Failed to append message:",r)}}async function rd(e,a,t){try{let r=await Oa(e,a);if(r){let o=r.filter(s=>s.msgId!==t);await sa(e,a,o)}}catch(r){console.error("Failed to remove message:",r)}}async function Ao(e,a,t,r,o,s=!1){try{let i=await Oa(e,a);if(!i)return;let n=i.map(l=>{if(String(l.msgSeq)!==String(t))return l;let u=l.emojiLikesList||[];if(o){let d=u.findIndex(c=>c.emojiId===r);if(d>=0){let c=[...u];return c[d]={...c[d],likesCnt:String(parseInt(c[d].likesCnt)+1),isClicked:c[d].isClicked||s},{...l,emojiLikesList:c}}else return{...l,emojiLikesList:[...u,{emojiId:r,emojiType:parseInt(r)>999?"2":"1",likesCnt:"1",isClicked:s}]}}else{let d=u.findIndex(c=>c.emojiId===r);if(d>=0){let c=[...u],m=parseInt(c[d].likesCnt)-1;return m<=0?c.splice(d,1):c[d]={...c[d],likesCnt:String(m),isClicked:s?!1:c[d].isClicked},{...l,emojiLikesList:c}}}return l});await sa(e,a,n)}catch(i){console.error("Failed to update emoji reaction:",i)}}async function od(e,a,t,r){try{let o=await Oa(e,a);if(!o)return!1;let s=!1,i=o.map(n=>n.msgId===t||r&&String(n.msgSeq)===String(r)?(s=!0,{...n,recallTime:String(Math.floor(Date.now()/1e3))}):n);return s&&await sa(e,a,i),s}catch(o){return console.error("Failed to mark message as recalled:",o),!1}}import{useState as Vs,useEffect as Mm,useRef as Am}from"react";import{createPortal as Pm}from"react-dom";import{Fragment as xt,jsx as se,jsxs as he}from"react/jsx-runtime";var Dm=({level:e})=>{let a=e%4,t=Math.floor(e/4)%4,r=Math.floor(e/16)%4,o=Math.floor(e/64)%4,s=Math.floor(e/256),i=[];for(let n=0;n<s;n++)i.push(se("span",{className:"text-amber-400 text-xs font-bold",title:"\u91D1\u4F01\u9E45",children:"\u{1F427}"},`penguin-${n}`));for(let n=0;n<o;n++)i.push(se(vt,{size:14,className:"text-amber-500"},`crown-${n}`));for(let n=0;n<r;n++)i.push(se(Sr,{size:14,className:"text-orange-400"},`sun-${n}`));for(let n=0;n<t;n++)i.push(se(Ir,{size:14,className:"text-blue-400"},`moon-${n}`));for(let n=0;n<a;n++)i.push(se(wa,{size:14,className:"text-yellow-400 fill-yellow-400"},`star-${n}`));return se("div",{className:"flex items-center gap-0.5 flex-wrap",children:i})},zr=({profile:e,loading:a,position:t,onClose:r,isFriend:o,onFriendDeleted:s})=>{let i=Am(null),[n,l]=Vs({left:t.x,top:t.y}),[u,d]=Vs(!1),[c,m]=Vs(!1);if(Mm(()=>{if(!i.current)return;let x=320,v=i.current.offsetHeight||400,I=t.x,k=t.y;I+x>window.innerWidth-20&&(I=window.innerWidth-x-20),I<20&&(I=20),k+v>window.innerHeight-20&&(k=window.innerHeight-v-20),k<20&&(k=20),l({left:I,top:k})},[t,e,a]),!e&&!a)return null;let p=x=>x===1?"\u7537":x===2?"\u5973":"",f=x=>{if(!x)return"";let v=new Date(x*1e3),I=new Date,k=I.getFullYear()-v.getFullYear(),y=I.getMonth()-v.getMonth(),N=k+(y<0?-1:0);if(N<1){let q=k*12+y;return q>0?`${q}\u4E2A\u6708`:"\u4E0D\u8DB31\u4E2A\u6708"}return`${N}\u5E74`},h=x=>x==="owner"?"\u7FA4\u4E3B":x==="admin"?"\u7BA1\u7406\u5458":"",g=x=>x==="owner"?"bg-amber-500 text-white":x==="admin"?"bg-green-500 text-white":"",C=async()=>{if(e){m(!0);try{await nu(e.uid),T("\u5DF2\u5220\u9664\u597D\u53CB","success"),s?.(e.uid),r()}catch(x){T(x.message||"\u5220\u9664\u597D\u53CB\u5931\u8D25","error")}finally{m(!1),d(!1)}}},L=x=>x?new Date(x*1e3).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"";return Pm(he(xt,{children:[se("div",{className:"fixed inset-0 z-40",onClick:r}),he("div",{ref:i,className:"fixed z-50 r-card overflow-hidden bg-popup glass-pop origin-top-left",style:{left:n.left,top:n.top,width:320,maxHeight:"calc(100vh - 40px)"},onClick:x=>x.stopPropagation(),children:[a?se("div",{className:"flex items-center justify-center h-40",children:se(ee,{size:24,className:"animate-spin text-pink-500"})}):e&&he(xt,{children:[he("div",{className:"bg-gradient-to-r from-pink-400 to-amber-300 p-4 relative",children:[o&&!e.groupRole&&se("button",{onClick:()=>d(!0),className:"absolute top-2 right-2 p-1.5 rounded-full bg-white/20 hover:bg-white/40 text-white transition-colors",title:"\u5220\u9664\u597D\u53CB",children:se(We,{size:16})}),he("div",{className:"flex items-start gap-4",children:[se("img",{src:e.avatar,alt:e.nickname,className:"w-16 h-16 rounded-full border-3 border-white/80 object-cover flex-shrink-0"}),he("div",{className:"flex-1 min-w-0 text-white pt-1",children:[he("div",{className:"flex items-center gap-2 mb-1",children:[se("span",{className:"font-bold text-lg truncate",children:e.nickname}),e.groupRole&&h(e.groupRole)&&se("span",{className:`text-xs px-1.5 py-0.5 rounded flex-shrink-0 ${g(e.groupRole)}`,children:h(e.groupRole)})]}),e.remark&&e.remark!==e.nickname&&he("div",{className:"text-white/80 text-sm truncate mb-1",children:["\u5907\u6CE8: ",e.remark]}),se("div",{className:"text-white/90 text-sm",children:e.uin}),e.qid&&he("div",{className:"text-white/70 text-xs mt-0.5",children:["QID: ",e.qid]})]})]})]}),he("div",{className:"p-4 overflow-y-auto",style:{maxHeight:"calc(100vh - 40px - 120px)"},children:[e.signature&&se("div",{className:"text-theme-secondary text-sm mb-3 bg-theme-item/50 rounded-lg px-3 py-2 max-h-24 overflow-y-auto break-words",children:e.signature}),he("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[p(e.sex)&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u6027\u522B"}),se("span",{className:"text-theme",children:p(e.sex)})]}),e.birthday&&e.birthday!=="0-0-0"&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u751F\u65E5"}),se("span",{className:"text-theme",children:e.birthday})]}),f(e.regTime)&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"Q\u9F84"}),se("span",{className:"text-theme",children:f(e.regTime)})]}),e.level>0&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u7B49\u7EA7"}),he("div",{className:"flex items-center gap-2",children:[he("span",{className:"text-theme",children:["Lv.",e.level]}),se(Dm,{level:e.level})]})]})]}),!!(e.groupCard||e.groupTitle||e.groupLevel||e.joinTime||e.lastSpeakTime)&&he(xt,{children:[se("div",{className:"border-t border-theme-divider my-3"}),se("div",{className:"text-xs text-theme-hint mb-2",children:"\u7FA4\u4FE1\u606F"}),he("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[e.groupCard&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u7FA4\u540D\u7247"}),se("span",{className:"text-theme truncate",children:e.groupCard})]}),e.groupTitle&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u7FA4\u5934\u8854"}),se("span",{className:"text-pink-500",children:e.groupTitle})]}),e.groupLevel!==void 0&&e.groupLevel>0&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u7FA4\u7B49\u7EA7"}),he("span",{className:"text-theme",children:["Lv.",e.groupLevel]})]}),!!e.joinTime&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u5165\u7FA4\u65F6\u95F4"}),se("span",{className:"text-theme",children:L(e.joinTime)})]}),!!e.lastSpeakTime&&he(xt,{children:[se("span",{className:"text-theme-hint",children:"\u6700\u540E\u53D1\u8A00"}),se("span",{className:"text-theme",children:L(e.lastSpeakTime)})]})]})]})]})]}),u&&e&&se("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center rounded-xl",children:he("div",{className:"bg-popup m-4 p-4 rounded-lg shadow-lg max-w-[280px]",children:[he("div",{className:"flex items-center justify-between mb-3",children:[se("span",{className:"font-medium text-theme",children:"\u5220\u9664\u597D\u53CB"}),se("button",{onClick:()=>d(!1),className:"text-theme-muted hover:text-theme",children:se(Re,{size:18})})]}),he("p",{className:"text-sm text-theme-secondary mb-4",children:["\u786E\u5B9A\u8981\u5220\u9664\u597D\u53CB ",se("span",{className:"font-medium text-theme",children:e.remark||e.nickname})," \u5417\uFF1F\u5220\u9664\u540E\u5C06\u65E0\u6CD5\u6062\u590D\u3002"]}),he("div",{className:"flex gap-2 justify-end",children:[se("button",{onClick:()=>d(!1),className:"px-3 py-1.5 text-sm rounded-lg bg-theme-item hover:bg-theme-hover text-theme transition-colors",disabled:c,children:"\u53D6\u6D88"}),he("button",{onClick:C,className:"px-3 py-1.5 text-sm rounded-lg bg-red-500 hover:bg-red-600 text-white transition-colors flex items-center gap-1",disabled:c,children:[c&&se(ee,{size:14,className:"animate-spin"}),"\u5220\u9664"]})]})]})})]})]}),document.body)};import{useState as sd,useEffect as Em,useRef as Tm}from"react";import{createPortal as Fm}from"react-dom";import{Fragment as Qt,jsx as Ce,jsxs as Ae}from"react/jsx-runtime";var Js=({profile:e,loading:a,position:t,onClose:r,onQuitGroup:o})=>{let s=Tm(null),[i,n]=sd({left:t.x,top:t.y}),[l,u]=sd(!1),d=gt(),c=e?.ownerUin===d;if(Em(()=>{if(!s.current)return;let h=320,g=s.current.offsetHeight||300,C=t.x,L=t.y;C+h>window.innerWidth-20&&(C=window.innerWidth-h-20),C<20&&(C=20),L+g>window.innerHeight-20&&(L=window.innerHeight-g-20),L<20&&(L=20),n({left:C,top:L})},[t,e,a]),!e&&!a)return null;let m=h=>h?new Date(h*1e3).toLocaleDateString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit"}):"",p=()=>{u(!0)},f=()=>{e&&o&&o(e.groupCode,c),u(!1),r()};return Fm(Ae(Qt,{children:[Ce("div",{className:"fixed inset-0 z-40",onClick:r}),Ce("div",{ref:s,className:"fixed z-50 r-card overflow-hidden bg-popup glass-pop origin-top-left",style:{left:i.left,top:i.top,width:320,maxHeight:"calc(100vh - 40px)"},onClick:h=>h.stopPropagation(),children:a?Ce("div",{className:"flex items-center justify-center h-40",children:Ce(ee,{size:24,className:"animate-spin text-pink-500"})}):e&&Ae(Qt,{children:[Ae("div",{className:"bg-gradient-to-r from-blue-400 to-cyan-300 p-4 relative",children:[o&&Ce("button",{onClick:p,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors",title:c?"\u89E3\u6563\u8BE5\u7FA4":"\u9000\u51FA\u8BE5\u7FA4",children:Ce(La,{size:16})}),Ae("div",{className:"flex items-start gap-4",children:[Ce("img",{src:e.avatar,alt:e.groupName,className:"w-16 h-16 rounded-lg border-3 border-white/80 object-cover flex-shrink-0"}),Ae("div",{className:"flex-1 min-w-0 text-white pt-1 pr-6",children:[Ce("div",{className:"font-bold text-lg truncate mb-1",children:e.groupName}),e.remarkName&&e.remarkName!==e.groupName&&Ae("div",{className:"text-white/80 text-sm truncate mb-1",children:["\u5907\u6CE8: ",e.remarkName]}),Ce("div",{className:"text-white/90 text-sm",children:e.groupCode})]})]})]}),Ae("div",{className:"p-4 overflow-y-auto",style:{maxHeight:"calc(100vh - 40px - 140px)"},children:[Ae("div",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[Ae("span",{className:"text-theme-hint flex items-center gap-1",children:[Ce(St,{size:14}),"\u6210\u5458"]}),Ae("span",{className:"text-theme",children:[e.memberCount,e.maxMemberCount?` / ${e.maxMemberCount}`:""]}),e.ownerName&&Ae(Qt,{children:[Ae("span",{className:"text-theme-hint flex items-center gap-1",children:[Ce(vt,{size:14}),"\u7FA4\u4E3B"]}),Ce("span",{className:"text-theme truncate",children:e.ownerName})]}),e.createTime&&Ae(Qt,{children:[Ae("span",{className:"text-theme-hint flex items-center gap-1",children:[Ce(dr,{size:14}),"\u521B\u5EFA"]}),Ce("span",{className:"text-theme",children:m(e.createTime)})]})]}),e.description&&Ae(Qt,{children:[Ce("div",{className:"border-t border-theme-divider my-3"}),Ce("div",{className:"text-xs text-theme-hint mb-2",children:"\u7FA4\u7B80\u4ECB"}),Ce("div",{className:"text-theme-secondary text-sm bg-theme-item/50 rounded-lg px-3 py-2 break-words whitespace-pre-wrap",style:{maxHeight:"120px",overflowY:"auto"},children:e.description})]}),e.announcement&&Ae(Qt,{children:[Ce("div",{className:"border-t border-theme-divider my-3"}),Ae("div",{className:"text-xs text-theme-hint mb-2 flex items-center gap-1",children:[Ce(yt,{size:12}),"\u7FA4\u516C\u544A"]}),Ce("div",{className:"text-theme-secondary text-sm bg-theme-item/50 rounded-lg px-3 py-2 break-words whitespace-pre-wrap",style:{maxHeight:"120px",overflowY:"auto"},children:e.announcement})]})]})]})}),l&&e&&Ae(Qt,{children:[Ce("div",{className:"fixed inset-0 z-[60] bg-black/50",onClick:()=>u(!1)}),Ae("div",{className:"fixed z-[70] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[320px]",children:[Ce("h3",{className:"text-lg font-medium text-theme mb-4",children:c?"\u786E\u8BA4\u89E3\u6563\u7FA4\u804A":"\u786E\u8BA4\u9000\u51FA\u7FA4\u804A"}),Ce("p",{className:"text-theme-secondary mb-6",children:c?Ae(Qt,{children:["\u786E\u5B9A\u8981\u89E3\u6563\u7FA4 ",Ce("span",{className:"font-medium text-theme",children:e.groupName})," \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\uFF0C\u6240\u6709\u7FA4\u6210\u5458\u5C06\u88AB\u79FB\u51FA\u3002"]}):Ae(Qt,{children:["\u786E\u5B9A\u8981\u9000\u51FA\u7FA4 ",Ce("span",{className:"font-medium text-theme",children:e.groupName})," \u5417\uFF1F"]})}),Ae("div",{className:"flex justify-end gap-3",children:[Ce("button",{onClick:()=>u(!1),className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),Ce("button",{onClick:f,className:"px-4 py-2 text-sm bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors",children:c?"\u786E\u8BA4\u89E3\u6563":"\u786E\u8BA4\u9000\u51FA"})]})]})]})]}),document.body)};import{useState as Xs,useEffect as Nm}from"react";import{createPortal as nd}from"react-dom";import{jsx as Nt,jsxs as Qs}from"react/jsx-runtime";var Ks=({url:e,onClose:a})=>e?nd(Qs("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/80",onClick:a,children:[Nt("button",{onClick:async r=>{r.stopPropagation();try{let o=new URL(e,location.origin).pathname.split("/").pop()||"image";await Lo(e,o)}catch(o){T(o.message||"\u4E0B\u8F7D\u5931\u8D25","error")}},title:"\u4E0B\u8F7D\u56FE\u7247",className:"absolute top-4 right-16 p-2 text-white/80 hover:text-white bg-black/50 rounded-full",children:Nt($t,{size:24})}),Nt("button",{onClick:a,className:"absolute top-4 right-4 p-2 text-white/80 hover:text-white bg-black/50 rounded-full",children:Nt(Re,{size:24})}),Nt("img",{src:e,alt:"\u9884\u89C8",className:"max-w-[90vw] max-h-[90vh] object-contain",onClick:r=>r.stopPropagation()})]}),document.body):null,Zs=({videoInfo:e,onClose:a})=>{let[t,r]=Xs(null),[o,s]=Xs(!1),[i,n]=Xs(null);return Nm(()=>{if(!e){r(null),n(null);return}s(!0),n(null),Tl(e.fileUuid,e.isGroup).then(r).catch(l=>n(l.message||"\u83B7\u53D6\u89C6\u9891\u5931\u8D25")).finally(()=>s(!1))},[e]),e?nd(Qs("div",{className:"fixed inset-0 z-[10000] flex items-center justify-center bg-black/80",onClick:a,children:[Nt("button",{onClick:a,className:"absolute top-4 right-4 p-2 text-white/80 hover:text-white bg-black/50 rounded-full z-10",children:Nt(Re,{size:24})}),o&&Qs("div",{className:"text-white flex items-center gap-2",children:[Nt(ee,{size:24,className:"animate-spin"}),"\u52A0\u8F7D\u4E2D..."]}),i&&Nt("div",{className:"text-red-400",children:i}),t&&!o&&Nt("video",{src:t,controls:!0,autoPlay:!0,className:"max-w-[90vw] max-h-[90vh]",onClick:l=>l.stopPropagation()})]}),document.body):null};import Ut,{useState as et,useEffect as vn,memo as wn,useRef as bn}from"react";import{createPortal as wg}from"react-dom";import{Slot as yg}from"@luckylillia-dev/plugin-sdk/webui";var id=new WeakMap;function Po(e){let a=id.get(e);return a||(a={msgId:e.msgId,msgSeq:String(e.msgSeq),chatType:Number(e.chatType),peerId:String(e.peerUin),senderUin:String(e.senderUin),senderName:Er(e),time:Number(e.msgTime),text:(e.elements??[]).map(t=>t.textElement?.content??"").join(""),self:e.senderUid===ot()},id.set(e,a)),a}var _m=600*1e3,Bm=30*1e3,Kt=Io((e,a)=>({privateRkey:"",groupRkey:"",fetchedAt:0,loading:!1,ensureRkey:()=>{let{fetchedAt:t,loading:r}=a();r||t&&Date.now()-t<_m||a().refresh()},refresh:async()=>{let{loading:t,fetchedAt:r}=a();if(!t&&!(r&&Date.now()-r<Bm)){e({loading:!0});try{let o=await Sl();e({privateRkey:o.private_rkey||"",groupRkey:o.group_rkey||"",fetchedAt:Date.now(),loading:!1})}catch{e({loading:!1})}}}}));import Cc,{useContext as Ic,useMemo as cg,useRef as fg,useState as Ho}from"react";var Ys={};ci(Ys,{decode:()=>Hr,encode:()=>na,format:()=>za,parse:()=>jr});var ld={};function qm(e){let a=ld[e];if(a)return a;a=ld[e]=[];for(let t=0;t<128;t++){let r=String.fromCharCode(t);a.push(r)}for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);a[r]="%"+("0"+r.toString(16).toUpperCase()).slice(-2)}return a}function Do(e,a){typeof a!="string"&&(a=Do.defaultChars);let t=qm(a);return e.replace(/(%[a-f0-9]{2})+/gi,function(r){let o="";for(let s=0,i=r.length;s<i;s+=3){let n=parseInt(r.slice(s+1,s+3),16);if(n<128){o+=t[n];continue}if((n&224)===192&&s+3<i){let l=parseInt(r.slice(s+4,s+6),16);if((l&192)===128){let u=n<<6&1984|l&63;u<128?o+="\uFFFD\uFFFD":o+=String.fromCharCode(u),s+=3;continue}}if((n&240)===224&&s+6<i){let l=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16);if((l&192)===128&&(u&192)===128){let d=n<<12&61440|l<<6&4032|u&63;d<2048||d>=55296&&d<=57343?o+="\uFFFD\uFFFD\uFFFD":o+=String.fromCharCode(d),s+=6;continue}}if((n&248)===240&&s+9<i){let l=parseInt(r.slice(s+4,s+6),16),u=parseInt(r.slice(s+7,s+9),16),d=parseInt(r.slice(s+10,s+12),16);if((l&192)===128&&(u&192)===128&&(d&192)===128){let c=n<<18&1835008|l<<12&258048|u<<6&4032|d&63;c<65536||c>1114111?o+="\uFFFD\uFFFD\uFFFD\uFFFD":(c-=65536,o+=String.fromCharCode(55296+(c>>10),56320+(c&1023))),s+=9;continue}}o+="\uFFFD"}return o})}Do.defaultChars=";/?:@&=+$,#";Do.componentChars="";var Hr=Do;var ud={};function Um(e){let a=ud[e];if(a)return a;a=ud[e]=[];for(let t=0;t<128;t++){let r=String.fromCharCode(t);/^[0-9a-z]$/i.test(r)?a.push(r):a.push("%"+("0"+t.toString(16).toUpperCase()).slice(-2))}for(let t=0;t<e.length;t++)a[e.charCodeAt(t)]=e[t];return a}function Eo(e,a,t){typeof a!="string"&&(t=a,a=Eo.defaultChars),typeof t>"u"&&(t=!0);let r=Um(a),o="";for(let s=0,i=e.length;s<i;s++){let n=e.charCodeAt(s);if(t&&n===37&&s+2<i&&/^[0-9a-f]{2}$/i.test(e.slice(s+1,s+3))){o+=e.slice(s,s+3),s+=2;continue}if(n<128){o+=r[n];continue}if(n>=55296&&n<=57343){if(n>=55296&&n<=56319&&s+1<i){let l=e.charCodeAt(s+1);if(l>=56320&&l<=57343){o+=encodeURIComponent(e[s]+e[s+1]),s++;continue}}o+="%EF%BF%BD";continue}o+=encodeURIComponent(e[s])}return o}Eo.defaultChars=";/?:@&=+$,-_.!~*'()#";Eo.componentChars="-_.!~*'()";var na=Eo;function za(e){let a="";return a+=e.protocol||"",a+=e.slashes?"//":"",a+=e.auth?e.auth+"@":"",e.hostname&&e.hostname.indexOf(":")!==-1?a+="["+e.hostname+"]":a+=e.hostname||"",a+=e.port?":"+e.port:"",a+=e.pathname||"",a+=e.search||"",a+=e.hash||"",a}function To(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Om=/^([a-z0-9.+-]+:)/i,zm=/:[0-9]*$/,Hm=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,jm=["<",">",'"',"`"," ","\r",`
2
+ `," "],Gm=["{","}","|","\\","^","`"].concat(jm),Wm=["'"].concat(Gm),dd=["%","/","?",";","#"].concat(Wm),cd=["/","?","#"],$m=255,fd=/^[+a-z0-9A-Z_-]{0,63}$/,Vm=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,md={javascript:!0,"javascript:":!0},pd={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Jm(e,a){if(e&&e instanceof To)return e;let t=new To;return t.parse(e,a),t}To.prototype.parse=function(e,a){let t,r,o,s=e;if(s=s.trim(),!a&&e.split("#").length===1){let u=Hm.exec(s);if(u)return this.pathname=u[1],u[2]&&(this.search=u[2]),this}let i=Om.exec(s);if(i&&(i=i[0],t=i.toLowerCase(),this.protocol=i,s=s.substr(i.length)),(a||i||s.match(/^\/\/[^@\/]+@[^@\/]+/))&&(o=s.substr(0,2)==="//",o&&!(i&&md[i])&&(s=s.substr(2),this.slashes=!0)),!md[i]&&(o||i&&!pd[i])){let u=-1;for(let f=0;f<cd.length;f++)r=s.indexOf(cd[f]),r!==-1&&(u===-1||r<u)&&(u=r);let d,c;u===-1?c=s.lastIndexOf("@"):c=s.lastIndexOf("@",u),c!==-1&&(d=s.slice(0,c),s=s.slice(c+1),this.auth=d),u=-1;for(let f=0;f<dd.length;f++)r=s.indexOf(dd[f]),r!==-1&&(u===-1||r<u)&&(u=r);u===-1&&(u=s.length),s[u-1]===":"&&u--;let m=s.slice(0,u);s=s.slice(u),this.parseHost(m),this.hostname=this.hostname||"";let p=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!p){let f=this.hostname.split(/\./);for(let h=0,g=f.length;h<g;h++){let C=f[h];if(C&&!C.match(fd)){let L="";for(let x=0,v=C.length;x<v;x++)C.charCodeAt(x)>127?L+="x":L+=C[x];if(!L.match(fd)){let x=f.slice(0,h),v=f.slice(h+1),I=C.match(Vm);I&&(x.push(I[1]),v.unshift(I[2])),v.length&&(s=v.join(".")+s),this.hostname=x.join(".");break}}}}this.hostname.length>$m&&(this.hostname=""),p&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let n=s.indexOf("#");n!==-1&&(this.hash=s.substr(n),s=s.slice(0,n));let l=s.indexOf("?");return l!==-1&&(this.search=s.substr(l),s=s.slice(0,l)),s&&(this.pathname=s),pd[t]&&this.hostname&&!this.pathname&&(this.pathname=""),this};To.prototype.parseHost=function(e){let a=zm.exec(e);a&&(a=a[0],a!==":"&&(this.port=a.substr(1)),e=e.substr(0,e.length-a.length)),e&&(this.hostname=e)};var jr=Jm;var on={};ci(on,{Any:()=>en,Cc:()=>tn,Cf:()=>Xm,P:()=>Gr,S:()=>an,Z:()=>rn});var en=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,tn=/[\0-\x1F\x7F-\x9F]/,Xm=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Gr=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B4E\u1B4F\u1B5A-\u1B60\u1B7D-\u1B7F\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDD6E\uDEAD\uDED0\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9\uDFD4\uDFD5\uDFD7\uDFD8]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09\uDFE1]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDD6D-\uDD6F\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD839\uDDFF|\uD83A[\uDD5E\uDD5F]/,an=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C1\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2429\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E5\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD803[\uDD8E\uDD8F\uDED1-\uDED8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDC00-\uDCEF\uDCFA-\uDCFC\uDD00-\uDEB3\uDEBA-\uDED0\uDEE0-\uDEF0\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED8\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0-\uDCBB\uDCC0\uDCC1\uDCD0-\uDCD8\uDD00-\uDE57\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF-\uDEF8\uDF00-\uDF92\uDF94-\uDFEF\uDFFA]/,rn=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/;var Qm=[8364,0,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,0,381,0,0,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,0,382,376];function Km(e){return e===0||e>=55296&&e<=57343||e>1114111}function hd(e){return Km(e)?65533:e>=128&&e<=159&&Qm[e-128]||e}function gd(e){return e-1>>>0<127||e-160>>>0<55136?String.fromCharCode(e):String.fromCodePoint(hd(e))}var At=(()=>{let e=new Uint8Array(127),a=0;for(let t=33;t<=126;t++)t!==34&&t!==36&&t!==92&&(e[t]=a++);return e})();function xd(e,a,t,r,o,s){let n=e.length,l=s*90,u=0,d=()=>{let q=At[e.charCodeAt(u++)];return q<s?q:q*91-l+At[e.charCodeAt(u++)]},c=t-r,m=t+o,p=new Int32Array(m);p.fill(-1,r,s),p.fill(-1,s+c,m);let f=new Int32Array(m),h=new Int32Array(m);function g(q,_){let B=0,K=_,P=_+q;for(;K<P;){let F=At[e.charCodeAt(u++)];if(F<89)B+=F,p[K++]=B;else if(F===89){let S=At[e.charCodeAt(u++)]+2;for(;S--;)p[K++]=++B}else{let S=At[e.charCodeAt(u++)];B+=89+(S<90?S*91+At[e.charCodeAt(u++)]:At[e.charCodeAt(u++)]*8281+At[e.charCodeAt(u++)]*91+At[e.charCodeAt(u++)]),p[K++]=B}}}g(r,0),g(c,s);let C=new Int32Array(o*2),L=0,x=0;function v(q,_){for(let B=0;B<q;B++){let K=_+B,P=d(),F=d();C[x*2]=P,C[x*2+1]=F,x+=1,f[K]=L;let S=(p[P]<0?h[P]:1)+(p[F]<0?h[F]:1);h[K]=S,L+=S}}v(o-s+r,s+c),v(s-r,r);let I=new Uint16Array(L),k=0;for(let q=0;q<x;q++)for(let _=0;_<2;_++){let B=C[q*2+_],K=p[B];if(K<0){let P=f[B],F=P+h[B];for(;P<F;)I[k++]=I[P++]}else I[k++]=K}let y=new Uint16Array(a),N=0;for(;u<n;){let q=At[e.charCodeAt(u++)];q>=s&&(q=q*91-l+At[e.charCodeAt(u++)]);let _=p[q];if(_<0){let B=f[q],K=B+h[q];for(;B<K;)y[N++]=I[B++]}else y[N++]=_}return y}var Cd=xd("!}.&u%}'&}*'~!6*)%&,~!J~!J~%L~y<~!R,~~%Lu~~#GD~~#|)1#%}^%}2%+#.##%##%}&%##%'#%##&%#%#'%#&#%#&#'#%%#&#%##%#)%''%&%#%#'%#%%#%%}%%%#%#&(23#%%#&-%0%('1#(##%#'##+%'*.:1}#%#6-+(%'%%#%%%}#L'2351&('%}&/N'(0(/*-%(%%}#'+&T%7.2}#&%&#%#36/5##%&%%#&#%%#))2%%##%&&'0~!#*+&'%1~!%).'3q?&%'1~!.##%6(~!+%%%(Gw'rT~!E#<nA%#jZ~!H%(~!42##~!*31&~!G%U~#)5~#`3~!J~!Z~%]~%Y~%C~!q~!u~#kz~%#~!6'~!D~!U~!?~#T~!c%~!G#'~%7|~!G~!J~!G&~#pb~(Df}#%}*&}#%##%##%##&#-}&'#'&%#.++}%mI,#,@&(}*%}*'%&##&#%##%}&0}#.},U},%}+%}&%}#%##&}B%(}(%}+%)})%##%#&}&%##%&}<%}>%#%&}*%}(%}9%}/%})%}*%}*%}?&}&%}3%}&*#%})%#%#)}#&#-#+*%E%%'%'#%}#*V##&##I}#&&##%&%#&&Qf%%))w/0+&%#(#.%-''''++++7}>%4'',##1,#%#&%##&#'##&#*#9)%&%}#*}%,#+P(%A&%#'&##wSD',9E00#y#@}(+}&%&>~!#~!X}#*}(&&}(&}(,%}%&#+&}#&}I%#%}%)#(},'%#*}4%%#%}(''}#/##(##),%-##%%)#&}(.}&%#&}%%}*&#%},&&}&%}#%*'#%})%}D&}&%}-&}6&#&}-,%}#%})-(~+`~,=?~I9'9%~!,#%})%})%}@%}?%}(~!?~#<~#pP~#BG~#=1#%K+~#?#~%;)~#A~#mF1~#A'~'X%'~#lR~#N~'N~#r~#m#-~#i'?%#'%~#B%##%,%#~#_%#0%~#]732~,w~2+#:&#%&'0%&>%}#>##F+)#%&&#(+_}4&}-%}(&}@&}O7Fdf0@+/v4}&WU##&/0#&'('B#%}.%}'+#%}#%%&#&%#%##+#&#)#6#'#.},%}c%},%#%##%&#&%#&~#>'*-.%##%##%}#%%}%'~#)D1}#%*&~#_%%'(~#S2%'.}#~#=##*'*-%}&'%'##&&~'E%.#&~#M4}%%##&'%#~#O1##%&#'+~#<B%##%%'%+~#;#@%}#&%#&&%#(~#H1}'%'##&&~#?A}&'~#D#%32}'&&&&~#[}'(#%}'~#;C})&}%%#%~#=&%,3}%'(#%%~#^'#&&)#%'~#Y%-~#d-%'~#^%%&#&&&}#~#b~2t*&'~&(~&@~0%~e~3}%*''0})&}+~!9##-}#%-hD*)1fC#%/&/fB#40~!+#)*4~!+~!K'&:~!/*7~!.#~!H~!L':~%x&~!H#~!*~%1~!I#~!+A~#p'~!F~~#-#~,,(~.Z~!V~%;'B'mq-W~!N~%I%#&&#&}#%},%%}'%}+X#%}#&}(%}'%}<%}#%}%%'}'%}:~![)9@~%>~#UA%-%##&~!C%~!-.9:~!1~!-^2/:a~!y,D*J#-5)/4~%23,~#G~!L1~!0X3`~!2+~!!0-~&E~!W~!o,>Y&]~%cZx_&~#O*9#A#'#+I'%#)~!0B*-5A+-((F&*M#)(-7-5+'-3a5Vi~!Y~!?+[)%3),ERHm~!+:D,VG.+)?fB%%*(%)'(#&80%1'8`K8?`+'Z#&O&'H5#*9)A%%5&3))0%39+.*7#()&&*=4@**L)<'_&*+..;(#*+)./&0#3)%')-8(4ixD(&.}%,('aI:,)%,k2231T)I'#/-W7,/'Q#.'Y24+h')37</31&83##&0#),H(?'&?/1##%#&&#%''-%&&&#(&''&#.-'%#%%(,')*'&#&#'##%(%(#%('#&##%%%%('%#%#%%#%#&%##h>w+v<ayvyvcg.uuhKr}g/v|g>u9i[~>g5uI~=RvdwEg;v/g;uk!!TTSx]@RT!U!#!@VBRUU!'UTe-d0c`e&gSdicedFcrdTaqb.kYcAohdYd@a3e+d}dMdtd.aJ#bqcK`dle/e.e'dwdPdodddjbEb}ogd^ofdpduc6j?l%d{drdqc)d7bacOdQ%T#Y)X.sR[yH>6Vyv3[xwLu>vo'!*.[yBacahoj>6Rew3[xqdZa#!a&#^(X-[yG>6Vyu3[xvg3sEr|g.u/Ri9db0T#^(Xa)!-[y;>6Vylg4wKs{JwNZt3@3r=c4Z([xlg;wKt!cpq's@v7A'*a(a+!-a#[y<3Dt?3Dt'>6Vym3[xmg9rxsNJwLZt4~?r?db1T#`-!(Xa,!0[yS>6Vz%NuQs.g4wKtnJwNZtS@3r>c4Z([y%g;wKtrdga8!a(!#&T*Y-Xa#!a0<or[yc3Dtq>6Vz43[y3JwNZtf@3s!Ju}!%Dti:pm3c_%X#tjB5pkd6q!r]u?voC'*-a.a2!0a&a+[yI3DtI3Ds~3DtH>6Vyw3[xx;:s#~<5pKJwNZtE@3r~d`a)!a2T#a.(!+U.X1[yT3Dt`3Dtv>6Vz&3[y&g9rxwzcxstPu.<rAJwLZtT~?r@dZa%!a.&^*Za(/Reu[ya>6Vz23[y1g3sEr}wkg{NuQRg{ci(U#5@b`~,cg#U(2WnH5wugcRh7dX#T(Y,a'Ta!!a,[yZ<]mj>6Vz,3[y+Pv#5ReZKu+=,%!H}7ABwkaS?Rh:BcW(X#<]mrj:ubv/ARekdg%!(!a.*Ta(Y.X1!#sP>Rl*Dt6[y>>6Vyo3Wf*jOvuumvuRgRJuq*!:9<B@bX~3jVv&v@s@5Re[d/rQt{uAvo&a&a*)a2!,0Wf!3Dt0=Bs'>6Re}3[xy~<5s%JwJZt1~Gs)c;&!#2sJkNuXvzq7rxu,Re8dka4!a8(aEZ+a@Y.X1Xa)[yd=Bs(3DtP>6Vz53[y4cX#X&Re:avRe9~<5s&JwJZtQ~Gs*i^rzvdRg+Jv{%!2sbB@bX}kdga,!Za?&^*T1/!a'Dt+[y6>6Vyf3Wf%g/u;s4hGu6?Rh-JvZ,!c%#&RoX54Rivj7uyvf8RgTKvZB%*!2sGh<vu5Rgq<=C::9bb~#dZ#T&Ta6Y.X*Dt>[y93Wf)coZ(T,6VyifluvRgC@95@B@bX~/hFu34cC#T,k/unq8w8Q5RkUklwQuzunq8w8Q5Rk8d/rJu?v8w9)-&!a0a;a&aIWejg3sEr/h1s<DtDJvyZqY5aws3Jvy!&Wei~Hr1:au5@Bag>23E~5c:Z&bX};kKv?w&unuVu5Rjc;>bs)#~@:Rh.=ay<a]C;b`}Vd6s/t{uAvoaxa()!a,a7%-a#a2Dt,[yF2Wo[>6Vyt3[xuNuPRi&NuPwpi#RoWh?vf8Ri%Jv]!%Ri:KvxD!.'2WeAjZu`q9rxu,Re7woeAg-unLq(qA_/*2Wg_g3u5q^9:4E}/jTrxrzv=Wkkd~0UX#^^Xa-a1a5T&a=U1a'*aEa]!a*aPaA-adok[y54Rn>;:p3~Dp5g9rpsFNvZqjg3uJp4~<5p0Pw;5qlJwNZt*@3p1Pw:5p/Ou!5p2JvG'!6Vye=<qnJvh_[xhg3v,Rh3kOwOw-sDuev/Re^dha[a%!%!a+#Ta7)-5TaCaO!aka!a)sf[yb2>Rl!9ARiq5E}Qg=ucRkBE|oJrJ_@Wk~@Wk{JrJ_@Wk|@WkyJrJ_@Wk}@WkzJvO_[y2g-vMRmiKuYC!)&>Ri;>Ri<@3RkNc](X#@9Rk=g5vuRmhKvDB!+'=]meg3u4Rmgd)#Y'Vz3CARmfd`a+!%T'!+#Ta1Ta6TaM-sTDt9[yA9sYd'%Y#s[[xpj:ueunaXRgEjRq,v-vuqdd2'`#6Rev<32@5>:2<E}5xIo9a*X#Y(;5RePJvD_g>vyRgNj8w)v8<wggs:RgXiZt|vjx,hSq3ah!-(~@:Ro/Ou!5RhWj^v(pyw8unRhUdx-UY#^Ua.a3a70!)%UX1TaDa)'omRiRRhE[y:3Dsz=Br,>6Vyj3[xkg6ruwjcqsrPw;5r*Ku]D'Zt-@3r(~?r.i[vwv]dU1a--U#`a4(g/vsRhPOu!5RhLj:rmu9Wo!~@:wdh@g/vsRiTjXuvvNr}:RhBj^v(pyw8unRn]dz1UYa'a+^Y(!aETZalaRY.Ta?a4[yDJw1!#qLsW>6Vyrfzq-pLflpwRe|Js>%!Dt@3Dt&Jvy_[xs~HrnjMuwpsw'RecKu+D#'!t<~Grl~?rjg5u-x,gwp{ah!-(~@:Rg~Ou!5Rh'jXuvvNr}:Rh#cW#X/c;&!#2sLi[v7u7RgpJv)(!iLrxu,Re6j7v@s@5Se[e7d`aW!Za(a`T.a#!a3!&aDa-!9)Dt_=6s+3[x~~DR|h~DS6avhGun5RkZj3w)v-]mkKunB!&*]kb97R|i<ARk<c:Z(6Vy}Juh'!wziMRoS:F|vkLuauJv5vtvQRh1d='T+Y#VyO~DR|jcF#T'7R|g97R|kJv3'!ay<Rj,Jvh&!:ReXcsa6*a+#a#_aIRf9aLRf?c,Z&Rf5Rf7c.Z&Rf;Rf>cQ#%T'p-Rf8Rf=ct#%'(*!,p,Rf4p+Rf6Rf:Rf<d~'Ua%U*^UYa(!a,-!#a4YaTalaEX0a8a<Weo3Dt/3Dsx=Br93Wen~Dr;~<5p<JwNZt2@3p=Pw:5p;Ou!5r3c7&!#:p>3Ds}KvGB)_6Vyk2sM=<r7x'eovA(!hFu1ARf}cV#X&@r5j6rvwQa^Rf3c=Za'wkghJv__g;unRggA53B9=b^}%j6uduo5Jq;!(hIv%2Re`Ou4ARe_e%a#^^^Xa&!a*a2!&a6YaP!*ad!#a:aE/5Rn?[y@>6Vyp;:pE~DrY~<5pBJwNZt8@3pCh=rt3rWPw:5pAJup_[xoNuPpF9c!#'45pD5ARn)d8#X'X*3@rU72s]h>v<<sSjJpqvewOJq/(!hNw'5ReBk0s2u3w/w'5ReE5@Jq.!a+JQ!&WeU23d(#Y&RjG5]jBk!u7w&u0udARjEe#+^^^Ub#!a2/a`Z(agT1!a-a;|@TaG!aS[yV=Re~fow'RguNuPRe?bz#'>RoUWeL>:Cbb|?JwPZtVg6ruRmzJvD'!6Vz(g/vmRh~Jvy_[y(g9voRgyx*cy(#2>Ri2B9b]~9kIw9u7rluJu3Rg]dI#a%UY'@=p%CAx.gQZ&RhwwygtRm{x5g_Z'+ABqR9Woa=Bp&dV#^*Xa'!&@o{g4v]Rk;Jv{!%Rk[wkkiA5RkiwwfUB=x,fUuqC&*!>RfTg8v0RfV~ARfSd;rJsAuAv9wR'ae+/aO!a@aza/a#[yQ@Wg!2Wemg3sEr0JvB_g>uvReWg2v+Re=KupB_+[y!2AbY~-~Hr2AJwD!(h<~El>h<~El?Kun@+_:9b`}Kg-v/Ri3g;vtwyk_9]k_d=&T#*U.6qh@Ab`|K9:H|CJv[!&3Dtex'fDwC%!Rf[9WlMd[(^X,!a%Z06Vz!@WgBg=v~Rgvg,QRe@awd,#Y+jTv|Q~EfWj]uNr|~FRfXdy#Y&^Ua%!aO.!(a)Ua;=!a@aKap!a-,a!Ta]a[rSa]p?[y82sK=Bq~;:p:~<5p8Pw:5p7d'#Y'Wf(;RnRi[u4w&RgJJvG'!6Vyh=<r#ijuuv/sIKuYD'ZtG@3p9~Gr&d2#`(g<vtRgFj`u5w&rqpxRf2CJuY!+:wfnTOu!5Rg}jNs1ucv&RfwJvA!&3@q|BDcC#T,k/unq8w8Q5RkTklwQuzunq8w8Q5Rk9dga#!a'!a=#a0!:+Tb*b@aO.a4!aba8aFJv^}?!VyR~Dr<g;u%Rn.~<5p[x'e`wNZtR@3p]Pw:5pZhNvjBp.woe_g5u-r4JwF!%DtO3:ooc7&!#:p^3DtpLuGw(!+%)Dtk6Vz#2sd=<r8d'#Y([y#<x3gJt`w@!)%}MRiowzikRij=]ilxAf3,U(#B2Rf#g0v-Rm[ck{`U#]giKv3>)!&6Ri154s,KuGB_%@r68r:dJ|t`#X(9<E|u2@H|rx3gJu?w'!+'1Nu7Reg4=H~+9<wxgY95Rm]xLggZ-`(X}U2:Ri4h<uOawRmsJv__5@bb{jbV~3dka#a'a]!,#a+U=a>b6a3b%!/aKa/)!arwve^VyJ;:pR~DpTg3uJpS~<5pOPw;5qmPw:5pNOu!5pQJvG'!6Vyx=<qoJvA!{~Jup!%@qk7Rn/KvyD!}''[xz;>wkh'?Rh,x8gyt`w5D!&),(SgyccRgztJ@3pPB5p#d'(Y#<]mmifubw&RgoJvE&!82s^JvF&!8Rf,ADb]~;x=h'rNu]vK!,%'*0RnORh)4Rh*AqQg-vaRnNg;wHwkh'ba~4cE#Ta*x3gctyw@'!+%RnFRnD<4Rn@hFvK5RnCxWg[#`&a0Ua()`1Rm75Rg[c]%X#qi8Rg^NvdRj>BwzgZauwji7Rm6A4wgg]d1#&(*,.0a#Rm;Rm<Rm=Rm>Rm?Rm@RmARmBe%#^^^Xaea?aC/b+(,!a+a#!a/!>a&Ta<aKbD!2wphBRnk[yPw}hE|.=Br-3Dtm>6Vy~g6urRf.x,hPrNav!%'RnqRo%Ro#Nu;q[Pw;5r+JwNZtM@3r)d'#Y'Weh;xChL#`&RnmRnoKu}>%(!Rne~Bs-;2wjcussJv+'!aYSO}6@B<5?ba~8LrNvj!.%*ROwungw~ng~:9;Ri^>wtnig;wHRnixDh@|(UZ.x1h@|)!#:2<H|*xHn]#-UX'3Ro)z=iT}6ARns=Bwsn_wpnaRncw]aR(#UXa&Ua*a/=]iPd'#Y&Ro'WnXf{QRm2hNvj]nZd`'T~&1`{|`#9b]{}c:'!#Wl{>@=be}]?cl{{U#:5Abb}Jds#^YaF!a*b4a#a3aPa>&Tb!bH!*a_!Eau?/a&RjY<]gj>6Vz*;:pe~DrZg,QRj1JwNZtX@wihspcJvZ&!VyX9WmOJu|!|N2WmHJvh&!]ht~Bpbcn&T(!#RmQ<s7Nu;padH#X'`+WmJ@>RmKCARhnKup=!)&Wf+:RhqNuPpf9c!#'45pd5AwghpARn(Ls@w!%,)!RmP@Wfe<E|IJva!&WmNg8vsRmLd`*.`#Y'Xa!axRn*]hrA8Rhug5s@rXg8u!RmMd8#X'X*3@rV72smdI*#UY&RmICARho~GsgxVgd)Ta'U-Y&Xa!T#RnEWnA@Wffg1uDRi0hFvK5RnBxGnG&#`%owp)@wsf+bX}Ze-*1!a*^^^Ua|!#a.aq&Ya2!a>.a6!a:aO`aJDtL[y`@Wg#>6Vz12@wzoYRoZNuPRi!NuPRhzg=ucRi,@=b`{Yg=ucRi-ACJvB!&Sh[ebSh]ebi`wUuFRm4Jw2_[y0JvB!.<Ju(!&SoG}6Shd}6<Ju(!&SoH}6She}6Kur@._g5vHRieJvx!{L2G{Kx6gd'T#?Rh82Wi5cZ#X(g1w)Rm5dW-Y(Ta#!a)!#aYa=wnfE=su2>>bU{0j9udv:<svj8uQv-7RgHdE%#^'sq9sp=>Bb_{TJv`!&g/r|snj6v(us5d,#Y(56H}[978H}]Jw5!&g1rushJvB!+j;v{u5?zDhd}6}bj;v{u5?zDhe}6}ce*#`(^^^a[aea!=!a6a*aoXb1a.!aAbL!b>,b'aL!aV@Wf|2Wlg3[y/JwNZt^@3piPw:5pgJunZou3@rsJva&!Vy_g<v~Rm#JvG'!6Vz0=<r{Ju{%!:pj@WfsiXuJu3Rm:JvZ&!WfA~Bph@c4Z&Dtwax5rubx(#:awRk1@d,#Y&RfjRfid1#,Y(@Wfp2Wlrg5s@ryKu[@!,'=]ig9wlk?Rk>g5u-rqJvy'!@9RkQcH(T#=>Ri~@<wkj(Wj(KuZB*!&<7rw@9RkRcH(T#=>Ri}@<wkj)Wj)dg(Ta2Xa9X#`-!a*CARhg@@=I}d9x;c~#X%so=<sj>2@@=aybb}XjWv0Q~EfEj3vLv;<d,#Y(56H}`978H}_dgaPaFa'a/!#a3Y0a_a;a|!1(a7-[yE3[xt;:pJNvZrrg3uJrvJwNZt=@3pIh=rt3rxPw:5pGOu!5rpJvG'!6Vys=<rz@c4Z&Dt(ax5rtJvZ!&~BpH@wsfNg-vaRlNci*U#=<wei<F}a5@Jq.!a*JQ!%@qZ23d(#Y&RjH5]jCk!u7w&u0udARjFd/prq=tyvpaEa(a:.!a1aZ(@@=I}:9wpd%=<sX55w_h}@@=I{t=ay<aU@@=I}T=ay<2@@=I})?C9:9au@9Cb]}DP~=x-fAZ(2Wl1=ay<aU@@=I}>5@d##Y+jTv|vV~EfFj]uNpn~FRfGdgaK!Z2&!a8a-Tb({E!acTbM*!a(DtY[yYd'%Y#sl[y*hHvh>Re5x2c{Z}.j4uCvcawRiMd+#X+_x&d!},<5RkX;2Hzw@x,gavfB-!{CcF&T#Roe;RodwWbBg5urRgaKvHC*_6Vz+<4opieuew&Rmq@d]&Y)X,T#X0Rh}<BqP=4qS9:ReMg/ujReNJw0!/<Jui%!bd{kawwnemRelAxUa?a3#*.&UX(Ya+a/RhvRnQ<o}9Wmtd-#Y&RgSRmw9;Rmxay=Rmyg-vaRmuxEhSrNu,v-voC!%(aR.a(a7+1Ro1>Ro5CE{A9b]{@;5x#eO{:g;urRi+KrNA!%(Ro3>Ro79;Ri_Ku@>{;&!x%gX|{KunA_+g5QRj/g3u5Rj#g>uERj%wio/xRhS&!,!#^1U}wba{8>>@=be}qC@:D5ba{7Ku+A&!}x?ba}t>>@=be}se(aA^^^Uat!b0#{pa+awUazbGa#aLb9bgaWac'a5TbS=Br!d1#`%scp_Jvl!#rT>Re0JvX&!VyN=H{Fcm#U&:pY=ReaJv2&!]h0=]nUJvG'!6Vy|=<r%JrM_=]h2@Wlud'#)U'Wf'b]{i=]h/Jvh!&~BpWg=v]RnMx+ny#'Nu;pVwjnu=]nwxJnx,T#`&Reqwjnt=]nvieu9vrRjLLuYwP(#+!th@wih5pX~Gr'g5v/Rh4KunA'!-CARnP@wwiN:Rm_9x'cvw>!|l=<saKvAA!0&3@q}>w^e1bp#&Re2Re3BDx7gH#T|f5H|eKuZ>!%(:qNAH{]Jv6!+3B2B9=b^{X<5<B92:E{ZLvhwA(a;a%!igQuyRmad+#Y}m@3Rh5d8#X'X*:AqUAHzmaxwbh<aXRnVcF}RT#Nw&cj#U(BWnug/vsRntdka)(a3+.Zb7aYYan1!bVa@Xa}[y^@b[{G=H{+hFu73Rj&Pv#5ReQcK%T#sig1v{Rj'Ku+D#'!t]~Grm~?rkKuMB!01d5#`'Vy.ta3Dtu~Hroc8#'{^45s85AwZbP&!#Rn!wghxWn#KvEA!)&2RlA2RlBx:h|#(T,=]j09Wobz>x]z/@awRoTd+#Y(az]hFhCrm4d,#Y+jTv|Q~EfMj]uNr|~FRfOdCa!Xa9_X#@<plJvf!%b`{(9;Rgwc;.!#2x7cw#T|UDb]|T5Ju={(!=@E{&Jv)&!Ab`{'awJvf!~*>>@=be{#KuY>!+&4Ezyi[ugv&RjIdea+T)#UXa&T-T&a!Rh9auRmW=]kLg5vuRn+g3u4Rn-Ow6ARn,hHus5xNk?#UX(U~)/g8v0RkD~AwkkF?Ri.OuNBwkkA?Ri/d|a2`a*^UYa.!aBTZaTa'Xa;!(!2!-a#b2[yC>6Vyq3[xr2Wi?g1rusVh%s?DtF~<5rbJs;%!DtBfswKtCj[uvuSsEu3RgVx3o:u+wN'*Zt;@3rd~Grh~?rfg8w)Lq)qE&-a%!>bI|`jWv0vV~EfCjTv|vV~Ef@j]uNpn~FRfBcK#T']gWNu7x,k7q4ai(0!hHv8<RhmkMu9vrsBuev/RhlCJvB!,g<v{wchh~@:Rhji[vrv{wchi~@:RhkdS&a5UY#Ta!RgPwwiI5BwciI~@:Rh`x'iJvj'!5]iJPu8Bwch]~@:Rhach)U#h3rp]gLh@t|Ax,hTq3ah!-(~@:Ro0Ou!5RhXj^v(pyw8unRhVd|)`,^UYas!a?/a2Z'a^Ta{Tb7Ta(a#!a,Wf&9sZ3DtAadamov=Bqt3[xig8vsRm~>waiL2b`{QJv*_Ouv2qgj<v]v2BqfdR'X*X#Y-@3qr~Gqv~?p6hHv-]glPup5Lq+q?_%*b_{qF{n9b^{rOu4ARhpKvCD!+&~Bqp:5Dbb}nwoiKl&unuTuBv]v+ueunaXRf0=Jvh!0nKufu8v1w&w7q%w&uHrz:Rgnj5w,uxDJq/(!hNw'5ReCk0s2u3w/w'5ReFd>Za&!*UaA=<wkgsRnSJv^!%Refifw3vyRgOKu_B'!,<]gkiiu:w&Rh<=C@a^<B57@2F{[<B5@aW:=3away9A5aW=<B=C@a^<B57@2F{Ie-#`(^^^bCara.b8aza6!/bZ,!adTbnTbOb+aFaS!aAT9@Wf~2Wli3Dtl2@d,#Y&RfnRfmJwJZtN~GqyJva&!VyMg<v~Rm%iXuJu3Rm9Jv[_=]ih9wlkDRkCd1#`(@Wg>2Wls3cH#T(@<Rj*=>Ri|b~'#23s9h<~El.d'#Y&Dtxi^rzvdRl#d*#U%(o|B2s`hJwSaxRmDKv4B&!1:Rmdd5#`'Vx}to~Hq{x'f1v3(!BA5ba|bJv_&!Wfug1v]ReIdO+U/Y#&G}-8wze=Rh{g1v]ReHg/uQRf/by#)ibQwERl/cH#T(@<Rj+=>Ri{cNu+vlax-!(#a0qa9<Rii2;;bU{H;x<i=&X#Rk`<4wwi=C9H~8xAI(Y#<azRi@45wXI<B9;5bb~7dL(X#Xa(+!aL6Vy{g5QqOau:5au2@ay547EzbxOcU(UX-T#Ta#:Cbb|A?wjh/b_|SOw6ARgtihr}u7Rhy<d1#T)X1@@=I|~=ay<2@@=aybb}Sj3vLv;<d,#Y(56H}A978H}@dGpvs@uAu`vcw9*!aFa+ai%(b!aXa8.a?a[ozWey=sU2@G}Nch&U#Rf_WexKu+D#'!t:~Gr`~?r^j]uNr|~FRg*j^psurwJt|RmcKv)@&!)7Rkv~Br[@wxfO:Rl3co#U'6Rezj_q#vIuavjRltwzeyh@vr5JqD0!>aY?C9:9au@9Cb]}9cl#U*5;5<H||jbuus1ucv&Rfvg1v~d/pppzqFr^a--a~!aMat1(hFv;Wiz@@=Izoj5uuv-7Rix~Cw`fk2WlVcZ#X,k)u3vWs@u2]ktg;wEx'fBq(_2Wg/jTv|vV~EfoJv]!15x'hzqG!(P~EfU~CRl_j6v(us5x4i-#T(2WmZ?C2F|d>Kq<aj1!*jTqIsBv=Wl`~Cw`fi2WlWj`v0u*~>RlR=c>Z,k#u3vWs@u2]kr<c1Z+jTqIsBv=Wla~Cw`fm2WlXdmb3!a{(arZa`bkTa%TbQTa-a9+c'!aM!/[yL=Bqug.w'RifhFvyDRj.g>vgwyk^9]k^Jv3_@WfbAARkhJw2_[x|JvB_wkoIRoKwkoJRoLd'(Y#<]gm=<9<H|yd'%_X#skDtb3awwqkgNulRkgdB#^',9:p'hJwSaxRmEBwVb8@4=H|qLu+w50&!)@3qs~?pU>Awwn;;Rn=c:Z'ARn<=<qwKvC@!/&~BqqJv6!&]eVb^z^xRge'/a%+^`#Sge}6<4Rn3=]n0Pw2>Rn8Jw0!&>Rn:>Rn6cY#a7+!a&=<wkaNw~h3z_c5Z{=wjh#=]nLKv^D!&)Vyz=bW|swYb<WetcG#T(2wxa@qVx@gD#Y&b^|V5JwG&!5bb|pg/w&RgD@x=kHs=uAvn!a%%/'+RmSRh694Ro`g-vaRmRhHv-]mlxCcS#`&ba~.5cD#Ta)P~=d,#Y(56H{>978H{Dd_#{2^Y%_+qbbb{6g3sERhsbU{?dfa.,`a(Xa<!aiX#(55RiG54RiHcI#T'WiU3RiVNvdwtfcRlKNvdd,#Y&RlHRlExQgf.1*^T'X#Sgf}6Wn4=]hfPrk>Rn7Jw0!&>Rn5>Rn9Lunw?&a2!,5<oq@@wqfdRlJj5Q~=d,#Y(~ARfcOuN]fdDKw;ay(}i!547E}j?cI#T(@5bV}iCbV}hdv(^^Tb?a40,b##Tbo!a*bR!a<b|a/!aKai!aU[yK=]o^g:v>ReGJwPZtK<7Rh+h<~El,Pv#5ReR@awwxjCg,ulRjDJv6&!]j!z?aQeeg>w=Sh<eeJw;!&axEzOg,Qosc!#*:wkeJ]eJ>x'h-u(!%Ro.w~h.zPdNZ(X,Ya![x{;9ReY;wkgxRiF:x?ap#Y&RmUg<s2Rkod]+UY0TZ'!a&A9sw<=bczLNvuw{gqzNhJwSaxRmCKuLay!#&s_Rf-55b^{uJvZa!!c%#(55Ri654wmiu5RiuawLu,vp!+}^%b_}Y9;wkgxba}o>A9:=b^}zKuh=a''!3awRk3c*'!#aHRk6c+Z&Rk5Rk4Jv)&!awRjSawd9*`#0?C2@EzMj8u<uJ5RmbjQrquJu3x,k>uq@_+=ayb^|W~ARkEOuN]k@7dhzV^X/X&a-#zRzSb`zXcJzTT#2WkVKvDBzW!%FzY9;5bbzWjQrquJu3Jw3%!b`zU=ayb^zQd:#X(T-a!6Vyywxh}=b]{Jg=u1RiAdGp~qHtzv!w(wA+a+a;<!aJaYai'anasb(=azRmV:Cbb{MLq2vb!%')RjuRjrRjtRjqx3jnqCw3!%')Rk(Rk+Rk&Rk)Lq2vb!%')Rj{RjxRjzRjwLq2vb!%')RjsRjpRjfRjex3jcqCw3!%')Rk'Rk*RjkRjl9<CbbzfOu4ARhxLq2vb!%')RjyRjvRjhRjgx=joq*uKvb!%')+-Rk.Rk%Rj~Rk-Rk#Rj}x=jdq*uKvb!%')+-Rk,Rk!Rj|RjmRjjRjidAq&qKs@uAv8Aa.'*-a@a&0!aM@a5[y73Dsy3Ds|3Dt):wxgI2sHJwJZt.~Gqxwsf0ikrzt}Rl0Jvy_[xj~HqzKv_A|D!&WfP8axRoVcf,U#k(v]v+ueunaXRf1Ju}'!g8u#Ri=jQw!sCunLprq>!,')~<5qeGzq9F{W=c##%s5au:5aU3CBE|;d4#X(D!a&6Vygx(b;#(=]ed?C2F{N<capoq2r[a&!aPa9,'Pw;5s:@@=I|,55w_h|@@=IzcP~=x'fCqB_2Wl2>aU@@=I|1OuNBc1Z+jTqIsBv=Wlc~Cw`fl2WlZ~AcTa%!Z+jTqIsBv=Wlb~Cw`fh2WlYk+uNqJsBv=WlSg,u3dca3#UXaMYa)TaB-=cM|7T#<bI}l5@B932:aV2G{BOuNBJq:|M!5Ezt=<B=C@a^<B57@2F{v>cB{/T#=ay<bI{3Jv6!a.6BKq0ah&+!5E}HP~Ef{978BaU@@=Iza<7d#.Y#978BaU@@=IzH~AJq0!(@@=IzG978BaU@@=IzFe,aU*Y&^^^bvJb,b:bFad!a,c2Ta>aL.bo6!a#CbTa'T#Re{2Wlh2@G{yg6t~Ro_NvdRfticuRQRllJv3&!x&c|zs@Jw3!%RflwpfkRlpKuL;%(!Re<@G|C2GzdhIvuBwgjAg-u0RjAKQB%!(GzZ@G|5NuuRl7d='T+Y#Vy[g<v~Rm!==G|>JvA!)@wma=]m1ifuaw&RmnLs@vT'!|/+[y,g:v>ReTJw1!#qX=x!eC{bLu+wT&)ZtZauq_~Graci&U#F|89:r_Lupvq!.)&2RlG8RfaC=x!eF{_h?rpWlmd&'!#X|&]k::xJey#`'T|+<E|&2@H|%dE#(^,g;u.RiEg6vjRiC9xCkA{O|zY#g=ucRmXKs0@!&*@G|m@awRknJuh!,3d(}gY}eJvj!%Rm):Jw3!%Rm+Rm-Ls0w(&!a(a#@b[|6cZ#X'7RkxWgAOu4ARn'dH'U#Y*Vz-Wm'CARm}d]*#a%^a*T'aK!a<9bV{PC=p*Jw4!&SgxcbB5r]idw(wBRmF7xFkt#&`(Rm/Rm8E|!JuY_9:Rl5=wrgr2:bbxd@xXfB(a*#T+!.X0X1Ta/a'T&RlDRfL>RlyARl9b[z[>RfZ:RlL:RfRwlg/ARl;9;RlxKv,A/!%7s69<74=BA5ba{-8Bde#`a<XaKYa1,a'P~=wxfB2bZ}}?C972@@=I}r8@55B9;5bb}G978B2@@=aybb}3j3vLv;<Jw3&!>Rfk=ayb^}4~Ad1#`*@@=aybb{w2@>==<bbz]dx+UY#^UaF!a9!bB'Ya1.!ajXa#%olRhD[y=3Dt#Ov5BrHKuMB%!(Rf^Wep~HrJwkiQjKr|~FRg)Ku+D#'!t5~GrF~?rDdV)UY,Z/_7RkuG{<~BrBg,rlsO:235B@bX}|d?a1!#`(6Vyn5@d##Y+jTv|vV~EfIj]uNpn~FRfH7Lq2vb1!a9-978BaU@@=Iz9978BbU}#~AJq0!(@@=Iz8978BaU@@=Iz7~AJQ|}!978BbU}!JvkaK!AdUa21-U#`a+(g/vsRn~Ou!5RPj:rmu9WhOjXuvvNr}:RhAj^v(pyw8unRn[kPr}p|u7vwv]RiSBd;pppzq@qHQa?(b.!a.a`@.|xa(hFv;Wiyj5uuv-7Riw~Cw`fg2WlU978BbU|wOuNBJqG!(P~EfD~CRlQcZ#X,k)u3vWs@u2]ksg;wEx'f@q1_2Wg.j]uNpn~FRfqJv]!15x'h{qG!(@@=IzK~CRl^j6v(us5x4i,#T(2WmY?C2F{1>Kq<aj1!*jTqIsBv=Wld~Cw`fj2Wl[j`v0u*~>RlT=c>Z,k#u3vWs@u2]kq<c1Z+jTqIsBv=Wle~Cw`fn2Wl]dn1#c(a(b^a2!b/bAT(bj!aDa7bu,a_a{c0!2T0g:v>ReD2@G{42@G{5~DpM~<5rc=Bx6i>{RT#RnI@zCx]y]z:2Jv[!zr5Awyk]9]k]dD(Y+X#6Vz.g=wKtgwhaCwgmTWj2Lu,w%_+/[y-B;b^xeg3u3Rj-2@bX{*KrJ<!+'@Wg(g?QRlC@Jv`!%b[zIwsfII}8JQ_@w|kW|=Jv(%!AqcOuNBJvEzh!bYzjLs@wP#(0!oy@>RkdJwMZtc3Dtd@BcG#T'9bWxg2@2Fznd*#Y+;2x'c}w<zizixNgwa#Z'U+!/!a'!a+w~g~z6wcn{Rn}wcnzRn|5Rh%=]nJg5vuRmvNvdRlvcprJu}w*az*a#!%.a.'Bot9qT]kj@Wg'ay2Gzv@Jv`!%b[zEwsfHI}1;ck#Ux`<Cbbx_Lu+w!a&0*!wko*wwo,So,}6Juqxf!E}PigQuyRm`d3(`#8>Rn%:A5B;bZ~%KvhCa!a2!x>k7#Uxb@b{#xaRk7Jw0!)>wwhlShl}6>wwhmShm}6CJvB!.x'hhvj{!!5Bwkhhbaz}x'hivjz~!5Bwkhibaz|xEhTrNu,v-vpD!a%&/)a3a.,%Ro2t[CE{)@3re9b]{%wjo09:rgc:Z&Ro6=<riifuaw&RmoKrNA!%(Ro4>Ro89;Ri`dSaL'UYzxZb)7Rka3xRhT&!,!#^1U}vbaz{>>@=be}yC@:D5bazzKu+A&!}{?ba}y>>@=be}wxBh[t`u~vJvr!%a!a()a,a0a4RoC=]o;Ju(!%RoGRhdwjh`=]oAg>w#Ro?g5vuRo=NvdRl|Ku]C.!&;RoEJvB!%RoORoMBx'h[v+_?w~h`}~5?w~hd~!xKh]oiptu-utv.vp!#%&a30a@a'a+(a/aOp(o~p!RoDJu(!%RoHRhewjha=]oBNvdRl}g>w#Ro@g5vuRo>c[#X']o<CauRoRAd-#Y':RkpauRoQKu]C.!&;RoFJvB!%RoNRoPBx'h]v+_?w~ha}t5?w~he}ue!/UbhYacXaW^Tc&a;b:a-c/#b&aja1(!cL+!bKbt!bmcRc9aIc?8[yW3Dtt94Rg`Jv}!&SiRMzBhEebShEMNuPRe>x7gL#TzuwjirRipc<Z&>on;>z=h-MSh.Mwqczx'a7vj&!>Re4@=ResJt__NuPRi*NuPRi)j]uNr|~FRfzKrJ>_+@Wfy@Wf]2WocKrJ<!+'@Wg%g/QRl@@Jv`!&awRl<wsfFIzgLu(w*!.*&ShBMwvhIRhI9;RhNx1hK'!#Sn]Mx1hK~0!#:2<H~7cNu+w7D*'1ZtW>Rn1~?rOc:Z&Rn2=<rQ<7wjh&=BSnLMc]#X(6Vz)w[b=a!U#9wzgMc3#&(RgMRitRis<x,gKt`ax!&+SioM=BSilMc3#&(RgKRinRimKurB,!&SiQMzBhDebShDM6BJQ!(P~Efx978B2@@=I}WLrJw!!,a*&@G}O@9wkibRid@@x'fKwC!&SlDMSfLMjUv~Q~EfKKv3@a+!(hFv-]mpx/hYZ(C5RiWz<o/MwkhY?So/M@x,gbvfB*&!SgEM:SoeeehFu3:Rgbda(,^TZa)X/7Sg[eb:2RgI~BrMC@wgkc:wwkcRerx3h(uUvK!&*,SnOM4Sh*MArRg;wHRh(x=h;rJvPwI!a4',a'0@Wg&=BSh/Mg>w=Rh=g3w*wwgGRgGcW(X#;Sg}M2Gzk@Jv`!&awRl=wsfGIz`dKZ*T'Y-:RhR7RhQg5u-p`j6v(us5d,#Y+~Awkia?RicOuNBwkibba}Ld6p~tyu_vbAa'a+!a/'a3aEa8a!>Sh,ebJv{!&Sh@ebSaReb9;SgwebNuPRi(NvdRl)NuPRi'hHu^<Rm^Jvv_@Wl(g;u1Si/ebKu'B&!*Sh?eb@Wl'z@aPeb95Si.ebcpputyvjB)!,&a+0a%ShAMWeK@G}C@WfJ9;RhMwvhH9w{ia}ix,hJvRA1(!zAn[MRhHx1hJ~*!#hFv(BSn[MBJQ!(@@=I~'978B2@@=I}2db.Ua<'X}+T#a0XaG2G}E;wkg|wuh!Rh!x,hZu,@)!&So0MVy)C5RiXACJvB!&5RiY5RiZg8w)cG}*T#2@bU}=KsA>(!a.3wkhZba~(x,h^u(A!&(SoCMRhb5Bz=h[eb?w~hb~6x,h_u(A!&(SoDMRhc5Bz=h]eb?w~hc~6e)aA1T#T,^^^c-bMb&blcPaP(a/!0!bA=b5c@a(!bfbrc#2afwmhARnjwchORnp2Wlf3DtsNvdRl-2@wpa<]m0bx(#:awRk2@Jw3!%RfhwpfgRlnKQB%!(G{V@G|'NuuRl6d='T+Y#VyUg<v~Rl~==G|<Jv+'!aYShC}6@B<5?ba~8@Jw3'!g2QRljhLrpWlOd+#Y'g.w'rIg>w*wgj@g-u0Rj@Lu+wT&)ZtUauq]~GrGci&U#F|39:rELrNvj!.%*RhCwunfw~nf~:9;Ri]>wtnhg;wHRnhx3hDs@v~!/+'@Wfr@9RkSNu&Rlo=@<5GzoKs0@_+@Wl+@awRkmJuh!-3d(}pY#qWJvj!%Rm(:Jw3!%Rm,Rm*de&!1U-U#`)Re;@G|.@9Ri82@wjfvRlq=@<5GzpLvOvr!).&2RlF8Rf`C=x!eE{.Jw3_g2QRlkhLrpWlPde(!#U{s,UXa*Ta'[y'g:v>ReS;x0PZ&RnlRnn~HrKJw1}f!=x!eB|2w]aP(#Xa&a*Ta.Ua2a7=]iOd'#Y&Ro&WnWg;u.RiDg6vjRiBNvdRlzhNvj]nYJuW_2Wm3x)kFze{9d])!a.!,Y01!#&aC!a3RndC=ox~BrC@2b^{pg,rlse7x'ksuq!%Rm.E{xidw(wBRmGx9o+)X#wwo-So-}69:Rl4@xSf@a#XZ'X)X,Ta(/ARl8b[xc>RfY:RlI:RfQwlg.ARl:9;Rlwdn'#^XafaQa1X1TaHTa)@b[{zcZ#X'7RkwWg@Ou4ARn&x)kG#{,g7u/RkGdH'U#Y*Vz'Wm&CARm|bx#(A]gUbUzJj9Q~=d,#Y(56H}l978H{U7d,0#U*2>ABb_xZ978BbU{e~AJQ{g!978BbU{hxMh?ad{oUYZ.x1h?{l!#:2<H{mx3n[t{vl!,&a%3Ro(z=iS}6ARnr=Bwsn^wvn`Rnbd`*T}B0!#^X'BG{c9b]{a>>@=be}F?JvS!&BG{d7BG}(Bde#`a1X,Ya@!a'P~=wxf@2bZ}I56B2@@=aybb}08@55B9;5bb}<j3vLv;<Jw3&!>Rfg=ayb^}&OuNBKuLA!)a!P~=x#fD{f2@>==<bbzl?C972@@=Ix^d6rSu,v7w*C(0a)a6#B+a%!sQ[y?3Dt%3[xn~<5rLOu!5p@Ku+D#'!t7~GrP~?rNKvlaya7'!h+v-5qMg=t|cd,U#5AAaa5Abb{S@52B5@a[@52B5Gx[iXueu;d<#`a(!/549C;ag>23ExY5@Dah89b^~689Jv)!~2b[~1Lv'w(%*!a#bX|aPrmawRe]keu7uhv-q6rxu,q`xTo]/a5aU!bNaDXbi!b-!ao!b<bwA!#5@B932:aV2G|:d-)Y#hJrL>RhG<7@C5<H|_=Cau:5aj5@B932:bJ|ng>vIbs)#?C2F|9jPv0w.vISh-MKvUaz(.!9ABbb|[5;5<H|Eg>unwfh;9:4E|YjQsBt|vjx'hYq3!(?C2F|J:2<BaY?C2F|GOu!5x,g|p{ah!-(?C2F|c9:4E|OjXuvvNr}:Rh&i[w*t|cd+U#jJvsu)vsSn~Mkfrmu9p}u7vwv]So!McW#Xa!ax5@A5aY:5;5<H|>kJv~vYrquJu3x4ib#T)2@SmZM?C2F|Bj:rmu9@xPhI(a*a#U#`a3-5Abb|L~@:RhK9:4E|0@52B5G|#C::aY?C2F|-:2<BaY?C2F|.5Jvk!a)javYrquJu3x4ia#T)2@SmYM?C2F|HAxPhH(!a#U#`a*-5Abb|4~@:RhJ9:4E|R@52B5G|F:2<BaY?C2F|Sc^#Xa2j=Qq5CJvB!-g<v{z;hhM?C2F|Zi[vrv{z;hiM?C2F|XKsA>!a)-g<v{z;h[eb?C2F|]i[vrv{z;h]eb?C2F|^iZu.vix,hZq3ah!.(?C2F|QOu!5ShXM:2<BaY?C2F|P",13494,2713,49,25,61);var De;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.FLAG13=8192]="FLAG13",e[e.BRANCH_LENGTH=8064]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE",e[e.VALUE_MASK=8191]="VALUE_MASK"})(De||(De={}));var $e;(function(e){e[e.AMP=38]="AMP",e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_X=120]="LOWER_X"})($e||($e={}));var Fo=32,bd=21,Zm=2097151,sn=2047,vd=0;function Ym(e){let a=e>>>bd;return a===sn?vd:a}function wd(e){return e-$e.ZERO>>>0<=9}function ep(e){return(e|Fo)-$e.LOWER_A>>>0<=5}function yd(e){return(e|Fo)-$e.LOWER_A>>>0<=25}function tp(e){return e===$e.EQUALS||yd(e)||wd(e)}var Ld;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Ld||(Ld={}));var nn;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(nn||(nn={}));function ap(e,a,t,r){let o=(a&De.BRANCH_LENGTH)>>7,s=a&De.JUMP_TABLE;if(s){if(o===0)return r===s?t:-1;let l=r-s;if(l>>>0>=o)return-1;let u=e[t+l];return u===0?-1:t+o+u-1&65535}if(o===0)return-1;let i=o+1>>1,n=t+i+o;for(let l=0;l<o;l++){let d=e[t+(l>>1)]>>((l&1)<<3)&255;if(d===r){let c=t+i+l;return n+e[c]&65535}if(d>r)return-1}return-1}function Id(e,a,t){return t===1?String.fromCharCode(e[a]&De.VALUE_MASK):t===2?String.fromCharCode(e[a+1]):String.fromCharCode(e[a+1],e[a+2])}function rp(e,a,t){let r=a+1,o=0,s=r;if(r<t&&(e.charCodeAt(r)|Fo)===$e.LOWER_X)for(r+=1,s=r;r<t;){let n=e.charCodeAt(r);if(wd(n))o=o*16+(n-$e.ZERO);else if(ep(n))o=o*16+((n|Fo)-$e.LOWER_A+10);else break;r+=1}else for(;r<t;){let n=e.charCodeAt(r)-$e.ZERO;if(n>>>0>9)break;o=o*10+n,r+=1}if(r===s)return 0;r<t&&e.charCodeAt(r)===$e.SEMI&&(r+=1),o>1114111&&(o=1114112);let i=r-a;return i>=sn&&(vd=i,i=sn),i<<bd|o}function op(e,a,t){let r=Cd,o=e.indexOf("&");if(o<0)return e;let s=e.length,i=0,n="",l=r[0],u=l&De.JUMP_TABLE,d=(l&De.BRANCH_LENGTH)>>7;do{let c=o+1,m=e.charCodeAt(c),p,f;if(m===$e.NUM){let h=rp(e,c,s);p=Ym(h),a&&p>0&&e.charCodeAt(c+p-1)!==$e.SEMI&&(p=0),f=p===0?"":gd(h&Zm)}else if(yd(m)){p=0,f="";let h=m-u,g;if(h>>>0<d){let I=r[1+h];g=I===0?-1:d+I&65535}else g=-1;let C=0,L=0,x=g<0?0:r[g],v=c+1;e:for(;v<s;){for(;(x&(De.VALUE_LENGTH|De.FLAG13))===0&&(x&De.JUMP_TABLE)!==0;){let N=x&De.JUMP_TABLE,q=(x&De.BRANCH_LENGTH)>>7;if(q===0){if(e.charCodeAt(v)!==N)break e;g+=1}else{let _=e.charCodeAt(v)-N;if(_>>>0>=q)break e;let B=r[g+1+_];if(B===0)break e;g=g+q+B&65535}if(x=r[g],v+=1,v>=s)break e}if((x&(De.VALUE_LENGTH|De.FLAG13))===De.FLAG13){let N=(x&De.BRANCH_LENGTH)>>7;if(e.charCodeAt(v)!==(x&De.JUMP_TABLE))break;v+=1;let q=N-1,_=g+1,B=0;for(;B+1<q;B+=2){let K=r[_];if(e.charCodeAt(v)!==(K&255)||(v+=1,e.charCodeAt(v)!==(K>>8&255)))break e;v+=1,_+=1}if(B<q){if(e.charCodeAt(v)!==(r[_]&255))break;v+=1}g+=1+(N>>1),x=r[g];continue}let I=x>>>14,k=e.charCodeAt(v);if(I!==0){if(k===$e.SEMI){p=v-c+1,f=I===1?String.fromCharCode(x&De.VALUE_MASK):Id(r,g,I);break}if(!a&&(x&De.FLAG13)===0&&(p=v-c,C=g,L=I),I===1)break}let y=ap(r,x,g+(I||1),k);if(y<0)break;g=y,x=r[g],v+=1}if(f===""){let I=x>>>14;I!==0&&!a&&(x&De.FLAG13)===0&&(p=v-c,C=g,L=I),p>0&&(f=Id(r,C,L))}}else p=0,f="";p===0||t&&m!==$e.NUM&&e.charCodeAt(c+p-1)!==$e.SEMI&&c+p<s&&tp(e.charCodeAt(c+p))?o=c:(i<o&&(n+=e.slice(i,o)),n+=f,o=i=c+p),e.charCodeAt(o)!==$e.AMP&&(o=e.indexOf("&",o))}while(o>=0);return n+e.slice(i)}function No(e){return op(e,!0,!1)}var kd;(function(e){e[e.XML=0]="XML",e[e.HTML=1]="HTML"})(kd||(kd={}));var Sd;(function(e){e[e.UTF8=0]="UTF8",e[e.ASCII=1]="ASCII",e[e.Extensive=2]="Extensive",e[e.Attribute=3]="Attribute",e[e.Text=4]="Text"})(Sd||(Sd={}));var np=class{src_Any=en.source;src_Cc=tn.source;src_Z=rn.source;src_P=Gr.source;src_ZPCc=[this.src_Z,this.src_P,this.src_Cc].join("|");src_ZCc=[this.src_Z,this.src_Cc].join("|");cache={};opts={maxLength:1e4,urlAuth:!1,schema_names:[]};constructor(e={}){this.opts={...this.opts,...e}}set(e={}){return this.opts={...this.opts,...e},this.cache={},this}escapeRE(e){return e.replace(/[.?*+^$[\]\\(){}|-]/g,"\\$&")}nestedPairRE(e,a,t=4){let r=this.escapeRE(e),o=this.escapeRE(a),s=`(?:(?!${this.src_ZCc}|${r}|${o}).)`,i=`${r}${s}{0,1000}${o}`;for(let n=2;n<=t;n++)i=`${r}(?:${s}|${i}){0,1000}${o}`;return i}get_text_separators(){return this.cache.text_separators??=/[><\uff5c]/}get_pseudo_letter(){return this.cache.src_pseudo_letter??=new RegExp(`(?:(?!${this.get_text_separators().source}|${this.src_ZPCc})${this.src_Any})`)}get_ipv4_addr(){return this.cache.src_ip4??=new RegExp("(?:(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])[.]){3}(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])")}get_ipv6_addr(){let e="[0-9A-Fa-f]{1,4}",a=`(?:(?:${e}:${e})|${this.get_ipv4_addr().source})`;return this.cache.src_ip6_addr??=new RegExp(`(?:(?:${e}:){6}${a}|::(?:${e}:){5}${a}|(?:${e})?::(?:${e}:){4}${a}|(?:(?:${e}:){0,1}${e})?::(?:${e}:){3}${a}|(?:(?:${e}:){0,2}${e})?::(?:${e}:){2}${a}|(?:(?:${e}:){0,3}${e})?::${e}:${a}|(?:(?:${e}:){0,4}${e})?::${a}|(?:(?:${e}:){0,5}${e})?::${e}|(?:(?:${e}:){0,6}${e})?::)`)}get_ipv6_url_host(){return this.cache.src_ip6_host??=new RegExp(`\\[${this.get_ipv6_addr().source}\\]`)}get_ipv6_mail_host(){return this.cache.src_ipv6_mail_host??=new RegExp(`\\[IPv6:${this.get_ipv6_addr().source}\\]`)}get_auth(){return this.cache.src_auth??=new RegExp(`(?:(?:(?!${this.src_ZCc}|[@/\\[\\]()]).){1,50}@)?`)}get_port(){return this.cache.src_port??=new RegExp("(?::(?:6(?:[0-4]\\d{3}|5(?:[0-4]\\d{2}|5(?:[0-2]\\d|3[0-5])))|[1-5]?\\d{1,4}))?")}get_host_terminator(){return this.cache.src_host_terminator??=new RegExp(`(?=$|${this.get_text_separators().source}|${this.src_ZPCc})(?!${this.opts["---"]?"-(?!--)|":"-|"}_|:\\d|\\.-|\\.(?!$|${this.src_ZPCc}))`)}get_path_terminator(){return this.cache.src_path_terminator??=new RegExp(`${this.src_ZPCc}|${this.get_text_separators().source}`)}get_path(){return this.cache.src_path??=new RegExp(`(?:[/?#](?:${this.nestedPairRE("[","]")}|${this.nestedPairRE("(",")")}|${this.nestedPairRE("{","}")}|\\"(?:(?!${this.src_ZCc}|["]).){1,100}\\"|\\'(?:(?!${this.src_ZCc}|[']).){1,100}\\'|\\'(?=${this.get_pseudo_letter().source}|[-])|\\.{2,20}[:]?[a-zA-Z0-9%/&]|\\.(?!${this.src_ZCc}|[.]|$)|`+(this.opts["---"]?"\\-(?!--(?:[^-]|$))(?:-{0,19})|":"\\-{1,20}|")+`,(?!${this.src_ZCc}|$)|;(?!${this.src_ZCc}|$)|\\!{1,20}(?!${this.src_ZCc}|[!]|$)|\\?(?!${this.src_ZCc}|[?]|$)|`+this.get_path_extra().source+`[\\\\/:%@#&=_~*]|(?!${this.get_path_terminator().source}).){1,${this.opts.maxLength}}|\\/)?`)}get_mail_name(){return this.cache.src_mail_name??=new RegExp("[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9](?:[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9]|[.](?=[-!#$%&'*+/=?^_`{|}~a-zA-Z0-9])){0,63}")}get_xn(){return this.cache.src_xn??=new RegExp("xn--[a-z0-9\\-]{1,59}")}get_tld(){if(this.cache.tld)return this.cache.tld;let e=[...new Set(this.opts.tlds||[])].sort().reverse().join("|");return this.cache.tld=new RegExp(`${e||"$#none#$"}|${this.get_xn().source}`),this.cache.tld}get_domain_root(){return this.cache.src_domain_root??=new RegExp("(?:"+this.get_xn().source+`|${this.get_pseudo_letter().source}{1,63})`)}get_domain(){return this.cache.src_domain??=new RegExp("(?:"+this.get_xn().source+`|(?:${this.get_pseudo_letter().source})|(?:${this.get_pseudo_letter().source}(?:-|${this.get_pseudo_letter().source}){0,61}${this.get_pseudo_letter().source}))`)}get_url_host_port(){return this.cache.url_host_port??=new RegExp("(?:"+this.get_ipv6_url_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,10}${this.get_domain().source}))`+this.get_port().source+this.get_host_terminator().source)}get_fuzzy_url_host_port(){return this.cache.fuzzy_url_host_port??=new RegExp("(?:"+(this.opts.fuzzyIP?this.get_ipv4_addr().source+"|":"")+`(?:(?:(?:${this.get_domain().source})\\.){1,10}(?:${this.get_tld().source})))`+this.get_host_terminator().source)}get_mail_host(){return this.cache.src_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})\\.){0,4}${this.get_domain().source}))`+this.get_host_terminator().source)}get_fuzzy_mail_host(){return this.cache.src_fuzzy_mail_host??=new RegExp("(?:"+this.get_ipv6_mail_host().source+`|(?:(?:(?:${this.get_domain().source})[.]){1,4}${this.get_domain_root().source}))`+this.get_host_terminator().source)}get_path_extra(){return this.cache.src_path_extra??=new RegExp("")}get_fuzzy_mail_host_search(){return this.cache.mail_fuzzy_host_search??=new RegExp(`@${this.get_fuzzy_mail_host().source}`,"ig")}get_fuzzy_link_search(){return this.cache.link_fuzzy_search??=new RegExp(`(^|(?![.:/\\-_@])(?:[$+<=>^\`|\uFF5C]|${this.src_ZPCc}))(?:(?![$+<=>^\`|\uFF5C])${this.get_fuzzy_url_host_port().source}${this.get_path().source})`,"ig")}get_http_validator(){return this.cache.http_validator??=new RegExp("\\/\\/"+(this.opts.urlAuth?this.get_auth().source:"")+this.get_url_host_port().source+this.get_path().source,"iy")}get_relative_proto_validator(){return this.cache.relative_proto_validator??=new RegExp((this.opts.urlAuth?this.get_auth().source:"")+`(?:localhost|${this.get_ipv6_url_host().source}|(?:(?:${this.get_domain().source})[.]){1,10}${this.get_domain_root().source})`+this.get_port().source+this.get_host_terminator().source+this.get_path().source,"iy")}get_mail_name_validator(){return this.cache.mail_name_validator??=new RegExp(`(?:^|${this.get_text_separators().source}|"|\\(|${this.src_ZCc})(${this.get_mail_name().source})$`)}get_mailto_validator(){return this.cache.mailto_validator??=new RegExp(`${this.get_mail_name().source}@${this.get_mail_host().source}`,"iy")}get_schema_names(){return this.cache.schema_names??=new RegExp((this.opts.schema_names||[]).map(e=>this.escapeRE(e)).join("|"))}get_schema_search(){return this.cache.schema_search??=new RegExp(`(^|(?!_)(?:[><\uFF5C]|${this.src_ZPCc}))(${this.get_schema_names().source})`,"ig")}get_schema_at_start(){return this.cache.schema_at_start??=new RegExp(`^${this.get_schema_search().source}`,"i")}},ln={validate:(e,a,t)=>{let r=t.re.get_http_validator();r.lastIndex=a;let o=r.exec(e);return o?o[0].length:0},normalize:(e,a)=>a.normalize(e)},ip={"http:":ln,"https:":ln,"ftp:":ln,"//":{validate:function(e,a,t){let r=t.re.get_relative_proto_validator();r.lastIndex=a;let o=r.exec(e);return o?a>=3&&e[a-3]===":"||a>=3&&e[a-3]==="/"?0:o[0].length:0},normalize:(e,a)=>a.normalize(e)},"mailto:":{validate:function(e,a,t){let r=t.re.get_mailto_validator();r.lastIndex=a;let o=r.exec(e);return o?o[0].length:0},normalize:(e,a)=>a.normalize(e)}},lp="a:cdefgilmnoqrstuwxz|b:abdefghijmnorstvwyz|c:acdfghiklmnoruvwxyz|d:ejkmoz|e:cegrstu|f:ijkmor|g:abdefghilmnpqrstuwy|h:kmnrtu|i:delmnoqrst|j:emop|k:eghimnprwyz|l:abcikrstuvy|m:acdeghklmnopqrstuvwxyz|n:acefgilopruz|o:m|p:aefghklmnrstwy|q:a|r:eosuw|s:abcdeghijklmnortuvxyz|t:cdfghjklmnortvwz|u:agksyz|v:aceginu|w:fs|y:et|z:amw",up="biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|\u0440\u0444";function dp(){let e=up.split("|");return lp.split("|").forEach(a=>{let t=a.indexOf(":"),r=a.slice(0,t);for(let o of a.slice(t+1))e.push(r+o)}),e}var cp={fuzzyLink:!1,fuzzyEmail:!0,fuzzyIP:!1,"---":!1,tlds:dp(),urlAuth:!1,maxLength:1e4},Rd=class{schema;index;lastIndex;raw;text;url;constructor(e,a,t,r){let o=e.slice(t,r);this.schema=a.toLowerCase(),this.index=t,this.lastIndex=r,this.raw=o,this.text=o,this.url=o}},Md=class{__opts__;__schemas__;re;constructor(e={}){let{rebuilder:a,...t}=e;this.__opts__={...cp,...t},this.__schemas__={...ip},this.re=a||new np,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)})}add(e,a=null){if(!a)delete this.__schemas__[e];else{let t={normalize:(r,o)=>o.normalize(r),...a};this.__schemas__[e]=t}return this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}set(e={}){return this.__opts__={...this.__opts__,...e},this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}test(e){if(!e.length)return!1;let a,t;for(t=this.re.get_schema_search(),t.lastIndex=0;(a=t.exec(e))!==null;)if(this.testSchemaAt(e,a[2],t.lastIndex))return!0;if(this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(t=this.re.get_fuzzy_link_search(),t.lastIndex=0,t.exec(e)!==null))return!0;if(this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&e.indexOf("@")>=0){let r=this.re.get_fuzzy_mail_host_search(),o=this.re.get_mail_name_validator();for(r.lastIndex=0;(a=r.exec(e))!==null;){let s=e.slice(Math.max(0,a.index-65),a.index);if(o.test(s))return!0}}return!1}testSchemaAt(e,a,t){return this.__schemas__[a.toLowerCase()]?this.__schemas__[a.toLowerCase()].validate(e.slice(0,t+this.__opts__.maxLength),t,this):0}match(e){let a=[],t=this.re.get_schema_search(),r,o,s,i,n,l,u=!1,d=!1,c=!1,m=0;if(!e.length)return null;for(t.lastIndex=0,this.__opts__.fuzzyLink&&this.__schemas__["http:"]&&(r=this.re.get_fuzzy_link_search(),r.lastIndex=0),this.__opts__.fuzzyEmail&&this.__schemas__["mailto:"]&&(o=this.re.get_fuzzy_mail_host_search(),o.lastIndex=0,s=this.re.get_mail_name_validator());;){let p=Math.max(m-1,0);if(o&&s&&!c&&(!n||n.index<m))for(o.lastIndex<p&&(o.lastIndex=p);;){let L=o.exec(e);if(!L){c=!0,n=void 0;break}let x=s.exec(e.slice(Math.max(0,L.index-65),L.index));if(x){if(n={schema:"mailto:",index:L.index-x[1].length,lastIndex:L.index+L[0].length},n.index>=m)break;o.lastIndex<p&&(o.lastIndex=p)}}if(r&&!d&&(!i||i.index<m))for(r.lastIndex<p&&(r.lastIndex=p);;){let L=r.exec(e);if(!L){d=!0,i=void 0;break}if(i={schema:"",index:L.index+L[1].length,lastIndex:L.index+L[0].length},i.index>=m)break;r.lastIndex<p&&(r.lastIndex=p)}let f=n;(!f||i&&(i.index<f.index||i.index===f.index&&i.lastIndex>f.lastIndex))&&(f=i);let h;if(!u)for(;;){if(!l){t.lastIndex<p&&(t.lastIndex=p);let v=t.exec(e);if(!v){u=!0;break}l={schema:v[2],index:v.index+v[1].length,lastIndex:v.index+v[0].length}}if(l.index<m){l=void 0;continue}if(f&&l.index>f.index)break;let L=l;l=void 0;let x=this.testSchemaAt(e,L.schema,L.lastIndex);if(x){h={schema:L.schema,index:L.index,lastIndex:L.lastIndex+x};break}}let g=h;if((!g||n&&(n.index<g.index||n.index===g.index&&n.lastIndex>g.lastIndex))&&(g=n),(!g||i&&(i.index<g.index||i.index===g.index&&i.lastIndex>g.lastIndex))&&(g=i),!g)break;g===n?n=void 0:g===i&&(i=void 0);let C=new Rd(e,g.schema,g.index,g.lastIndex);C.schema?this.__schemas__[C.schema].normalize(C,this):this.normalize(C),a.push(C),m=g.lastIndex}return a.length?a:null}matchAtStart(e){if(!e.length)return null;let a=this.re.get_schema_at_start().exec(e);if(!a)return null;let t=this.testSchemaAt(e,a[2],a[0].length);if(!t)return null;let r=new Rd(e,a[2],a.index+a[1].length,a.index+a[0].length+t);return this.__schemas__[r.schema].normalize(r,this),r}tlds(e,a=!1){return e=Array.isArray(e)?e:[e],a?this.__opts__.tlds=this.__opts__.tlds.concat(e):this.__opts__.tlds=e,this.re.set({...this.__opts__,schema_names:Object.keys(this.__schemas__)}),this}normalize(e){e.schema||(e.url=`http://${e.url}`),e.schema==="mailto:"&&!/^mailto:/i.test(e.url)&&(e.url=`mailto:${e.url}`)}};var fp=/^xn--/,mp=/[^\0-\x7F]/,pp=/[\x2E\u3002\uFF0E\uFF61]/g,hp={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},un=35,_t=Math.floor,dn=String.fromCharCode;function ia(e){throw new RangeError(hp[e])}function gp(e,a){let t=[],r=e.length;for(;r--;)t[r]=a(e[r]);return t}function Pd(e,a){let t=e.split("@"),r="";t.length>1&&(r=t[0]+"@",e=t[1]),e=e.replace(pp,".");let o=e.split("."),s=gp(o,a).join(".");return r+s}function Dd(e){let a=[],t=0,r=e.length;for(;t<r;){let o=e.charCodeAt(t++);if(o>=55296&&o<=56319&&t<r){let s=e.charCodeAt(t++);(s&64512)==56320?a.push(((o&1023)<<10)+(s&1023)+65536):(a.push(o),t--)}else a.push(o)}return a}var xp=e=>String.fromCodePoint(...e),Cp=function(e){return e>=48&&e<58?26+(e-48):e>=65&&e<91?e-65:e>=97&&e<123?e-97:36},Ad=function(e,a){return e+22+75*(e<26)-((a!=0)<<5)},Ed=function(e,a,t){let r=0;for(e=t?_t(e/700):e>>1,e+=_t(e/a);e>un*26>>1;r+=36)e=_t(e/un);return _t(r+(un+1)*e/(e+38))},Td=function(e){let a=[],t=e.length,r=0,o=128,s=72,i=e.lastIndexOf("-");i<0&&(i=0);for(let n=0;n<i;++n)e.charCodeAt(n)>=128&&ia("not-basic"),a.push(e.charCodeAt(n));for(let n=i>0?i+1:0;n<t;){let l=r;for(let d=1,c=36;;c+=36){n>=t&&ia("invalid-input");let m=Cp(e.charCodeAt(n++));m>=36&&ia("invalid-input"),m>_t((2147483647-r)/d)&&ia("overflow"),r+=m*d;let p=c<=s?1:c>=s+26?26:c-s;if(m<p)break;let f=36-p;d>_t(2147483647/f)&&ia("overflow"),d*=f}let u=a.length+1;s=Ed(r-l,u,l==0),_t(r/u)>2147483647-o&&ia("overflow"),o+=_t(r/u),r%=u,a.splice(r++,0,o)}return String.fromCodePoint(...a)},Fd=function(e){let a=[];e=Dd(e);let t=e.length,r=128,o=0,s=72;for(let l of e)l<128&&a.push(dn(l));let i=a.length,n=i;for(i&&a.push("-");n<t;){let l=2147483647;for(let d of e)d>=r&&d<l&&(l=d);let u=n+1;l-r>_t((2147483647-o)/u)&&ia("overflow"),o+=(l-r)*u,r=l;for(let d of e)if(d<r&&++o>2147483647&&ia("overflow"),d===r){let c=o;for(let m=36;;m+=36){let p=m<=s?1:m>=s+26?26:m-s;if(c<p)break;let f=c-p,h=36-p;a.push(dn(Ad(p+f%h,0))),c=_t(f/h)}a.push(dn(Ad(c,0))),s=Ed(o,u,n===i),o=0,++n}++o,++r}return a.join("")},Lp=function(e){return Pd(e,function(a){return fp.test(a)?Td(a.slice(4).toLowerCase()):a})},Ip=function(e){return Pd(e,function(a){return mp.test(a)?"xn--"+Fd(a):a})},bp={version:"2.3.1",ucs2:{decode:Dd,encode:xp},decode:Td,encode:Fd,toASCII:Ip,toUnicode:Lp};var cn=bp;var Nd=Object.defineProperty,Vd=(e,a)=>{let t={};for(var r in e)Nd(t,r,{get:e[r],enumerable:!0});return a||Nd(t,Symbol.toStringTag,{value:"Module"}),t},vp=Vd({arrayReplaceAt:()=>wp,asciiTrim:()=>Oo,callable:()=>Jd,escapeHtml:()=>la,escapeRE:()=>Tp,fromCodePoint:()=>$r,isMdAsciiPunct:()=>Xr,isPunctChar:()=>Qd,isPunctCharCode:()=>Jr,isSpace:()=>ve,isValidEntityCode:()=>xn,isWhiteSpace:()=>Vr,lib:()=>Fp,normalizeReference:()=>Uo,unescapeAll:()=>Ha,unescapeMd:()=>Rp});function Jd(e){let a=function(...t){return Reflect.construct(e,t,new.target&&new.target!==a?new.target:e)};return Object.defineProperty(a,"name",{value:e.name}),Object.setPrototypeOf(a,e),a.prototype=e.prototype,a}function wp(e,a,t){return[].concat(e.slice(0,a),t,e.slice(a+1))}function xn(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)===65535||(e&65535)===65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function $r(e){if(e>65535){e-=65536;let a=55296+(e>>10),t=56320+(e&1023);return String.fromCharCode(a,t)}return String.fromCharCode(e)}var Xd=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,yp=new RegExp(`${Xd.source}|${/&([a-z#][a-z0-9]{1,31});/gi.source}`,"gi"),kp=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Sp(e,a){if(a.charCodeAt(0)===35&&kp.test(a)){let r=a[1].toLowerCase()==="x"?parseInt(a.slice(2),16):parseInt(a.slice(1),10);return xn(r)?$r(r):e}let t=No(e);return t!==e?t:e}function Rp(e){return e.indexOf("\\")<0?e:e.replace(Xd,"$1")}function Ha(e){return e.indexOf("\\")<0&&e.indexOf("&")<0?e:e.replace(yp,function(a,t,r){return t||Sp(a,r)})}var Mp=/[&<>"]/,Ap=/[&<>"]/g,Pp={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"};function Dp(e){return Pp[e]}function la(e){return Mp.test(e)?e.replace(Ap,Dp):e}var Ep=/[.?*+^$[\]\\(){}|-]/g;function Tp(e){return e.replace(Ep,"\\$&")}function ve(e){switch(e){case 9:case 32:return!0}return!1}function Vr(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Qd(e){return Gr.test(e)||an.test(e)}function Jr(e){return Qd($r(e))}function Xr(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Uo(e){return e=e.trim().replace(/\s+/g," "),e.toLowerCase().toUpperCase()}function _d(e){return e===32||e===9||e===10||e===13}function Oo(e){let a=0;for(;a<e.length&&_d(e.charCodeAt(a));a++);let t=e.length-1;for(;t>=a&&_d(e.charCodeAt(t));t--);return e.slice(a,t+1)}var Fp={mdurl:Ys,ucmicro:on};function Np(e,a,t){let r,o,s,i,n=e.posMax,l=e.pos;for(e.pos=a+1,r=1;e.pos<n;){if(s=e.src.charCodeAt(e.pos),s===93&&(r--,r===0)){o=!0;break}if(i=e.pos,e.md.inline.skipToken(e),s===91){if(i===e.pos-1)r++;else if(t)return e.pos=l,-1}}let u=-1;return o&&(u=e.pos),e.pos=l,u}function _p(e,a,t){let r,o=a,s={ok:!1,pos:0,str:""};if(e.charCodeAt(o)===60){for(o++;o<t;){if(r=e.charCodeAt(o),r===10||r===60)return s;if(r===62)return s.pos=o+1,s.str=Ha(e.slice(a+1,o)),s.ok=!0,s;if(r===92&&o+1<t){o+=2;continue}o++}return s}let i=0;for(;o<t&&(r=e.charCodeAt(o),!(r===32||r<32||r===127));){if(r===92&&o+1<t){if(e.charCodeAt(o+1)===32){o++;continue}o+=2;continue}if(r===40&&(i++,i>32))return s;if(r===41){if(i===0)break;i--}o++}return a===o||i!==0||(s.str=Ha(e.slice(a,o)),s.pos=o,s.ok=!0),s}function Bp(e,a,t,r){let o,s=a,i={ok:!1,can_continue:!1,pos:0,str:"",marker:0};if(r)i.str=r.str,i.marker=r.marker;else{if(s>=t)return i;let n=e.charCodeAt(s);if(n!==34&&n!==39&&n!==40)return i;a++,s++,n===40&&(n=41),i.marker=n}for(;s<t;){if(o=e.charCodeAt(s),o===i.marker)return i.pos=s+1,i.str+=Ha(e.slice(a,s)),i.ok=!0,i;if(o===40&&i.marker===41)return i;o===92&&s+1<t&&s++,s++}return i.can_continue=!0,i.str+=Ha(e.slice(a,s)),i}var qp=Vd({parseLinkDestination:()=>_p,parseLinkLabel:()=>Np,parseLinkTitle:()=>Bp});function Qr(e){"@babel/helpers - typeof";return Qr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},Qr(e)}function Up(e,a){if(Qr(e)!="object"||!e)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var r=t.call(e,a||"default");if(Qr(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(a==="string"?String:Number)(e)}function Op(e){var a=Up(e,"string");return Qr(a)=="symbol"?a:a+""}function W(e,a,t){return(a=Op(a))in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}var Ra=class{constructor(e,a,t){W(this,"map",null),W(this,"level",0),W(this,"children",null),W(this,"content",""),W(this,"markup",""),W(this,"info",""),W(this,"block",!1),W(this,"hidden",!1),this.type=e,this.tag=a,this.attrs=null,this.nesting=t,this.meta=null}attrIndex(e){if(!this.attrs)return-1;let a=this.attrs;for(let t=0,r=a.length;t<r;t++)if(a[t][0]===e)return t;return-1}attrPush(e){this.attrs?this.attrs.push(e):this.attrs=[e]}attrSet(e,a){let t=this.attrIndex(e),r=[e,a];t<0?this.attrPush(r):this.attrs[t]=r}attrGet(e){let a=this.attrIndex(e),t=null;return a>=0&&(t=this.attrs[a][1]),t}attrJoin(e,a){let t=this.attrIndex(e);t<0?this.attrPush([e,a]):this.attrs[t][1]=`${this.attrs[t][1]} ${a}`}},Kr=class{constructor(){W(this,"__rules__",[]),W(this,"__cache__",null)}__find__(e){for(let a=0;a<this.__rules__.length;a++)if(this.__rules__[a].name===e)return a;return-1}__compile__(){let e=new Set;this.__rules__.forEach(a=>{a.enabled&&a.alt.forEach(t=>{t&&e.add(t)})}),this.__cache__=Object.create(null),this.__cache__[""]=[],this.__rules__.forEach(a=>{a.enabled&&this.__cache__[""].push(a.fn)}),e.forEach(a=>{this.__cache__[a]=[],this.__rules__.forEach(t=>{t.enabled&&t.alt.indexOf(a)>=0&&this.__cache__[a].push(t.fn)})})}at(e,a,t={}){let r=this.__find__(e);if(r===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__[r].fn=a,this.__rules__[r].alt=t.alt||[],this.__cache__=null}before(e,a,t,r={}){let o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o,0,{name:a,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null}after(e,a,t,r={}){let o=this.__find__(e);if(o===-1)throw new Error(`Parser rule not found: ${e}`);this.__rules__.splice(o+1,0,{name:a,enabled:!0,fn:t,alt:r.alt||[]}),this.__cache__=null}push(e,a,t={}){this.__rules__.push({name:e,enabled:!0,fn:a,alt:t.alt||[]}),this.__cache__=null}enable(e,a=!1){Array.isArray(e)||(e=[e]);let t=[];return e.forEach(r=>{let o=this.__find__(r);if(o<0){if(a)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!0,t.push(r)}),this.__cache__=null,t}enableOnly(e,a=!1){Array.isArray(e)||(e=[e]),this.__rules__.forEach(t=>{t.enabled=!1}),this.enable(e,a)}disable(e,a=!1){Array.isArray(e)||(e=[e]);let t=[];return e.forEach(r=>{let o=this.__find__(r);if(o<0){if(a)return;throw new Error(`Rules manager: invalid rule name ${r}`)}this.__rules__[o].enabled=!1,t.push(r)}),this.__cache__=null,t}getRules(e){return this.__cache__||this.__compile__(),this.__cache__[e]||[]}},Bt={};Bt.code_inline=function(e,a,t,r,o){let s=e[a];return`<code${o.renderAttrs(s)}>${la(s.content)}</code>`};Bt.code_block=function(e,a,t,r,o){let s=e[a];return`<pre${o.renderAttrs(s)}><code>${la(e[a].content)}</code></pre>
3
+ `};Bt.fence=function(e,a,t,r,o){let s=e[a],i=s.info?Ha(s.info).trim():"",n="",l="";if(i){let d=i.split(/(\s+)/g);n=d[0],l=d.slice(2).join("")}let u;if(t.highlight?u=t.highlight(s.content,n,l)||la(s.content):u=la(s.content),u.indexOf("<pre")===0)return u+`
4
+ `;if(i){let d=s.attrIndex("class"),c=s.attrs?s.attrs.slice():[];d<0?c.push(["class",`${t.langPrefix}${n}`]):(c[d]=[c[d][0],c[d][1]],c[d][1]+=` ${t.langPrefix}${n}`);let m={attrs:c};return`<pre><code${o.renderAttrs(m)}>${u}</code></pre>
5
+ `}return`<pre><code${o.renderAttrs(s)}>${u}</code></pre>
6
+ `};Bt.image=function(e,a,t,r,o){let s=e[a];return s.attrs[s.attrIndex("alt")][1]=o.renderInlineAsText(s.children,t,r),o.renderToken(e,a,t)};Bt.hardbreak=function(e,a,t){return t.xhtmlOut?`<br />
7
+ `:`<br>
8
+ `};Bt.softbreak=function(e,a,t){return t.breaks?t.xhtmlOut?`<br />
9
+ `:`<br>
10
+ `:`
11
+ `};Bt.text=function(e,a){return la(e[a].content)};Bt.html_block=function(e,a){return e[a].content};Bt.html_inline=function(e,a){return e[a].content};var Kd=class{constructor(){W(this,"rules",Object.assign({},Bt))}renderAttrs(e){let a,t,r;if(!e.attrs)return"";for(r="",a=0,t=e.attrs.length;a<t;a++)r+=` ${la(e.attrs[a][0])}="${la(String(e.attrs[a][1]))}"`;return r}renderToken(e,a,t){let r=e[a],o="";if(r.hidden)return"";let s=a-1;for(;s>=0&&e[s].hidden&&e[s].nesting===0;)s--;r.block&&r.nesting!==-1&&s>=0&&e[s].hidden&&e[s].nesting===-1&&(o+=`
12
+ `),o+=(r.nesting===-1?"</":"<")+r.tag,o+=this.renderAttrs(r),r.nesting===0&&t.xhtmlOut&&(o+=" /");let i=!1;if(r.block&&(i=!0,r.nesting===1)){let n=a+1;for(;n<e.length&&e[n].hidden&&e[n].nesting===0;)n++;if(n<e.length){let l=e[n];(l.type==="inline"||l.hidden||l.nesting===-1&&l.tag===r.tag)&&(i=!1)}}return o+=i?`>
13
+ `:">",o}renderInline(e,a,t){let r="",o=this.rules;for(let s=0,i=e.length;s<i;s++){let n=e[s].type;typeof o[n]<"u"?r+=o[n](e,s,a,t,this):r+=this.renderToken(e,s,a)}return r}renderInlineAsText(e,a,t){let r="";for(let o=0,s=e.length;o<s;o++)switch(e[o].type){case"text":case"code_inline":r+=e[o].content;break;case"image":r+=this.renderInlineAsText(e[o].children,a,t);break;case"html_inline":case"html_block":r+=e[o].content;break;case"softbreak":case"hardbreak":r+=`
14
+ `}return r}render(e,a,t){let r="",o=this.rules;for(let s=0,i=e.length;s<i;s++){let n=e[s].type;n==="inline"?r+=this.renderInline(e[s].children,a,t):typeof o[n]<"u"?r+=o[n](e,s,a,t,this):r+=this.renderToken(e,s,a)}return r}},Zd=class{constructor(e,a,t){W(this,"tokens",[]),W(this,"inlineMode",!1),W(this,"Token",Ra),this.src=e,this.env=t,this.md=a}},zp=/\r\n?/g,Hp=/\0/g;function jp(e){let a;a=e.src.replace(zp,`
15
+ `),a=a.replace(Hp,"\uFFFD"),e.src=a}function Gp(e){let a;e.inlineMode?(a=new e.Token("inline","",0),a.content=e.src,a.map=[0,1],a.children=[],e.tokens.push(a)):e.md.block.parse(e.src,e.md,e.env,e.tokens)}function Wp(e){let a=e.tokens,t=0;for(let r=0;r<a.length;r++)a[r].type!=="reference_definition"&&(r!==t&&(a[t]=a[r]),t++);a.length!==t&&(a.length=t)}function $p(e){let a=e.tokens;for(let t=0,r=a.length;t<r;t++){let o=a[t];o.type==="inline"&&e.md.inline.parse(o.content,e.md,e.env,o.children)}}function Vp(e){return/^<a[>\s]/i.test(e)}function Jp(e){return/^<\/a\s*>/i.test(e)}function Xp(e){let a=e.tokens;if(e.md.options.linkify)for(let t=0,r=a.length;t<r;t++){if(a[t].type!=="inline"||!e.md.linkify.test(a[t].content))continue;let o=a[t].children,s=[],i=0;for(let n=o.length-1;n>=0;n--){let l=o[n];if(l.type==="link_close"){for(n--;o[n].level!==l.level&&o[n].type!=="link_open";)n--;continue}if(l.type==="html_inline"&&(Vp(l.content)&&i>0&&i--,Jp(l.content)&&i++),!(i>0)&&l.type==="text"&&e.md.linkify.test(l.content)){let u=l.content,d=e.md.linkify.match(u),c=[],m=l.level,p=0;d.length>0&&d[0].index===0&&n>0&&o[n-1].type==="text_special"&&(d=d.slice(1));for(let f=0;f<d.length;f++){let h=d[f].url,g=e.md.normalizeLink(h);if(!e.md.validateLink(g))continue;let C=d[f].text;d[f].schema?d[f].schema==="mailto:"&&!/^mailto:/i.test(C)?C=e.md.normalizeLinkText(`mailto:${C}`).replace(/^mailto:/,""):C=e.md.normalizeLinkText(C):C=e.md.normalizeLinkText(`http://${C}`).replace(/^http:\/\//,"");let L=d[f].index;if(L>p){let k=new e.Token("text","",0);k.content=u.slice(p,L),k.level=m,c.push(k)}let x=new e.Token("link_open","a",1);x.attrs=[["href",g]],x.level=m++,x.markup="linkify",x.info="auto",c.push(x);let v=new e.Token("text","",0);v.content=C,v.level=m,c.push(v);let I=new e.Token("link_close","a",-1);I.level=--m,I.markup="linkify",I.info="auto",c.push(I),p=d[f].lastIndex}if(p<u.length){let f=new e.Token("text","",0);f.content=u.slice(p),f.level=m,c.push(f)}s.push({index:n,nodes:c})}}if(s.length>0){let n=o.length;for(let c of s)n+=c.nodes.length-1;let l=new Array(n),u=0,d=0;s.reverse();for(let c=0;c<o.length;c++){let m=s[u];if(m?.index===c){for(let p of m.nodes)l[d++]=p;u++}else l[d++]=o[c]}a[t].children=l}}}var Yd=/\+-|\.\.|\?\?\?\?|!!!!|,,|--/,Qp=/\((c|tm|r)\)/i,Kp=/\((c|tm|r)\)/gi,Zp={c:"\xA9",r:"\xAE",tm:"\u2122"};function Yp(e,a){return Zp[a.toLowerCase()]}function eh(e){let a=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r.type==="text"&&!a&&(r.content=r.content.replace(Kp,Yp)),r.type==="link_open"&&r.info==="auto"&&a--,r.type==="link_close"&&r.info==="auto"&&a++}}function th(e){let a=0;for(let t=e.length-1;t>=0;t--){let r=e[t];r.type==="text"&&!a&&Yd.test(r.content)&&(r.content=r.content.replace(/\+-/g,"\xB1").replace(/\.{2,}/g,"\u2026").replace(/([?!])…/g,"$1..").replace(/([?!]){4,}/g,"$1$1$1").replace(/,{2,}/g,",").replace(/(^|[^-])---(?=[^-]|$)/gm,"$1\u2014").replace(/(^|\s)--(?=\s|$)/gm,"$1\u2013").replace(/(^|[^-\s])--(?=[^-\s]|$)/gm,"$1\u2013")),r.type==="link_open"&&r.info==="auto"&&a--,r.type==="link_close"&&r.info==="auto"&&a++}}function ah(e){let a;if(e.md.options.typographer)for(a=e.tokens.length-1;a>=0;a--)e.tokens[a].type==="inline"&&(Qp.test(e.tokens[a].content)&&eh(e.tokens[a].children),Yd.test(e.tokens[a].content)&&th(e.tokens[a].children))}var rh=/['"]/,Bd=/['"]/g,qd="\u2019",oh=1e3;function Ud(e,a,t){for(;e.length>t;){let r=e.pop();r.isSingleQuote?a.single=r.prevSameQuoteIdx:a.double=r.prevSameQuoteIdx}}function _o(e,a,t,r){e[a]||(e[a]=[]),e[a].push({pos:t,ch:r})}function sh(e,a){let t="",r=0;a.sort((o,s)=>o.pos-s.pos);for(let o=0;o<a.length;o++){let s=a[o];t+=e.slice(r,s.pos)+s.ch,r=s.pos+1}return t+e.slice(r)}function nh(e,a){let t,r=[],o={single:-1,double:-1},s={};for(let i=0;i<e.length;i++){let n=e[i],l=e[i].level;for(t=r.length-1;t>=0&&!(r[t].level<=l);t--);if(Ud(r,o,t+1),n.type!=="text")continue;let u=n.content,d=0,c=u.length;e:for(;d<c;){Bd.lastIndex=d;let m=Bd.exec(u);if(!m)break;let p=!0,f=!0;d=m.index+1;let h=m[0]==="'",g=32;if(m.index-1>=0)g=u.charCodeAt(m.index-1);else for(t=i-1;t>=0&&!(e[t].type==="softbreak"||e[t].type==="hardbreak");t--)if(e[t].content){g=e[t].content.charCodeAt(e[t].content.length-1);break}let C=32;if(d<c)C=u.charCodeAt(d);else for(t=i+1;t<e.length&&!(e[t].type==="softbreak"||e[t].type==="hardbreak");t++)if(e[t].content){C=e[t].content.charCodeAt(0);break}let L=Xr(g)||Jr(g),x=Xr(C)||Jr(C),v=Vr(g),I=Vr(C);if(I?p=!1:x&&(v||L||(p=!1)),v?f=!1:L&&(I||x||(f=!1)),C===34&&m[0]==='"'&&g>=48&&g<=57&&(f=p=!1),p&&f&&(p=L,f=x),!p&&!f){h&&_o(s,i,m.index,qd);continue}if(f&&(t=h?o.single:o.double,t>=0&&r[t].level===l)){let k=r[t],y,N;h?(y=a.md.options.quotes[2],N=a.md.options.quotes[3]):(y=a.md.options.quotes[0],N=a.md.options.quotes[1]),_o(s,i,m.index,N),_o(s,k.tokenIdx,k.contentPos,y),Ud(r,o,t);continue e}if(p){if(r.length>=oh)return;r.push({tokenIdx:i,contentPos:m.index,isSingleQuote:h,level:l,prevSameQuoteIdx:h?o.single:o.double}),h?o.single=r.length-1:o.double=r.length-1}else f&&h&&_o(s,i,m.index,qd)}}Object.keys(s).forEach(function(i){let n=Number(i);e[n].content=sh(e[n].content,s[i])})}function ih(e){if(e.md.options.typographer)for(let a=e.tokens.length-1;a>=0;a--)e.tokens[a].type!=="inline"||!rh.test(e.tokens[a].content)||nh(e.tokens[a].children,e)}function lh(e){let a,t,r=e.length;for(a=0;a<r;a++)e[a].type==="text_special"&&(e[a].type="text");for(a=t=0;a<r;a++)e[a].type==="text"&&a+1<r&&e[a+1].type==="text"?e[a+1].content=e[a].content+e[a+1].content:(a!==t&&(e[t]=e[a]),t++);a!==t&&(e.length=t)}function uh(e){let a,t,r=e.tokens,o=r.length;for(let s=0;s<o;s++){if(r[s].type!=="inline")continue;let i=r[s].children,n=i.length;for(a=0;a<n;a++)i[a].type==="text_special"&&(i[a].type="text"),i[a].children&&lh(i[a].children);for(a=t=0;a<n;a++)i[a].type==="text"&&a+1<n&&i[a+1].type==="text"?i[a+1].content=i[a].content+i[a+1].content:(a!==t&&(i[t]=i[a]),t++);a!==t&&(i.length=t)}}var fn=[["normalize",jp],["block",Gp],["strip_references",Wp],["inline",$p],["linkify",Xp],["replacements",ah],["smartquotes",ih],["text_join",uh]],ec=class{constructor(){W(this,"ruler",new Kr),W(this,"State",Zd);for(let e=0;e<fn.length;e++)this.ruler.push(fn[e][0],fn[e][1])}process(e){let a=this.ruler.getRules("");for(let t=0,r=a.length;t<r;t++)a[t](e)}},tc=class{constructor(e,a,t,r){W(this,"bMarks",[]),W(this,"eMarks",[]),W(this,"tShift",[]),W(this,"sCount",[]),W(this,"bsCount",[]),W(this,"blkIndent",0),W(this,"line",0),W(this,"lineMax",0),W(this,"tight",!1),W(this,"listIndent",-1),W(this,"parentType","root"),W(this,"level",0),W(this,"Token",Ra),this.src=e,this.md=a,this.env=t,this.tokens=r;let o=this.src;for(let s=0,i=0,n=0,l=0,u=o.length,d=!1;i<u;i++){let c=o.charCodeAt(i);if(!d)if(ve(c)){n++,c===9?l+=4-l%4:l++;continue}else d=!0;(c===10||i===u-1)&&(c!==10&&i++,this.bMarks.push(s),this.eMarks.push(i),this.tShift.push(n),this.sCount.push(l),this.bsCount.push(0),d=!1,n=0,l=0,s=i+1)}this.bMarks.push(o.length),this.eMarks.push(o.length),this.tShift.push(0),this.sCount.push(0),this.bsCount.push(0),this.lineMax=this.bMarks.length-1}push(e,a,t){let r=new Ra(e,a,t);return r.block=!0,t<0&&this.level--,r.level=this.level,t>0&&this.level++,this.tokens.push(r),r}isEmpty(e){return this.bMarks[e]+this.tShift[e]>=this.eMarks[e]}skipEmptyLines(e){for(let a=this.lineMax;e<a&&!(this.bMarks[e]+this.tShift[e]<this.eMarks[e]);e++);return e}skipSpaces(e){for(let a=this.src.length;e<a&&ve(this.src.charCodeAt(e));e++);return e}skipSpacesBack(e,a){if(e<=a)return e;for(;e>a;)if(!ve(this.src.charCodeAt(--e)))return e+1;return e}skipChars(e,a){for(let t=this.src.length;e<t&&this.src.charCodeAt(e)===a;e++);return e}skipCharsBack(e,a,t){if(e<=t)return e;for(;e>t;)if(a!==this.src.charCodeAt(--e))return e+1;return e}getLines(e,a,t,r){if(e>=a)return"";let o=new Array(a-e);for(let s=0,i=e;i<a;i++,s++){let n=0,l=this.bMarks[i],u=l,d;for(i+1<a||r?d=this.eMarks[i]+1:d=this.eMarks[i];u<d&&n<t;){let c=this.src.charCodeAt(u);if(ve(c))c===9?n+=4-(n+this.bsCount[i])%4:n++;else if(u-l<this.tShift[i])n++;else break;u++}n>t?o[s]=new Array(n-t+1).join(" ")+this.src.slice(u,d):o[s]=this.src.slice(u,d)}return o.join("")}},dh=65536;function mn(e,a){let t=e.bMarks[a]+e.tShift[a],r=e.eMarks[a];return e.src.slice(t,r)}function Od(e){let a=[],t=e.length,r=0,o=e.charCodeAt(r),s=!1,i=0,n="";for(;r<t;)o===124&&(s?(n+=e.substring(i,r-1),i=r):(a.push(n+e.substring(i,r)),n="",i=r+1)),s=o===92,r++,o=e.charCodeAt(r);return a.push(n+e.substring(i)),a}function ch(e,a,t,r){if(a+2>t)return!1;let o=a+1;if(e.sCount[o]<e.blkIndent||e.sCount[o]-e.blkIndent>=4)return!1;let s=e.bMarks[o]+e.tShift[o];if(s>=e.eMarks[o])return!1;let i=e.src.charCodeAt(s++);if(i!==124&&i!==45&&i!==58||s>=e.eMarks[o])return!1;let n=e.src.charCodeAt(s++);if(n!==124&&n!==45&&n!==58&&!ve(n)||i===45&&ve(n))return!1;for(;s<e.eMarks[o];){let v=e.src.charCodeAt(s);if(v!==124&&v!==45&&v!==58&&!ve(v))return!1;s++}let l=mn(e,a+1),u=l.split("|"),d=[];for(let v=0;v<u.length;v++){let I=u[v].trim();if(!I){if(v===0||v===u.length-1)continue;return!1}if(!/^:?-+:?$/.test(I))return!1;I.charCodeAt(I.length-1)===58?d.push(I.charCodeAt(0)===58?"center":"right"):I.charCodeAt(0)===58?d.push("left"):d.push("")}if(l=mn(e,a).trim(),l.indexOf("|")===-1||e.sCount[a]-e.blkIndent>=4)return!1;u=Od(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop();let c=u.length;if(c===0||c!==d.length)return!1;if(r)return!0;let m=e.parentType;e.parentType="table";let p=e.md.block.ruler.getRules("blockquote"),f=e.push("table_open","table",1),h=[a,0];f.map=h;let g=e.push("thead_open","thead",1);g.map=[a,a+1];let C=e.push("tr_open","tr",1);C.map=[a,a+1];for(let v=0;v<u.length;v++){let I=e.push("th_open","th",1);d[v]&&(I.attrs=[["style",`text-align:${d[v]}`]]);let k=e.push("inline","",0);k.content=u[v].trim(),k.children=[],e.push("th_close","th",-1)}e.push("tr_close","tr",-1),e.push("thead_close","thead",-1);let L,x=0;for(o=a+2;o<t&&!(e.sCount[o]<e.blkIndent);o++){let v=!1;for(let k=0,y=p.length;k<y;k++)if(p[k](e,o,t,!0)){v=!0;break}if(v||(l=mn(e,o).trim(),!l)||e.sCount[o]-e.blkIndent>=4||(u=Od(l),u.length&&u[0]===""&&u.shift(),u.length&&u[u.length-1]===""&&u.pop(),x+=c-u.length,x>dh))break;if(o===a+2){let k=e.push("tbody_open","tbody",1);k.map=L=[a+2,0]}let I=e.push("tr_open","tr",1);I.map=[o,o+1];for(let k=0;k<c;k++){let y=e.push("td_open","td",1);d[k]&&(y.attrs=[["style",`text-align:${d[k]}`]]);let N=e.push("inline","",0);N.content=u[k]?u[k].trim():"",N.children=[],e.push("td_close","td",-1)}e.push("tr_close","tr",-1)}return L&&(e.push("tbody_close","tbody",-1),L[1]=o),e.push("table_close","table",-1),h[1]=o,e.parentType=m,e.line=o,!0}function fh(e,a,t){if(e.sCount[a]-e.blkIndent<4)return!1;let r=a+1,o=r;for(;r<t;){if(e.isEmpty(r)){r++;continue}if(e.sCount[r]-e.blkIndent>=4){r++,o=r;continue}break}e.line=o;let s=e.push("code_block","code",0);return s.content=e.getLines(a,o,4+e.blkIndent,!1)+`
16
+ `,s.map=[a,e.line],!0}function mh(e,a,t,r){let o=e.bMarks[a]+e.tShift[a],s=e.eMarks[a];if(e.sCount[a]-e.blkIndent>=4||o+3>s)return!1;let i=e.src.charCodeAt(o);if(i!==126&&i!==96)return!1;let n=o;o=e.skipChars(o,i);let l=o-n;if(l<3)return!1;let u=e.src.slice(n,o),d=e.src.slice(o,s);if(i===96&&d.indexOf(String.fromCharCode(i))>=0)return!1;if(r)return!0;let c=a,m=!1;for(;c++,!(c>=t||(o=n=e.bMarks[c]+e.tShift[c],s=e.eMarks[c],o<s&&e.sCount[c]<e.blkIndent));)if(e.src.charCodeAt(o)===i&&!(e.sCount[c]-e.blkIndent>=4)&&(o=e.skipChars(o,i),!(o-n<l)&&(o=e.skipSpaces(o),!(o<s)))){m=!0;break}l=e.sCount[a],e.line=c+(m?1:0);let p=e.push("fence","code",0);return p.info=d,p.content=e.getLines(a+1,c,l,!0),p.markup=u,p.map=[a,e.line],!0}function ph(e,a,t,r){let o=e.bMarks[a]+e.tShift[a],s=e.eMarks[a],i=e.lineMax;if(e.sCount[a]-e.blkIndent>=4||e.src.charCodeAt(o)!==62)return!1;if(r)return!0;let n=[],l=[],u=[],d=[],c=e.md.block.ruler.getRules("blockquote"),m=e.parentType;e.parentType="blockquote";let p=!1,f;for(f=a;f<t;f++){let x=e.sCount[f]<e.blkIndent;if(o=e.bMarks[f]+e.tShift[f],s=e.eMarks[f],o>=s)break;if(e.src.charCodeAt(o++)===62&&!x){let I=e.sCount[f]+1,k,y;e.src.charCodeAt(o)===32?(o++,I++,y=!1,k=!0):e.src.charCodeAt(o)===9?(k=!0,(e.bsCount[f]+I)%4===3?(o++,I++,y=!1):y=!0):k=!1;let N=I;for(n.push(e.bMarks[f]),e.bMarks[f]=o;o<s;){let q=e.src.charCodeAt(o);if(ve(q))q===9?N+=4-(N+e.bsCount[f]+(y?1:0))%4:N++;else break;o++}p=o>=s,l.push(e.bsCount[f]),e.bsCount[f]=e.sCount[f]+1+(k?1:0),u.push(e.sCount[f]),e.sCount[f]=N-I,d.push(e.tShift[f]),e.tShift[f]=o-e.bMarks[f];continue}if(p)break;let v=!1;for(let I=0,k=c.length;I<k;I++)if(c[I](e,f,t,!0)){v=!0;break}if(v){e.lineMax=f,e.blkIndent!==0&&(n.push(e.bMarks[f]),l.push(e.bsCount[f]),d.push(e.tShift[f]),u.push(e.sCount[f]),e.sCount[f]-=e.blkIndent);break}n.push(e.bMarks[f]),l.push(e.bsCount[f]),d.push(e.tShift[f]),u.push(e.sCount[f]),e.sCount[f]=-1}let h=e.blkIndent;e.blkIndent=0;let g=e.push("blockquote_open","blockquote",1);g.markup=">";let C=[a,0];g.map=C,e.md.block.tokenize(e,a,f);let L=e.push("blockquote_close","blockquote",-1);L.markup=">",e.lineMax=i,e.parentType=m,C[1]=e.line;for(let x=0;x<d.length;x++)e.bMarks[x+a]=n[x],e.tShift[x+a]=d[x],e.sCount[x+a]=u[x],e.bsCount[x+a]=l[x];return e.blkIndent=h,!0}function hh(e,a,t,r){let o=e.eMarks[a];if(e.sCount[a]-e.blkIndent>=4)return!1;let s=e.bMarks[a]+e.tShift[a],i=e.src.charCodeAt(s++);if(i!==42&&i!==45&&i!==95)return!1;let n=1;for(;s<o;){let u=e.src.charCodeAt(s++);if(u!==i&&!ve(u))return!1;u===i&&n++}if(n<3)return!1;if(r)return!0;e.line=a+1;let l=e.push("hr","hr",0);return l.map=[a,e.line],l.markup=Array(n+1).join(String.fromCharCode(i)),!0}function zd(e,a){let t=e.eMarks[a],r=e.bMarks[a]+e.tShift[a],o=e.src.charCodeAt(r++);return o!==42&&o!==45&&o!==43||r<t&&!ve(e.src.charCodeAt(r))?-1:r}function Hd(e,a){let t=e.bMarks[a]+e.tShift[a],r=e.eMarks[a],o=t;if(o+1>=r)return-1;let s=e.src.charCodeAt(o++);if(s<48||s>57)return-1;for(;;){if(o>=r)return-1;if(s=e.src.charCodeAt(o++),s>=48&&s<=57){if(o-t>=10)return-1;continue}if(s===41||s===46)break;return-1}return o<r&&(s=e.src.charCodeAt(o),!ve(s))?-1:o}function gh(e,a){let t=e.level+2;for(let r=a+2,o=e.tokens.length-2;r<o;r++)e.tokens[r].level===t&&e.tokens[r].type==="paragraph_open"&&(e.tokens[r+2].hidden=!0,e.tokens[r].hidden=!0,r+=2)}function xh(e,a,t,r){let o,s,i,n,l=a,u=!0;if(e.sCount[l]-e.blkIndent>=4||e.listIndent>=0&&e.sCount[l]-e.listIndent>=4&&e.sCount[l]<e.blkIndent)return!1;let d=!1;r&&e.parentType==="paragraph"&&e.sCount[l]>=e.blkIndent&&(d=!0);let c,m,p;if((p=Hd(e,l))>=0){if(c=!0,i=e.bMarks[l]+e.tShift[l],m=Number(e.src.slice(i,p-1)),d&&m!==1)return!1}else if((p=zd(e,l))>=0)c=!1;else return!1;if(d&&e.skipSpaces(p)>=e.eMarks[l])return!1;if(r)return!0;let f=e.src.charCodeAt(p-1),h=e.tokens.length;c?(n=e.push("ordered_list_open","ol",1),m!==1&&(n.attrs=[["start",m]])):n=e.push("bullet_list_open","ul",1);let g=[l,0];n.map=g,n.markup=String.fromCharCode(f);let C=!1,L=e.md.block.ruler.getRules("list"),x=e.parentType;for(e.parentType="list";l<t;){s=p,o=e.eMarks[l];let v=e.sCount[l]+p-(e.bMarks[l]+e.tShift[l]),I=v;for(;s<o;){let S=e.src.charCodeAt(s);if(S===9)I+=4-(I+e.bsCount[l])%4;else if(S===32)I++;else break;s++}let k=s,y;k>=o?y=1:y=I-v,y>4&&(y=1);let N=v+y;n=e.push("list_item_open","li",1),n.markup=String.fromCharCode(f);let q=[l,0];n.map=q,c&&(n.info=e.src.slice(i,p-1));let _=e.tight,B=e.tShift[l],K=e.sCount[l],P=e.listIndent;if(e.listIndent=e.blkIndent,e.blkIndent=N,e.tight=!0,e.tShift[l]=k-e.bMarks[l],e.sCount[l]=I,k>=o&&e.isEmpty(l+1)?e.line=Math.min(e.line+2,t):e.md.block.tokenize(e,l,t),(!e.tight||C)&&(u=!1),C=e.line-l>1&&e.isEmpty(e.line-1),e.blkIndent=e.listIndent,e.listIndent=P,e.tShift[l]=B,e.sCount[l]=K,e.tight=_,n=e.push("list_item_close","li",-1),n.markup=String.fromCharCode(f),l=e.line,q[1]=l,l>=t||e.sCount[l]<e.blkIndent||e.sCount[l]-e.blkIndent>=4)break;let F=!1;for(let S=0,z=L.length;S<z;S++)if(L[S](e,l,t,!0)){F=!0;break}if(F)break;if(c){if(p=Hd(e,l),p<0)break;i=e.bMarks[l]+e.tShift[l]}else if(p=zd(e,l),p<0)break;if(f!==e.src.charCodeAt(p-1))break}return c?n=e.push("ordered_list_close","ol",-1):n=e.push("bullet_list_close","ul",-1),n.markup=String.fromCharCode(f),g[1]=l,e.line=l,e.parentType=x,u&&gh(e,h),!0}var pn=999;function Ch(e){let a=e.length;for(let t=0;t<e.length-1;t++){let r=e.charCodeAt(t);if(r<55296||r>56319)continue;let o=e.charCodeAt(t+1);o>=56320&&o<=57343&&(a--,t++)}return a}function Wr(e,a){return Math.min(e.eMarks[a]+1,e.src.length)}function Bo(e,a){let t=e.lineMax;if(a>=t||e.isEmpty(a))return-1;let r=!1;if(e.sCount[a]-e.blkIndent>3&&(r=!0),e.sCount[a]<0&&(r=!0),!r){let o=e.md.block.ruler.getRules("reference"),s=e.parentType;e.parentType="reference";let i=!1;for(let n=0,l=o.length;n<l;n++)if(o[n](e,a,t,!0)){i=!0;break}if(e.parentType=s,i)return-1}return e.bMarks[a]+e.tShift[a]}function Lh(e,a,t,r){let o=e.src,s=e.bMarks[a]+e.tShift[a],i=a+1;if(e.sCount[a]-e.blkIndent>=4||o.charCodeAt(s)!==91)return!1;let n=Wr(e,a),l="",u=-1,d=++s;for(;s<n;){if(l.length+s-d>pn*2)return!1;let k=o.charCodeAt(s);if(k===91)return!1;if(k===93){u=s;break}if(k===92&&(k=o.charCodeAt(++s)),k===10&&s<n){let y=Bo(e,i);if(y<0)return!1;l+=o.slice(d,n),s=d=y,n=Wr(e,i++);continue}s++}if(u<0||o.charCodeAt(u+1)!==58||(l+=o.slice(d,u),l.length>pn&&Ch(l)>pn))return!1;for(s=u+2;s<n;){let k=o.charCodeAt(s);if(k===10){let y=Bo(e,i);if(y<0)break;s=y,n=Wr(e,i++)}else if(ve(k))s++;else break}let c=e.md.helpers.parseLinkDestination(o,s,n);if(!c.ok)return!1;let m=e.md.normalizeLink(c.str);if(!e.md.validateLink(m))return!1;s=c.pos;let p=s,f=n,h=i;for(;s<n;){let k=o.charCodeAt(s);if(k===10){let y=Bo(e,i);if(y<0)break;s=y,n=Wr(e,i++)}else if(ve(k))s++;else break}let g=s,C=e.md.helpers.parseLinkTitle(o,s,n);for(;C.can_continue;){let k=Bo(e,i);if(k<0)break;s=k,n=Wr(e,i++),C=e.md.helpers.parseLinkTitle(o,s,n,C)}let L;for(g!==p&&C.ok?(L=C.str,s=C.pos):(L="",s=p,n=f,i=h);s<n&&ve(o.charCodeAt(s));)s++;if(s<n&&o.charCodeAt(s)!==10&&L)for(L="",s=p,n=f,i=h;s<n&&ve(o.charCodeAt(s));)s++;if(s<n&&o.charCodeAt(s)!==10)return!1;let x=Uo(l);if(!x)return!1;if(r)return!0;typeof e.env.references>"u"&&(e.env.references={}),typeof e.env.references[x]>"u"&&(e.env.references[x]={title:L,href:m});let v=e.push("reference_definition","",0);v.map=[a,i],v.hidden=!0;let I=Object.create(null);return I.label=x,v.meta=I,e.line=i,!0}var Ih=["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"],ac=`<[A-Za-z][A-Za-z0-9\\-]*(?:\\s+[a-zA-Z_:][a-zA-Z0-9:._-]*(?:\\s*=\\s*(?:[^"'=<>\`\\x00-\\x20]+|'[^']*'|"[^"]*"))?)*\\s*\\/?>`,rc="<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>";new RegExp(`^(?:${ac}|${rc}|<!---?>|<!--(?:[^-]|-[^-]|--[^>])*-->|<[?][\\s\\S]*?[?]>|<![A-Za-z][^>]*>|<!\\[CDATA\\[[\\s\\S]*?\\]\\]>)`);var oc=new RegExp(`^(?:${ac}|${rc})`),Sa=[[/^<(script|pre|style|textarea)(?=(\s|>|$))/i,/<\/(script|pre|style|textarea)>/i,!0],[/^<!--/,/-->/,!0],[/^<\?/,/\?>/,!0],[/^<![A-Za-z]/,/>/,!0],[/^<!\[CDATA\[/,/\]\]>/,!0],[new RegExp(`^</?(${Ih.join("|")})(?=(\\s|/?>|$))`,"i"),/^$/,!0],[new RegExp(`${oc.source}\\s*$`),/^$/,!1]];function bh(e,a,t,r){let o=e.bMarks[a]+e.tShift[a],s=e.eMarks[a];if(e.sCount[a]-e.blkIndent>=4||!e.md.options.html||e.src.charCodeAt(o)!==60)return!1;let i=e.src.slice(o,s),n=0;for(;n<Sa.length&&!Sa[n][0].test(i);n++);if(n===Sa.length)return!1;if(r)return Sa[n][2];let l=a+1,u=Sa[n][1].test("");if(!Sa[n][1].test(i)){for(;l<t&&!(e.sCount[l]<e.blkIndent&&(u||!e.isEmpty(l)));l++)if(o=e.bMarks[l]+e.tShift[l],s=e.eMarks[l],i=e.src.slice(o,s),Sa[n][1].test(i)){i.length!==0&&l++;break}}e.line=l;let d=e.push("html_block","",0);return d.map=[a,l],d.content=e.getLines(a,l,e.blkIndent,!0),!0}function vh(e,a,t,r){let o=e.bMarks[a]+e.tShift[a],s=e.eMarks[a];if(e.sCount[a]-e.blkIndent>=4)return!1;let i=e.src.charCodeAt(o);if(i!==35||o>=s)return!1;let n=1;for(i=e.src.charCodeAt(++o);i===35&&o<s&&n<=6;)n++,i=e.src.charCodeAt(++o);if(n>6||o<s&&!ve(i))return!1;if(r)return!0;s=e.skipSpacesBack(s,o);let l=e.skipCharsBack(s,35,o);l>o&&ve(e.src.charCodeAt(l-1))&&(s=l),e.line=a+1;let u=e.push("heading_open",`h${n}`,1);u.markup="########".slice(0,n),u.map=[a,e.line];let d=e.push("inline","",0);d.content=Oo(e.src.slice(o,s)),d.map=[a,e.line],d.children=[];let c=e.push("heading_close",`h${n}`,-1);return c.markup="########".slice(0,n),!0}function wh(e,a,t){let r=e.md.block.ruler.getRules("paragraph");if(e.sCount[a]-e.blkIndent>=4)return!1;let o=e.parentType;e.parentType="paragraph";let s=0,i,n=a+1;for(;n<t&&!e.isEmpty(n);n++){if(e.sCount[n]-e.blkIndent>3)continue;if(e.sCount[n]>=e.blkIndent){let p=e.bMarks[n]+e.tShift[n],f=e.eMarks[n];if(p<f&&(i=e.src.charCodeAt(p),(i===45||i===61)&&(p=e.skipChars(p,i),p=e.skipSpaces(p),p>=f))){s=i===61?1:2;break}}if(e.sCount[n]<0)continue;let m=!1;for(let p=0,f=r.length;p<f;p++)if(r[p](e,n,t,!0)){m=!0;break}if(m)break}if(!s)return e.parentType=o,!1;let l=Oo(e.getLines(a,n,e.blkIndent,!1));e.line=n+1;let u=e.push("heading_open",`h${s}`,1);u.markup=String.fromCharCode(i),u.map=[a,e.line];let d=e.push("inline","",0);d.content=l,d.map=[a,e.line-1],d.children=[];let c=e.push("heading_close",`h${s}`,-1);return c.markup=String.fromCharCode(i),e.parentType=o,!0}function yh(e,a,t){let r=e.md.block.ruler.getRules("paragraph"),o=e.parentType,s=a+1;for(e.parentType="paragraph";s<t&&!e.isEmpty(s);s++){if(e.sCount[s]-e.blkIndent>3||e.sCount[s]<0)continue;let u=!1;for(let d=0,c=r.length;d<c;d++)if(r[d](e,s,t,!0)){u=!0;break}if(u)break}let i=Oo(e.getLines(a,s,e.blkIndent,!1));e.line=s;let n=e.push("paragraph_open","p",1);n.map=[a,e.line];let l=e.push("inline","",0);return l.content=i,l.map=[a,e.line],l.children=[],e.push("paragraph_close","p",-1),e.parentType=o,!0}var qo=[["table",ch,["paragraph","reference"]],["code",fh],["fence",mh,["paragraph","reference","blockquote","list"]],["blockquote",ph,["paragraph","reference","blockquote","list"]],["hr",hh,["paragraph","reference","blockquote","list"]],["list",xh,["paragraph","reference","blockquote"]],["reference",Lh],["html_block",bh,["paragraph","reference","blockquote"]],["heading",vh,["paragraph","reference","blockquote"]],["lheading",wh],["paragraph",yh]],sc=class{constructor(){W(this,"ruler",new Kr),W(this,"State",tc);for(let e=0;e<qo.length;e++)this.ruler.push(qo[e][0],qo[e][1],{alt:(qo[e][2]||[]).slice()})}tokenize(e,a,t){let r=this.ruler.getRules(""),o=r.length,s=e.md.options.maxNesting,i=a,n=!1;for(;i<t&&(e.line=i=e.skipEmptyLines(i),!(i>=t||e.sCount[i]<e.blkIndent));){if(e.level>=s){e.line=t;break}let l=e.line,u=!1;for(let d=0;d<o;d++)if(u=r[d](e,i,t,!1),u){if(l>=e.line)throw new Error("block rule didn't increment state.line");break}if(!u)throw new Error("none of the block rules matched");e.tight=!n,e.isEmpty(e.line-1)&&(n=!0),i=e.line,i<t&&e.isEmpty(i)&&(n=!0,i++,e.line=i)}}parse(e,a,t,r){if(!e)return;let o=new this.State(e,a,t,r);this.tokenize(o,o.line,o.lineMax)}},nc=class{constructor(e,a,t,r){W(this,"pos",0),W(this,"level",0),W(this,"pending",""),W(this,"pendingLevel",0),W(this,"cache",{}),W(this,"backticks",{}),W(this,"backticksScanned",!1),W(this,"skipHtmlSpecial",!1),W(this,"linkLevel",0),W(this,"delimiters",[]),W(this,"_prev_delimiters",[]),W(this,"Token",Ra),this.src=e,this.env=t,this.md=a,this.tokens=r,this.tokens_meta=Array(r.length),this.posMax=this.src.length}pushPending(){let e=new Ra("text","",0);return e.content=this.pending,e.level=this.pendingLevel,this.tokens.push(e),this.pending="",e}push(e,a,t){this.pending&&this.pushPending();let r=new Ra(e,a,t),o;return t<0&&(this.level--,this.delimiters=this._prev_delimiters.pop()),r.level=this.level,t>0&&(this.level++,this._prev_delimiters.push(this.delimiters),this.delimiters=[],o={delimiters:this.delimiters}),this.pendingLevel=this.level,this.tokens.push(r),this.tokens_meta.push(o),r}scanDelims(e,a){let t=this.posMax,r=this.src.charCodeAt(e),o;if(e===0)o=32;else if(e===1)o=this.src.charCodeAt(0),(o&63488)===55296&&(o=65533);else if(o=this.src.charCodeAt(e-1),(o&64512)===56320){let f=this.src.charCodeAt(e-2);o=(f&64512)===55296?65536+(f-55296<<10)+(o-56320):65533}else(o&64512)===55296&&(o=65533);let s=e;for(;s<t&&this.src.charCodeAt(s)===r;)s++;let i=s-e,n=s<t?this.src.charCodeAt(s):32;if((n&64512)===55296){let f=this.src.charCodeAt(s+1);n=(f&64512)===56320?65536+(n-55296<<10)+(f-56320):65533}else(n&64512)===56320&&(n=65533);let l=Xr(o)||Jr(o),u=Xr(n)||Jr(n),d=Vr(o),c=Vr(n),m=!c&&(!u||d||l),p=!d&&(!l||c||u);return{can_open:m&&(a||!p||l),can_close:p&&(a||!m||u),length:i}}};function kh(e){switch(e){case 10:case 33:case 35:case 36:case 37:case 38:case 42:case 43:case 45:case 58:case 60:case 61:case 62:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 125:case 126:return!0;default:return!1}}function Sh(e,a){let t=e.pos;for(;t<e.posMax&&!kh(e.src.charCodeAt(t));)t++;return t===e.pos?!1:(a||(e.pending+=e.src.slice(e.pos,t)),e.pos=t,!0)}function Rh(e){return e>=65&&e<=90||e>=97&&e<=122}function Mh(e){return e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===45||e===46}function Ah(e,a){if(!e.md.options.linkify||e.linkLevel>0)return!1;let t=e.pos,r=e.posMax;if(t+3>r||e.src.charCodeAt(t)!==58||e.src.charCodeAt(t+1)!==47||e.src.charCodeAt(t+2)!==47)return!1;let o=t-Math.min(10,e.pending.length,t),s=t;for(;s>o&&Mh(e.src.charCodeAt(s-1));)s--;if(s===t||!Rh(e.src.charCodeAt(s)))return!1;let i=t-s,n=e.md.linkify.matchAtStart(e.src.slice(s));if(!n)return!1;let l=n.url;if(l.length<=i)return!1;let u=l.length;for(;u>0&&l.charCodeAt(u-1)===42;)u--;u!==l.length&&(l=l.slice(0,u));let d=e.md.normalizeLink(l);if(!e.md.validateLink(d))return!1;if(!a){e.pending=e.pending.slice(0,-i);let c=e.push("link_open","a",1);c.attrs=[["href",d]],c.markup="linkify",c.info="auto";let m=e.push("text","",0);m.content=e.md.normalizeLinkText(l);let p=e.push("link_close","a",-1);p.markup="linkify",p.info="auto"}return e.pos+=l.length-i,!0}function Ph(e,a){let t=e.pos;if(e.src.charCodeAt(t)!==10)return!1;let r=e.pending.length-1,o=e.posMax;if(!a)if(r>=0&&e.pending.charCodeAt(r)===32)if(r>=1&&e.pending.charCodeAt(r-1)===32){let s=r-1;for(;s>=1&&e.pending.charCodeAt(s-1)===32;)s--;e.pending=e.pending.slice(0,s),e.push("hardbreak","br",0)}else e.pending=e.pending.slice(0,-1),e.push("softbreak","br",0);else e.push("softbreak","br",0);for(t++;t<o&&ve(e.src.charCodeAt(t));)t++;return e.pos=t,!0}var Cn=[];for(let e=0;e<256;e++)Cn.push(0);"\\!\"#$%&'()*+,./:;<=>?@[]^_`{|}~-".split("").forEach(function(e){Cn[e.charCodeAt(0)]=1});function Dh(e,a){let t=e.pos,r=e.posMax;if(e.src.charCodeAt(t)!==92||(t++,t>=r))return!1;let o=e.src.charCodeAt(t);if(o===10){for(a||e.push("hardbreak","br",0),t++;t<r&&(o=e.src.charCodeAt(t),!!ve(o));)t++;return e.pos=t,!0}if(o===32){if(!a){let n=e.push("text_special","",0);n.content="\\",n.markup="\\",n.info="escape"}return e.pos=t,!0}let s=e.src[t];if(o>=55296&&o<=56319&&t+1<r){let n=e.src.charCodeAt(t+1);n>=56320&&n<=57343&&(s+=e.src[t+1],t++)}let i="\\"+s;if(!a){let n=e.push("text_special","",0);o<256&&Cn[o]!==0?n.content=s:n.content=i,n.markup=i,n.info="escape"}return e.pos=t+1,!0}function Eh(e){let a={},t=0;for(;(t=e.indexOf("`",t))!==-1;){let r=t;for(;e.charCodeAt(++t)===96;);a[t-r]=r}return a}function Th(e,a){var t;let r=e.pos;if(e.src.charCodeAt(r)!==96)return!1;let o=e.posMax,s=r+1;for(;s<o&&e.src.charCodeAt(s)===96;)s++;let i=e.src.slice(r,s),n=i.length;if(e.backticksScanned||(e.backticks=Eh(e.src),e.backticksScanned=!0),((t=e.backticks[n])!==null&&t!==void 0?t:-1)>=s){let l=s,u;for(;(u=e.src.indexOf("`",l))!==-1&&u<o;){for(l=u+1;e.src.charCodeAt(l)===96;)l++;if(l>o)break;if(l-u===n){if(!a){let d=e.push("code_inline","code",0);d.markup=i;let c=e.src.slice(s,u).replace(/\n/g," ");c.startsWith(" ")&&c.endsWith(" ")&&/[^ ]/.test(c)&&(c=c.slice(1,-1)),d.content=c}return e.pos=l,!0}}}return a||(e.pending+=i),e.pos=s,!0}function Fh(e,a){let t=e.pos,r=e.src.charCodeAt(t);if(a||r!==126)return!1;let o=e.scanDelims(e.pos,!0),s=o.length,i=String.fromCharCode(r);if(s<2)return!1;let n;s%2&&(n=e.push("text","",0),n.content=i,s--);for(let l=0;l<s;l+=2)n=e.push("text","",0),n.content=i+i,e.delimiters.push({marker:r,length:0,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close});return e.pos+=o.length,!0}function jd(e,a){let t,r=[],o=a.length;for(let s=0;s<o;s++){let i=a[s];if(i.marker!==126||i.end===-1)continue;let n=a[i.end];t=e.tokens[i.token],t.type="s_open",t.tag="s",t.nesting=1,t.markup="~~",t.content="",t=e.tokens[n.token],t.type="s_close",t.tag="s",t.nesting=-1,t.markup="~~",t.content="",e.tokens[n.token-1].type==="text"&&e.tokens[n.token-1].content==="~"&&r.push(n.token-1)}for(;r.length;){let s=r.pop(),i=s+1;for(;i<e.tokens.length&&e.tokens[i].type==="s_close";)i++;i--,s!==i&&(t=e.tokens[i],e.tokens[i]=e.tokens[s],e.tokens[s]=t)}}function Nh(e){let a=e.tokens_meta,t=e.tokens_meta.length;jd(e,e.delimiters);for(let o=0;o<t;o++){var r;let s=(r=a[o])===null||r===void 0?void 0:r.delimiters;s&&jd(e,s)}}var ic={tokenize:Fh,postProcess:Nh};function _h(e,a){let t=e.pos,r=e.src.charCodeAt(t);if(a||r!==95&&r!==42)return!1;let o=e.scanDelims(e.pos,r===42);for(let s=0;s<o.length;s++){let i=e.push("text","",0);i.content=String.fromCharCode(r),e.delimiters.push({marker:r,length:o.length,token:e.tokens.length-1,end:-1,open:o.can_open,close:o.can_close})}return e.pos+=o.length,!0}function Gd(e,a){let t=a.length;for(let r=t-1;r>=0;r--){let o=a[r];if(o.marker!==95&&o.marker!==42||o.end===-1)continue;let s=a[o.end],i=r>0&&a[r-1].end===o.end+1&&a[r-1].marker===o.marker&&a[r-1].token===o.token-1&&a[o.end+1].token===s.token+1,n=String.fromCharCode(o.marker),l=e.tokens[o.token];l.type=i?"strong_open":"em_open",l.tag=i?"strong":"em",l.nesting=1,l.markup=i?n+n:n,l.content="";let u=e.tokens[s.token];u.type=i?"strong_close":"em_close",u.tag=i?"strong":"em",u.nesting=-1,u.markup=i?n+n:n,u.content="",i&&(e.tokens[a[r-1].token].content="",e.tokens[a[o.end+1].token].content="",r--)}}function Bh(e){let a=e.tokens_meta,t=e.tokens_meta.length;Gd(e,e.delimiters);for(let o=0;o<t;o++){var r;let s=(r=a[o])===null||r===void 0?void 0:r.delimiters;s&&Gd(e,s)}}var lc={tokenize:_h,postProcess:Bh};function qh(e,a){let t,r,o,s,i="",n="",l=e.pos,u=!0;if(e.src.charCodeAt(e.pos)!==91)return!1;let d=e.pos,c=e.posMax,m=e.pos+1,p=e.md.helpers.parseLinkLabel(e,e.pos,!0);if(p<0)return!1;let f=p+1;if(f<c&&e.src.charCodeAt(f)===40){for(u=!1,f++;f<c&&(t=e.src.charCodeAt(f),!(!ve(t)&&t!==10));f++);if(f>=c)return!1;if(l=f,o=e.md.helpers.parseLinkDestination(e.src,f,e.posMax),o.ok){for(i=e.md.normalizeLink(o.str),e.md.validateLink(i)?f=o.pos:i="",l=f;f<c&&(t=e.src.charCodeAt(f),!(!ve(t)&&t!==10));f++);if(o=e.md.helpers.parseLinkTitle(e.src,f,e.posMax),f<c&&l!==f&&o.ok)for(n=o.str,f=o.pos;f<c&&(t=e.src.charCodeAt(f),!(!ve(t)&&t!==10));f++);}(f>=c||e.src.charCodeAt(f)!==41)&&(u=!0),f++}if(u){if(typeof e.env.references>"u")return!1;if(f<c&&e.src.charCodeAt(f)===91?(l=f+1,f=e.md.helpers.parseLinkLabel(e,f),f>=0?r=e.src.slice(l,f++):f=p+1):f=p+1,r||(r=e.src.slice(m,p)),r=Uo(r),s=e.env.references[r],!s)return e.pos=d,!1;i=s.href,n=s.title}if(!a){e.pos=m,e.posMax=p;let h=e.push("link_open","a",1),g=[["href",i]];if(h.attrs=g,n&&g.push(["title",n]),r){let C=Object.create(null);C.label=r,h.meta=C}e.linkLevel++,e.md.inline.tokenize(e),e.linkLevel--,e.push("link_close","a",-1)}return e.pos=f,e.posMax=c,!0}function Uh(e,a){let t,r,o,s,i,n,l,u,d="",c=e.pos,m=e.posMax;if(e.src.charCodeAt(e.pos)!==33||e.src.charCodeAt(e.pos+1)!==91)return!1;let p=e.pos+2,f=e.md.helpers.parseLinkLabel(e,e.pos+1,!1);if(f<0)return!1;if(s=f+1,s<m&&e.src.charCodeAt(s)===40){for(s++;s<m&&(t=e.src.charCodeAt(s),!(!ve(t)&&t!==10));s++);if(s>=m)return!1;for(u=s,n=e.md.helpers.parseLinkDestination(e.src,s,e.posMax),n.ok&&(d=e.md.normalizeLink(n.str),e.md.validateLink(d)?s=n.pos:d=""),u=s;s<m&&(t=e.src.charCodeAt(s),!(!ve(t)&&t!==10));s++);if(n=e.md.helpers.parseLinkTitle(e.src,s,e.posMax),s<m&&u!==s&&n.ok)for(l=n.str,s=n.pos;s<m&&(t=e.src.charCodeAt(s),!(!ve(t)&&t!==10));s++);else l="";if(s>=m||e.src.charCodeAt(s)!==41)return e.pos=c,!1;s++}else{if(typeof e.env.references>"u")return!1;if(s<m&&e.src.charCodeAt(s)===91?(u=s+1,s=e.md.helpers.parseLinkLabel(e,s),s>=0?o=e.src.slice(u,s++):s=f+1):s=f+1,o||(o=e.src.slice(p,f)),o=Uo(o),i=e.env.references[o],!i)return e.pos=c,!1;d=i.href,l=i.title}if(!a){r=e.src.slice(p,f);let h=[];e.md.inline.parse(r,e.md,e.env,h);let g=e.push("image","img",0),C=[["src",d],["alt",""]];if(g.attrs=C,g.children=h,g.content=r,l&&C.push(["title",l]),o){let L=Object.create(null);L.label=o,g.meta=L}}return e.pos=s,e.posMax=m,!0}var Oh=/^([a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*)$/,zh=/^([a-zA-Z][a-zA-Z0-9+.-]{1,31}):([^<>\x00-\x20]*)$/;function Hh(e,a){let t=e.pos;if(e.src.charCodeAt(t)!==60)return!1;let r=e.pos,o=e.posMax;for(;;){if(++t>=o)return!1;let i=e.src.charCodeAt(t);if(i===60)return!1;if(i===62)break}let s=e.src.slice(r+1,t);if(zh.test(s)){let i=e.md.normalizeLink(s);if(!e.md.validateLink(i))return!1;if(!a){let n=e.push("link_open","a",1);n.attrs=[["href",i]],n.markup="autolink",n.info="auto";let l=e.push("text","",0);l.content=e.md.normalizeLinkText(s);let u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}if(Oh.test(s)){let i=e.md.normalizeLink(`mailto:${s}`);if(!e.md.validateLink(i))return!1;if(!a){let n=e.push("link_open","a",1);n.attrs=[["href",i]],n.markup="autolink",n.info="auto";let l=e.push("text","",0);l.content=e.md.normalizeLinkText(s);let u=e.push("link_close","a",-1);u.markup="autolink",u.info="auto"}return e.pos+=s.length+2,!0}return!1}function jh(e){return/^<a[>\s]/i.test(e)}function Gh(e){return/^<\/a\s*>/i.test(e)}function uc(e){let a=e|32;return a>=97&&a<=122}function Wh(e,a){let t=e.src,r,o;if(t.startsWith("<!--",a)){if(t.startsWith(">",a+4))return a+5;if(t.startsWith("->",a+4))return a+6;r=a+4,o="-->"}else if(t.startsWith("<![CDATA[",a))r=a+9,o="]]>";else if(t.charCodeAt(a+1)===63)r=a+2,o="?>";else if(uc(t.charCodeAt(a+2)))r=a+3,o=">";else return-1;if(e.skipHtmlSpecial)return-1;let s=t.indexOf(o,r);return s<0?(e.skipHtmlSpecial=!0,-1):s+o.length}function $h(e,a){if(!e.md.options.html)return!1;let t=e.posMax,r=e.pos;if(e.src.charCodeAt(r)!==60||r+2>=t)return!1;let o,s=e.src.charCodeAt(r+1);if(s===33||s===63)o=Wh(e,r);else if(s===47||uc(s)){let i=e.src.slice(r).match(oc);o=i?r+i[0].length:-1}else return!1;if(o<0)return!1;if(!a){let i=e.push("html_inline","",0);i.content=e.src.slice(r,o),jh(i.content)&&e.linkLevel++,Gh(i.content)&&e.linkLevel--}return e.pos=o,!0}var Vh=/^&#((?:x[a-f0-9]{1,6}|[0-9]{1,7}));/i,Jh=/^&([a-z][a-z0-9]{1,31});/i;function Xh(e,a){let t=e.pos,r=e.posMax;if(e.src.charCodeAt(t)!==38||t+1>=r)return!1;if(e.src.charCodeAt(t+1)===35){let o=e.src.slice(t).match(Vh);if(o){if(!a){let s=o[1][0].toLowerCase()==="x"?parseInt(o[1].slice(1),16):parseInt(o[1],10),i=e.push("text_special","",0);i.content=xn(s)?$r(s):$r(65533),i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}else{let o=e.src.slice(t).match(Jh);if(o){let s=No(o[0]);if(s!==o[0]){if(!a){let i=e.push("text_special","",0);i.content=s,i.markup=o[0],i.info="entity"}return e.pos+=o[0].length,!0}}}return!1}function Wd(e){let a={},t=e.length;if(!t)return;let r=0,o=-2,s=[];for(let i=0;i<t;i++){let n=e[i];if(s.push(0),(e[r].marker!==n.marker||o!==n.token-1)&&(r=i),o=n.token,n.length=n.length||0,!n.close)continue;a.hasOwnProperty(n.marker)||(a[n.marker]=[-1,-1,-1,-1,-1,-1]);let l=a[n.marker][(n.open?3:0)+n.length%3],u=r-s[r]-1,d=u;for(;u>l;u-=s[u]+1){let c=e[u];if(c.marker===n.marker&&c.open&&c.end<0){let m=!1;if((c.close||n.open)&&(c.length+n.length)%3===0&&(c.length%3!==0||n.length%3!==0)&&(m=!0),!m){let p=u>0&&!e[u-1].open?s[u-1]+1:0;s[i]=i-u+p,s[u]=p,n.open=!1,c.end=i,c.close=!1,d=-1,o=-2;break}}}d!==-1&&(a[n.marker][(n.open?3:0)+(n.length||0)%3]=d)}}function Qh(e){let a=e.tokens_meta,t=e.tokens_meta.length;Wd(e.delimiters);for(let o=0;o<t;o++){var r;let s=(r=a[o])===null||r===void 0?void 0:r.delimiters;s&&Wd(s)}}function Kh(e){let a,t,r=0,o=e.tokens,s=e.tokens.length;for(a=t=0;a<s;a++)o[a].nesting<0&&r--,o[a].level=r,o[a].nesting>0&&r++,o[a].type==="text"&&a+1<s&&o[a+1].type==="text"?o[a+1].content=o[a].content+o[a+1].content:(a!==t&&(o[t]=o[a]),t++);a!==t&&(o.length=t)}var hn=[["text",Sh],["linkify",Ah],["newline",Ph],["escape",Dh],["backticks",Th],["strikethrough",ic.tokenize],["emphasis",lc.tokenize],["link",qh],["image",Uh],["autolink",Hh],["html_inline",$h],["entity",Xh]],gn=[["balance_pairs",Qh],["strikethrough",ic.postProcess],["emphasis",lc.postProcess],["fragments_join",Kh]],dc=class{constructor(){W(this,"ruler",new Kr),W(this,"ruler2",new Kr),W(this,"State",nc);for(let e=0;e<hn.length;e++)this.ruler.push(hn[e][0],hn[e][1]);for(let e=0;e<gn.length;e++)this.ruler2.push(gn[e][0],gn[e][1])}skipToken(e){let a=e.pos,t=this.ruler.getRules(""),r=t.length,o=e.md.options.maxNesting,s=e.cache;if(typeof s[a]<"u"){e.pos=s[a];return}let i=!1;if(e.level<o){for(let n=0;n<r;n++)if(e.level++,i=t[n](e,!0),e.level--,i){if(a>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}else e.pos=e.posMax;i||e.pos++,s[a]=e.pos}tokenize(e){let a=this.ruler.getRules(""),t=a.length,r=e.posMax,o=e.md.options.maxNesting;for(;e.pos<r;){let s=e.pos,i=!1;if(e.level<o){for(let n=0;n<t;n++)if(i=a[n](e,!1),i){if(s>=e.pos)throw new Error("inline rule didn't increment state.pos");break}}if(i){if(e.pos>=r)break;continue}e.pending+=e.src[e.pos++]}e.pending&&e.pushPending()}parse(e,a,t,r){let o=new this.State(e,a,t,r);this.tokenize(o);let s=this.ruler2.getRules(""),i=s.length;for(let n=0;n<i;n++)s[n](o)}},Zh={default:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:100},components:{core:{},block:{},inline:{}}},zero:{options:{html:!1,xhtmlOut:!1,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["paragraph"]},inline:{rules:["text"],rules2:["balance_pairs","fragments_join"]}}},commonmark:{options:{html:!0,xhtmlOut:!0,breaks:!1,langPrefix:"language-",linkify:!1,typographer:!1,quotes:"\u201C\u201D\u2018\u2019",highlight:null,maxNesting:20},components:{core:{rules:["normalize","block","strip_references","inline","text_join"]},block:{rules:["blockquote","code","fence","heading","hr","html_block","lheading","list","reference","paragraph"]},inline:{rules:["autolink","backticks","emphasis","entity","escape","html_inline","image","link","newline","text"],rules2:["balance_pairs","emphasis","fragments_join"]}}}},Yh=/^(vbscript|javascript|file|data):/,eg=/^data:image\/(gif|png|jpeg|webp);/,$d=["http:","https:","mailto:"],qt=class{validateLink(e){let a=e.trim().toLowerCase();return Yh.test(a)?eg.test(a):!0}normalizeLink(e){let a=jr(e,!0);if(a.hostname&&(!a.protocol||$d.indexOf(a.protocol)>=0))try{a.hostname=cn.toASCII(a.hostname)}catch{}return a.auth&&(a.auth=na(a.auth)),a.hostname&&(a.hostname=na(a.hostname)),a.pathname&&(a.pathname=na(a.pathname)),a.search&&(a.search=na(a.search)),a.hash&&(a.hash=na(a.hash)),za(a)}normalizeLinkText(e){let a=jr(e,!0);if(a.hostname&&(!a.protocol||$d.indexOf(a.protocol)>=0))try{a.hostname=cn.toUnicode(a.hostname)}catch{}return Hr(za(a),Hr.defaultChars+"%")}constructor(...e){W(this,"inline",new dc),W(this,"block",new sc),W(this,"core",new ec),W(this,"renderer",new Kd),W(this,"linkify",new Md),W(this,"utils",vp),W(this,"helpers",Object.assign({},qp));let[a,t]=e;typeof a=="string"?(this.configure(a),t&&this.set(t)):(this.configure("default"),this.set(a||{}))}set(e){return Object.assign(this.options,e),this}configure(e){let a;if(typeof e=="string"){let o=e;if(a=Zh[o],!a)throw new Error(`Wrong 'markdown-it' preset "${o}", check name`)}else a=e;if(!a)throw new Error("Wrong `markdown-it` preset, can't be empty");a.options&&(this.options={...a.options});let t=a.components;if(t){var r;["core","block","inline"].forEach(s=>{var i;let n=(i=t[s])===null||i===void 0?void 0:i.rules;n&&this[s].ruler.enableOnly(n)});let o=(r=t.inline)===null||r===void 0?void 0:r.rules2;o&&this.inline.ruler2.enableOnly(o)}return this}enable(e,a=!1){let t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{t=t.concat(this[o].ruler.enable(e,!0))}),t=t.concat(this.inline.ruler2.enable(e,!0));let r=e.filter(o=>t.indexOf(o)<0);if(r.length&&!a)throw new Error(`MarkdownIt. Failed to enable unknown rule(s): ${r}`);return this}disable(e,a=!1){let t=[];Array.isArray(e)||(e=[e]),["core","block","inline"].forEach(o=>{t=t.concat(this[o].ruler.disable(e,!0))}),t=t.concat(this.inline.ruler2.disable(e,!0));let r=e.filter(o=>t.indexOf(o)<0);if(r.length&&!a)throw new Error(`MarkdownIt. Failed to disable unknown rule(s): ${r}`);return this}use(e,...a){return e.apply(e,[this,...a]),this}parse(e,a){if(typeof e!="string")throw new Error("Input data should be a String");let t=new this.core.State(e,this,a);return this.core.process(t),t.tokens}render(e,a={}){return this.renderer.render(this.parse(e,a),this.options,a)}parseInline(e,a){let t=new this.core.State(e,this,a);return t.inlineMode=!0,this.core.process(t),t.tokens}renderInline(e,a={}){return this.renderer.render(this.parseInline(e,a),this.options,a)}};W(qt,"Token",Ra);W(qt,"Ruler",Kr);W(qt,"Renderer",Kd);W(qt,"ParserCore",ec);W(qt,"StateCore",Zd);W(qt,"ParserBlock",sc);W(qt,"StateBlock",tc);W(qt,"ParserInline",dc);W(qt,"StateInline",nc);var cc=Jd(qt);var mc=128*1024,tg=1e4,Zr=e=>!!e&&typeof e=="object"&&!Array.isArray(e),zo=e=>typeof e=="string"?e:"";function ua(e){if(!(!/^https?:\/\//i.test(e)||/[\u0000-\u0020\u007f]/.test(e)))try{let a=new URL(e);if(!a.username&&!a.password)return a.href}catch{}}function ag(e,a){let t=/\s*#(\d{1,5})px\s+#(\d{1,5})px\s*$/.exec(e),r=t?+t[1]:0,o=t?+t[2]:0;return{type:"image",src:ua(a),alt:t?e.slice(0,t.index).trim():e,...r>0&&o>0&&r<=16384&&o<=16384?{width:r,height:o}:{}}}var rg=e=>{let a=Zr(e.attributes)?e.attributes.attributes:void 0;return Array.isArray(a)?a.filter(Zr):[]},og=e=>{if(e.busId!=="FlashTransfer")return null;let a=rg(e).find(i=>i.viewId==="file");if(!a||!Array.isArray(a.attributes))return null;let t=a.attributes.filter(Zr),r=i=>t.find(n=>n.viewId===i),o,s;try{let i=new URL(zo(a.schema));o=i.searchParams.get("fileset_id")||void 0,s=i.searchParams.get("scene_type")||void 0}catch{}return{kind:"flash",label:"\u95EA\u4F20",title:zo(r("title")?.text).trim()||"\u95EA\u4F20\u6587\u4EF6",description:zo((r("subtitle")??r("desc"))?.text).trim(),fileSetId:o,sceneType:s}};function sg(e,a){let t=[],r=0,o=(s,i)=>{if(i>12||++r>512||t.length>=20)return;if(Array.isArray(s)){for(let l of s.slice(0,128))o(l,i+1);return}if(!Zr(s))return;let n=zo(s.text).trim().slice(0,2e3);n&&!t.includes(n)&&t.push(n),o(s.attributes,i+1)};return o(e.attributes,0),{kind:"generic",label:a||"QQ \u5361\u7247",title:t.shift()||a||"QQ \u5361\u7247",lines:t}}function ng(e,a,t=[]){try{let r=new URL(e);if(r.protocol!=="mqqapi:"||r.hostname!=="markdown"||r.pathname!=="/node"||r.searchParams.get("nodeType")!=="richui")return null;let o=r.searchParams.get("json");if(!o||o.length>mc)return null;let s=JSON.parse(o);if(!Zr(s))return null;for(let i of[...t,og])try{let n=i(s,a);if(n)return n}catch{}return sg(s,a)}catch{return null}}var fc=e=>{try{return decodeURIComponent(e)}catch{return e}},ja=new cc({html:!1,linkify:!0,breaks:!0,maxNesting:20}),ig=ja.validateLink.bind(ja);ja.validateLink=e=>/^(?:mqqapi|qqbot-media):/i.test(e)||ig(e);ja.inline.ruler.before("autolink","qq_inline",(e,a)=>{if(e.src[e.pos]!=="<")return!1;let t=e.src.slice(e.pos,Math.min(e.posMax,e.pos+2048)),r=/^<(?:@!?(\w+)|#(\w+)|emoji:(\d+))>/.exec(t),o=/^<(qqbot-at-user|qqbot-at-everyone|qqbot-cmd-input|qqbot-cmd-enter)\b([^<>]*?)\/>/.exec(t),s,i=0;if(r)s=r[1]?{kind:"mention",label:"@"+r[1],id:r[1]}:r[2]?{kind:"channel",label:"#"+r[2],id:r[2]}:{kind:"emoji",label:"[\u8868\u60C5 "+r[3]+"]",id:r[3]},i=r[0].length;else if(o){let n=new Map;if(o[2].replace(/\s+([\w-]+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,(u,d,c,m)=>(n.set(d,ja.utils.unescapeAll(c??m)),"")).trim())return!1;o[1]==="qqbot-at-everyone"?s={kind:"mention",label:"@\u5168\u4F53\u6210\u5458"}:o[1]==="qqbot-at-user"&&n.get("id")?s={kind:"mention",label:"@"+n.get("id"),id:n.get("id")}:o[1].startsWith("qqbot-cmd-")&&n.get("text")&&(s={kind:"command",label:fc(n.get("show")||n.get("text")),text:fc(n.get("text")),action:o[1]==="qqbot-cmd-enter"?"enter":"input",reference:n.get("reference")==="true"}),i=o[0].length}if(!s)return!1;if(!a){let n=e.push("qq_inline","",0);n.meta=s}return e.pos+=i,!0});function pc(e,a=[]){let t=[{type:"text",text:e}];if(e.length>mc)return t;let r=0,o=(s,i=0)=>{if(i>24)throw new Error("Markdown nesting limit");let n=0,l=()=>{let u=[];for(;n<s.length;){let d=s[n++];if(++r>tg)throw new Error("Markdown node limit");if(d.level>=19)throw new Error("Markdown nesting limit");if(d.nesting===-1)break;if(d.nesting===1){let c=l();if(d.type==="link_open"){let m=String(d.attrGet("href")||""),p=Ln(c),f=ng(m,p,a);u.push(f?{type:"card",card:f}:{type:"link",href:ua(m),children:c,unsupported:!ua(m)})}else d.hidden?u.push(...c):u.push({type:"element",tag:d.tag,children:c,...d.tag==="ol"?{start:+(d.attrGet("start")||"1")}:{},...d.tag==="strong"&&d.markup==="__"?{underline:!0}:{}})}else d.type==="inline"?u.push(...o(d.children||[],i+1)):d.type==="image"?u.push(ag(Ln(o(d.children||[],i+1))||d.content,String(d.attrGet("src")||""))):d.type==="qq_inline"?u.push({type:"qq",value:d.meta}):d.type==="softbreak"||d.type==="hardbreak"?u.push({type:"element",tag:"br",children:[]}):d.type==="hr"?u.push({type:"element",tag:"hr",children:[]}):d.type==="fence"||d.type==="code_block"?u.push({type:"element",tag:"pre",children:[{type:"element",tag:"code",children:[{type:"text",text:d.content}]}]}):d.type==="code_inline"?u.push({type:"element",tag:"code",children:[{type:"text",text:d.content}]}):u.push({type:"text",text:d.content})}return u};return l()};try{return o(ja.parse(e,{}))}catch{return t}}function Ln(e){return e.map(a=>a.type==="text"?a.text:a.type==="image"?a.alt:a.type==="qq"?a.value.label:a.type==="card"?a.card.title:Ln(a.children)).join("")}import{createContext as lg}from"react";var Yr=lg(null);import{useRef as hc,useState as Ga}from"react";import{jsx as da,jsxs as xc}from"react/jsx-runtime";function ug(e){let a=Number(e);if(!Number.isFinite(a)||a<0)return"\u5927\u5C0F\u672A\u77E5";if(a<1024)return`${a} B`;let t=["B","KB","MB","GB","TB"],r=Math.min(Math.floor(Math.log(a)/Math.log(1024)),t.length-1);return`${Number((a/1024**r).toFixed(2))} ${t[r]}`}function dg({fileSetId:e,file:a}){let t=hc(!1),[r,o]=Ga(!1),[s,i]=Ga("");return xc("span",{className:"block mt-2 border-t border-current/10 pt-2",children:[da("span",{className:"block break-all",children:a.name}),da("span",{className:"block text-xs opacity-60",title:`${a.size} \u5B57\u8282`,children:ug(a.size)}),da("button",{type:"button",disabled:r,className:"text-blue-500 hover:underline disabled:opacity-50",onClick:async n=>{if(n.stopPropagation(),!t.current){t.current=!0,o(!0),i("");try{let l=new URLSearchParams({fileSetId:e,fileUuid:a.id}),u=await X(`/api/webqq/flash-file-url?${l}`),d=u.data?.downloadPath||"";if(!u.success||!/^\/api\/webqq\/flash-file-download\?ticket=[a-f0-9]{48}$/.test(d))throw new Error(u.message||"\u4E0B\u8F7D\u5730\u5740\u65E0\u6548");let c=ht().authUrl(d),m=document.createElement("a");m.href=c,m.download=a.name,m.referrerPolicy="no-referrer",document.body.appendChild(m),m.click(),m.remove()}catch(l){i(l instanceof Error?l.message:"\u4E0B\u8F7D\u5931\u8D25")}finally{t.current=!1,o(!1)}}},children:r?"\u51C6\u5907\u4E0B\u8F7D\u2026":"\u4E0B\u8F7D"}),s&&da("span",{role:"alert",className:"block text-xs text-red-500",children:s})]})}function gc({fileSetId:e}){let[a,t]=Ga(null),[r,o]=Ga(""),[s,i]=Ga(!1),[n,l]=Ga(!1),u=hc(!1);return xc("span",{className:"block mt-2 text-sm",children:[da("button",{type:"button",className:"text-blue-500 hover:underline disabled:opacity-50",disabled:s,"aria-expanded":n,onClick:async d=>{if(d.stopPropagation(),!u.current){if(a){l(!n);return}u.current=!0,i(!0),o("");try{let c=await X(`/api/webqq/flash-files?${new URLSearchParams({fileSetId:e})}`);if(!c.success)throw new Error(c.message||"\u83B7\u53D6\u6587\u4EF6\u5931\u8D25");t(c.data),l(!0)}catch(c){o(c instanceof Error?c.message:"\u83B7\u53D6\u6587\u4EF6\u5931\u8D25")}finally{u.current=!1,i(!1)}}},children:s?"\u52A0\u8F7D\u4E2D\u2026":n?"\u6536\u8D77\u6587\u4EF6":r?"\u91CD\u8BD5\u52A0\u8F7D\u6587\u4EF6":"\u67E5\u770B\u6587\u4EF6"}),r&&da("span",{role:"alert",className:"block text-xs text-red-500",children:r}),n&&a?.length===0&&da("span",{className:"block opacity-60",children:"\u6682\u65E0\u6587\u4EF6\uFF0C\u53EF\u80FD\u5DF2\u8FC7\u671F"}),n&&a?.map(d=>da(dg,{fileSetId:e,file:d},d.id))]})}import{jsx as Ee,jsxs as Go}from"react/jsx-runtime";function mg({card:e}){return Go("span",{className:"inline-flex align-middle items-center gap-3 px-3 py-2.5 my-1 rounded-lg bg-black/5 dark:bg-white/5 border border-current/10 min-w-0 max-w-full",style:{width:280},children:[Go("span",{className:"flex-1 min-w-0",children:[Ee("span",{className:"block text-xs opacity-60 mb-1",children:e.label}),Ee("span",{className:"block text-sm font-medium leading-snug break-all",children:e.title}),e.description&&Ee("span",{className:"block text-xs opacity-60 mt-1 break-all",children:e.description}),e.lines?.map((a,t)=>Ee("span",{className:"block text-sm mt-1 whitespace-pre-wrap break-all",children:a},t)),e.kind==="flash"&&e.fileSetId&&Ee(gc,{fileSetId:e.fileSetId},e.fileSetId)]}),e.kind==="flash"&&Ee(wt,{className:"w-8 h-8 flex-shrink-0 opacity-70","aria-hidden":"true"})]})}function pg({node:e,preview:a=!0}){let[t,r]=Ho(!1),o=Ic(Yr);if(!e.src||t)return Go("span",{className:"text-xs opacity-70",children:["[\u56FE\u7247\uFF1A",e.alt||"\u6682\u65E0\u6CD5\u663E\u793A","]"]});let s=e.width&&e.height?Math.min(1,320/e.width,320/e.height):1,i=Ee("img",{src:e.src,alt:e.alt,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",width:e.width?Math.round(e.width*s):void 0,height:e.height?Math.round(e.height*s):void 0,className:"inline-block max-w-full max-h-80 h-auto object-contain rounded align-middle",onError:()=>r(!0)});return a&&o?Ee("button",{type:"button",className:"inline-block max-w-full cursor-zoom-in","aria-label":`\u9884\u89C8\u56FE\u7247\uFF1A${e.alt||"\u56FE\u7247"}`,onClick:n=>{n.stopPropagation(),o.previewImage(e.src)},children:i}):i}function hg({value:e,message:a}){let t=Ic(Yr),r=fg(!1),[o,s]=Ho(!1),[i,n]=Ho(""),[l,u]=Ho(!1),d="inline-block rounded px-1 bg-black/5 text-blue-500 dark:text-blue-300 break-all";if(e.kind==="emoji"&&/^\d{1,4}$/.test(e.id||"")&&!l)return Ee("img",{src:Ge(`/face/${e.id}.png`),alt:e.label,title:e.label,className:"inline-block w-6 h-6 align-text-bottom",onError:()=>u(!0)});if(e.kind==="command"){let m=t?t.unavailable(e,a):"\u8BF7\u5728\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u4E2D\u4F7F\u7528";return Go("span",{children:[Ee("button",{type:"button",className:d+" hover:underline disabled:opacity-50 disabled:cursor-not-allowed",disabled:!!m||o,title:m||(e.action==="enter"?`\u53D1\u9001\uFF1A${e.text}`:`\u586B\u5165\uFF1A${e.text}`),onClick:async p=>{if(p.stopPropagation(),!(!t||!a||m||r.current)){r.current=!0,s(!0),n("");try{await t.command(e,a)}catch(f){n(f instanceof Error?f.message:"\u6307\u4EE4\u6267\u884C\u5931\u8D25")}finally{r.current=!1,s(!1)}}},children:o?"\u53D1\u9001\u4E2D\u2026":e.label}),i&&Ee("span",{role:"alert",className:"text-xs text-red-500 ml-1",children:i})]})}let c=e.kind==="mention"&&e.id?t?.mentionName(e.id):void 0;return c&&a?Ee("button",{type:"button",className:d+" hover:underline",title:"\u5728\u8F93\u5165\u6846\u4E2D\u63D0\u53CA",onClick:m=>{m.stopPropagation(),t?.mention(e.id,a)},children:c}):Ee("span",{className:d,children:e.label})}var Lc={p:"my-1 whitespace-pre-wrap",h1:"text-xl font-bold my-2",h2:"text-lg font-bold my-2",h3:"text-base font-bold my-2",h4:"font-bold my-1",h5:"font-bold my-1",h6:"font-bold my-1",strong:"font-bold",em:"italic",s:"line-through",ul:"list-disc pl-5 my-1",ol:"list-decimal pl-5 my-1",li:"my-0.5",blockquote:"border-l-2 border-current/30 pl-3 my-2 opacity-80",pre:"bg-black/10 rounded p-2 my-2 overflow-x-auto whitespace-pre font-mono text-xs",code:"font-mono bg-black/5 rounded px-0.5",hr:"border-current/20 my-3",br:"",table:"border-collapse text-sm my-2",thead:"",tbody:"",tr:"",th:"border border-current/20 p-1 font-bold",td:"border border-current/20 p-1"};function jo(e,a,t=!1){return e.map((r,o)=>{if(r.type==="text")return r.text;if(r.type==="card")return Ee(mg,{card:r.card},o);if(r.type==="image")return Ee(pg,{node:r,preview:!t},o+":"+r.src);if(r.type==="qq")return t?Ee("span",{children:r.value.label},o):Ee(hg,{value:r.value,message:a},o);if(r.type==="link")return r.href?Ee("a",{href:r.href,target:"_blank",rel:"noopener noreferrer",className:"text-blue-500 dark:text-blue-300 underline break-all",onClick:i=>i.stopPropagation(),children:jo(r.children,a,!0)},o):Ee("span",{className:"break-all",title:r.unsupported?"\u6B64\u94FE\u63A5\u6682\u4E0D\u652F\u6301\u5728 WebQQ \u4E2D\u6253\u5F00":void 0,children:jo(r.children,a,!0)},o);let s=jo(r.children,a,t);return Object.hasOwn(Lc,r.tag)?Cc.createElement(r.tag,{key:o,className:Lc[r.tag]+(r.underline?" underline":""),...r.tag==="ol"?{start:r.start}:{}},r.tag==="br"||r.tag==="hr"?void 0:s):Ee(Cc.Fragment,{children:s},o)})}function bc({content:e,message:a}){let t=cg(()=>pc(e),[e]);return Ee("div",{className:"min-w-0 max-w-full overflow-x-auto whitespace-normal",style:{overflowWrap:"anywhere"},children:jo(t,a)})}import{useMemo as Lg,useState as Ig}from"react";var $o=e=>!!e&&typeof e=="object"&&!Array.isArray(e),ca=e=>$o(e)?e:{},it=e=>typeof e=="string"?e.trim().slice(0,2e3):"";function Ma(e,a=0){return a>4?"":typeof e=="string"?it(e):Array.isArray(e)?e.slice(0,64).map(t=>Ma(t,a+1)).join("").slice(0,2e3):$o(e)?it(e.text)||Ma(e.text_content??e.contents,a+1):""}function Wo(e){let a=it(e);return a.startsWith("//")?a="https:"+a:/^(?:[a-z\d-]+\.)+[a-z]{2,}(?::\d+)?\//i.test(a)&&(a="https://"+a),ua(a)}var gg=e=>{if(e.app!=="com.tencent.forum")return null;let a=ca(ca(e.meta).detail),t=ca(a.feed),r=ca(a.channel_info),o=ca(a.poster),s=Array.isArray(t.videos)?t.videos:[],i=Array.isArray(t.images)?t.images:[],n=ca(ca(s[0]).cover),l=Ma(t.title),u=Ma(t.contents),d=[["view_count","\u6D4F\u89C8"],["prefer_count","\u8D5E"],["comment_count","\u8BC4\u8BBA"]].flatMap(([c,m])=>typeof t[c]=="number"&&Number.isFinite(t[c])&&t[c]>=0?[{label:m,value:t[c]}]:[]);return!l&&!u&&!it(r.guild_name)?null:{kind:"forum",label:"\u9891\u9053\u5E16\u5B50",title:l||u||it(e.prompt)||"\u9891\u9053\u5E16\u5B50",description:(u!==l?u:"")||Ma(t.sub_title),source:[it(r.guild_name),it(r.channel_name)].filter(Boolean).join(" \xB7 "),author:it(o.nick),icon:Wo(r.guild_icon),cover:Wo(n.pic_url)||Wo(ca(i[0]).pic_url),video:s.length>0,url:ua(it(a.jump_url)),stats:d}};function xg(e){let a=[],t=[{value:e,depth:0}];for(let r=0;r<t.length&&r<128;r++){let{value:o,depth:s}=t[r];if(!(s>5)){if(Array.isArray(o))for(let i of o.slice(0,32))t.length<128&&t.push({value:i,depth:s+1});else if($o(o)){a.push(o);for(let[i,n]of Object.entries(o))["config","token","extra"].includes(i)||t.length<128&&n&&typeof n=="object"&&t.push({value:n,depth:s+1})}}}return a}function Cg(e){let a=xg(e.meta),t=d=>{for(let c of d)for(let m of a){let p=Ma(m[c]);if(p)return p}return""},r=(d,c=!1)=>{for(let m of d)for(let p of a){let f=c?Wo(p[m]):ua(it(p[m]));if(f)return f}},o=it(e.app),s=/miniapp/i.test(o)?"miniapp":/music/i.test(o)?"music":/contact/i.test(o)?"contact":/structmsg/i.test(o)?"link":"generic",i={miniapp:"\u5C0F\u7A0B\u5E8F",music:"\u97F3\u4E50",contact:"\u8054\u7CFB\u4EBA",link:"\u5206\u4EAB\u94FE\u63A5",generic:"\u5361\u7247\u6D88\u606F"},n=t(["title","name","nickname","nick","prompt"])||it(e.prompt)||it(e.desc)||i[s],l=t(["desc","summary","description","content","text","sub_title"]),u=[];for(let d of a){let c=Ma(d.text);c&&c!==n&&c!==l&&!u.includes(c)&&u.length<4&&u.push(c)}return{kind:s,label:i[s],title:n,description:l===n?"":l,source:t(["tag","appname","source","source_name","guild_name"]),author:t(["author","singer"]),cover:r(["preview","image","cover","pic_url","picUrl","picture","avatar"],!0),icon:r(["icon","source_icon"],!0),url:r(["jump_url","jumpUrl","qqdocurl","url","link","action_url"])||ua(it(e.url)),lines:u}}function vc(e,a=[]){if(!e||e.length>256*1024)return null;try{let t=JSON.parse(e.replace(/^\uFEFF/,""));if(!$o(t))return null;for(let r of[...a,gg])try{let o=r(t);if(o)return o}catch{}return Cg(t)}catch{return null}}import{Fragment as vg,jsx as He,jsxs as Wa}from"react/jsx-runtime";function wc({src:e,icon:a=!1,video:t=!1}){let[r,o]=Ig(!1);if(r)return null;let s=He("img",{src:e,alt:"",loading:"lazy",referrerPolicy:"no-referrer",className:a?"w-4 h-4 rounded flex-shrink-0":"block w-full max-h-48 object-cover",onError:()=>o(!0)});return a?s:Wa("span",{className:"block relative overflow-hidden",children:[s,t&&He("span",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:He("span",{className:"rounded-full bg-black/40 p-2 text-white",children:He(Ia,{size:24,fill:"currentColor","aria-hidden":"true"})})})]})}var bg=e=>e>=1e4?`${Number((e/1e4).toFixed(1))}\u4E07`:String(e);function yc({content:e}){let a=Lg(()=>vc(e),[e]);if(!a)return He("span",{children:"[\u5361\u7247\u6D88\u606F]"});let t=Wa(vg,{children:[a.cover&&He(wc,{src:a.cover,video:a.video},a.cover),Wa("span",{className:"block px-3 py-2.5",children:[He("span",{className:"block text-sm font-medium leading-snug break-words line-clamp-3",children:a.title}),a.description&&He("span",{className:"block mt-1 text-xs opacity-70 whitespace-pre-wrap break-words line-clamp-4",children:a.description}),a.lines?.map((o,s)=>He("span",{className:"block mt-1 text-xs break-words line-clamp-2",children:o},s)),a.author&&He("span",{className:"block mt-2 text-xs opacity-70",children:a.author}),!!a.stats?.length&&He("span",{className:"flex flex-wrap gap-3 mt-1 text-xs opacity-60",children:a.stats.map(o=>Wa("span",{children:[bg(o.value)," ",o.label]},o.label))}),Wa("span",{className:"flex items-center gap-1.5 mt-2 text-xs opacity-70"+(a.kind==="forum"?"":" border-t border-current/10 pt-2"),children:[a.icon?He(wc,{src:a.icon,icon:!0},a.icon):He(wt,{size:14,className:"flex-shrink-0","aria-hidden":"true"}),He("span",{className:"min-w-0 break-words",children:a.source||a.label})]}),a.kind==="forum"&&Wa("span",{className:"flex items-center gap-1.5 border-t border-current/10 mt-2 pt-2 text-xs",children:[He(gr,{size:15,strokeWidth:2.5,className:"flex-shrink-0 text-sky-500","aria-hidden":"true"}),He("span",{className:"opacity-80",children:"\u817E\u8BAF\u9891\u9053"})]})]})]}),r="block max-w-full rounded-xl border border-current/10 bg-black/5 dark:bg-white/5 overflow-hidden text-inherit no-underline whitespace-normal";return a.url?He("a",{href:a.url,target:"_blank",rel:"noopener noreferrer","aria-label":`\u6253\u5F00${a.label}\uFF1A${a.title}`,className:r+" hover:opacity-90",style:{width:280},onClick:o=>o.stopPropagation(),children:t}):He("div",{className:r,style:{width:280},children:t})}var In=e=>!!(e.textElement||e.picElement||e.fileElement||e.pttElement||e.videoElement||e.faceElement||e.grayTipElement||e.arkElement||e.marketFaceElement||e.multiForwardMsgElement||e.markdownElement?.content?.trim());import{Fragment as Xo,jsx as H,jsxs as ye}from"react/jsx-runtime";var Vo=Ut.createContext(null),yn=Ut.createContext(null),kn=Ut.createContext(null),Sn=Ut.createContext(null),kc=(e,a)=>{if(!e)return"";if(e.startsWith("blob:"))return e;if(e.includes("qpic.cn")||e.includes("multimedia.nt.qq.com.cn")){if(e.includes("rkey="))return e;try{let t=new URL(e).searchParams.get("appid");if(t==="1406"&&a?.privateRkey)return e+a.privateRkey;if(t==="1407"&&a?.groupRkey)return e+a.groupRkey}catch{}return e}return e},Jo=wn(({element:e,message:a})=>H(yg,{name:"webqq.message.element",match:String(e.elementType),props:{element:e,message:a&&Po(a)},children:H(kg,{element:e,message:a})})),kg=wn(({element:e,message:a})=>{let[t,r]=et(!1),[o,s]=et(!1),[i,n]=et(!1),[l,u]=et(!1),d=Ut.useContext(Vo),c=Ut.useContext(yn),m=Ut.useContext(kn),p=Kt(h=>h.privateRkey),f=Kt(h=>h.groupRkey);if(vn(()=>{e.picElement&&Kt.getState().ensureRkey()},[e]),e.textElement)return H("span",{className:"whitespace-pre-wrap break-all",style:{overflowWrap:"anywhere",wordBreak:"break-all"},children:e.textElement.content});if(e.markdownElement)return H(bc,{content:e.markdownElement.content,message:a});if(e.picElement){let h=e.picElement,g=h.originImageUrl?h.originImageUrl.startsWith("http")?h.originImageUrl:`https://gchat.qpic.cn${h.originImageUrl}`:"",C=kc(g,{privateRkey:p,groupRkey:f}),L=200,x=300,v=h.picWidth||200,I=h.picHeight||200;return I>L&&(v=v*L/I,I=L),v>x&&(I=I*x/v,v=x),ye("div",{className:"relative rounded-lg overflow-hidden bg-theme-item cursor-pointer",style:{width:v,height:I},onClick:()=>d?.showPreview(C),onContextMenu:y=>{a&&(y.preventDefault(),y.stopPropagation(),m?.showMenu(y,a,e.elementId))},children:[!t&&!o&&H("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint",children:H(ee,{size:24,className:"animate-spin"})}),o&&H("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint text-xs",children:"\u56FE\u7247\u52A0\u8F7D\u5931\u8D25"}),H("img",{src:C,alt:"\u56FE\u7247",loading:"lazy",referrerPolicy:"no-referrer",className:`w-full h-full object-cover transition-opacity ${t?"opacity-100":"opacity-0"}`,onLoad:()=>r(!0),onError:()=>{s(!0),Kt.getState().refresh()}})]})}if(e.faceElement){let h=e.faceElement.faceIndex,g=e.faceElement.faceText;return H("img",{src:Ge(`/face/${h}.png`),alt:g||`[\u8868\u60C5${h}]`,title:g||`\u8868\u60C5${h}`,className:"inline-block align-text-bottom",style:{width:24,height:24},onError:C=>{let L=C.target;L.style.display="none";let x=document.createElement("span");x.textContent=g||`[\u8868\u60C5${h}]`,L.parentNode?.insertBefore(x,L)}})}if(e.fileElement){let h=e.fileElement,g=a?.chatType===2,C=g?{fileId:h.fileUuid,folderId:h.folderId}:void 0,L=a&&!g&&h.fileUuid?{fileId:h.fileUuid,peerUid:a.peerUid,isSelfSend:a.senderUid===ot()}:void 0;return H(Sg,{fileName:h.fileName,fileSize:h.fileSize,groupFile:C,privateFile:L})}if(e.pttElement)return H(Mg,{element:e,message:a});if(e.videoElement){let h=e.videoElement,g=200,C=300,L=h.thumbWidth||200,x=h.thumbHeight||150;x>g&&(L=L*g/x,x=g),L>C&&(x=x*C/L,L=C);let v="";if(h.thumbPath){let _;h.thumbPath instanceof Map?_=h.thumbPath.values().next().value:typeof h.thumbPath=="object"&&(_=Object.values(h.thumbPath)[0]),_&&(v=ht().authUrl(`/api/webqq/file-proxy?path=${encodeURIComponent(_)}`))}let I=h.fileTime||0,k=Math.floor(I/60),y=I%60,N=`${k}:${y.toString().padStart(2,"0")}`;return ye("div",{className:"relative rounded-lg overflow-hidden bg-theme-item cursor-pointer group",style:{width:L,height:x},onClick:()=>{h.fileUuid&&c?.showPreview(h.fileUuid,a?.chatType===2)},children:[H("div",{className:"absolute inset-0 fill-quiet"}),v?ye(Xo,{children:[!i&&!l&&H("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint",children:H(ee,{size:24,className:"animate-spin"})}),H("img",{src:v,alt:"\u89C6\u9891\u7F29\u7565\u56FE",loading:"lazy",className:`absolute inset-0 w-full h-full object-cover transition-opacity ${i?"opacity-100":"opacity-0"}`,onLoad:()=>n(!0),onError:()=>u(!0)})]}):H("div",{className:"absolute inset-0 flex items-center justify-center text-theme-hint text-xs",children:"\u89C6\u9891"}),H("div",{className:"absolute inset-0 flex items-center justify-center",children:H("div",{className:"w-12 h-12 rounded-full bg-black/50 flex items-center justify-center group-hover:bg-black/70 transition-colors",children:H("div",{className:"w-0 h-0 border-t-8 border-t-transparent border-l-12 border-l-white border-b-8 border-b-transparent ml-1",style:{borderLeftWidth:"14px"}})})}),H("div",{className:"absolute bottom-1 right-1 px-1.5 py-0.5 bg-black/60 rounded text-white text-xs",children:N})]})}if(e.grayTipElement){let h=e.grayTipElement;if(h.jsonGrayTipElement?.jsonStr)try{let g=JSON.parse(h.jsonGrayTipElement.jsonStr);if(g.items){let C=g.items.map(L=>L.txt||"").join("");return H("span",{className:"text-theme-hint text-xs",children:C||"[\u6233\u4E00\u6233]"})}}catch{}return H("span",{className:"text-theme-hint text-xs",children:"[\u7CFB\u7EDF\u63D0\u793A]"})}if(e.multiForwardMsgElement)return H(Eg,{element:e});if(e.arkElement){try{let h=JSON.parse(e.arkElement.bytesData);if(h.app==="com.tencent.multimsg"&&h.meta?.detail?.resid)return H(Tg,{arkData:h})}catch{}return H(yc,{content:e.arkElement.bytesData})}if(e.marketFaceElement){let{emojiId:h,faceName:g,supportSize:C}=e.marketFaceElement,{width:L=200,height:x=200}=C?.[0]??{},I=`https://gxh.vip.qq.com/club/item/parcel/item/${h.substring(0,2)}/${h}/raw${Math.min(L,300)}.gif`;return H("img",{src:I,alt:g||"[\u8868\u60C5\u5305]",title:g,className:"inline-block align-text-bottom rounded",style:{maxWidth:Math.min(L,200),maxHeight:Math.min(x,200)},onError:k=>{let y=k.target;y.style.display="none";let N=document.createElement("span");N.textContent=`[${g||"\u8868\u60C5\u5305"}]`,y.parentNode?.insertBefore(N,y)}})}return null}),Sg=wn(({fileName:e,fileSize:a,groupFile:t,privateFile:r})=>{let o=Rg(a),s=Ut.useContext(Sn),[i,n]=et(!1),l=!!t&&!!s,u=!!r,d=l||u;return ye("div",{className:`flex items-center gap-3 px-3 py-2.5 rounded-lg bg-white/5 dark:bg-white/5 border border-white/10 min-w-[220px] max-w-[280px]${d?" cursor-pointer hover:bg-white/10 transition-colors":""}`,onClick:d?async()=>{if(l){s.open(t);return}if(u&&!i){n(!0);try{let m=await Vl(r.peerUid,r.fileId,r.isSelfSend);window.open(m,"_blank")}catch(m){T(m.message||"\u4E0B\u8F7D\u5931\u8D25","error")}finally{n(!1)}}}:void 0,title:l?"\u5728\u7FA4\u6587\u4EF6\u4E2D\u67E5\u770B":u?"\u70B9\u51FB\u4E0B\u8F7D":void 0,children:[ye("div",{className:"flex-1 min-w-0",children:[H("div",{className:"text-sm font-medium leading-snug line-clamp-2 break-all",children:e}),o&&H("div",{className:"text-xs opacity-60 mt-1",children:o})]}),H("div",{className:"flex-shrink-0 w-10 h-10 rounded bg-white/10 flex items-center justify-center",children:i?H(ee,{className:"w-5 h-5 opacity-70 animate-spin"}):H(wt,{className:"w-5 h-5 opacity-70"})})]})});function Rg(e){if(!e||e<=0)return"";let a=["B","KB","MB","GB","TB"],t=0,r=e;for(;r>=1024&&t<a.length-1;)r/=1024,t++;return`${r.toFixed(r>=100||t===0?0:r>=10?1:2)} ${a[t]}`}var Sc=e=>!e.elements||e.elements.length===0?!1:e.elements.every(a=>a.grayTipElement||a.replyElement),Mg=({element:e,message:a})=>{let[t,r]=et(null),[o,s]=et(!1),[i,n]=et(!1),[l,u]=et(!1),[d,c]=et(!1),m=bn(null),p=bn(null),f=bn(null);vn(()=>()=>{f.current?.abort(),m.current&&(m.current.onended=null,m.current.onerror=null,m.current.onloadeddata=null,m.current.pause(),m.current.src=""),p.current&&URL.revokeObjectURL(p.current)},[]);let h=e.pttElement,g=h.duration||0,C=Math.floor(g/60),L=g%60,x=C>0?`${C}:${L.toString().padStart(2,"0")}`:`${L}"`,v=h.text,I=80,y=Math.min(200,Math.max(I,I+g*3)),N=async()=>{if(!a||!h.fileUuid&&!h.filePath||d)return;if(l&&m.current){m.current.pause(),u(!1);return}if(m.current&&m.current.readyState>=2){try{if(await m.current.play(),f.current?.signal.aborted)return;u(!0)}catch{if(f.current?.signal.aborted)return;u(!1),T("\u8BED\u97F3\u64AD\u653E\u5931\u8D25\uFF0C\u8BF7\u518D\u6B21\u70B9\u51FB\u64AD\u653E","error")}return}c(!0);let _=new AbortController;f.current=_;try{let B=a.chatType===2,K=await Gl(h.fileUuid||"",B,h.filePath,_.signal);if(_.signal.aborted)return;m.current&&(m.current.onended=null,m.current.onerror=null,m.current.onloadeddata=null,m.current.pause(),m.current.src=""),p.current&&URL.revokeObjectURL(p.current);let P=URL.createObjectURL(K);p.current=P;let F=new Audio;m.current=F,F.onended=()=>u(!1),F.onerror=()=>{u(!1),c(!1),T("\u8BED\u97F3\u65E0\u6CD5\u64AD\u653E\uFF0C\u8BF7\u91CD\u8BD5","error")},F.onloadeddata=async()=>{c(!1);try{if(await F.play(),_.signal.aborted)return;u(!0)}catch{if(_.signal.aborted)return;u(!1),T("\u8BED\u97F3\u64AD\u653E\u5931\u8D25\uFF0C\u8BF7\u518D\u6B21\u70B9\u51FB\u64AD\u653E","error")}},F.src=P}catch(B){if(_.signal.aborted)return;T(B instanceof Error?B.message:"\u83B7\u53D6\u8BED\u97F3\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5","error"),u(!1),c(!1)}},q=async()=>{if(!(!a||o||t!==null)){s(!0),n(!1);try{let _=await Ul(a.msgId,a.chatType,a.peerUid,e);r(_||"(\u65E0\u6CD5\u8BC6\u522B)")}catch(_){console.error("\u8BED\u97F3\u8F6C\u6587\u5B57\u5931\u8D25:",_),n(!0),r("\u8F6C\u6362\u5931\u8D25")}finally{s(!1)}}};return ye("div",{className:"flex flex-col gap-1",children:[ye("div",{className:"flex items-center gap-2",children:[ye("div",{className:"flex items-center gap-2 px-3 py-2 bg-green-100 dark:bg-green-900/40 rounded-full cursor-pointer hover:bg-green-200 dark:hover:bg-green-900/60 transition-colors",style:{width:y},onClick:N,title:"\u70B9\u51FB\u64AD\u653E",children:[d?H(ee,{size:16,className:"text-green-600 dark:text-green-400 flex-shrink-0 animate-spin"}):l?H(vr,{size:16,className:"text-green-600 dark:text-green-400 flex-shrink-0"}):H(Ia,{size:16,className:"text-green-600 dark:text-green-400 flex-shrink-0"}),H("div",{className:"flex-1 flex items-center gap-0.5",children:[1,2,3,4,5].map(_=>H("div",{className:`w-0.5 bg-green-400 dark:bg-green-500 rounded-full transition-all ${l?"animate-pulse":""}`,style:{height:`${8+Math.random()*8}px`}},_))}),H("span",{className:"text-xs text-green-700 dark:text-green-300 flex-shrink-0",children:x})]}),!v&&t===null&&H("button",{onClick:q,disabled:o,className:"w-6 h-6 flex items-center justify-center rounded-full fill-quiet fill-quiet-hover text-gray-500 dark:text-gray-300 hover:text-gray-700 dark:hover:text-white text-xs font-medium transition-colors disabled:opacity-50",title:"\u8BED\u97F3\u8F6C\u6587\u5B57",children:o?H(ee,{size:12,className:"animate-spin"}):"\u6587"})]}),(v||t)&&H("div",{className:`text-sm px-3 py-1.5 fill-quiet r-control max-w-[250px] ${i?"text-red-500":"text-theme-secondary"}`,children:v||t})]})},Ag=({segment:e})=>{let a=Ut.useContext(Vo),t=Kt(o=>o.privateRkey),r=Kt(o=>o.groupRkey);if(vn(()=>{e.type==="image"&&Kt.getState().ensureRkey()},[e]),e.type==="text"&&e.data.text)return H("span",{className:"whitespace-pre-wrap break-all",style:{overflowWrap:"anywhere"},children:e.data.text});if(e.type==="image"&&e.data.url){let o=kc(e.data.url,{privateRkey:t,groupRkey:r});return H("img",{src:o,alt:"\u56FE\u7247",loading:"lazy",referrerPolicy:"no-referrer",className:"max-w-[200px] max-h-[150px] rounded-lg cursor-pointer object-cover",onClick:()=>a?.showPreview(o),onError:()=>Kt.getState().refresh()})}return e.type==="face"&&e.data.faceId!==void 0?H("img",{src:Ge(`/face/${e.data.faceId}.png`),alt:`[\u8868\u60C5${e.data.faceId}]`,className:"inline-block align-text-bottom",style:{width:24,height:24},onError:o=>{let s=o.target;s.style.display="none";let i=document.createElement("span");i.textContent=`[\u8868\u60C5${e.data.faceId}]`,s.parentNode?.insertBefore(i,s)}}):e.type==="forward"&&e.data.resId?H(Pg,{resId:e.data.resId,title:e.data.title||"[\u804A\u5929\u8BB0\u5F55]"}):null},Pg=({resId:e,title:a})=>{let[t,r]=et(!1);return ye(Xo,{children:[ye("div",{className:"flex items-center gap-2 px-3 py-2 fill-quiet r-control cursor-pointer fill-quiet-hover transition-colors",onClick:()=>r(!0),children:[H("span",{className:"text-sm text-theme-secondary",children:a}),H(nt,{size:14,className:"text-theme-hint flex-shrink-0"})]}),t&&H(Rn,{resId:e,title:a,onClose:()=>r(!1)})]})};function Dg(e){let a=e.match(/<title[^>]*color="#000000"[^>]*>(.*?)<\/title>/)?.[1]||"[\u804A\u5929\u8BB0\u5F55]",r=e.match(/<title[^>]*color="#777777"[^>]*>(.*?)<\/title>/g)?.map(s=>s.replace(/<[^>]+>/g,""))||[],o=e.match(/<summary[^>]*>(.*?)<\/summary>/)?.[1]||"";return{title:a,previews:r,summary:o}}var Eg=({element:e})=>{let[a,t]=et(!1),r=e.multiForwardMsgElement,{title:o,previews:s,summary:i}=Dg(r.xmlContent);return ye(Xo,{children:[ye("div",{className:"w-[240px] fill-quiet r-control overflow-hidden cursor-pointer fill-quiet-hover transition-colors border border-theme-divider",onClick:()=>t(!0),children:[ye("div",{className:"px-3 pt-2.5 pb-1",children:[H("div",{className:"text-sm font-medium text-theme mb-1.5",children:o}),s.map((n,l)=>H("div",{className:"text-xs text-theme-secondary truncate leading-5",children:n},l))]}),ye("div",{className:"flex items-center justify-between px-3 py-1.5 border-t border-theme-divider",children:[H("span",{className:"text-xs text-theme-hint",children:i}),H(nt,{size:12,className:"text-theme-hint"})]})]}),a&&H(Rn,{resId:r.resId,title:o,onClose:()=>t(!1)})]})},Tg=({arkData:e})=>{let[a,t]=et(!1),r=e.meta?.detail||{},o=r.source||"[\u804A\u5929\u8BB0\u5F55]",s=(r.news||[]).map(l=>l.text||""),i=r.summary||"",n=r.resid||"";return ye(Xo,{children:[ye("div",{className:"w-[240px] fill-quiet r-control overflow-hidden cursor-pointer fill-quiet-hover transition-colors border border-theme-divider",onClick:()=>t(!0),children:[ye("div",{className:"px-3 pt-2.5 pb-1",children:[H("div",{className:"text-sm font-medium text-theme mb-1.5",children:o}),s.map((l,u)=>H("div",{className:"text-xs text-theme-secondary truncate leading-5",children:l},u))]}),ye("div",{className:"flex items-center justify-between px-3 py-1.5 border-t border-theme-divider",children:[H("span",{className:"text-xs text-theme-hint",children:i}),H(nt,{size:12,className:"text-theme-hint"})]})]}),a&&H(Rn,{resId:n,title:o,onClose:()=>t(!1)})]})},Rn=({resId:e,title:a,onClose:t})=>{let[r,o]=et([]),[s,i]=et(!0),[n,l]=et(null);Ut.useEffect(()=>{let d=!1;return(async()=>{try{i(!0),l(null);let m=await tu(e);d||o(m)}catch(m){d||l(m.message||"\u52A0\u8F7D\u5931\u8D25")}finally{d||i(!1)}})(),()=>{d=!0}},[e]);let u=d=>d?new Date(d*1e3).toLocaleTimeString("zh-CN",{hour:"2-digit",minute:"2-digit"}):"";return wg(H("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center scrim",onClick:t,children:ye("div",{className:"glass glass-thick r-window glass-pop w-[90vw] max-w-[480px] max-h-[80vh] flex flex-col overflow-hidden",onClick:d=>d.stopPropagation(),children:[ye("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider flex-shrink-0",children:[H("span",{className:"font-medium text-theme",children:a}),H("button",{onClick:t,className:"p-1 rounded-full fill-quiet-hover transition-colors",children:H(Re,{size:18,className:"text-theme-hint"})})]}),ye("div",{className:"flex-1 overflow-y-auto px-4 py-3 space-y-3",children:[s&&H("div",{className:"flex items-center justify-center py-8",children:H(ee,{size:24,className:"animate-spin text-pink-500"})}),n&&H("div",{className:"text-center py-8 text-red-500 text-sm",children:n}),!s&&!n&&r.length===0&&H("div",{className:"text-center py-8 text-theme-hint text-sm",children:"\u6682\u65E0\u6D88\u606F"}),!s&&!n&&r.map((d,c)=>ye("div",{className:"flex gap-2",children:[H("img",{src:Oe(d.senderUin),alt:d.senderName,className:"w-7 h-7 rounded-full object-cover flex-shrink-0 mt-0.5"}),ye("div",{className:"flex-1 min-w-0",children:[ye("div",{className:"flex items-center gap-2 mb-0.5",children:[H("span",{className:"text-xs font-medium text-theme-secondary",children:d.senderName}),H("span",{className:"text-xs text-theme-hint",children:u(d.time)})]}),ye("div",{className:"text-sm text-theme break-words",children:[d.segments.map((m,p)=>H(Ag,{segment:m},p)),d.segments.length===0&&H("span",{className:"text-theme-hint",children:"[\u4E0D\u652F\u6301\u7684\u6D88\u606F\u7C7B\u578B]"})]})]})]},c))]})]})}),document.body)};import lt,{useState as Mc,useEffect as Fg,memo as Ko}from"react";import{Slot as Ng,useSlotMatches as _g}from"@luckylillia-dev/plugin-sdk/webui";import{jsx as ie,jsxs as st}from"react/jsx-runtime";var An=lt.createContext(null),Pn=lt.createContext(null),Dn=lt.createContext(null),En=lt.createContext(null),Tn=lt.createContext(null),Fn=lt.createContext(null),Nn=lt.createContext(null),Rc=e=>{for(let a of e.elements)if(a.grayTipElement?.jsonGrayTipElement?.jsonStr)try{let t=JSON.parse(a.grayTipElement.jsonGrayTipElement.jsonStr);if(Array.isArray(t.items))return t.items}catch{}return null},Qo=(e,a,t)=>!!(a&&e.uid&&String(e.uid)===String(a)||t&&e.uin&&String(e.uin)===String(t)),Mn=(e,a,t)=>{let r=[],o=0;for(let s of e)if(s.type==="qq"){let i=Qo(s,a,t)?"\u4F60":s.nm||s.uin||s.uid||"";i&&r.push(ie("span",{className:"text-blue-500",children:i},o++))}else s.type==="nor"&&s.txt?r.push(ie("span",{children:s.txt},o++)):s.type==="img"&&s.src&&r.push(ie("img",{src:s.src,alt:"",referrerPolicy:"no-referrer",className:"inline-block w-4 h-4 mx-0.5 align-text-bottom",onError:i=>{i.currentTarget.style.display="none"}},o++));return r.length>0?r:"[\u7CFB\u7EDF\u63D0\u793A]"},Aa=new Map,Bg=Ko(({message:e,groupCode:a})=>{let t=ot(),r=gt(),o=Rc(e),s=!!o?.some(u=>u.type==="qq"&&u.uid&&!u.nm&&!Qo(u,t,r)),i=Aa.get(e.msgId)??(o&&!s?Mn(o,t,r):void 0),[n,l]=Mc(i??"[\u7CFB\u7EDF\u63D0\u793A]");return Fg(()=>{if(Aa.has(e.msgId)){l(Aa.get(e.msgId));return}let u=Rc(e);if(!u){for(let m of e.elements)if(m.grayTipElement?.xmlElement?.content){let p=m.grayTipElement.xmlElement.content.replace(/<[^>]+>/g,"");Aa.set(e.msgId,p),l(p);return}Aa.set(e.msgId,"[\u7CFB\u7EDF\u63D0\u793A]"),l("[\u7CFB\u7EDF\u63D0\u793A]");return}if(!u.some(m=>m.type==="qq"&&m.uid&&!m.nm&&!Qo(m,t,r))){let m=Mn(u,t,r);Aa.set(e.msgId,m),l(m);return}(async()=>{let m=await Promise.all(u.map(async f=>{if(f.type==="qq"&&f.uid&&!f.nm&&!Qo(f,t,r)){let h=await ql(f.uid,a);return{...f,nm:h}}return f})),p=Mn(m,t,r);Aa.set(e.msgId,p),l(p)})()},[e.msgId,t,r,a]),ie("div",{className:"flex justify-center py-2",children:ie("span",{className:"text-xs text-theme-hint bg-theme-item/50 px-3 py-1 rounded-full",children:n})})}),Ac=Ko(({message:e,allMessages:a,isHighlighted:t})=>{if(Sc(e)){let S=e.chatType===2?String(e.peerUin):void 0;return ie(Bg,{message:e,groupCode:S})}let r=ot(),o=r?e.senderUid===r:!1,s=lt.useContext(An),i=lt.useContext(En),n=lt.useContext(Tn),l=lt.useContext(Fn),u=lt.useContext(Nn),d=lt.useContext(Pn),c=_g("webqq.message.element"),m=Er(e);if(e.chatType===1&&!o&&u){let S=u.getFriend(String(e.senderUin));S&&(m=S.remark||S.nickname||m)}let p=Oe(e.senderUin),f=Number(e.msgTime)*1e3,h,g,C;if(e.chatType===2){let S=e.msgAttrs;if(S){let O=(M=>{if(S instanceof Map)return S.get(M);if(typeof S=="object")return S[M.toString()]})(2);O?.groupHonor&&(h=O.groupHonor.level,g=O.groupHonor.uniqueTitle||void 0)}if(l){let O=l.getMembers(String(e.peerUin))?.find(M=>M.uid===e.senderUid||M.uin===String(e.senderUin));O&&(C=O.role,h===void 0&&O.level&&(h=O.level),!g&&O.specialTitle&&(g=O.specialTitle))}}if(!e.elements||!Array.isArray(e.elements))return null;let L=e.recallTime&&e.recallTime!=="0",x=e.elements.find(S=>S.replyElement)?.replyElement,v=e.elements.filter(S=>!S.replyElement);if(!(v.some(S=>In(S)||c.includes(String(S.elementType)))||x))return null;let k=v.length===1&&v[0].pttElement&&!x,y=x?.replayMsgSeq??x?.replyMsgSeq,N=x?a.find(S=>S.msgId===x.replayMsgId||String(S.msgSeq)===String(y)):null,q=S=>{d?.enabled||(S.preventDefault(),S.stopPropagation(),s?.showMenu(S,e))},_=S=>{S.preventDefault(),S.stopPropagation(),i?.showMenu(S,{senderUid:e.senderUid,senderUin:String(e.senderUin),senderName:m,chatType:e.chatType,groupCode:e.chatType===2?String(e.peerUin):void 0})},B=S=>{("ontouchstart"in window||navigator.maxTouchPoints>0)&&(S.preventDefault(),S.stopPropagation(),i?.showMenu(S,{senderUid:e.senderUid,senderUin:String(e.senderUin),senderName:m,chatType:e.chatType,groupCode:e.chatType===2?String(e.peerUin):void 0}))},K=()=>{x&&n?.scrollToMessage(x.replayMsgId,y===void 0?void 0:String(y))},P=st("div",{className:`flex gap-2 w-full ${o?"flex-row-reverse":""} ${t?"animate-pulse fill-selected r-control -mx-2 px-2":""}`,children:[ie("img",{src:p,alt:m,loading:"lazy",className:"w-8 h-8 rounded-full object-cover flex-shrink-0 cursor-pointer hover:opacity-80 transition-opacity",onClick:B,onContextMenu:_}),st("div",{className:`flex flex-col ${o?"items-end":"items-start"} max-w-[calc(100%-48px)] md:max-w-[70%] min-w-0 overflow-hidden`,children:[st("div",{className:`flex items-center gap-1.5 mb-1 ${o?"flex-row-reverse":""}`,children:[ie("span",{className:"text-xs text-theme-hint",children:m}),h!==void 0&&h>0&&st("span",{className:"text-xs px-1 py-0.5 fill-quiet text-theme-secondary r-inner",children:["Lv.",h]}),C==="owner"&&ie("span",{className:"text-xs px-1.5 py-0.5 bg-amber-100 dark:bg-amber-900/50 text-amber-600 dark:text-amber-300 rounded",children:g||"\u7FA4\u4E3B"}),C==="admin"&&ie("span",{className:"text-xs px-1.5 py-0.5 bg-blue-100 dark:bg-blue-900/50 text-blue-600 dark:text-blue-300 rounded",children:g||"\u7BA1\u7406\u5458"}),C==="member"&&g&&ie("span",{className:"text-xs px-1.5 py-0.5 bg-pink-100 dark:bg-pink-900/50 text-pink-600 dark:text-pink-300 rounded",children:g})]}),ie(Ng,{name:"webqq.message.bubble",props:{message:Po(e)},children:k?st("div",{onContextMenu:q,className:L?"opacity-50":"",children:[v.map((S,z)=>ie(Jo,{element:S,message:e},z)),L&&ie("div",{className:"text-xs text-theme-muted italic mt-1",children:"\u5DF2\u64A4\u56DE"})]}):st("div",{className:"relative",children:[st("div",{className:`rounded-[18px] px-4 py-2 min-w-[80px] max-w-full break-words overflow-hidden bg-theme-item text-theme ${L?"opacity-50":""}`,onContextMenu:q,children:[x&&ie("div",{className:"text-xs mb-2 pb-2 border-b border-theme-divider cursor-pointer hover:opacity-80 transition-opacity",onClick:K,children:ie("div",{className:"bg-theme-input rounded px-2 py-1",children:N?st("div",{className:"space-y-1",children:[st("div",{className:"font-medium text-theme-secondary",children:[Er(N),":"]}),ie("div",{className:"text-theme-muted",children:N.elements?.filter(S=>!S.replyElement).map((S,z)=>ie(Jo,{element:S},z))})]}):ie("span",{className:"text-theme-muted",children:x.sourceMsgText||"[\u6D88\u606F]"})})}),v.map((S,z)=>ie(Jo,{element:S,message:e},z))]}),L&&ie("div",{className:"text-xs text-theme-muted italic mt-1",children:"\u5DF2\u64A4\u56DE"})]})}),ie(Ug,{message:e,isSelf:o}),ie("span",{className:"text-xs text-theme-hint mt-1",children:_r(f)})]})]});if(!d?.enabled)return P;let F=d.isSelected(e.msgId);return st("div",{onClick:()=>d.toggle(e.msgId),className:`flex items-center gap-2 cursor-pointer rounded-lg -mx-2 px-2 py-1 transition-colors ${F?"fill-selected":"hover:bg-theme-item-hover"}`,children:[ie("input",{type:"checkbox",checked:F,readOnly:!0,className:"w-4 h-4 flex-shrink-0 accent-pink-500 pointer-events-none"}),ie("div",{className:"flex-1 min-w-0 pointer-events-none",children:P})]})});function qg(e,a){if(a==="2"){let t=parseInt(e).toString(16);return Ge(`/face/emoji-${t}.png`)}return Ge(`/face/${e}.png`)}var Ug=Ko(({message:e,isSelf:a})=>{let[t,r]=Mc(null),o=lt.useContext(Dn);if(!e.emojiLikesList||e.emojiLikesList.length===0)return null;let s=async(i,n)=>{if(!t){r(i);try{await Fr(e.chatType,String(e.peerUin),e.msgSeq,i,!n),o?.onSelfReact(e.msgSeq,i,!n,String(e.peerUin))}catch(l){T(l.message||"\u64CD\u4F5C\u5931\u8D25","error")}finally{r(null)}}};return ie("div",{className:`flex flex-wrap gap-1 mt-1 ${a?"justify-end":"justify-start"}`,children:e.emojiLikesList.map((i,n)=>{let l=qg(i.emojiId,i.emojiType);return st("button",{onClick:()=>s(i.emojiId,i.isClicked),disabled:t===i.emojiId,className:`flex items-center gap-0.5 px-1.5 py-0.5 rounded-full text-xs transition-all cursor-pointer hover:scale-105 active:scale-95 ${i.isClicked?"bg-pink-100 dark:bg-pink-900/40 border border-pink-300 dark:border-pink-700":"bg-theme-item border border-theme-divider hover:border-pink-300 dark:hover:border-pink-700"} ${t===i.emojiId?"opacity-50":""}`,title:i.isClicked?"\u70B9\u51FB\u53D6\u6D88":"\u70B9\u51FB\u8DDF\u8D34",children:[ie("img",{src:l,alt:`\u8868\u60C5${i.emojiId}`,className:"w-4 h-4",onError:u=>{if(i.emojiType==="2"){let d=u.target,c=String.fromCodePoint(parseInt(i.emojiId));d.style.display="none",d.insertAdjacentHTML("afterend",`<span class="text-sm">${c}</span>`)}}}),ie("span",{className:"text-theme-secondary",children:i.likesCnt})]},`${i.emojiId}-${n}`)})})}),Pc=Ko(({message:e,onRetry:a})=>{let t=gt(),r=t?Oe(t):"";return st("div",{className:"flex gap-2 flex-row-reverse w-full",children:[r&&ie("img",{src:r,alt:"\u6211",loading:"lazy",className:"w-8 h-8 rounded-full object-cover flex-shrink-0"}),st("div",{className:"flex flex-col items-end max-w-[calc(100%-48px)] md:max-w-[70%] min-w-0 overflow-hidden",children:[ie("span",{className:"text-xs text-theme-hint mb-1",children:"\u6211"}),st("div",{className:"flex items-end gap-1",children:[e.status==="failed"&&ie("button",{onClick:a,className:"p-1 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/30 rounded",title:"\u91CD\u65B0\u53D1\u9001",children:ie(ba,{size:14})}),ie("div",{className:"rounded-[18px] px-4 py-2 bg-theme-item text-theme min-w-[80px] max-w-full break-words overflow-hidden",children:e.items.map((o,s)=>o.type==="text"&&o.content?ie("span",{className:"whitespace-pre-wrap break-words",children:o.content},s):o.type==="face"&&o.faceId!==void 0?ie("img",{src:Ge(`/face/${o.faceId}.png`),alt:`[\u8868\u60C5${o.faceId}]`,className:"inline-block align-text-bottom",style:{width:24,height:24}},s):o.type==="image"&&o.imageUrl?ie("img",{src:o.imageUrl,alt:"\u56FE\u7247",loading:"lazy",className:"max-w-full rounded-lg",style:{maxHeight:"200px"}},s):o.type==="at"&&o.atName?st("span",{className:"text-blue-500",children:["@",o.atName]},s):null)}),e.status==="sending"&&ie(ee,{size:14,className:"animate-spin text-theme-hint"}),e.status==="failed"&&ie(bt,{size:14,className:"text-red-500"})]}),ie("span",{className:"text-xs text-theme-hint mt-1",children:_r(e.timestamp)})]})]})});import{useState as eo}from"react";import{createPortal as _n}from"react-dom";import{Fragment as Bn,jsx as we,jsxs as Be}from"react/jsx-runtime";var Zo=({name:e,onMute:a,onClose:t})=>{let[r,o]=eo(0),[s,i]=eo(0),[n,l]=eo(0),[u,d]=eo(0),c=()=>{let p=r+s*60+n*3600+u*86400;p>0&&a(p)},m=r+s*60+n*3600+u*86400;return _n(Be(Bn,{children:[we("div",{className:"fixed inset-0 z-50 bg-black/30",onClick:t}),Be("div",{className:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[340px]",children:[Be("h3",{className:"text-lg font-medium text-theme mb-4",children:["\u7981\u8A00 ",e]}),Be("div",{className:"mb-4",children:[we("p",{className:"text-sm text-theme-secondary mb-3",children:"\u8BBE\u7F6E\u7981\u8A00\u65F6\u957F\uFF1A"}),Be("div",{className:"grid grid-cols-4 gap-2",children:[Be("div",{className:"flex flex-col items-center",children:[we("input",{type:"number",min:0,max:59,value:r,onChange:p=>o(Math.min(59,Math.max(0,parseInt(p.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),we("span",{className:"text-xs text-theme-secondary mt-1",children:"\u79D2"})]}),Be("div",{className:"flex flex-col items-center",children:[we("input",{type:"number",min:0,max:59,value:s,onChange:p=>i(Math.min(59,Math.max(0,parseInt(p.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),we("span",{className:"text-xs text-theme-secondary mt-1",children:"\u5206\u949F"})]}),Be("div",{className:"flex flex-col items-center",children:[we("input",{type:"number",min:0,max:23,value:n,onChange:p=>l(Math.min(23,Math.max(0,parseInt(p.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),we("span",{className:"text-xs text-theme-secondary mt-1",children:"\u5C0F\u65F6"})]}),Be("div",{className:"flex flex-col items-center",children:[we("input",{type:"number",min:0,max:29,value:u,onChange:p=>d(Math.min(29,Math.max(0,parseInt(p.target.value)||0))),className:"w-full px-2 py-2 text-center bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20"}),we("span",{className:"text-xs text-theme-secondary mt-1",children:"\u5929"})]})]}),we("p",{className:"text-xs text-theme-secondary mt-2 text-center",children:"\u6700\u957F29\u592923\u5C0F\u65F659\u520659\u79D2"})]}),Be("div",{className:"flex justify-between",children:[we("button",{onClick:()=>a(0),className:"px-4 py-2 text-sm text-green-500 hover:bg-green-50 dark:hover:bg-green-900/30 rounded-lg transition-colors",children:"\u89E3\u9664\u7981\u8A00"}),Be("div",{className:"flex gap-2",children:[we("button",{onClick:t,className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),we("button",{onClick:c,disabled:m===0,className:"px-4 py-2 text-sm bg-orange-500 text-white hover:bg-orange-600 rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"\u786E\u8BA4\u7981\u8A00"})]})]})]})]}),document.body)},Yo=({name:e,groupName:a,onConfirm:t,onClose:r})=>_n(Be(Bn,{children:[we("div",{className:"fixed inset-0 z-50 bg-black/50",onClick:r}),Be("div",{className:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[320px]",children:[we("h3",{className:"text-lg font-medium text-theme mb-4",children:"\u786E\u8BA4\u8E22\u51FA"}),Be("p",{className:"text-theme-secondary mb-6",children:["\u786E\u5B9A\u8981\u5C06 ",we("span",{className:"font-medium text-theme",children:e})," \u79FB\u51FA\u7FA4 ",we("span",{className:"font-medium text-theme",children:a})," \u5417\uFF1F"]}),Be("div",{className:"flex justify-end gap-3",children:[we("button",{onClick:r,className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),we("button",{onClick:t,className:"px-4 py-2 text-sm bg-red-500 text-white hover:bg-red-600 rounded-lg transition-colors",children:"\u786E\u8BA4\u8E22\u51FA"})]})]})]}),document.body),es=({name:e,onConfirm:a,onClose:t})=>{let[r,o]=eo("");return _n(Be(Bn,{children:[we("div",{className:"fixed inset-0 z-50 bg-black/30",onClick:t}),Be("div",{className:"fixed z-50 top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-6 min-w-[320px]",children:[we("h3",{className:"text-lg font-medium text-theme mb-4",children:"\u8BBE\u7F6E\u5934\u8854"}),Be("p",{className:"text-sm text-theme-secondary mb-3",children:["\u4E3A ",e," \u8BBE\u7F6E\u4E13\u5C5E\u5934\u8854\uFF1A"]}),we("input",{type:"text",maxLength:12,value:r,onChange:s=>o(s.target.value),placeholder:"\u7559\u7A7A\u6E05\u9664\u5934\u8854",className:"w-full px-3 py-2 bg-theme-input border border-theme-input rounded-lg text-theme focus:outline-none focus:ring-2 focus:ring-pink-500/20 placeholder:text-theme-hint",autoFocus:!0,onKeyDown:s=>{s.key==="Enter"&&a(r.trim())}}),we("p",{className:"text-xs text-theme-secondary mt-2",children:"\u4E2D\u6587\u6700\u591A6\u5B57\uFF0C\u82F1\u6587\u6700\u591A12\u5B57\uFF0C\u6309\u56DE\u8F66\u786E\u8BA4"}),Be("div",{className:"flex justify-end gap-2 mt-4",children:[we("button",{onClick:t,className:"px-4 py-2 text-sm text-theme-secondary hover:bg-theme-item rounded-lg transition-colors",children:"\u53D6\u6D88"}),we("button",{onClick:()=>a(r.trim()),className:"px-4 py-2 text-sm bg-pink-500 text-white hover:bg-pink-600 rounded-lg transition-colors",children:"\u786E\u8BA4"})]})]})]}),document.body)};import{useState as Og,useEffect as zg,useRef as Dc}from"react";import{createPortal as Ec}from"react-dom";import{Fragment as qn,jsx as Ve,jsxs as qe}from"react/jsx-runtime";function Tc(e,a,t){let[r,o]=Og({left:-9999,top:-9999,ready:!1});return zg(()=>{o({left:-9999,top:-9999,ready:!1});let s=requestAnimationFrame(()=>{if(!t.current){o({left:e,top:a,ready:!0});return}let i=t.current.getBoundingClientRect(),n=10,l=e,u=a;e+i.width>window.innerWidth-n&&(l=e-i.width),l<n&&(l=n),a+i.height>window.innerHeight-n&&(u=a-i.height),u<n&&(u=n),o({left:l,top:u,ready:!0})});return()=>cancelAnimationFrame(s)},[e,a]),r}var Fc=({contextMenu:e,session:a,getCachedMembers:t,onClose:r,onReply:o,onEmojiReaction:s,onRecall:i,onForward:n,onMultiSelect:l})=>{let u=e.message,d=ot(),c=d&&u.senderUid===d,m=u.chatType===2,p=m&&a?t(a.peerId):null,h=(p&&d?p.find(B=>B.uid===d):null)?.role,g=h==="owner",C=h==="admin"||h==="owner",x=(p?p.find(B=>B.uid===u.senderUid):null)?.role,I=c||m&&(g||C&&!(x==="admin"||x==="owner")),k=!!e.elementId,y=Dc(null),N=Tc(e.x,e.y,y),q=async()=>{if(e.elementId){r();try{let P=u.elements.find(z=>z.elementId===e.elementId)?.picElement?.originImageUrl||"";if(!P){T("\u56FE\u7247\u5730\u5740\u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u6DFB\u52A0","error");return}let F=P.startsWith("http")?P:`https://gchat.qpic.cn${P}`,S=await jl(F);S.result===0?T(S.isExist?"\u8868\u60C5\u5DF2\u5B58\u5728":"\u5DF2\u6DFB\u52A0\u5230\u8868\u60C5","success"):T(S.errMsg||"\u6DFB\u52A0\u5931\u8D25","error")}catch(B){T(B.message||"\u6DFB\u52A0\u5931\u8D25","error")}}},_=async()=>{if(e.elementId){r();try{let K=u.elements.find(S=>S.elementId===e.elementId)?.picElement,P=K?.originImageUrl||"";if(!P){T("\u56FE\u7247\u5730\u5740\u4E3A\u7A7A\uFF0C\u65E0\u6CD5\u4E0B\u8F7D","error");return}let F=P.startsWith("http")?P:`https://gchat.qpic.cn${P}`;await Lo(F,K?.fileName||K?.md5HexStr)}catch(B){T(B.message||"\u4E0B\u8F7D\u5931\u8D25","error")}}};return Ec(qe(qn,{children:[Ve("div",{className:"fixed inset-0 z-40",onClick:r,onContextMenu:B=>{B.preventDefault(),r()}}),qe("div",{ref:y,className:"fixed z-50 bg-popup r-control glass-pop origin-top-left py-1 min-w-[100px]",style:{left:N.left,top:N.top,visibility:N.ready?"visible":"hidden"},onContextMenu:B=>B.preventDefault(),children:[qe("button",{onClick:()=>{o(u),r()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(va,{size:14})," \u56DE\u590D"]}),!k&&qe(qn,{children:[qe("button",{onClick:()=>{n(u),r()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(Ca,{size:14})," \u8F6C\u53D1"]}),qe("button",{onClick:()=>{l(u),r()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(Cr,{size:14})," \u591A\u9009\u8F6C\u53D1"]})]}),a.chatType===2&&qe("button",{onClick:()=>{s(u,e.x,e.y),r()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(Tt,{size:14})," \u8D34\u8868\u60C5"]}),k&&qe("button",{onClick:_,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve($t,{size:14})," \u4E0B\u8F7D\u56FE\u7247"]}),k&&qe("button",{onClick:q,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(wa,{size:14})," \u6DFB\u52A0\u5230\u8868\u60C5"]}),I&&qe("button",{onClick:async()=>{r();try{await Fl(u.chatType,u.peerUid,u.msgId),i(u.msgId),T("\u6D88\u606F\u5DF2\u64A4\u56DE","success")}catch(B){T(B.message||"\u64A4\u56DE\u5931\u8D25","error")}},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-500 hover:bg-theme-item-hover transition-colors",children:[Ve(We,{size:14})," \u64A4\u56DE"]})]})]}),document.body)},ts=({avatarContextMenu:e,getCachedMembers:a,onClose:t,onInsertAt:r,onShowProfile:o,onSetTitle:s,onMute:i,onKick:n,onAdminChanged:l,groupName:u})=>{let d=ot(),c=e.groupCode?a(e.groupCode):null,p=(c&&d?c.find(_=>_.uid===d):null)?.role,f=p==="owner",h=p==="admin",C=(c?c.find(_=>_.uid===e.senderUid):null)?.role,L=C==="admin",x=f||h&&C==="member",v=f||h&&C==="member",I=e.senderUid===d,k=f&&!I,y=Dc(null),N=Tc(e.x,e.y,y),q=async()=>{let _=e;t();try{await Ol(_.groupCode,_.senderUid,!L),T(L?"\u5DF2\u53D6\u6D88\u7BA1\u7406\u5458":"\u5DF2\u8BBE\u4E3A\u7BA1\u7406\u5458","success"),l?.()}catch(B){T(B.message||"\u64CD\u4F5C\u5931\u8D25","error")}};return Ec(qe(qn,{children:[Ve("div",{className:"fixed inset-0 z-40",onClick:t,onContextMenu:_=>{_.preventDefault(),t()}}),qe("div",{ref:y,className:"fixed z-50 bg-popup r-control glass-pop origin-top-left py-1 min-w-[120px]",style:{left:N.left,top:N.top,visibility:N.ready?"visible":"hidden"},onContextMenu:_=>_.preventDefault(),children:[e.chatType===2&&qe("button",{onClick:()=>{r(e.senderUid,e.senderUin,e.senderName),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(nr,{size:14})," \u53EC\u5524ta"]}),qe("button",{onClick:async()=>{let _=e;t();try{_.chatType===2&&_.groupCode?await Rs(_.chatType,parseInt(_.senderUin),parseInt(_.groupCode)):await Rs(_.chatType,parseInt(_.senderUin))}catch(B){T(B.message||"\u6233\u4E00\u6233\u5931\u8D25","error")}},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(hr,{size:14})," \u6233\u4E00\u6233"]}),qe("button",{onClick:()=>{o(e.senderUid,e.senderUin,e.x,e.y,e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(Pr,{size:14})," \u67E5\u770B\u8D44\u6599"]}),e.chatType===2&&e.groupCode&&f&&qe("button",{onClick:()=>{s(e.senderUid,e.senderName,e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[Ve(ir,{size:14})," \u8BBE\u7F6E\u5934\u8854"]}),e.chatType===2&&e.groupCode&&k&&qe("button",{onClick:q,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-theme hover:bg-theme-item-hover transition-colors",children:[L?Ve(yr,{size:14}):Ve(yt,{size:14}),L?"\u53D6\u6D88\u7BA1\u7406\u5458":"\u8BBE\u4E3A\u7BA1\u7406\u5458"]}),e.chatType===2&&e.groupCode&&!I&&x&&qe("button",{onClick:()=>{i(e.senderUid,e.senderName,e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-orange-500 hover:bg-theme-item-hover transition-colors",children:[Ve(Dr,{size:14})," \u7981\u8A00"]}),e.chatType===2&&e.groupCode&&!I&&v&&qe("button",{onClick:()=>{n(e.senderUid,e.senderName,e.groupCode,u||e.groupCode),t()},className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-500 hover:bg-theme-item-hover transition-colors",children:[Ve(Mr,{size:14})," \u8E22\u51FA\u7FA4"]})]})]}),document.body)};import{useRef as Xa,useCallback as Lt,useState as Qa,forwardRef as lx,useImperativeHandle as ux,useEffect as dx}from"react";import{useRef as Un,useCallback as Je,forwardRef as Hg,useImperativeHandle as jg,useState as Gg}from"react";import{jsx as Nc,jsxs as Wg}from"react/jsx-runtime";var On=Hg(({placeholder:e="\u8F93\u5165\u6D88\u606F...",disabled:a=!1,onEnter:t,onPaste:r,onChange:o,onMentionChange:s},i)=>{let n=Un(null),l=Un(!1),u=Un(null),[d,c]=Gg(!1),m=Je(()=>{let P=n.current;if(!P)return[];let F=[],S=P.childNodes;for(let z=0;z<S.length;z++){let O=S[z];if(O.nodeType===Node.TEXT_NODE){let U=(O.textContent||"").replace(/\u200B/g,"");U&&F.push({type:"text",content:U})}else if(O.nodeType===Node.ELEMENT_NODE){let M=O;if(M.dataset.type==="face")F.push({type:"face",faceId:parseInt(M.dataset.faceId||"0")});else if(M.dataset.type==="image")F.push({type:"image",imageUrl:M.dataset.imageUrl,imageFile:M.__file});else if(M.dataset.type==="at")F.push({type:"at",atUid:M.dataset.atUid,atUin:M.dataset.atUin,atName:M.dataset.atName});else if(M.tagName==="BR")F.push({type:"text",content:`
17
+ `});else{let te=(M.textContent||"").replace(/\u200B/g,"");te&&F.push({type:"text",content:te})}}}return F},[]),p=Je(()=>{let P=m();return P.length===0||P.length===1&&P[0].type==="text"&&!P[0].content?.trim()},[m]),f=Je(()=>{let P=window.getSelection();if(!P||P.rangeCount===0)return{top:0,left:0};let S=P.getRangeAt(0).getBoundingClientRect(),z=n.current?.getBoundingClientRect();return z?{top:z.bottom-S.top+8,left:S.left-z.left}:{top:0,left:0}},[]),h=Je(()=>{if(!u.current)return"";let P=window.getSelection();if(!P||P.rangeCount===0)return"";let F=P.getRangeAt(0),{node:S,offset:z}=u.current;return F.startContainer!==S?"":(S.textContent||"").slice(z,F.startOffset)},[]),g=Je(()=>{u.current=null,c(!1),s?.({active:!1,query:"",position:{top:0,left:0}})},[s]),C=Je(()=>{let P=window.getSelection();if(!P||P.rangeCount===0)return;let F=P.getRangeAt(0),S=F.startContainer;if(S.nodeType!==Node.TEXT_NODE){d&&g();return}let z=S.textContent||"",O=F.startOffset;if(d&&u.current){if(u.current.node===S&&O>=u.current.offset){let te=h();te.includes(" ")?g():s?.({active:!0,query:te,position:f()})}else g();return}let M=z.slice(0,O),U=M.lastIndexOf("@");if(U!==-1){let te=U>0?M[U-1]:" ";if(te===" "||te===`
18
+ `||U===0){let de=M.slice(U+1);de.includes(" ")||(u.current={node:S,offset:U+1},c(!0),s?.({active:!0,query:de,position:f()}))}}},[d,h,f,g,s]),L=Je(P=>{let F=n.current;if(!F)return;g();let S=document.createTextNode(P),z=window.getSelection();if(z&&z.rangeCount>0){let O=z.getRangeAt(0);F.contains(O.commonAncestorContainer)?(O.deleteContents(),O.insertNode(S),O.setStartAfter(S),O.setEndAfter(S),z.removeAllRanges(),z.addRange(O)):F.appendChild(S)}else F.appendChild(S);F.focus(),o?.(m())},[o,m,g]),x=Je(P=>{let F=n.current;if(!F)return;g();let S=document.createElement("span");S.contentEditable="false",S.dataset.type="face",S.dataset.faceId=String(P),S.className="inline-block align-middle mx-0.5 select-all";let z=document.createElement("img");z.src=Ge(`/face/${P}.png`),z.alt="[\u8868\u60C5]",z.className="w-6 h-6 inline-block",z.draggable=!1,S.appendChild(z);let O=window.getSelection();if(O&&O.rangeCount>0){let M=O.getRangeAt(0);if(F.contains(M.commonAncestorContainer)){M.deleteContents(),M.insertNode(S);let U=document.createTextNode("\u200B");S.after(U),M.setStartAfter(U),M.setEndAfter(U),O.removeAllRanges(),O.addRange(M)}else{F.appendChild(S);let U=document.createTextNode("\u200B");F.appendChild(U)}}else{F.appendChild(S);let M=document.createTextNode("\u200B");F.appendChild(M)}F.focus(),o?.(m())},[o,m,g]),v=Je((P,F)=>{let S=n.current;if(!S)return;g();let z=document.createElement("span");z.contentEditable="false",z.dataset.type="image",z.dataset.imageUrl=F,P&&(z.__file=P),z.className="inline-block align-middle mx-0.5 select-all",z.innerHTML=`<img src="${F}" alt="[\u56FE\u7247]" class="h-16 max-w-[200px] rounded inline-block object-cover" draggable="false" />`;let O=window.getSelection();if(O&&O.rangeCount>0){let M=O.getRangeAt(0);if(S.contains(M.commonAncestorContainer)){M.deleteContents(),M.insertNode(z);let U=document.createTextNode("\u200B");z.after(U),M.setStartAfter(U),M.setEndAfter(U),O.removeAllRanges(),O.addRange(M)}else{S.appendChild(z);let U=document.createTextNode("\u200B");S.appendChild(U)}}else{S.appendChild(z);let M=document.createTextNode("\u200B");S.appendChild(M)}S.focus(),o?.(m())},[o,m,g]),I=Je((P,F,S)=>{let z=n.current;if(!z)return;if(d&&u.current){let{node:de,offset:je}=u.current,tt=window.getSelection();if(tt&&tt.rangeCount>0){let Ue=tt.getRangeAt(0),at=document.createRange();at.setStart(de,je-1),at.setEnd(Ue.startContainer,Ue.startOffset),at.deleteContents()}}g();let O=document.createElement("span");O.contentEditable="false",O.dataset.type="at",O.dataset.atUid=P,O.dataset.atUin=F,O.dataset.atName=S,O.className="inline-block align-middle mx-0.5 px-1 py-0.5 bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-300 text-sm rounded select-all",O.textContent=`@${S}`;let M=window.getSelection();if(M&&M.rangeCount>0){let de=M.getRangeAt(0);z.contains(de.commonAncestorContainer)?(de.deleteContents(),de.insertNode(O),de.setStartAfter(O),de.setEndAfter(O),M.removeAllRanges(),M.addRange(de)):z.appendChild(O)}else z.appendChild(O);let U=document.createTextNode(" ");O.after(U);let te=document.createRange();te.setStartAfter(U),te.setEndAfter(U),M?.removeAllRanges(),M?.addRange(te),z.focus(),o?.(m())},[d,o,m,g]),k=Je(()=>{let P=n.current;P&&(P.innerHTML="",g(),o?.([]))},[o,g]),y=Je(()=>{let P=n.current;if(!P)return;P.focus();let F=window.getSelection();if(F){let S=document.createRange();S.selectNodeContents(P),S.collapse(!1),F.removeAllRanges(),F.addRange(S)}},[]);jg(i,()=>({focus:y,clear:k,insertFace:x,insertText:L,insertImage:v,insertAt:I,getContent:m,isEmpty:p,cancelMention:g}),[y,k,x,L,v,I,m,p,g]);let N=Je(P=>{if(d){if(["ArrowUp","ArrowDown","Enter","Tab"].includes(P.key))return;if(P.key==="Escape"){P.preventDefault(),g();return}}P.key==="Enter"&&!P.shiftKey&&!l.current&&!d&&(P.preventDefault(),t?.())},[t,d,g]),q=Je(()=>{C(),o?.(m())},[o,m,C]),_=Je(P=>{let F=P.clipboardData?.items;if(F){for(let z=0;z<F.length;z++)if(F[z].type.startsWith("image/")){P.preventDefault(),r?.(P);return}}P.preventDefault();let S=P.clipboardData?.getData("text/plain");S&&document.execCommand("insertText",!1,S)},[r]),B=Je(()=>{setTimeout(C,0)},[C]),K=Je(()=>{setTimeout(()=>{d&&g()},200)},[d,g]);return Wg("div",{className:"relative",children:[Nc("div",{ref:n,contentEditable:!a,onKeyDown:N,onInput:q,onPaste:_,onClick:B,onBlur:K,onCompositionStart:()=>{l.current=!0},onCompositionEnd:()=>{l.current=!1,q()},className:`min-h-[36px] max-h-[120px] overflow-y-auto px-3 py-2 outline-none text-theme whitespace-pre-wrap break-words ${a?"opacity-50 cursor-not-allowed":""}`,style:{wordBreak:"break-word"},"data-placeholder":e,suppressContentEditableWarning:!0}),Nc("style",{children:`
19
+ [data-placeholder]:empty:before {
20
+ content: attr(data-placeholder);
21
+ color: var(--theme-hint, #9ca3af);
22
+ pointer-events: none;
23
+ }
24
+ `})]})});On.displayName="RichInput";import{useState as $g,useEffect as as,useRef as Vg,useMemo as Jg}from"react";import{jsx as Ot,jsxs as zn}from"react/jsx-runtime";var _c=({members:e,loading:a,query:t,onSelect:r,onClose:o})=>{let s=Vg(null),[i,n]=$g(0),l=Jg(()=>{if(!t)return e.slice(0,20);let d=t.toLowerCase();return e.filter(c=>c.nickname.toLowerCase().includes(d)||c.card?.toLowerCase().includes(d)||c.uin.includes(t)).slice(0,20)},[e,t]);as(()=>{n(0)},[t]),as(()=>{let d=c=>{c.key==="ArrowDown"?(c.preventDefault(),n(m=>Math.min(m+1,l.length-1))):c.key==="ArrowUp"?(c.preventDefault(),n(m=>Math.max(m-1,0))):c.key==="Enter"||c.key==="Tab"?(c.preventDefault(),l[i]&&r(l[i])):c.key==="Escape"&&(c.preventDefault(),o())};return window.addEventListener("keydown",d),()=>window.removeEventListener("keydown",d)},[l,i,r,o]),as(()=>{let d=c=>{s.current&&!s.current.contains(c.target)&&o()};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),as(()=>{let d=s.current;if(!d)return;let c=d.querySelector(`[data-index="${i}"]`);c&&c.scrollIntoView({block:"nearest"})},[i]);let u=d=>d==="owner"?Ot(vt,{size:12,className:"text-yellow-500"}):d==="admin"?Ot(yt,{size:12,className:"text-green-500"}):null;return Ot("div",{ref:s,className:"absolute z-50 glass glass-thick glass-dense r-card glass-pop origin-bottom-left overflow-hidden",style:{bottom:"100%",left:0,marginBottom:8,minWidth:240,maxWidth:300},children:a?Ot("div",{className:"flex items-center justify-center py-4",children:Ot(ee,{size:20,className:"animate-spin text-pink-500"})}):l.length===0?Ot("div",{className:"py-3 px-4 text-sm text-theme-muted text-center",children:t?"\u6CA1\u6709\u5339\u914D\u7684\u6210\u5458":"\u6682\u65E0\u6210\u5458"}):Ot("div",{className:"max-h-[200px] overflow-y-auto py-1",children:l.map((d,c)=>zn("div",{"data-index":c,onClick:()=>r(d),className:`flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors ${c===i?"bg-pink-50 dark:bg-pink-900/30":"hover:bg-theme-item-hover"}`,children:[Ot("img",{src:d.avatar||`https://q1.qlogo.cn/g?b=qq&nk=${d.uin}&s=40`,alt:"",className:"w-7 h-7 rounded-full flex-shrink-0",loading:"lazy"}),zn("div",{className:"flex-1 min-w-0",children:[zn("div",{className:"flex items-center gap-1",children:[Ot("span",{className:"text-sm text-theme truncate",children:d.card||d.nickname}),u(d.role)]}),d.card&&d.card!==d.nickname&&Ot("div",{className:"text-xs text-theme-muted truncate",children:d.nickname})]})]},d.uid))})})};import{useState as Hn,useEffect as Xg,useRef as Qg}from"react";import{Fragment as tx,jsx as Ct,jsxs as rs}from"react/jsx-runtime";var Kg=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,43,46,49,53,56,59,60,63,64,66,67,74,75,76,77,78,79,85,86,89,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,114,116,118,119,120,121,123,124,125,129,137,144,146,147,169,171,172,173,174,175,176,177,178,179,181,182,183,185,187,201,212,262,263,264,265,266,267,268,269,270,271,272,273,277,281,282,283,284,285,286,287,289,293,294,295,297,298,299,300,302,303,305,306,307,311,312,314,317,318,319,320,323,324,325,326,332,333,334,336,337,338,339,341,342,343,344,345,346,347,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,415,416,417,419,420,421,422,423,424,425,426,427,428,429,430,431,432,451,453,454,458,459,460,461,462],Zg=[{codePoint:9728,char:"\u2600"},{codePoint:9749,char:"\u2615"},{codePoint:9786,char:"\u263A"},{codePoint:10024,char:"\u2728"},{codePoint:10068,char:"\u2754"},{codePoint:127801,char:"\u{1F339}"},{codePoint:127817,char:"\u{1F349}"},{codePoint:127822,char:"\u{1F34E}"},{codePoint:127827,char:"\u{1F353}"},{codePoint:127836,char:"\u{1F35C}"},{codePoint:127838,char:"\u{1F35E}"},{codePoint:127847,char:"\u{1F367}"},{codePoint:127866,char:"\u{1F37A}"},{codePoint:127867,char:"\u{1F37B}"},{codePoint:127881,char:"\u{1F389}"},{codePoint:127978,char:"\u{1F3EA}"},{codePoint:128014,char:"\u{1F40E}"},{codePoint:128020,char:"\u{1F414}"},{codePoint:128027,char:"\u{1F41B}"},{codePoint:128046,char:"\u{1F42E}"},{codePoint:128051,char:"\u{1F433}"},{codePoint:128053,char:"\u{1F435}"},{codePoint:128054,char:"\u{1F436}"},{codePoint:128055,char:"\u{1F437}"},{codePoint:128056,char:"\u{1F438}"},{codePoint:128064,char:"\u{1F440}"},{codePoint:128070,char:"\u{1F446}"},{codePoint:128074,char:"\u{1F44A}"},{codePoint:128076,char:"\u{1F44C}"},{codePoint:128077,char:"\u{1F44D}"},{codePoint:128078,char:"\u{1F44E}"},{codePoint:128079,char:"\u{1F44F}"},{codePoint:128098,char:"\u{1F462}"},{codePoint:128102,char:"\u{1F466}"},{codePoint:128103,char:"\u{1F467}"},{codePoint:128123,char:"\u{1F47B}"},{codePoint:128137,char:"\u{1F489}"},{codePoint:128147,char:"\u{1F493}"},{codePoint:128157,char:"\u{1F49D}"},{codePoint:128163,char:"\u{1F4A3}"},{codePoint:128164,char:"\u{1F4A4}"},{codePoint:128166,char:"\u{1F4A6}"},{codePoint:128168,char:"\u{1F4A8}"},{codePoint:128169,char:"\u{1F4A9}"},{codePoint:128170,char:"\u{1F4AA}"},{codePoint:128235,char:"\u{1F4EB}"},{codePoint:128293,char:"\u{1F525}"},{codePoint:128299,char:"\u{1F52B}"},{codePoint:128513,char:"\u{1F601}"},{codePoint:128514,char:"\u{1F602}"},{codePoint:128516,char:"\u{1F604}"},{codePoint:128522,char:"\u{1F60A}"},{codePoint:128524,char:"\u{1F60C}"},{codePoint:128525,char:"\u{1F60D}"},{codePoint:128527,char:"\u{1F60F}"},{codePoint:128530,char:"\u{1F612}"},{codePoint:128531,char:"\u{1F613}"},{codePoint:128532,char:"\u{1F614}"},{codePoint:128536,char:"\u{1F618}"},{codePoint:128538,char:"\u{1F61A}"},{codePoint:128540,char:"\u{1F61C}"},{codePoint:128541,char:"\u{1F61D}"},{codePoint:128557,char:"\u{1F62D}"},{codePoint:128560,char:"\u{1F630}"},{codePoint:128561,char:"\u{1F631}"},{codePoint:128563,char:"\u{1F633}"},{codePoint:128591,char:"\u{1F64F}"},{codePoint:128684,char:"\u{1F6AC}"}],Yg="webqq_recent_emojis";function qc(){let e=qa();return e?`${e}-${Yg}`:null}var ex=10;function os(){let e=qc();if(!e)return[];try{let a=localStorage.getItem(e);if(!a)return[];let t=JSON.parse(a);return Array.isArray(t)&&t.length>0&&typeof t[0]=="number"?t.map(r=>({type:"face",faceId:r})):t}catch{return[]}}function Bc(e){let a=qc();if(!a)return;let t=os().filter(r=>r.type!==e.type?!0:r.type==="face"?r.faceId!==e.faceId:r.codePoint!==e.codePoint);t.unshift(e),localStorage.setItem(a,JSON.stringify(t.slice(0,ex)))}var ss=({onSelect:e,onSelectEmoji:a,onClose:t,position:r,inline:o})=>{let[s,i]=Hn(new Set),[n,l]=Hn(os()),[u,d]=Hn("qq"),c=Qg(null);Xg(()=>{let h=g=>{c.current&&!c.current.contains(g.target)&&t()};return document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[t]);let m=h=>{Bc({type:"face",faceId:h}),l(os()),e(h)},p=(h,g)=>{Bc({type:"emoji",codePoint:h,char:g}),l(os()),a&&a(g)},f=(h,g)=>h.type==="face"&&h.faceId!==void 0?Ct("button",{onClick:()=>m(h.faceId),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors",title:`\u8868\u60C5 ${h.faceId}`,children:Ct("img",{src:Ge(`/face/${h.faceId}.png`),alt:`\u8868\u60C5${h.faceId}`,className:"w-6 h-6"})},`recent-face-${h.faceId}`):h.type==="emoji"&&h.char?Ct("button",{onClick:()=>p(h.codePoint,h.char),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors text-xl",title:h.char,children:h.char},`recent-emoji-${h.codePoint}`):null;return rs("div",{ref:c,className:`${o?"":"absolute bottom-full left-0 mb-2"} glass glass-thick glass-dense r-card glass-pop origin-bottom-left z-50`,style:r?{left:r.x,bottom:r.y}:void 0,children:[rs("div",{className:"flex border-b border-theme-divider",children:[Ct("button",{className:`flex-1 px-3 py-2 text-sm ${u==="qq"?"text-pink-500 border-b-2 border-pink-500":"text-theme-secondary"}`,onClick:()=>d("qq"),children:"QQ\u8868\u60C5"}),Ct("button",{className:`flex-1 px-3 py-2 text-sm ${u==="emoji"?"text-pink-500 border-b-2 border-pink-500":"text-theme-secondary"}`,onClick:()=>d("emoji"),children:"Emoji"})]}),rs("div",{className:"p-2 max-h-[280px] overflow-y-auto w-[320px]",children:[n.length>0&&rs(tx,{children:[Ct("div",{className:"text-xs text-theme-hint mb-1",children:"\u6700\u8FD1\u4F7F\u7528"}),Ct("div",{className:"grid grid-cols-8 gap-1 mb-2 pb-2 border-b border-theme-divider",children:n.map((h,g)=>f(h,g))})]}),u==="qq"?Ct("div",{className:"grid grid-cols-8 gap-1",children:Kg.map(h=>Ct("button",{onClick:()=>m(h),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors",title:`\u8868\u60C5 ${h}`,children:Ct("img",{src:Ge(`/face/${h}.png`),alt:`\u8868\u60C5${h}`,className:`w-6 h-6 transition-opacity ${s.has(h)?"opacity-100":"opacity-0"}`,onLoad:()=>i(g=>new Set(g).add(h)),onError:g=>{g.target.style.display="none"}})},h))}):Ct("div",{className:"grid grid-cols-8 gap-1",children:Zg.map(({codePoint:h,char:g})=>Ct("button",{onClick:()=>p(h,g),className:"w-8 h-8 flex items-center justify-center hover:bg-theme-item rounded transition-colors text-xl",title:g,children:g},h))})]})]})};import{useState as Va,useEffect as jn,useRef as Gn}from"react";import{createPortal as ax}from"react-dom";import{Fragment as Wn,jsx as Xe,jsxs as Ja}from"react/jsx-runtime";var $a=null;var rx="webqq_recent_fav_emojis",ox=10;function $n(){let e=qa();return e?`${e}-${rx}`:null}function to(){let e=$n();if(!e)return[];try{let a=localStorage.getItem(e);return a?JSON.parse(a):[]}catch{return[]}}function sx(e){let a=$n();if(!a)return;let t=to().filter(r=>r.emoId!==e.emoId);t.unshift(e),localStorage.setItem(a,JSON.stringify(t.slice(0,ox)))}function nx(e){let a=$n();if(!a)return;let t=to().filter(r=>r.emoId!==e);localStorage.setItem(a,JSON.stringify(t))}var ix=({x:e,y:a,onClose:t,onDelete:r})=>{let o=Gn(null),[s,i]=Va({left:e,top:a});return jn(()=>{if(!o.current)return;let n=o.current.getBoundingClientRect(),l=10,u=e,d=a;e+n.width>window.innerWidth-l&&(u=e-n.width),u<l&&(u=l),a+n.height>window.innerHeight-l&&(d=a-n.height),d<l&&(d=l),i({left:u,top:d})},[e,a]),ax(Ja(Wn,{children:[Xe("div",{className:"fixed inset-0 z-[60]",onClick:t,onContextMenu:n=>{n.preventDefault(),t()}}),Xe("div",{ref:o,className:"fixed z-[60] bg-popup r-control glass-pop origin-top-left py-1 min-w-[100px]",style:{left:s.left,top:s.top},onContextMenu:n=>n.preventDefault(),children:Ja("button",{onClick:r,className:"w-full flex items-center gap-2 px-3 py-2 text-sm text-red-500 hover:bg-theme-item-hover transition-colors",children:[Xe(We,{size:14})," \u5220\u9664"]})})]}),document.body)},Uc=({onSelect:e,onClose:a})=>{let[t,r]=Va($a||[]),[o,s]=Va(!$a),[i,n]=Va(null),[l,u]=Va(to()),[d,c]=Va(null),m=Gn(null);jn(()=>{if($a){r($a),s(!1);return}(async()=>{try{let x=(await zl()).map(v=>({emoId:v.emoId,resId:v.resId||"",url:v.url,desc:v.desc||""}));$a=x,r(x)}catch{n("\u52A0\u8F7D\u5931\u8D25")}finally{s(!1)}})()},[]);let p=Gn(d);p.current=d,jn(()=>{let C=L=>{p.current||m.current&&!m.current.contains(L.target)&&a()};return document.addEventListener("mousedown",C),()=>document.removeEventListener("mousedown",C)},[a]);let f=C=>{sx(C),u(to()),e(C)},h=(C,L)=>{C.preventDefault(),C.stopPropagation(),c({x:C.clientX,y:C.clientY,emoji:L})},g=async()=>{if(!d)return;let{emoji:C}=d;c(null);try{let L=await Hl(C.resId);if(L.result===0){T("\u5DF2\u5220\u9664","success");let x=t.filter(v=>v.emoId!==C.emoId);r(x),$a=x,nx(C.emoId),u(to())}else T(L.errMsg||"\u5220\u9664\u5931\u8D25","error")}catch(L){T(L.message||"\u5220\u9664\u5931\u8D25","error")}};return Ja("div",{ref:m,className:"absolute bottom-full left-0 mb-2 glass glass-thick glass-dense r-card glass-pop origin-bottom-left z-50 w-[320px]",children:[Xe("div",{className:"p-2 border-b border-theme-divider text-sm text-theme-secondary",children:"\u6536\u85CF\u8868\u60C5"}),Ja("div",{className:"p-2 max-h-[300px] overflow-y-auto",children:[l.length>0&&Ja(Wn,{children:[Xe("div",{className:"text-xs text-theme-hint mb-1",children:"\u6700\u8FD1\u4F7F\u7528"}),Xe("div",{className:"grid grid-cols-4 gap-1 mb-2 pb-2 border-b border-theme-divider",children:l.map(C=>Xe("button",{onClick:()=>f(C),onContextMenu:L=>h(L,C),className:"p-1 rounded-lg hover:bg-theme-item transition-colors",title:C.desc,children:Xe("img",{src:C.url,alt:C.desc,className:"w-16 h-16 object-contain"})},`recent-${C.emoId}`))})]}),o?Xe("div",{className:"flex items-center justify-center py-8",children:Xe(ee,{size:24,className:"animate-spin text-pink-500"})}):i?Xe("div",{className:"text-center py-8 text-theme-hint text-sm",children:i}):t.length===0?Xe("div",{className:"text-center py-8 text-theme-hint text-sm",children:"\u6682\u65E0\u6536\u85CF\u8868\u60C5"}):Ja(Wn,{children:[Xe("div",{className:"text-xs text-theme-hint mb-1",children:"\u5168\u90E8"}),Xe("div",{className:"grid grid-cols-4 gap-1",children:t.map(C=>Xe("button",{onClick:()=>f(C),onContextMenu:L=>h(L,C),className:"p-1 rounded-lg hover:bg-theme-item transition-colors",title:C.desc,children:Xe("img",{src:C.url,alt:C.desc,className:"w-16 h-16 object-contain",loading:"lazy"})},C.emoId))})]})]}),d&&Xe(ix,{x:d.x,y:d.y,emoji:d.emoji,onClose:()=>c(null),onDelete:g})]})};import{jsx as Se,jsxs as Ka}from"react/jsx-runtime";var Vn=lx((e,a)=>{let{session:t,replyTo:r,onReplyCancel:o,onSendStart:s,onSendEnd:i,onTempMessage:n,onTempMessageRemove:l,onTempMessageFail:u}=e,d=Xa(null),c=Xa(null),m=Xa(null),[p,f]=Qa(!1),[h,g]=Qa(!1),[C,L]=Qa(!1),[x,v]=Qa({active:!1,query:"",position:{top:0,left:0}}),[I,k]=Qa([]),[y,N]=Qa(!1),{getCachedMembers:q,fetchGroupMembers:_}=ne(),B=Xa(null),K=Xa(q);K.current=q;let P=Xa(_);P.current=_,dx(()=>{let V=t?.chatType===2?t.peerId:null;if(B.current=V,!V){k([]),N(!1);return}let oe=!Na(2,V);if(!oe){let Ie=K.current(V);if(Ie){k(Ie),N(!1);return}}N(!0),k([]),P.current(V,oe).then(Ie=>{B.current===V&&(k(Ie),N(!1))}).catch(()=>{B.current===V&&N(!1)})},[t?.chatType,t?.peerId]);let F=Lt(V=>{if(t?.chatType!==2){v({active:!1,query:"",position:{top:0,left:0}});return}v(V)},[t?.chatType]),S=Lt(V=>{d.current?.insertAt(V.uid,V.uin,V.card||V.nickname)},[]),z=Lt(()=>{d.current?.cancelMention()},[]),O=Lt(async(V,oe)=>{if(!t)return!1;s();let Ie=V.map(J=>({type:J.type,content:J.content,faceId:J.faceId,imageUrl:J.imageUrl,atName:J.atName})),D=`temp_${Date.now()}_${Math.random().toString(36).slice(2)}`;n({msgId:D,items:Ie,timestamp:Date.now(),status:"sending"});try{let J=[];oe&&J.push({type:"reply",msgId:oe.msgId,msgSeq:oe.msgSeq});for(let ue of V)if(ue.type==="text"&&ue.content)J.push({type:"text",text:ue.content});else if(ue.type==="face"&&ue.faceId!==void 0)J.push({type:"face",faceId:ue.faceId});else if(ue.type==="image"){if(ue.imageFile){let Me=await Pl(ue.imageFile);J.push({type:"image",imagePath:Me.imagePath})}else if(ue.imageUrl){let Me=await Dl(ue.imageUrl);J.push({type:"image",imagePath:Me.imagePath})}}else ue.type==="at"&&ue.atUid&&J.push({type:"at",uid:ue.atUid,uin:ue.atUin,name:ue.atName});return J.length===0?(l(D),!1):(await ys({chatType:t.chatType,peerId:t.peerId,content:J}),l(D),!0)}catch{return T("\u53D1\u9001\u5931\u8D25","error"),u(D),!1}finally{i()}},[t,s,i,n,l,u]),M=Lt(async()=>{if(!t||!d.current||d.current.isEmpty())return;let V=d.current.getContent(),oe=r;d.current.clear(),o(),L(!1),setTimeout(()=>d.current?.focus(),0),await O(V,oe)},[t,r,o,O]);ux(a,()=>({insertAt:(V,oe,Ie)=>d.current?.insertAt(V,oe,Ie),insertText:V=>d.current?.insertText(V),focus:()=>d.current?.focus(),sendCommand:V=>O([{type:"text",content:V}],null)}),[O]);let U=Lt(V=>{d.current?.insertFace(V),f(!1)},[]),te=Lt(V=>{d.current?.insertText(V),f(!1)},[]),de=Lt(V=>{g(!1),d.current?.insertImage(null,V.url)},[]),je=Lt(V=>{let oe=V.target.files?.[0];if(oe){if(!ou(oe.name)){T("\u4E0D\u652F\u6301\u7684\u56FE\u7247\u683C\u5F0F\uFF0C\u4EC5\u652F\u6301 JPG\u3001PNG\u3001GIF","error");return}d.current?.insertImage(oe,URL.createObjectURL(oe)),c.current&&(c.current.value="")}},[]),tt=Lt(async V=>{let oe=V.target.files?.[0];if(!oe||!t)return;if(oe.size>100*1024*1024){T("\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 100MB","error");return}m.current&&(m.current.value=""),s();let Ie=`temp_${Date.now()}`;n({msgId:Ie,items:[{type:"text",content:`[\u6587\u4EF6] ${oe.name}`}],timestamp:Date.now(),status:"sending"});try{let D=await ks(oe);await ys({chatType:t.chatType,peerId:t.peerId,content:[{type:"file",filePath:D.filePath,fileName:D.fileName}]}),l(Ie)}catch{T("\u53D1\u9001\u5931\u8D25","error"),u(Ie)}finally{i()}},[t,s,i,n,l,u]),Ue=Lt(V=>{let oe=V.clipboardData?.items;if(oe){for(let Ie=0;Ie<oe.length;Ie++)if(oe[Ie].type.startsWith("image/")){let D=oe[Ie].getAsFile();if(!D)continue;let J=D.type.split("/")[1]?.toLowerCase();if(!["jpeg","jpg","png","gif"].includes(J)){T("\u4E0D\u652F\u6301\u7684\u56FE\u7247\u683C\u5F0F","error");return}d.current?.insertImage(D,URL.createObjectURL(D));return}}},[]),at=Lt(V=>{L(V.length>0&&!(V.length===1&&V[0].type==="text"&&!V[0].content?.trim()))},[]);return Ka("div",{className:"glass-bar hairline-t",children:[r&&Se("div",{className:"px-4 py-2 hairline-b bg-theme-item",children:Ka("div",{className:"flex items-center gap-2",children:[Se(va,{size:16,className:"text-pink-500 flex-shrink-0"}),Ka("div",{className:"flex-1 min-w-0 text-sm text-theme-secondary truncate",children:["\u56DE\u590D ",r.sendMemberName||r.sendNickName||r.senderUin,"\uFF1A",r.elements?.filter(V=>!V.replyElement).map((V,oe)=>V.textElement?Se("span",{children:V.textElement.content},oe):V.picElement?Se("span",{children:"[\u56FE\u7247]"},oe):V.faceElement?Se("span",{children:"[\u8868\u60C5]"},oe):null)]}),Se("button",{onClick:o,className:"p-1 text-theme-hint hover:text-theme rounded",children:Se(Re,{size:16})})]})}),Ka("div",{className:"px-4 pt-0.5 pb-3",children:[Ka("div",{className:"flex items-center gap-1 mb-2 relative",children:[Se("button",{onClick:()=>{f(!p),g(!1)},className:`p-2 rounded-lg transition-colors ${p?"text-pink-500 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30"}`,title:"\u8868\u60C5",children:Se(Tt,{size:18})}),Se("button",{onClick:()=>{g(!h),f(!1)},className:`p-2 rounded-lg transition-colors ${h?"text-pink-500 bg-pink-50 dark:bg-pink-900/30":"text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30"}`,title:"\u6536\u85CF\u8868\u60C5",children:Se(kr,{size:18})}),Se("button",{onClick:()=>c.current?.click(),className:"p-2 text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30 rounded-lg transition-colors",title:"\u56FE\u7247",children:Se(xr,{size:18})}),Se("button",{onClick:()=>m.current?.click(),className:"p-2 text-theme-muted hover:text-pink-500 hover:bg-pink-50 dark:hover:bg-pink-900/30 rounded-lg transition-colors",title:"\u6587\u4EF6",children:Se(br,{size:18})}),p&&Se(ss,{onSelect:U,onSelectEmoji:te,onClose:()=>f(!1)}),h&&Se(Uc,{onSelect:de,onClose:()=>g(!1)})]}),Ka("div",{className:"flex items-end gap-2 relative",children:[Se("input",{type:"file",ref:c,onChange:je,accept:"image/jpeg,image/png,image/gif",className:"hidden"}),Se("input",{type:"file",ref:m,onChange:tt,className:"hidden"}),Se("div",{className:"flex-1 bg-theme-input border border-theme-input rounded-xl focus-within:ring-2 focus-within:ring-pink-500/20 overflow-hidden",children:Se(On,{ref:d,placeholder:"\u8F93\u5165\u6D88\u606F...",onEnter:M,onPaste:Ue,onChange:at,onMentionChange:F})}),x.active&&t?.chatType===2&&Se(_c,{members:I,loading:y,query:x.query,position:x.position,onSelect:S,onClose:z}),Se("button",{onClick:M,disabled:!C,className:"p-2.5 bg-pink-500 text-white rounded-full hover:bg-pink-600 disabled:opacity-50 disabled:cursor-not-allowed flex-shrink-0",children:Se(wr,{size:20})})]})]})]})});Vn.displayName="ChatInput";function Jn(e,a){return!e||!a||e.chatType!==a.chatType?!1:String(e.peerUin||e.peerUid)===a.peerId}function Xn(e,a,t){if(e.kind!=="command"||!e.text?.trim()||!["input","enter"].includes(e.action||""))return"\u65E0\u6548\u6307\u4EE4";if(Array.from(e.text).length>100)return"\u6307\u4EE4\u8D85\u8FC7 100 \u5B57\u7B26";if(!Jn(a,t))return"\u8BF7\u5728\u6D88\u606F\u6240\u5C5E\u4F1A\u8BDD\u4E2D\u4F7F\u7528";if(e.action==="enter"&&t.chatType!==1)return"\u56DE\u8F66\u6307\u4EE4\u4EC5\u652F\u6301\u79C1\u804A"}async function Oc(e,a,t){let r=Xn(e,a,t.session);if(r)throw new Error(r);if(e.action==="input")t.insertText(e.text),e.reference&&t.reply(a);else if(!await t.sendText(e.text))throw new Error("\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5")}import{useState as cx,useMemo as zc}from"react";import{createPortal as fx}from"react-dom";import{Fragment as px,jsx as Pt,jsxs as Zt}from"react/jsx-runtime";var mx=({count:e,onSelect:a,onClose:t,sending:r})=>{let{recentChats:o,friendCategories:s,groups:i}=ne(),[n,l]=cx(""),u=zc(()=>{let c=new Set,m=[],p=f=>{if(f.chatType!==1&&f.chatType!==2)return;let h=`${f.chatType}_${f.peerId}`;c.has(h)||(c.add(h),m.push(f))};for(let f of o)p({chatType:f.chatType,peerId:f.peerId,name:f.peerName,avatar:f.peerAvatar});for(let f of i)p({chatType:2,peerId:f.groupCode,name:f.remarkName||f.groupName,avatar:f.avatar});for(let f of s)for(let h of f.friends)p({chatType:1,peerId:h.uin,name:h.remark||h.nickname,avatar:h.avatar});return m},[o,s,i]),d=zc(()=>{let c=n.trim().toLowerCase();return c?u.filter(m=>m.name.toLowerCase().includes(c)||m.peerId.includes(c)):u},[u,n]);return fx(Zt(px,{children:[Pt("div",{className:"fixed inset-0 z-[60] bg-black/40",onClick:r?void 0:t}),Zt("div",{className:"fixed z-[60] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop w-[360px] max-w-[92vw] max-h-[70vh] flex flex-col",children:[Zt("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider",children:[Zt("div",{className:"font-medium text-theme",children:["\u8F6C\u53D1\u5230",e>1?`\uFF08\u5408\u5E76 ${e} \u6761\uFF09`:""]}),Pt("button",{onClick:t,disabled:r,className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors disabled:opacity-50",children:Pt(Re,{size:18})})]}),Pt("div",{className:"p-3 border-b border-theme-divider",children:Zt("div",{className:"relative",children:[Pt(Vt,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-theme-hint"}),Pt("input",{autoFocus:!0,value:n,onChange:c=>l(c.target.value),placeholder:"\u641C\u7D22\u4F1A\u8BDD / \u597D\u53CB / \u7FA4",className:"w-full pl-9 pr-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme placeholder:text-theme-hint"})]})}),Zt("div",{className:"flex-1 overflow-y-auto py-1 relative",children:[r&&Pt("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-[rgb(var(--glass-tint)/0.6)]",children:Pt(ee,{size:24,className:"animate-spin text-pink-500"})}),d.length===0?Pt("div",{className:"flex items-center justify-center h-24 text-theme-hint text-sm",children:"\u672A\u627E\u5230\u4F1A\u8BDD"}):d.map(c=>Zt("button",{onClick:()=>a(c),disabled:r,className:"w-full flex items-center gap-3 px-3 py-2 hover:bg-theme-item-hover transition-colors text-left disabled:opacity-50",children:[Pt("img",{src:c.avatar,alt:c.name,loading:"lazy",className:"w-9 h-9 rounded-full object-cover flex-shrink-0",onError:m=>{m.currentTarget.src=c.chatType===2?`https://p.qlogo.cn/gh/${c.peerId}/${c.peerId}/100/`:`https://q1.qlogo.cn/g?b=qq&nk=${c.peerId}&s=100`}}),Zt("div",{className:"flex-1 min-w-0",children:[Pt("div",{className:"text-sm text-theme truncate",children:c.name}),Zt("div",{className:"text-xs text-theme-hint truncate",children:[c.chatType===2?"\u7FA4\u804A":"\u597D\u53CB"," \xB7 ",c.peerId]})]})]},`${c.chatType}_${c.peerId}`))]})]})]}),document.body)},Hc=mx;import{createPortal as hx}from"react-dom";import{Fragment as gx,jsx as Qn,jsxs as xx}from"react/jsx-runtime";var jc=({target:e,onClose:a,onReacted:t,containerRef:r})=>{let o=async l=>{let u=e.message;a();try{await Fr(u.chatType,String(u.peerUin),u.msgSeq,String(l),!0),t?.(String(l))}catch(d){T(d.message||"\u8D34\u8868\u60C5\u5931\u8D25","error")}},s=async l=>{let u=e.message;a();try{let d=l.codePointAt(0);if(!d){T("\u65E0\u6548\u7684\u8868\u60C5","error");return}await Fr(u.chatType,String(u.peerUin),u.msgSeq,String(d),!0),t?.(String(d))}catch(d){T(d.message||"\u8D34\u8868\u60C5\u5931\u8D25","error")}},n=(()=>{if(r?.current){let l=r.current.getBoundingClientRect();return{left:l.left+l.width/2,top:l.top+l.height/2}}return{left:window.innerWidth/2,top:window.innerHeight/2}})();return hx(xx(gx,{children:[Qn("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:a}),Qn("div",{className:"fixed z-50 -translate-x-1/2 -translate-y-1/2",style:{left:n.left,top:n.top},children:Qn(ss,{onSelect:o,onSelectEmoji:s,onClose:a,inline:!0})})]}),document.body)};import{Fragment as yx,jsx as $,jsxs as Qe}from"react/jsx-runtime";function bx(e){let a=parseInt(e);if(a>1e3){let t=a.toString(16);return Ge(`/face/emoji-${t}.png`)}return Ge(`/face/${e}.png`)}var vx=({tip:e,onScrollToMessage:a})=>{let t=bx(e.emojiId),r=parseInt(e.emojiId);return $("div",{className:"flex justify-center py-2",children:Qe("span",{className:"text-xs text-theme-hint bg-theme-item/50 px-3 py-1 rounded-full",children:[$("span",{className:"text-blue-500",children:e.userName}),$("span",{children:" \u56DE\u5E94\u4E86"}),$("span",{className:"text-blue-500 cursor-pointer hover:underline",onClick:()=>a(e.msgSeq),children:"\u6D88\u606F"}),$("span",{children:" "}),$("img",{src:t,alt:"emoji",className:"inline-block w-4 h-4 align-text-bottom",onError:o=>{let s=o.target;s.dataset.fallback||(s.dataset.fallback="1",r>1e3?(s.style.display="none",s.insertAdjacentHTML("afterend",`<span class="text-sm">${String.fromCodePoint(r)}</span>`)):s.src=`https://gxh.vip.qq.com/club/item/parcel/item/${e.emojiId.slice(0,2)}/${e.emojiId}/100x100.png`)}})]})})},wx=({session:e,onShowMembers:a,onShowFiles:t,onNewMessageCallback:r,onEmojiReactionCallback:o,onMessageRecalledCallback:s,appendInputMention:i,onAppendInputMentionConsumed:n,onBack:l,showBackButton:u})=>{let[d,c]=Le([]),[m,p]=Le([]),[f,h]=Le([]),[g,C]=Le(!1),[L,x]=Le(!1),[v,I]=Le(!0),[k,y]=Le(null),[N,q]=Le(null),[_,B]=Le(null),[K,P]=Le(null),[F,S]=Le(null),[z,O]=Le(null),[M,U]=Le(null),[te,de]=Le(!1),[je,tt]=Le(null),[Ue,at]=Le(null),[V,oe]=Le(null),[Ie,D]=Le(null),[J,ue]=Le(null),[Me,fa]=Le(!1),[Z,ce]=Le(!1),[Y,Ke]=Le(new Set),[Pe,ft]=Le(null),[Ht,Dt]=Le(!1),[Fe,jt]=Le(null),oo=mt(()=>({showPreview:b=>y(b)}),[]),so=mt(()=>({showPreview:(b,w)=>q({fileUuid:b,isGroup:w})}),[]),Yn=mt(()=>({open:b=>t?.(b)}),[t]),af=mt(()=>({showMenu:(b,w)=>{P({x:b.clientX,y:b.clientY,message:w})}}),[]),ei=Te(b=>{Ke(w=>{let R=new Set(w);return R.has(b)?R.delete(b):R.add(b),R})},[]),rf=mt(()=>({enabled:Z,isSelected:b=>Y.has(b),toggle:ei}),[Z,Y,ei]),ls=Te(()=>{ce(!1),Ke(new Set)},[]),of=Te(()=>d.filter(b=>Y.has(b.msgId)).map(b=>Number(b.msgSeq)).filter(b=>Number.isFinite(b)),[d,Y]),sf=Te(async b=>{if(!(!Pe||!e)){Dt(!0);try{let w={chatType:Number(e.chatType),peerId:e.peerId},R={chatType:b.chatType,peerId:b.peerId};Pe.single?await Ml(w,Pe.msgSeqs[0],R):await Al(w,Pe.msgSeqs,R),ft(null),ls(),jt(b)}catch(w){T(w.message||"\u8F6C\u53D1\u5931\u8D25","error")}finally{Dt(!1)}}},[Pe,e,ls]),nf=Te(()=>{Fe&&(ne.getState().setCurrentChat({chatType:Fe.chatType,peerId:Fe.peerId,peerName:Fe.name,peerAvatar:Fe.avatar}),jt(null))},[Fe]),lf=mt(()=>({showMenu:(b,w,R)=>{P({x:b.clientX,y:b.clientY,message:w,elementId:R})}}),[]),uf=mt(()=>({showMenu:(b,w)=>{S({x:b.clientX,y:b.clientY,...w})}}),[]),{getCachedMembers:no,setCachedMembers:Hx,fetchGroupMembers:df,friendCategories:ti}=ne(),ai=Ne(null),Pa=Ne(null),ma=Ne(null),Za=Ne(e),pa=Ne(!0),us=Ne(!1),ri=Ne(null),io=Ne([]),Ya=Ne(new Map),oi=Ne(null),ds=Ne(!1),lo=Ne(null),si=Ne(!0),cf=Ne(0),cs=Ne(!1);ut(()=>{Za.current=e},[e]);let It=mt(()=>{let b=new Set,w=d.filter(j=>!j||!j.elements||!Array.isArray(j.elements)||b.has(j.msgId)?!1:(b.add(j.msgId),!0)).map(j=>({type:"raw",data:j})),R=m.map(j=>({type:"temp",data:j})),E=f.map(j=>({type:"system",data:j})),G=[...w,...R,...E];return G.sort((j,me)=>{let fe=pe=>pe.type==="raw"?Number(pe.data.msgTime)*1e3:(pe.type==="temp",pe.data.timestamp);return fe(j)-fe(me)}),io.current=G,G},[d,m,f]),Gt=Ro({count:It.length,getScrollElement:()=>Pa.current,estimateSize:()=>80,overscan:5}),fs=Te((b,w)=>{let R=It.findIndex(E=>E.type!=="raw"?!1:E.data.msgId===b||!!w&&String(E.data.msgSeq)===String(w));if(R!==-1){Gt.scrollToIndex(R,{align:"center"});let E=It[R];E.type==="raw"&&(tt(E.data.msgId),setTimeout(()=>tt(null),2e3))}},[It,Gt]),ff=mt(()=>({scrollToMessage:fs}),[fs]),mf=mt(()=>({getMembers:b=>no(b)}),[no]),pf=mt(()=>({getFriend:b=>{for(let w of ti){let R=w.friends.find(E=>E.uin===b);if(R)return{uid:R.uid,uin:R.uin,nickname:R.nickname,remark:R.remark}}return null}}),[ti]),ha=Te(()=>{io.current.length>0&&Gt.scrollToIndex(io.current.length-1,{align:"end"});let b=Pa.current;b&&(b.scrollTop=b.scrollHeight)},[Gt]),[ni,ii]=Le(!1),li=Ne(0),er=Ne(null),uo=Te(()=>{er.current!==null&&(cancelAnimationFrame(er.current),er.current=null)},[]),co=Te((b=800)=>{li.current=Date.now()+b,uo();let w=()=>{if(Date.now()>li.current){er.current=null;return}ha(),er.current=requestAnimationFrame(w)};w()},[ha,uo]);ut(()=>{let b=e?`${e.chatType}_${e.peerId}`:null;b!==ri.current&&(ri.current=b,us.current=!1,de(!1),ii(!0))},[e?.chatType,e?.peerId]),ut(()=>{ce(!1),Ke(new Set),ft(null),jt(null)},[e?.chatType,e?.peerId]),ut(()=>{if(!ni||g)return;let b=0,w=0,R=Date.now(),E=5e3,G=()=>{let j=Pa.current,me=!!j&&j.scrollHeight>0&&io.current.length>0;if(me?(ha(),w=j.scrollHeight<=j.clientHeight||j.scrollHeight-j.scrollTop-j.clientHeight<4?w+1:0):w=0,me&&w>=5||Date.now()-R>E){ii(!1),us.current=!0,de(!0);return}b=requestAnimationFrame(G)};return b=requestAnimationFrame(G),()=>cancelAnimationFrame(b)},[ni,g,ha]),ut(()=>()=>uo(),[uo]),ut(()=>{pa.current&&It.length>0&&(ha(),pa.current=!1)},[It.length,ha]),ut(()=>(r&&r(w=>{if(!w||!w.msgId||!w.elements||!Array.isArray(w.elements))return;let R=ot();c(E=>{if(E.some(me=>me&&me.msgId===w.msgId))return E;let G=[...E,w],j=Za.current;return j&&Mo(j.chatType,j.peerId,w),G}),w.senderUid===R&&p(E=>{let G=E.filter(j=>j.status==="sending");return G.length===0?E:(console.warn(`[SSE] \u6536\u5230\u81EA\u5DF1\u7684\u6D88\u606F\u65F6\uFF0C\u4ECD\u5B58\u5728 ${G.length} \u6761\u4E34\u65F6\u6D88\u606F\uFF0C\u73B0\u5DF2\u6E05\u9664`,G),E.filter(j=>j.status!=="sending"))})}),()=>{r&&r(null)}),[r]);let ms=Te(b=>{let w=gt(),R=!!w&&b.userId===w;if(c(E=>E.map(G=>{if(String(G.msgSeq)!==String(b.msgSeq))return G;let j=G.emojiLikesList||[];if(b.isAdd){let me=j.findIndex(fe=>fe.emojiId===b.emojiId);if(me>=0){let fe=[...j];return fe[me]={...fe[me],likesCnt:String(parseInt(fe[me].likesCnt)+1),isClicked:fe[me].isClicked||R},{...G,emojiLikesList:fe}}else return{...G,emojiLikesList:[...j,{emojiId:b.emojiId,emojiType:parseInt(b.emojiId)>999?"2":"1",likesCnt:"1",isClicked:R}]}}else{let me=j.findIndex(fe=>fe.emojiId===b.emojiId);if(me>=0){let fe=[...j],pe=parseInt(fe[me].likesCnt)-1;return pe<=0?fe.splice(me,1):fe[me]={...fe[me],likesCnt:String(pe),isClicked:R?!1:fe[me].isClicked},{...G,emojiLikesList:fe}}}return G})),b.isAdd&&!R){let E={id:`tip_${Date.now()}_${Math.random()}`,type:"emoji-reaction",userName:b.userName,emojiId:b.emojiId,msgSeq:b.msgSeq,timestamp:Date.now()};h(G=>[...G,E])}},[]),ps=Te((b,w,R,E)=>{let G=gt()||"";ms({groupCode:E,msgSeq:String(b),emojiId:w,userId:G,userName:"",isAdd:R}),Ao(2,E,String(b),w,R,!0)},[ms]),hf=mt(()=>({onSelfReact:ps}),[ps]);ut(()=>(o&&o(w=>{ms(w)}),()=>{o&&o(null)}),[o]),ut(()=>(s&&s(w=>{c(R=>R.map(E=>E.msgId===w.msgId||w.msgSeq&&String(E.msgSeq)===String(w.msgSeq)?{...E,recallTime:String(Math.floor(Date.now()/1e3))}:E))}),()=>{s&&s(null)}),[s]);let ui=(b,w)=>`${b}_${w}`,di=Te(async(b,w)=>{if(!e)return;let R=e.chatType,E=e.peerId,G=()=>{let j=Za.current;return j&&j.chatType===R&&j.peerId===E};console.log("[ChatWindow] loadMessages called:",{chatType:R,peerId:E,beforeMsgSeq:b,afterMsgSeq:w}),b?x(!0):C(!0),b&&d.length>0&&(lo.current=d[0]?.msgId||null);try{let j=await ho(R,E,b,20,w);if(console.log("[ChatWindow] API response:",{messagesCount:j.messages.length,hasMore:j.hasMore}),!G()){console.log("[ChatWindow] Session changed after API call, skipping");return}let me=j.messages.filter(fe=>fe!=null&&fe.elements&&Array.isArray(fe.elements));return console.log("[ChatWindow] Valid messages:",me.length),c(fe=>{let pe=new Set(fe.map(rt=>rt.msgId)),Ze=me.filter(rt=>!pe.has(rt.msgId)),_e=b?[...Ze,...fe]:[...fe,...Ze];return _e.sort((rt,po)=>Number(rt.msgTime)-Number(po.msgTime)),console.log("[ChatWindow] Merged messages:",_e.length,"new:",Ze.length),sa(R,E,_e),_e}),I(j.hasMore),{validMessages:me,hasMore:j.hasMore}}catch(j){if(console.error("[ChatWindow] loadMessages error:",j),lo.current=null,!G())return;T(b?"\u52A0\u8F7D\u66F4\u591A\u6D88\u606F\u5931\u8D25":"\u52A0\u8F7D\u6D88\u606F\u5931\u8D25","error")}finally{G()&&(C(!1),x(!1))}},[e,d]),gf=Te(async b=>{if(!e)return;let w=e.chatType,R=e.peerId;C(!0);let E=()=>{let G=Za.current;return G&&G.chatType===w&&G.peerId===R};try{let G=await ho(w,R);if(!E()){console.log("[ChatWindow] Session changed during API call, skipping");return}let j=G.messages.filter(pe=>pe!=null&&pe.elements&&Array.isArray(pe.elements));if(console.log("[ChatWindow] Latest messages from API:",j.length),j.length===0){I(!1);return}let me=new Set(b.map(pe=>pe.msgId));if(j.some(pe=>me.has(pe.msgId))||b.length===0){console.log("[ChatWindow] Has overlap with cache, merging directly");let Ze=[...b,...j].filter((_e,rt,po)=>po.findIndex(tr=>tr.msgId===_e.msgId)===rt);Ze.sort((_e,rt)=>Number(_e.msgTime)-Number(rt.msgTime)),c(Ze),sa(w,R,Ze),I(G.hasMore)}else{console.log("[ChatWindow] No overlap, need to fill gap");let pe=[...j],Ze=j[0]?.msgSeq,_e=G.hasMore,rt=[...b].reverse().find(Wt=>Number(Wt.msgSeq)>0)?.msgSeq;for(let Wt=0;Wt<10&&_e;Wt++){if(!E()){console.log("[ChatWindow] Session changed during gap fill, skipping");return}let Da=await ho(w,R,Ze),ga=Da.messages.filter(Et=>Et!=null&&Et.elements&&Array.isArray(Et.elements));if(ga.length===0)break;pe=[...ga,...pe],Ze=ga[0]?.msgSeq,_e=Da.hasMore;let xs=new Set(ga.map(Et=>Et.msgId));if(b.some(Et=>xs.has(Et.msgId))||!!rt&&ga.some(Et=>Number(Et.msgSeq)<=Number(rt))){console.log("[ChatWindow] Connected with cache after",Wt+1,"iterations");break}}let tr=[...b,...pe].filter((Wt,Da,ga)=>ga.findIndex(xs=>xs.msgId===Wt.msgId)===Da);tr.sort((Wt,Da)=>Number(Wt.msgTime)-Number(Da.msgTime)),c(tr),sa(w,R,tr),I(_e)}}catch(G){console.error("[ChatWindow] loadMessagesAndMergeWithCache error:",G),T("\u52A0\u8F7D\u6D88\u606F\u5931\u8D25","error")}finally{E()&&C(!1)}},[e]);ut(()=>{let b=lo.current;if(b&&It.length>0){let w=It.findIndex(R=>R.type==="raw"&&R.data.msgId===b);w!==-1&&Gt.scrollToIndex(w,{align:"start"}),lo.current=null}},[It,Gt]),ut(()=>{if(e){let b=++cf.current,w=ui(e.chatType,e.peerId),R=e.chatType,E=e.peerId;console.log("[ChatWindow] Session changed:",{chatType:R,peerId:E,version:b}),cs.current=!1,C(!1);let G=Ya.current.get(w);G&&G.length>0?(console.log("[ChatWindow] Memory cache hit:",G.length,"messages"),c(G)):(console.log("[ChatWindow] Memory cache miss"),c([])),p([]),h([]),pa.current=!0;let j=si.current,me=Na(R,E),fe=j||!me;console.log("[ChatWindow] Check load:",{isFirstMount:j,hasVisited:me,shouldLoadFromApi:fe}),Oa(R,E).then(async pe=>{let Ze=Za.current;if(!Ze||Ze.chatType!==R||Ze.peerId!==E){console.log("[ChatWindow] Session changed after IndexedDB read, skipping");return}let _e=[];pe&&pe.length>0?(_e=pe.filter(rt=>rt.elements&&Array.isArray(rt.elements)),console.log("[ChatWindow] IndexedDB cache hit:",_e.length,"valid messages"),_e.length>0&&(Ya.current.set(w,_e),c(_e))):console.log("[ChatWindow] IndexedDB cache miss"),fe&&!cs.current&&(cs.current=!0,si.current=!1,vu(R,E),console.log("[ChatWindow] Calling loadMessagesAndMergeWithCache()"),await gf(_e))})}else c([]),p([]),h([])},[e?.peerId,e?.chatType]),ut(()=>{if(e&&d.length>0){let b=ui(e.chatType,e.peerId);Ya.current.set(b,d)}},[d,e?.chatType,e?.peerId]),ut(()=>{let b=oi.current,w=Pa.current;if(!b||!w)return;let R=new IntersectionObserver(E=>{if(E[0].isIntersecting&&us.current&&v&&!ds.current&&!g&&d.length>0){let j=d.find(me=>Number(me.msgSeq)>0)?.msgSeq;j&&(ds.current=!0,di(j).finally(()=>{ds.current=!1}))}},{root:w,rootMargin:"50px 0px 0px 0px",threshold:0});return R.observe(b),()=>R.disconnect()},[v,d,di]);let xf=Te(()=>{let b=Pa.current;if(!b||d.length===0)return;let w=b.scrollHeight-b.scrollTop-b.clientHeight<100;pa.current=w,fa(!w)},[d]),Cf=Te(b=>{p(w=>w.filter(R=>R.msgId!==b.msgId))},[]),Lf=Te(async(b,w,R,E,G)=>{O({profile:null,loading:!0,position:{x:R,y:E}});try{let j=await Nr(b,w,G);O({profile:j,loading:!1,position:{x:R,y:E}})}catch{O(null),T("\u83B7\u53D6\u7528\u6237\u8D44\u6599\u5931\u8D25","error")}},[]),If=Te(b=>{p(w=>[...w,b]),pa.current=!0},[]),bf=Te(()=>{pa.current=!0,fa(!1),co(900)},[co]),vf=Te(()=>{pa.current=!0,co(1400)},[co]),wf=Te(b=>{p(w=>w.filter(R=>R.msgId!==b))},[]),yf=Te(b=>{p(w=>w.map(R=>R.msgId===b?{...R,status:"failed"}:R))},[]),hs=Ne(e);hs.current=e;let kf=mt(()=>{let b=w=>e?.chatType===2?ne.getState().getCachedMembers(e.peerId)?.find(R=>R.uid===w||R.uin===w):void 0;return{unavailable:(w,R)=>Z?"\u591A\u9009\u6A21\u5F0F\u4E0B\u4E0D\u53EF\u64CD\u4F5C":Xn(w,R,e),command:async(w,R)=>{let E=ma.current;if(!E||Z)throw new Error("\u5F53\u524D\u65E0\u6CD5\u8F93\u5165\u6D88\u606F");await Oc(w,R,{session:hs.current,insertText:G=>E.insertText(G),reply:B,sendText:G=>E.sendCommand(G)})},previewImage:w=>y(w),mentionName:w=>{let R=b(w);return R?"@"+(R.card||R.nickname||R.uin):void 0},mention:(w,R)=>{if(!Jn(R,hs.current)||Z)return;let E=b(w);E&&ma.current?.insertAt(E.uid,E.uin,E.card||E.nickname||E.uin)}}},[e,Z]);ut(()=>{i&&(ma.current?.insertAt?.(i.uid,i.uin,i.name),ma.current?.focus?.(),n?.())},[i,n]);let fo=Ne(null),mo=Ne(null),[gs,Sf]=Le({head:56,foot:72});return Cx(()=>{let b=()=>Sf({head:fo.current?.offsetHeight??0,foot:mo.current?.offsetHeight??0}),w=new ResizeObserver(b);return fo.current&&w.observe(fo.current),mo.current&&w.observe(mo.current),b(),()=>w.disconnect()},[e?.peerId]),e?$(Vo.Provider,{value:oo,children:$(Yr.Provider,{value:kf,children:$(yn.Provider,{value:so,children:$(Sn.Provider,{value:Yn,children:$(kn.Provider,{value:lf,children:$(An.Provider,{value:af,children:$(En.Provider,{value:uf,children:$(Tn.Provider,{value:ff,children:$(Fn.Provider,{value:mf,children:$(Nn.Provider,{value:pf,children:$(Pn.Provider,{value:rf,children:Qe(Dn.Provider,{value:hf,children:[Qe("div",{ref:ai,className:"flex flex-col h-full relative",children:[Qe("div",{ref:fo,className:"absolute top-0 left-0 right-0 z-20 glass-bar hairline-b flex items-center justify-between px-2 md:px-4 py-3",children:[u&&$("button",{onClick:l,className:"p-2 mr-1 text-theme-muted hover:text-theme hover:bg-theme-item rounded-lg transition-colors md:hidden",children:$(sr,{size:20})}),Qe("div",{className:"flex items-center gap-3 cursor-pointer hover:opacity-80 transition-opacity flex-1 min-w-0",onClick:async b=>{let w=b.currentTarget.getBoundingClientRect(),R=w.left,E=w.bottom+8;if(e.chatType===2){U({profile:null,loading:!0,position:{x:R,y:E}});try{let G=await su(e.peerId);U({profile:G,loading:!1,position:{x:R,y:E}})}catch{U(null),T("\u83B7\u53D6\u7FA4\u8D44\u6599\u5931\u8D25","error")}}else{O({profile:null,loading:!0,position:{x:R,y:E}});try{let{friendCategories:G}=ne.getState(),j="";for(let fe of G){let pe=fe.friends.find(Ze=>Ze.uin===e.peerId);if(pe){j=pe.uid;break}}let me=await Nr(j||void 0,e.peerId);O({profile:me,loading:!1,position:{x:R,y:E}})}catch(G){console.log(G),O(null),T("\u83B7\u53D6\u7528\u6237\u8D44\u6599\u5931\u8D25","error")}}},children:[$("img",{src:e.peerAvatar,alt:e.peerName,className:"w-10 h-10 rounded-full object-cover flex-shrink-0"}),Qe("div",{className:"min-w-0",children:[$("div",{className:"font-medium text-theme truncate",children:(()=>{let{groups:b,friendCategories:w}=ne.getState();if(e.chatType===2){let R=b.find(E=>E.groupCode===e.peerId);if(R?.remarkName&&R.remarkName!==R.groupName)return`${R.remarkName}(${R.groupName})`}else for(let R of w){let E=R.friends.find(G=>G.uin===e.peerId);if(E?.remark&&E.remark!==E.nickname)return`${E.remark}(${E.nickname})`}return e.peerName})()}),$("div",{className:"text-xs text-theme-hint",children:e.chatType===2?(()=>{let{groups:b}=ne.getState(),w=b.find(R=>R.groupCode===e.peerId);return`\u7FA4\u804A ${e.peerId}${w?.memberCount?` \xB7 ${w.memberCount}\u4EBA`:""}`})():e.chatType===100?`\u4E34\u65F6\u4F1A\u8BDD ${e.peerId}`:`\u79C1\u804A ${e.peerId}`})]})]}),Qe("div",{className:"flex items-center flex-shrink-0 empty:hidden",children:[$(Ix,{name:"webqq.chat.actions",props:{chat:{chatType:Number(e.chatType),peerId:e.peerId,name:e.peerName}}}),e.chatType===2&&t&&$("button",{onClick:()=>t(),className:"p-2 text-theme-muted hover:text-theme hover:bg-theme-item rounded-lg",title:"\u7FA4\u6587\u4EF6",children:$(mr,{size:20})}),e.chatType===2&&a&&$("button",{onClick:a,className:"p-2 text-theme-muted hover:text-theme hover:bg-theme-item rounded-lg",title:"\u67E5\u770B\u7FA4\u6210\u5458",children:$(St,{size:20})})]})]}),Qe("div",{ref:Pa,onScroll:xf,className:"flex-1 overflow-y-auto overflow-x-hidden px-4",style:{paddingTop:gs.head+16,paddingBottom:gs.foot+16},children:[$("div",{ref:oi,className:"h-1"}),L&&$("div",{className:"flex justify-center py-2",children:$(ee,{size:20,className:"animate-spin text-pink-500"})}),g?$("div",{className:"flex items-center justify-center h-full",children:$(ee,{size:32,className:"animate-spin text-pink-500"})}):It.length===0?$("div",{className:"flex items-center justify-center h-full text-theme-hint",children:"\u6682\u65E0\u6D88\u606F"}):$("div",{style:{height:`${Gt.getTotalSize()}px`,width:"100%",position:"relative",opacity:te?1:0},className:"overflow-hidden",children:Gt.getVirtualItems().map(b=>{let w=It[b.index];return $("div",{style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${b.start}px)`,padding:"8px 0"},"data-index":b.index,ref:Gt.measureElement,className:"overflow-hidden box-border",children:w.type==="raw"?$(Ac,{message:w.data,allMessages:d,isHighlighted:je===w.data.msgId}):w.type==="temp"?$(Pc,{message:w.data,onRetry:()=>Cf(w.data)}):$(vx,{tip:w.data,onScrollToMessage:R=>fs("",R)})},b.key)})})]}),Me&&$("button",{onClick:ha,className:"absolute right-4 w-7 h-7 glass glass-chrome glass-interactive r-capsule flex items-center justify-center text-theme-muted hover:text-theme transition-all z-30",style:{bottom:gs.foot+16},title:"\u6EDA\u52A8\u5230\u5E95\u90E8",children:$(or,{size:12})}),$("div",{ref:mo,className:"absolute bottom-0 left-0 right-0 z-20",children:Z?Qe("div",{className:"glass-bar hairline-t px-4 py-3 flex items-center justify-between gap-3",children:[Qe("span",{className:"text-sm text-theme-secondary",children:["\u5DF2\u9009 ",Y.size," \u6761"]}),Qe("div",{className:"flex items-center gap-2",children:[$("button",{onClick:ls,className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors",children:"\u53D6\u6D88"}),Qe("button",{onClick:()=>{let b=of();if(b.length===0){T("\u8BF7\u5148\u9009\u62E9\u6D88\u606F","warning");return}ft({single:!1,msgSeqs:b})},disabled:Y.size===0,className:"px-4 py-1.5 text-sm gradient-primary text-white rounded-full font-medium disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-1.5 transition-all",children:[$(Ca,{size:15})," \u8F6C\u53D1 (",Y.size,")"]})]})]}):$(Vn,{ref:ma,session:e,replyTo:_,onReplyCancel:()=>B(null),onSendStart:bf,onSendEnd:vf,onTempMessage:If,onTempMessageRemove:wf,onTempMessageFail:yf})})]}),K&&$(Fc,{contextMenu:K,session:e,getCachedMembers:no,onClose:()=>P(null),onReply:b=>{B(b),setTimeout(()=>ma.current?.focus?.(),50)},onEmojiReaction:(b,w,R)=>ue({message:b,x:w,y:R}),onRecall:b=>{if(c(w=>w.filter(R=>R.msgId!==b)),e){let w=`${e.chatType}_${e.peerId}`,R=Ya.current.get(w);R&&Ya.current.set(w,R.filter(E=>E.msgId!==b)),rd(e.chatType,e.peerId,b)}},onForward:b=>ft({single:!0,msgSeqs:[Number(b.msgSeq)]}),onMultiSelect:b=>{ce(!0),Ke(new Set([b.msgId]))}}),J&&$(jc,{target:J,onClose:()=>ue(null),onReacted:b=>{let w=J.message;ps(w.msgSeq,b,!0,String(w.peerUin))},containerRef:ai}),F&&$(ts,{avatarContextMenu:F,getCachedMembers:no,onClose:()=>S(null),onInsertAt:(b,w,R)=>ma.current?.insertAt?.(b,w,R),onShowProfile:Lf,onSetTitle:(b,w,R)=>D({uid:b,name:w,groupCode:R}),onMute:(b,w,R)=>oe({uid:b,name:w,groupCode:R}),onKick:(b,w,R,E)=>at({uid:b,name:w,groupCode:R,groupName:E}),onAdminChanged:()=>e&&df(e.peerId,!0),groupName:e?.peerName}),z&&$(zr,{profile:z.profile,loading:z.loading,position:z.position,onClose:()=>O(null),isFriend:e?.chatType===1,onFriendDeleted:b=>{let{removeFriend:w,setCurrentChat:R,removeRecentChat:E}=ne.getState();w(b),e?.chatType===1&&(R(null),E(1,e.peerId))}}),M&&$(Js,{profile:M.profile,loading:M.loading,position:M.position,onClose:()=>U(null),onQuitGroup:async(b,w)=>{try{await Wl(b),T(w?"\u7FA4\u5DF2\u89E3\u6563":"\u5DF2\u9000\u51FA\u7FA4\u804A","success");let{setCurrentChat:R,removeRecentChat:E}=ne.getState();R(null),E(2,b)}catch(R){T(R.message||(w?"\u89E3\u6563\u5931\u8D25":"\u9000\u7FA4\u5931\u8D25"),"error")}}}),Ue&&$(Yo,{name:Ue.name,groupName:Ue.groupName,onConfirm:async()=>{let{uid:b,name:w,groupCode:R}=Ue;at(null);try{await go(R,b),T(`\u5DF2\u5C06 ${w} \u79FB\u51FA\u7FA4\u804A`,"success")}catch(E){T(E.message||"\u8E22\u51FA\u5931\u8D25","error")}},onClose:()=>at(null)}),V&&$(Zo,{name:V.name,onMute:async b=>{let{uid:w,name:R,groupCode:E}=V;oe(null);try{if(await xo(E,w,b),b===0)T(`\u5DF2\u89E3\u9664 ${R} \u7684\u7981\u8A00`,"success");else{let G=b>=86400?`${Math.floor(b/86400)}\u5929`:b>=3600?`${Math.floor(b/3600)}\u5C0F\u65F6`:b>=60?`${Math.floor(b/60)}\u5206\u949F`:`${b}\u79D2`;T(`\u5DF2\u7981\u8A00 ${R} ${G}`,"success")}}catch(G){T(G.message||"\u7981\u8A00\u5931\u8D25","error")}},onClose:()=>oe(null)}),Ie&&$(es,{name:Ie.name,onConfirm:async b=>{let{uid:w,name:R,groupCode:E}=Ie;D(null);try{await Co(E,w,b),T(b?`\u5DF2\u8BBE\u7F6E ${R} \u7684\u5934\u8854\u4E3A\u300C${b}\u300D`:`\u5DF2\u6E05\u9664 ${R} \u7684\u5934\u8854`,"success")}catch(G){T(G.message||"\u8BBE\u7F6E\u5934\u8854\u5931\u8D25","error")}},onClose:()=>D(null)}),$(Ks,{url:k,onClose:()=>y(null)}),$(Zs,{videoInfo:N,onClose:()=>q(null)}),Pe&&$(Hc,{count:Pe.msgSeqs.length,sending:Ht,onSelect:sf,onClose:()=>ft(null)}),Fe&&Lx(Qe(yx,{children:[$("div",{className:"fixed inset-0 z-[60] bg-black/40",onClick:()=>jt(null)}),Qe("div",{className:"fixed z-[60] top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 glass glass-thick r-panel glass-pop p-5 w-80 max-w-[90vw]",children:[$("div",{className:"font-medium text-theme mb-2",children:"\u8F6C\u53D1\u6210\u529F"}),Qe("div",{className:"text-sm text-theme-secondary mb-4 break-all",children:["\u662F\u5426\u8DF3\u8F6C\u5230\u300C",Fe.name,"\u300D\uFF1F"]}),Qe("div",{className:"flex justify-end gap-2",children:[$("button",{onClick:()=>jt(null),className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors",children:"\u7559\u5728\u5F53\u524D"}),$("button",{onClick:nf,className:"px-4 py-1.5 text-sm btn-primary transition-all",children:"\u8DF3\u8F6C\u8FC7\u53BB"})]})]})]}),document.body)]})})})})})})})})})})})}):$("div",{className:"flex-1 flex items-center justify-center bg-theme-item",children:Qe("div",{className:"text-center text-theme-hint",children:[$("div",{className:"text-6xl mb-4",children:"\u{1F4AC}"}),$("p",{children:"\u9009\u62E9\u4E00\u4E2A\u8054\u7CFB\u4EBA\u5F00\u59CB\u804A\u5929"})]})})},Gc=wx;import{useState as Yt,useEffect as Wc,useMemo as $c,useCallback as Vc,useRef as ao}from"react";import{jsx as ke,jsxs as ea}from"react/jsx-runtime";var kx=({member:e,onContextMenu:a,onClick:t})=>{let r=e.card||e.nickname,o=e.role==="owner"?ke(vt,{size:14,className:"text-yellow-500"}):e.role==="admin"?ke(yt,{size:14,className:"text-blue-500"}):null;return ea("div",{className:"flex items-center gap-3 px-3 py-2 hover:bg-theme-item-hover transition-colors cursor-pointer",onClick:i=>{("ontouchstart"in window||navigator.maxTouchPoints>0)&&t?.(i)},onContextMenu:a,children:[ke("img",{src:e.avatar,alt:r,className:"w-8 h-8 rounded-full object-cover flex-shrink-0",loading:"lazy",onError:i=>{i.currentTarget.src=Oe(e.uin)}}),ea("div",{className:"flex-1 min-w-0",children:[ea("div",{className:"flex items-center gap-1.5",children:[ke("span",{className:"text-sm text-theme truncate",children:r}),o]}),e.card&&e.card!==e.nickname&&ke("div",{className:"text-xs text-theme-hint truncate",children:e.nickname})]})]})},Sx=({groupCode:e,onClose:a,onAtMember:t})=>{let[r,o]=Yt([]),[s,i]=Yt(!1),[n,l]=Yt(""),[u,d]=Yt(null),[c,m]=Yt(null),[p,f]=Yt(null),[h,g]=Yt(null),[C,L]=Yt(null),[x,v]=Yt(null),{getCachedMembers:I,fetchGroupMembers:k,currentChat:y}=ne(),N=ao(null),q=ao(e);Wc(()=>{q.current=e},[e]);let _=ao(I);_.current=I;let B=ao(k);B.current=k;let K=ao(!1);Wc(()=>{let M=e,U=!Na(2,M),te=wu(M);console.log("[GroupMemberPanel] useEffect triggered:",{groupCode:M,isFirstVisit:U,alreadyFetched:te});let de=_.current(M);if(de&&(console.log("[GroupMemberPanel] Cache hit:",de.length,"members"),o(de),d(null),te)){i(!1);return}if(te){i(!1);return}if(K.current){console.log("[GroupMemberPanel] Already loading, skip");return}return console.log("[GroupMemberPanel] Fetching from API, isFirstVisit:",U),K.current=!0,de||(i(!0),d(null),o([])),B.current(M,U).then(je=>{console.log("[GroupMemberPanel] API success:",je.length,"members, currentGroupCode:",q.current),q.current===M&&(o(je),i(!1),yu(M))}).catch(je=>{console.log("[GroupMemberPanel] API error:",je.message),q.current===M&&(de||d(je.message||"\u52A0\u8F7D\u7FA4\u6210\u5458\u5931\u8D25"),T("\u52A0\u8F7D\u7FA4\u6210\u5458\u5931\u8D25","error"),i(!1))}).finally(()=>{q.current===M&&(K.current=!1)}),()=>{console.log("[GroupMemberPanel] Cleanup, reset isLoading"),K.current=!1}},[e]);let P=$c(()=>ru(r,n),[r,n]),F=Ro({count:P.length,getScrollElement:()=>N.current,estimateSize:()=>48,overscan:5}),S=$c(()=>{let M=r.filter(te=>te.role==="owner").length,U=r.filter(te=>te.role==="admin").length;return{owner:M,admin:U,total:r.length}},[r]),z=Vc((M,U)=>{M.preventDefault(),M.stopPropagation(),m({x:M.clientX,y:M.clientY,senderUid:U.uid,senderUin:U.uin,senderName:U.card||U.nickname,chatType:2,groupCode:e})},[e]),O=Vc(async(M,U,te,de,je)=>{let tt={x:te,y:de};f({profile:null,loading:!0,position:tt});try{let Ue=await Nr(M,U,je);f({profile:Ue,loading:!1,position:tt})}catch(Ue){T(Ue.message||"\u83B7\u53D6\u8D44\u6599\u5931\u8D25","error"),f(null)}},[]);return ea("div",{className:"flex flex-col h-full",children:[ea("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider",children:[ea("div",{children:[ke("div",{className:"font-medium text-theme",children:"\u7FA4\u6210\u5458"}),ea("div",{className:"text-xs text-theme-hint",children:[S.total," \u4EBA"]})]}),ke("button",{onClick:a,className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors",children:ke(Re,{size:18})})]}),ke("div",{className:"p-3",children:ea("div",{className:"relative",children:[ke(Vt,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-theme-hint"}),ke("input",{type:"text",value:n,onChange:M=>l(M.target.value),placeholder:"\u641C\u7D22\u6210\u5458...",className:"w-full pl-9 pr-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme placeholder:text-theme-hint"})]})}),ke("div",{ref:N,className:"flex-1 overflow-y-auto",children:s?ke("div",{className:"flex items-center justify-center h-32",children:ke(ee,{size:24,className:"animate-spin text-pink-500"})}):u?ea("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[ke("p",{className:"text-sm text-red-500",children:u}),ke("button",{onClick:()=>k(e),className:"text-sm text-pink-500 hover:text-pink-600",children:"\u91CD\u8BD5"})]}):P.length===0?ke("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:n?"\u672A\u627E\u5230\u5339\u914D\u7684\u6210\u5458":"\u6682\u65E0\u6210\u5458"}):ke("div",{className:"py-1 relative",style:{height:F.getTotalSize()},children:F.getVirtualItems().map(M=>{let U=P[M.index];return ke("div",{className:"absolute left-0 right-0",style:{top:M.start,height:M.size},children:ke(kx,{member:U,onClick:te=>z(te,U),onContextMenu:te=>z(te,U)})},U.uid)})})}),c&&ke(ts,{avatarContextMenu:c,getCachedMembers:I,onClose:()=>m(null),onInsertAt:(M,U,te)=>{t?.({uid:M,uin:U,name:te})},onShowProfile:O,onSetTitle:(M,U)=>v({uid:M,name:U}),onMute:(M,U)=>g({uid:M,name:U}),onKick:(M,U)=>L({uid:M,name:U}),onAdminChanged:()=>k(e,!0),groupName:y?.peerName}),p&&ke(zr,{profile:p.profile,loading:p.loading,position:p.position,onClose:()=>f(null)}),h&&ke(Zo,{name:h.name,onMute:async M=>{let{uid:U,name:te}=h;g(null);try{if(await xo(e,U,M),M===0)T(`\u5DF2\u89E3\u9664 ${te} \u7684\u7981\u8A00`,"success");else{let de=M>=86400?`${Math.floor(M/86400)}\u5929`:M>=3600?`${Math.floor(M/3600)}\u5C0F\u65F6`:M>=60?`${Math.floor(M/60)}\u5206\u949F`:`${M}\u79D2`;T(`\u5DF2\u7981\u8A00 ${te} ${de}`,"success")}}catch(de){T(de.message||"\u7981\u8A00\u5931\u8D25","error")}},onClose:()=>g(null)}),C&&ke(Yo,{name:C.name,groupName:y?.peerName||e,onConfirm:async()=>{let{uid:M,name:U}=C;L(null);try{await go(e,M),T(`\u5DF2\u5C06 ${U} \u79FB\u51FA\u7FA4\u804A`,"success")}catch(te){T(te.message||"\u8E22\u51FA\u5931\u8D25","error")}},onClose:()=>L(null)}),x&&ke(es,{name:x.name,onConfirm:async M=>{let{uid:U,name:te}=x;v(null);try{await Co(e,U,M),T(M?`\u5DF2\u8BBE\u7F6E ${te} \u7684\u5934\u8854\u4E3A\u300C${M}\u300D`:`\u5DF2\u6E05\u9664 ${te} \u7684\u5934\u8854`,"success")}catch(de){T(de.message||"\u8BBE\u7F6E\u5934\u8854\u5931\u8D25","error")}},onClose:()=>v(null)})]})},Jc=Sx;import Rx,{useState as dt,useEffect as Kn,useCallback as Mx,useRef as Xc}from"react";import{jsx as ae,jsxs as xe}from"react/jsx-runtime";function Ax(e){return!e||e<=0?"0 B":e<1024?e+" B":e<1024*1024?(e/1024).toFixed(1)+" KB":e<1024*1024*1024?(e/1024/1024).toFixed(1)+" MB":(e/1024/1024/1024).toFixed(2)+" GB"}function Px(e){return e?new Date(e*1e3).toLocaleString("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}):""}var Dx=({groupCode:e,onClose:a,locateTarget:t})=>{let[r,o]=dt([]),[s,i]=dt([]),[n,l]=dt(!1),[u,d]=dt(null),[c,m]=dt(!1),[p,f]=dt([]),[h,g]=dt(null),[C,L]=dt(""),[x,v]=dt(!1),[I,k]=dt(""),[y,N]=dt(null),[q,_]=dt(!1),[B,K]=dt(null),[P,F]=dt(null),S=Xc(new Map),z=(D,J,ue)=>{let Me=D.currentTarget.getBoundingClientRect(),fa=Math.min(Me.left,window.innerWidth-268);K({title:J,detail:ue,x:Math.max(8,fa),y:Me.bottom+4})},O=Xc(null),M=p.length>0?p[p.length-1].folderId:"/",U=Mx(async()=>{l(!0),d(null);try{let D=await Ms(e,M);o(D.files),i(D.folders)}catch(D){d(D.message||"\u83B7\u53D6\u7FA4\u6587\u4EF6\u5931\u8D25")}finally{l(!1)}},[e,M]);Kn(()=>{U()},[U]),Kn(()=>{if(!t)return;let{folderId:D,fileId:J}=t;if(F(J),!D||D==="/"){f([]);return}let ue=!1;return Ms(e,"/").then(Me=>{if(ue)return;let fa=Me.folders.find(Z=>Z.folderId===D);f([{folderId:D,folderName:fa?.folderName||D}])}).catch(()=>{ue||f([{folderId:D,folderName:D}])}),()=>{ue=!0}},[t?.folderId,t?.fileId,e]),Kn(()=>{if(!P||n)return;let D=r.find(Me=>Me.fileId===P||Me.fileName===P);if(!D)return;S.current.get(D.fileId)?.scrollIntoView({behavior:"smooth",block:"center"});let ue=setTimeout(()=>F(null),2500);return()=>clearTimeout(ue)},[P,r,n]);let te=D=>{f(J=>[...J,{folderId:D.folderId,folderName:D.folderName}])},de=D=>{f(J=>J.slice(0,D+1))},je=()=>O.current?.click(),tt=async D=>{let J=D.target.files?.[0];if(D.target&&(D.target.value=""),!!J){if(J.size>2*1024*1024*1024){T("\u6587\u4EF6\u8FC7\u5927\uFF0C\u6700\u5927\u652F\u6301 2GB","error");return}m(!0),T(`\u6B63\u5728\u4E0A\u4F20 ${J.name}...`,"warning");try{await Jl(e,J,M),T("\u4E0A\u4F20\u6210\u529F","success"),U()}catch(ue){T(`${ue.message||"\u4E0A\u4F20\u5931\u8D25"}\uFF0C\u53EF\u80FD\u8BE5\u7FA4\u4E0D\u5141\u8BB8\u4E0A\u4F20\u7FA4\u6587\u4EF6`,"error")}finally{m(!1)}}},Ue=async D=>{try{let J=await $l(e,D.fileId);window.open(J+encodeURIComponent(D.fileName),"_blank")}catch(J){T(J.message||"\u83B7\u53D6\u4E0B\u8F7D\u94FE\u63A5\u5931\u8D25","error")}},at=async()=>{if(!(!y||q)){_(!0);try{y.type==="file"?await Xl(e,y.id,y.busId):await Zl(e,y.id),T("\u5DF2\u5220\u9664","success"),N(null),U()}catch(D){T(D.message||"\u5220\u9664\u5931\u8D25","error")}finally{_(!1)}}},V=(D,J,ue,Me)=>{g({type:D,id:J,oldName:ue,busId:Me}),L(ue)},oe=async()=>{if(!h)return;let D=C.trim();if(!D||D===h.oldName){g(null);return}try{h.type==="file"?await Ql(e,h.id,M,D):await Yl(e,h.id,D),T("\u5DF2\u91CD\u547D\u540D","success"),g(null),U()}catch(J){T(J.message||"\u91CD\u547D\u540D\u5931\u8D25","error")}},Ie=async()=>{let D=I.trim();if(!D){v(!1);return}try{await Kl(e,D),T("\u6587\u4EF6\u5939\u5DF2\u521B\u5EFA","success"),v(!1),k(""),U()}catch(J){T(J.message||"\u65B0\u5EFA\u6587\u4EF6\u5939\u5931\u8D25","error")}};return xe("div",{className:"flex flex-col h-full",children:[xe("div",{className:"flex items-center justify-between px-4 py-3 border-b border-theme-divider",children:[ae("div",{className:"font-medium text-theme",children:"\u7FA4\u6587\u4EF6"}),xe("div",{className:"flex items-center gap-1",children:[ae("button",{onClick:U,title:"\u5237\u65B0",className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors",children:ae(ba,{size:16})}),ae("button",{onClick:a,className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded-lg transition-colors",children:ae(Re,{size:18})})]})]}),xe("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-theme-divider",children:[xe("button",{onClick:je,disabled:c,className:"flex items-center gap-1.5 px-3 py-1.5 text-sm btn-primary disabled:opacity-50 disabled:cursor-not-allowed transition-all",children:[c?ae(ee,{size:15,className:"animate-spin"}):ae(Rr,{size:15}),"\u4E0A\u4F20"]}),p.length===0&&xe("button",{onClick:()=>{v(!0),k("")},className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-theme-item hover:bg-theme-item-hover text-theme rounded-lg transition-colors",children:[ae(pr,{size:15}),"\u65B0\u5EFA\u6587\u4EF6\u5939"]}),ae("input",{ref:O,type:"file",className:"hidden",onChange:tt})]}),xe("div",{className:"flex items-center flex-wrap gap-0.5 px-3 py-2 text-sm text-theme-hint border-b border-theme-divider",children:[ae("button",{onClick:()=>de(-1),className:`hover:text-pink-500 transition-colors ${p.length===0?"text-theme font-medium":""}`,children:"\u5168\u90E8\u6587\u4EF6"}),p.map((D,J)=>xe(Rx.Fragment,{children:[ae(nt,{size:14,className:"text-theme-hint/60"}),ae("button",{onClick:()=>de(J),className:`hover:text-pink-500 transition-colors truncate max-w-[120px] ${J===p.length-1?"text-theme font-medium":""}`,children:D.folderName})]},D.folderId))]}),x&&xe("div",{className:"flex items-center gap-2 px-3 py-2 border-b border-theme-divider bg-theme-item/40",children:[ae(Ea,{size:16,className:"text-yellow-500 flex-shrink-0"}),ae("input",{autoFocus:!0,value:I,onChange:D=>k(D.target.value),onKeyDown:D=>{D.key==="Enter"&&Ie(),D.key==="Escape"&&v(!1)},placeholder:"\u6587\u4EF6\u5939\u540D\u79F0",className:"flex-1 min-w-0 px-2 py-1 text-sm bg-theme-input border border-theme-input rounded focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme"}),ae("button",{onClick:Ie,className:"text-sm text-pink-500 hover:text-pink-600",children:"\u786E\u5B9A"}),ae("button",{onClick:()=>v(!1),className:"text-sm text-theme-hint hover:text-theme",children:"\u53D6\u6D88"})]}),ae("div",{className:"flex-1 overflow-y-auto",children:n?ae("div",{className:"flex items-center justify-center h-32",children:ae(ee,{size:24,className:"animate-spin text-pink-500"})}):u?xe("div",{className:"flex flex-col items-center justify-center h-32 gap-2",children:[ae("p",{className:"text-sm text-red-500",children:u}),ae("button",{onClick:U,className:"text-sm text-pink-500 hover:text-pink-600",children:"\u91CD\u8BD5"})]}):s.length===0&&r.length===0?ae("div",{className:"flex items-center justify-center h-32 text-theme-hint text-sm",children:"\u6B64\u76EE\u5F55\u6682\u65E0\u6587\u4EF6"}):xe("div",{className:"py-1",children:[s.map(D=>xe("div",{className:"group flex items-center gap-3 px-3 py-2 hover:bg-theme-item-hover transition-colors",children:[xe("button",{onClick:()=>te(D),className:"flex items-center gap-3 flex-1 min-w-0 text-left",children:[ae(Ea,{size:20,className:"text-yellow-500 flex-shrink-0"}),xe("div",{className:"flex-1 min-w-0",onMouseEnter:J=>z(J,D.folderName,`${D.fileCount} \u4E2A\u6587\u4EF6 \xB7 ${D.creatorName}`),onMouseLeave:()=>K(null),children:[ae("div",{className:"text-sm text-theme truncate",children:D.folderName}),xe("div",{className:"text-xs text-theme-hint truncate",children:[D.fileCount," \u4E2A\u6587\u4EF6 \xB7 ",D.creatorName]})]})]}),xe("div",{className:"flex md:hidden md:group-hover:flex items-center gap-0.5 flex-shrink-0",children:[ae("button",{onClick:()=>V("folder",D.folderId,D.folderName),title:"\u91CD\u547D\u540D",className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded transition-colors",children:ae(Fa,{size:14})}),ae("button",{onClick:()=>N({type:"folder",id:D.folderId,name:D.folderName}),title:"\u5220\u9664",className:"p-1.5 text-theme-hint hover:text-red-500 hover:bg-theme-item rounded transition-colors",children:ae(We,{size:14})})]})]},D.folderId)),r.map(D=>{let J=`${Ax(D.fileSize)} \xB7 ${D.uploaderName||""}${D.uploadTime?` \xB7 ${Px(D.uploadTime)}`:""}`,ue=P!=null&&(D.fileId===P||D.fileName===P);return xe("div",{ref:Me=>{Me?S.current.set(D.fileId,Me):S.current.delete(D.fileId)},className:`group flex items-center gap-3 px-3 py-2 transition-colors ${ue?"bg-pink-500/10 ring-1 ring-inset ring-pink-500/60":"hover:bg-theme-item-hover"}`,children:[ae(wt,{size:20,className:"text-blue-400 flex-shrink-0"}),xe("div",{className:"flex-1 min-w-0",onMouseEnter:Me=>z(Me,D.fileName,J),onMouseLeave:()=>K(null),children:[ae("div",{className:"text-sm text-theme truncate",children:D.fileName}),ae("div",{className:"text-xs text-theme-hint truncate",children:J})]}),xe("div",{className:"flex md:hidden md:group-hover:flex items-center gap-0.5 flex-shrink-0",children:[ae("button",{onClick:()=>Ue(D),title:"\u4E0B\u8F7D",className:"p-1.5 text-theme-hint hover:text-pink-500 hover:bg-theme-item rounded transition-colors",children:ae($t,{size:14})}),ae("button",{onClick:()=>V("file",D.fileId,D.fileName,D.busId),title:"\u91CD\u547D\u540D",className:"p-1.5 text-theme-hint hover:text-theme hover:bg-theme-item rounded transition-colors",children:ae(Fa,{size:14})}),ae("button",{onClick:()=>N({type:"file",id:D.fileId,busId:D.busId,name:D.fileName}),title:"\u5220\u9664",className:"p-1.5 text-theme-hint hover:text-red-500 hover:bg-theme-item rounded transition-colors",children:ae(We,{size:14})})]})]},D.fileId)})]})}),h&&ae("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40",children:xe("div",{className:"glass glass-thick r-panel glass-pop p-5 w-80 max-w-[90vw]",children:[xe("div",{className:"font-medium text-theme mb-3",children:["\u91CD\u547D\u540D",h.type==="folder"?"\u6587\u4EF6\u5939":"\u6587\u4EF6"]}),ae("input",{autoFocus:!0,value:C,onChange:D=>L(D.target.value),onKeyDown:D=>{D.key==="Enter"&&oe(),D.key==="Escape"&&g(null)},className:"w-full px-3 py-2 text-sm bg-theme-input border border-theme-input rounded-lg focus:outline-none focus:ring-2 focus:ring-pink-500/20 focus:border-pink-500/50 text-theme"}),xe("div",{className:"flex justify-end gap-2 mt-4",children:[ae("button",{onClick:()=>g(null),className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors",children:"\u53D6\u6D88"}),ae("button",{onClick:oe,className:"px-4 py-1.5 text-sm btn-primary transition-all",children:"\u786E\u5B9A"})]})]})}),y&&ae("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/40",children:xe("div",{className:"glass glass-thick r-panel glass-pop p-5 w-80 max-w-[90vw]",children:[xe("div",{className:"font-medium text-theme mb-2",children:["\u5220\u9664",y.type==="folder"?"\u6587\u4EF6\u5939":"\u6587\u4EF6"]}),xe("div",{className:"text-sm text-theme-secondary mb-4 break-all",children:["\u786E\u5B9A\u5220\u9664",y.type==="folder"?"\u6587\u4EF6\u5939":"\u6587\u4EF6","\u300C",y.name,"\u300D",y.type==="folder"?"\u53CA\u5176\u4E2D\u6240\u6709\u6587\u4EF6\uFF1F":"\uFF1F","\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002"]}),xe("div",{className:"flex justify-end gap-2",children:[ae("button",{onClick:()=>N(null),disabled:q,className:"px-4 py-1.5 text-sm text-theme-hint hover:text-theme transition-colors disabled:opacity-50",children:"\u53D6\u6D88"}),xe("button",{onClick:at,disabled:q,className:"px-4 py-1.5 text-sm bg-red-500 hover:bg-red-600 text-white rounded-lg transition-colors disabled:opacity-50 flex items-center gap-1.5",children:[q&&ae(ee,{size:14,className:"animate-spin"}),"\u5220\u9664"]})]})]})}),B&&ae(Us,{children:xe("div",{className:"fixed z-[100] pointer-events-none max-w-[260px] px-3 py-2 glass glass-thick r-control",style:{left:B.x,top:B.y},children:[ae("div",{className:"text-sm text-theme break-all",children:B.title}),ae("div",{className:"text-xs text-theme-secondary break-all mt-0.5",children:B.detail})]})})]})},Qc=Dx;import{usePluginConfig as Ex}from"@luckylillia-dev/plugin-sdk/webui";function ns(){let{value:e}=Ex();return{autoHideSidebar:e?.autoHideSidebar??!1,fullscreenButton:e?.fullscreenButton??!0}}import{Fragment as _x,jsx as ct,jsxs as Zn}from"react/jsx-runtime";function Fx(e){if(!e||!e.elements||!Array.isArray(e.elements))return"[\u6D88\u606F]";let a=[];for(let r of e.elements){if(r.textElement?.content){a.push(r.textElement.content);continue}if(r.picElement){a.push("[\u56FE\u7247]");continue}if(r.faceElement){a.push("[\u8868\u60C5]");continue}if(r.fileElement){a.push("[\u6587\u4EF6]");continue}if(r.pttElement){a.push("[\u8BED\u97F3]");continue}if(r.videoElement){a.push("[\u89C6\u9891]");continue}if(r.replyElement){a.push("[\u56DE\u590D]");continue}if(r.multiForwardMsgElement){a.push("[\u804A\u5929\u8BB0\u5F55]");continue}if(r.grayTipElement?.jsonGrayTipElement?.jsonStr)try{let o=JSON.parse(r.grayTipElement.jsonGrayTipElement.jsonStr);if(Array.isArray(o.items)){let s=ot(),i=gt(),n=o.items.map(l=>l.type==="qq"?s&&l.uid===s||i&&String(l.uin)===String(i)?"\u4F60":l.nm||l.uin||"":l.type==="nor"&&l.txt||"").join("").trim();if(n){a.push(n);continue}}}catch{}if(r.grayTipElement?.xmlElement?.content){let o=r.grayTipElement.xmlElement.content.replace(/<[^>]+>/g,"").trim();if(o){a.push(o);continue}}if(r.arkElement)try{if(JSON.parse(r.arkElement.bytesData).app==="com.tencent.multimsg"){a.push("[\u804A\u5929\u8BB0\u5F55]");continue}}catch{}}let t=a.join("").replace(/\s+/g," ").trim();return t?/^@[^\s]+$/.test(t)?`${t} [\u63D0\u53CA]`:t:"[\u6D88\u606F]"}var Nx=({isFullscreen:e=!1})=>{let a=pt.useRef(null),t=pt.useRef(null),r=pt.useRef(null),o=pt.useRef([]),[,s]=pt.useState(0),{fullscreenButton:i}=ns(),{friendCategories:n,groups:l,contactsLoading:u,contactsError:d,currentChat:c,activeTab:m,unreadCounts:p,showMemberPanel:f,setCurrentChat:h,setActiveTab:g,setShowMemberPanel:C,clearUnreadCount:L,incrementUnreadCount:x,updateRecentChat:v,loadContacts:I,setRecentChats:k}=ne(),y=ne(Z=>Z.recentChats),N=ne(Z=>Z.addNotification),q=ne(Z=>Z.loadGroupNotifications),[_,B]=pt.useState(null),[K,P]=pt.useState(!1),[F,S]=pt.useState(null),z=zt(Z=>{if(Z){S(Z),P(!0),C(!1);return}S(null),P(ce=>{let Y=!ce;return Y&&C(!1),Y})},[C]),O=zt(()=>{C(!f),f||P(!1)},[f,C]),M=zt(Z=>{B(Z)},[]),U=zt(()=>{B(null)},[]);is(()=>{bo(),I(),q()},[I,q]),is(()=>{d&&T(d,"error")},[d]);let te=pt.useRef(c);is(()=>{te.current=c},[c]);let de=pt.useCallback(Z=>{if(a.current=Z,Z&&o.current.length>0){let ce=[...o.current];o.current=[],ce.forEach(Y=>Z(Y))}s(ce=>ce+1)},[]),je=pt.useCallback(Z=>{t.current=Z},[]),tt=pt.useCallback(Z=>{r.current=Z},[]);is(()=>{let Z=eu(ce=>{if(ce.type==="message-created"||ce.type==="message-sent"){let Y=ce.data;if(!Y||!Y.msgId||!Y.elements||!Array.isArray(Y.elements)){console.warn("SSE \u6536\u5230\u65E0\u6548\u6D88\u606F:",Y);return}let Ke=Y.chatType,Pe=String(Y.peerUin||Y.peerUid),ft=`${Ke}_${Pe}`,Ht=te.current;if(Mo(Ke,Pe,Y),Ht&&Ht.chatType===Ke&&Ht.peerId===Pe)a.current?a.current(Y):o.current.push(Y);else{let oo=ot(),so=gt();oo&&Y.senderUid===oo||so&&String(Y.senderUin)===String(so)||x(ft)}let Dt=Fx(Y),Fe,jt;Ke===2?(Fe=Y.peerName||void 0,jt=`https://p.qlogo.cn/gh/${Pe}/${Pe}/640/`):(Fe=Y.sendNickName||Y.sendMemberName||void 0,jt=Oe(Pe)),v(Ke,Pe,Dt,Y.msgTime*1e3,Fe,jt)}else if(ce.type==="emoji-reaction"){let{groupCode:Y,msgSeq:Ke,emojiId:Pe,userId:ft,userName:Ht,isAdd:Dt}=ce.data;if(ft&&String(ft)===String(gt()))return;let Fe=te.current;Ao(2,Y,Ke,Pe,Dt),Fe&&Fe.chatType===2&&Fe.peerId===Y&&t.current&&t.current({groupCode:Y,msgSeq:Ke,emojiId:Pe,userId:ft,userName:Ht,isAdd:Dt})}else if(ce.type==="message-deleted"){let{msgId:Y,msgSeq:Ke,chatType:Pe,peerUid:ft,peerUin:Ht}=ce.data,Dt=Ht||ft,Fe=te.current;od(Pe,Dt,Y,Ke),Fe&&Fe.chatType===Pe&&Fe.peerId===Dt&&r.current&&r.current({msgId:Y,msgSeq:Ke})}else if(ce.type==="group-notify"){let Y=ce.data;N({type:"group-notify",data:Y,time:Y.actionTime?parseInt(Y.actionTime)*1e3:Date.now()})}else if(ce.type==="friend-request"){let Y=ce.data;N({type:"friend-request",data:Y,time:Y.reqTime?parseInt(Y.reqTime)*1e3:Date.now()})}else ce.type==="group-dismiss"?N({type:"group-dismiss",data:ce.data,time:Date.now()}):ce.type==="group-quit"&&N({type:"group-quit",data:ce.data,time:Date.now()})},ce=>{console.error("SSE \u8FDE\u63A5\u9519\u8BEF:",ce)},()=>{console.log("[WebQQ] SSE \u91CD\u8FDE\u6210\u529F\uFF0C\u91CD\u7F6E\u5DF2\u8BBF\u95EE\u804A\u5929\u6807\u5FD7"),bo(),I()});return()=>{Z.close()}},[x,v,I,N]);let Ue=zt(Z=>{o.current=[],h(Z),S(null),Z.chatType!==2&&(C(!1),P(!1));let ce=`${Z.chatType}_${Z.peerId}`;L(ce),k(y.map(Y=>Y.chatType===Z.chatType&&Y.peerId===Z.peerId?{...Y,unreadCount:0}:Y))},[h,L,k,y,C]),[at,V]=Tx(!1),oe=zt(Z=>{Ue(Z),V(!0)},[Ue]),Ie=zt(()=>{V(!1)},[]),D=zt(Z=>{let ce={chatType:1,peerId:Z.uin,peerName:Z.remark||Z.nickname,peerAvatar:Z.avatar};oe(ce)},[oe]),J=zt(Z=>{let ce={chatType:2,peerId:Z.groupCode,peerName:Z.groupName,peerAvatar:Z.avatar};oe(ce)},[oe]),ue=zt(Z=>{let ce={chatType:Z.chatType,peerId:Z.peerId,peerName:Z.peerName,peerAvatar:Z.peerAvatar};oe(ce)},[oe]),Me=pt.useMemo(()=>new Map(Object.entries(p)),[p]);return u&&n.length===0&&l.length===0?ct("div",{className:"flex items-center justify-center h-[calc(100vh-200px)]",children:ct(ee,{size:48,className:"animate-spin text-pink-500"})}):d&&n.length===0&&l.length===0?Zn("div",{className:"flex flex-col items-center justify-center h-[calc(100vh-200px)] gap-4",children:[ct("p",{className:"text-red-500",children:d}),ct("button",{onClick:()=>I(),className:"px-4 py-2 bg-pink-500 text-white rounded-lg hover:bg-pink-600 transition-colors",children:"\u91CD\u8BD5"})]}):Zn(_x,{children:[Zn("div",{className:"flex h-[calc(100vh-80px)] md:h-[calc(100vh-120px)] glass glass-regular rounded-none md:r-panel overflow-hidden",children:[ct("div",{className:`
25
+ w-full md:w-72 md:hairline-r flex-shrink-0
26
+ ${at?"hidden md:block":"block"}
27
+ `,children:ct(Tu,{activeTab:m,onTabChange:g,friendCategories:n,groups:l,recentChats:y,unreadCounts:Me,selectedPeerId:c?.peerId,onSelectFriend:D,onSelectGroup:J,onSelectRecent:ue})}),ct("div",{className:`
28
+ flex-1 flex flex-col min-w-0
29
+ ${at?"block":"hidden md:flex"}
30
+ `,children:ct(Gc,{session:c,onShowMembers:O,onShowFiles:z,onNewMessageCallback:de,onEmojiReactionCallback:je,onMessageRecalledCallback:tt,appendInputMention:_,onAppendInputMentionConsumed:U,onBack:Ie,showBackButton:at})}),f&&c?.chatType===2&&ct("div",{className:"fixed inset-0 z-50 bg-[rgb(var(--glass-tint)/0.92)] backdrop-blur-xl md:static md:inset-auto md:z-auto md:bg-transparent md:backdrop-blur-none md:w-64 md:hairline-l md:flex-shrink-0",children:ct(Jc,{groupCode:c.peerId,onClose:()=>C(!1),onAtMember:M})}),K&&c?.chatType===2&&ct("div",{className:"fixed inset-0 z-50 bg-[rgb(var(--glass-tint)/0.92)] backdrop-blur-xl md:static md:inset-auto md:z-auto md:bg-transparent md:backdrop-blur-none md:w-80 md:hairline-l md:flex-shrink-0",children:ct(Qc,{groupCode:c.peerId,locateTarget:F,onClose:()=>{P(!1),S(null)}})})]}),!e&&i&&ct("button",{onClick:()=>window.open(ht().pageHref("webqq",{fullscreen:!0}),"_blank"),className:"fixed top-4 right-4 md:top-auto md:bottom-6 md:right-6 z-50 p-3 glass glass-chrome glass-interactive r-capsule text-[var(--accent)] transition-all duration-200 group",title:"\u5728\u65B0\u7A97\u53E3\u4E2D\u5168\u5C4F\u6253\u5F00",children:ct(Lr,{size:20,className:"group-hover:scale-110 transition-transform"})})]})},Kc=Nx;function Bx(e){return new Promise(a=>{let t=()=>{clearTimeout(r),e.removeEventListener("abort",t),a()},r=setTimeout(t,2e3);e.addEventListener("abort",t,{once:!0}),e.aborted&&t()})}async function Zc(e,a,t,r){for(;!a.aborted;){try{let o=await e(a);if(a.aborted)return;if(o.online&&o.uin&&o.uid)return r?.(o),o;t({message:"NTQQ \u8D26\u53F7\u8FD8\u6CA1\u6709\u767B\u5F55\uFF0C\u767B\u5F55\u540E\u4F1A\u81EA\u52A8\u8FDB\u5165\u804A\u5929",error:!1})}catch(o){if(a.aborted)return;t({message:o instanceof Error?o.message:"\u83B7\u53D6\u767B\u5F55\u4FE1\u606F\u5931\u8D25",error:!0})}await Bx(a)}}import{jsx as ro,jsxs as tf}from"react/jsx-runtime";var zx=()=>{let{fullscreen:e}=Ux(),{setCollapsed:a}=Ox(),{autoHideSidebar:t}=ns(),r=qx()?.find(l=>l.platform==="ntqq"),[o,s]=ef(null),[i,n]=ef(null);return Yc(()=>{t&&!e&&a(!0)},[t,e,a]),Yc(()=>{let l=new AbortController;return s(null),n(null),Zc(Rl,l.signal,n,u=>{kl(u.uid,u.uin,u.nick),Zu(u.uin),ku(u.uin)}).then(u=>{!u||l.signal.aborted||(n(null),s(u.uin))}),()=>l.abort()},[r?.selfId,r?.status]),i?tf("div",{className:"card p-6 flex items-center gap-3 text-sm",role:"status",children:[ro(ee,{size:18,className:"animate-spin text-pink-500 shrink-0"}),tf("div",{className:i.error?"text-red-500":"text-theme-secondary",children:[i.message,i.error&&ro("p",{className:"mt-1 text-xs text-theme-muted",children:"\u6B63\u5728\u91CD\u8BD5\u8FDE\u63A5..."})]})]}):o?ro(Kc,{isFullscreen:e},o):ro("div",{className:"flex justify-center py-16",children:ro(ee,{size:40,className:"animate-spin text-pink-500"})})},l1=zx;export{l1 as default};
31
+ /*! Bundled license information:
32
+
33
+ lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
34
+ lucide-react/dist/esm/shared/src/utils/toLucideIconData.mjs:
35
+ lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs:
36
+ lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs:
37
+ lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
38
+ lucide-react/dist/esm/shared/src/build/defaultAttributes.mjs:
39
+ lucide-react/dist/esm/shared/src/build/buildLucideIconNode.mjs:
40
+ lucide-react/dist/esm/shared/src/build/buildLucideIconForReact.mjs:
41
+ lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs:
42
+ lucide-react/dist/esm/context.mjs:
43
+ lucide-react/dist/esm/Icon.mjs:
44
+ lucide-react/dist/esm/createLucideIcon.mjs:
45
+ lucide-react/dist/esm/icons/archive.mjs:
46
+ lucide-react/dist/esm/icons/arrow-down.mjs:
47
+ lucide-react/dist/esm/icons/arrow-left.mjs:
48
+ lucide-react/dist/esm/icons/at-sign.mjs:
49
+ lucide-react/dist/esm/icons/award.mjs:
50
+ lucide-react/dist/esm/icons/ban.mjs:
51
+ lucide-react/dist/esm/icons/bell-off.mjs:
52
+ lucide-react/dist/esm/icons/bell.mjs:
53
+ lucide-react/dist/esm/icons/calendar.mjs:
54
+ lucide-react/dist/esm/icons/check.mjs:
55
+ lucide-react/dist/esm/icons/chevron-down.mjs:
56
+ lucide-react/dist/esm/icons/chevron-right.mjs:
57
+ lucide-react/dist/esm/icons/circle-exclamation-point.mjs:
58
+ lucide-react/dist/esm/icons/clock.mjs:
59
+ lucide-react/dist/esm/icons/crown.mjs:
60
+ lucide-react/dist/esm/icons/download.mjs:
61
+ lucide-react/dist/esm/icons/face-slightly-smiling.mjs:
62
+ lucide-react/dist/esm/icons/file-text.mjs:
63
+ lucide-react/dist/esm/icons/folder-open.mjs:
64
+ lucide-react/dist/esm/icons/folder-plus.mjs:
65
+ lucide-react/dist/esm/icons/folder.mjs:
66
+ lucide-react/dist/esm/icons/forward.mjs:
67
+ lucide-react/dist/esm/icons/hand.mjs:
68
+ lucide-react/dist/esm/icons/hash.mjs:
69
+ lucide-react/dist/esm/icons/image.mjs:
70
+ lucide-react/dist/esm/icons/list-checks.mjs:
71
+ lucide-react/dist/esm/icons/loader-circle.mjs:
72
+ lucide-react/dist/esm/icons/log-out.mjs:
73
+ lucide-react/dist/esm/icons/maximize-2.mjs:
74
+ lucide-react/dist/esm/icons/message-circle.mjs:
75
+ lucide-react/dist/esm/icons/moon.mjs:
76
+ lucide-react/dist/esm/icons/paperclip.mjs:
77
+ lucide-react/dist/esm/icons/pause.mjs:
78
+ lucide-react/dist/esm/icons/pencil.mjs:
79
+ lucide-react/dist/esm/icons/pin.mjs:
80
+ lucide-react/dist/esm/icons/play.mjs:
81
+ lucide-react/dist/esm/icons/refresh-cw.mjs:
82
+ lucide-react/dist/esm/icons/reply.mjs:
83
+ lucide-react/dist/esm/icons/search.mjs:
84
+ lucide-react/dist/esm/icons/send.mjs:
85
+ lucide-react/dist/esm/icons/shield-exclamation-point.mjs:
86
+ lucide-react/dist/esm/icons/shield-off.mjs:
87
+ lucide-react/dist/esm/icons/shield.mjs:
88
+ lucide-react/dist/esm/icons/star.mjs:
89
+ lucide-react/dist/esm/icons/sticker.mjs:
90
+ lucide-react/dist/esm/icons/sun.mjs:
91
+ lucide-react/dist/esm/icons/trash.mjs:
92
+ lucide-react/dist/esm/icons/triangle-exclamation-point.mjs:
93
+ lucide-react/dist/esm/icons/upload.mjs:
94
+ lucide-react/dist/esm/icons/user-minus.mjs:
95
+ lucide-react/dist/esm/icons/user-plus.mjs:
96
+ lucide-react/dist/esm/icons/user.mjs:
97
+ lucide-react/dist/esm/icons/users.mjs:
98
+ lucide-react/dist/esm/icons/volume-x.mjs:
99
+ lucide-react/dist/esm/icons/x.mjs:
100
+ lucide-react/dist/esm/lucide-react.mjs:
101
+ (**
102
+ * @license lucide-react v1.73.0 - ISC
103
+ *
104
+ * This source code is licensed under the ISC license.
105
+ * See the LICENSE file in the root directory of this source tree.
106
+ *)
107
+
108
+ markdown-it/dist/markdown-it.mjs:
109
+ (*! markdown-it 15.0.3 https://github.com/markdown-it/markdown-it @license MIT *)
110
+ */