(()=>{var e={};e.id=931,e.ids=[931],e.modules={2934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},4580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},5869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},2530:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>i.a,__next_app__:()=>h,originalPathname:()=>p,pages:()=>d,routeModule:()=>u,tree:()=>c}),r(2232),r(3397),r(5866);var s=r(3191),n=r(8716),a=r(7922),i=r.n(a),l=r(5231),o={};for(let e in l)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>l[e]);r.d(t,o);let c=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,2232)),"/Users/home/Projects/forumlify/app/page.js"]}]},{layout:[()=>Promise.resolve().then(r.bind(r,3397)),"/Users/home/Projects/forumlify/app/layout.js"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,5866,23)),"next/dist/client/components/not-found-error"]}],d=["/Users/home/Projects/forumlify/app/page.js"],p="/page",h={require:r,loadChunk:()=>Promise.resolve()},u=new s.AppPageRouteModule({definition:{kind:n.x.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:c}})},3448:(e,t,r)=>{Promise.resolve().then(r.bind(r,4646)),Promise.resolve().then(r.bind(r,7494))},3429:(e,t,r)=>{Promise.resolve().then(r.bind(r,8885))},8034:(e,t,r)=>{Promise.resolve().then(r.t.bind(r,2994,23)),Promise.resolve().then(r.t.bind(r,6114,23)),Promise.resolve().then(r.t.bind(r,9727,23)),Promise.resolve().then(r.t.bind(r,9671,23)),Promise.resolve().then(r.t.bind(r,1868,23)),Promise.resolve().then(r.t.bind(r,4759,23))},8885:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>tx});var s=r(326),n=r(7577);let a=null;function i(e){a=e,e?localStorage.setItem("forumlify-token",e):localStorage.removeItem("forumlify-token")}async function l(e,t={}){let r={...t.headers||{}};t.body&&"string"==typeof t.body&&(r["Content-Type"]="application/json"),a&&(r.Authorization="Bearer "+a);let s=await fetch("/api"+e,{...t,headers:r}),n=await s.json().catch(()=>({}));if(!s.ok||n.error){let e=Error(n.error||"请求失败");throw e.status=s.status,e}return n}let o={async login(e,t){let r=await l("/auth/login",{method:"POST",body:JSON.stringify({email:e,password:t})});return r.token&&i(r.token),r},register:(e,t,r)=>l("/auth/register",{method:"POST",body:JSON.stringify({email:e,password:t,username:r})}),logout(){i(null)},getMe:()=>l("/auth/me"),getPosts(e,t,r=1,s=20){let n="/posts?sort="+(e||"latest")+"&page="+r+"&limit="+s;return t&&(n+="&user_id="+t),l(n)},getPost:e=>l("/posts/"+e),createPost:(e,t,r)=>l("/posts",{method:"POST",body:JSON.stringify({title:e,content:t,images:r||[]})}),updatePost:(e,t,r,s)=>l("/posts/"+e,{method:"PUT",body:JSON.stringify({title:t,content:r,images:s})}),togglePinPost:e=>l("/posts/"+e+"/pin",{method:"PUT"}),deletePost:e=>l("/posts/"+e,{method:"DELETE"}),getReplies:e=>l("/posts/"+e+"/replies"),createReply:(e,t)=>l("/posts/"+e+"/replies",{method:"POST",body:JSON.stringify({content:t})}),deleteReply:e=>l("/replies/"+e,{method:"DELETE"}),getUsers:()=>l("/users"),getUsersByUsername:e=>l("/users?username="+encodeURIComponent(e)),updateUserRole:(e,t)=>l("/users/"+e+"/role",{method:"PUT",body:JSON.stringify({role:t})}),updateProfile:(e,t,r,s)=>l("/users/"+e,{method:"PUT",body:JSON.stringify({username:t,bio:r,signature:s})}),updateAvatar:(e,t)=>l("/users/"+e+"/avatar",{method:"PUT",body:JSON.stringify({avatar_url:t})}),updatePassword:(e,t,r)=>l("/users/"+e+"/password",{method:"PUT",body:JSON.stringify({oldPassword:t,newPassword:r})}),updateEmail:(e,t,r)=>l("/users/"+e+"/email",{method:"PUT",body:JSON.stringify({password:t,newEmail:r})}),getReports:()=>l("/reports"),createReport:(e,t)=>l("/reports",{method:"POST",body:JSON.stringify({post_id:e,reason:t})}),updateReport:(e,t,r)=>l("/reports/"+e,{method:"PUT",body:JSON.stringify({status:t,note:r})}),getStats:()=>l("/stats"),getSettings:()=>l("/settings"),updateSettings:e=>l("/settings",{method:"PUT",body:JSON.stringify({forum_name:e})}),getLinks:()=>l("/links"),addLink:(e,t)=>l("/links",{method:"POST",body:JSON.stringify({title:e,url:t})}),deleteLink:e=>l("/links/"+e,{method:"DELETE"}),getEventLogs:()=>l("/event-logs"),logEvent:e=>l("/event-logs",{method:"POST",body:JSON.stringify({action:e})}).catch(()=>{}),getConversations:()=>l("/conversations"),getOrCreateConversation:e=>l("/conversations",{method:"POST",body:JSON.stringify({other_user_id:e})}),getMessages:e=>l("/conversations/"+e+"/messages"),sendMessage:(e,t)=>l("/conversations/"+e+"/messages",{method:"POST",body:JSON.stringify({content:t})}),markMessageRead:e=>l("/messages/"+e+"/read",{method:"PUT"}),getCustomPages:()=>l("/custom-pages"),getCustomPage:e=>l("/custom-pages/"+e),adminGetCustomPages:()=>l("/admin/custom-pages"),adminCreateCustomPage:(e,t,r)=>l("/admin/custom-pages",{method:"POST",body:JSON.stringify({name:e,title:t,content:r})}),adminUpdateCustomPage:(e,t,r,s)=>l("/admin/custom-pages/"+e,{method:"PUT",body:JSON.stringify({title:t,content:r,enabled:s})}),adminDeleteCustomPage:e=>l("/admin/custom-pages/"+e,{method:"DELETE"}),uploadCustomCss(e){let t=new FormData;t.append("file",e);let r={};return a&&(r.Authorization="Bearer "+a),fetch("/api/admin/custom-css",{method:"POST",body:t,headers:r}).then(async e=>{let t=await e.json().catch(()=>({}));if(!e.ok||t.error)throw Error(t.error||"上传失败");return t})},deleteCustomCss:()=>l("/admin/custom-css",{method:"DELETE"}),getNotifications:()=>l("/notifications"),markNotificationRead:e=>l("/notifications/"+e+"/read",{method:"PUT"}),markAllNotificationsRead:()=>l("/notifications/read-all",{method:"PUT"}),generateRecoveryCodes:()=>l("/auth/recovery-codes/generate",{method:"POST"}),getRecoveryCodeCount:()=>l("/auth/recovery-codes/count"),resetPassword:(e,t,r)=>l("/auth/reset-password",{method:"POST",body:JSON.stringify({email:e,recoveryCode:t,newPassword:r})})};async function c(e){let t=new FormData;t.append("file",e);let r={};a&&(r.Authorization="Bearer "+a);let s=await fetch("/api/upload",{method:"POST",body:t,headers:r}),n=await s.json().catch(()=>({}));if(!s.ok||n.error)throw Error(n.error||"上传失败");return n.url}function d(){let e=Math.floor(9*Math.random())+1,t=Math.floor(9*Math.random())+1,r=["+","-"][Math.floor(2*Math.random())];if("-"===r&&e"Forumlify"),[l,c]=(0,n.useState)("light"),[d,h]=(0,n.useState)("feed"),[u,x]=(0,n.useState)(null),[g,m]=(0,n.useState)(null),[f,y]=(0,n.useState)(null),[b,k]=(0,n.useState)("latest"),[v,j]=(0,n.useState)(0),[S,w]=(0,n.useState)(!1),[C,z]=(0,n.useState)(!1);(0,n.useRef)(!1);let R=(0,n.useCallback)(()=>j(e=>e+1),[]),N=(0,n.useCallback)(()=>{c(e=>{let t="light"===e?"dark":"light";return document.documentElement.setAttribute("data-theme",t),localStorage.setItem("forumlify-theme",t),t})},[]),P=(0,n.useCallback)(e=>{let t=new URL(window.location);"feed"===e?t.searchParams.delete("page"):t.searchParams.set("page",e),t.searchParams.delete("post"),window.history.pushState({page:e},"",t),h(e),x(null),R()},[R]),D=(0,n.useCallback)(e=>{let t=new URL(window.location);t.searchParams.set("post",e),t.searchParams.delete("page"),t.searchParams.delete("user"),window.history.pushState({page:"post",postId:e},"",t),h("post"),x(e)},[]),T=(0,n.useCallback)(e=>{let t=new URL(window.location);t.searchParams.set("user",e),t.searchParams.delete("page"),t.searchParams.delete("post"),window.history.pushState({page:"user",username:e},"",t),h("user"),m(e)},[]),_=(0,n.useCallback)(e=>{let t=new URL(window.location);t.searchParams.set("page",e),t.searchParams.delete("post"),t.searchParams.delete("user"),window.history.pushState({page:"custom",pageName:e},"",t),h("custom"),y(e)},[]),A=(0,n.useCallback)(async(e,t)=>{let s=await o.login(e,t);return s.user&&(r(s.user),o.logEvent("login").catch(()=>{})),s},[]),$=(0,n.useCallback)(async(e,t,s)=>{let n=await o.register(e,t,s),a=await o.login(e,t);return a.user&&(r(a.user),o.logEvent("register").catch(()=>{})),n},[]),B=(0,n.useCallback)(()=>{o.logout(),r(null),P("feed")},[P]),L=(0,n.useCallback)(e=>{i(e),localStorage.setItem("forumlify-forum-name",e)},[]);return s.jsx(p.Provider,{value:{currentUser:t,setCurrentUser:r,forumName:a,forumNameLoaded:C,updateForumName:L,theme:l,toggleTheme:N,view:d,navigate:P,currentPostId:u,openPost:D,currentUsername:g,openUser:T,currentPageName:f,openCustomPage:_,sort:b,setSort:k,refreshKey:v,refresh:R,ready:S,login:A,register:$,logout:B},children:e})}let x={xmlns:"http://www.w3.org/2000/svg",width:16,height:16,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",style:{display:"inline",verticalAlign:"middle"}};function g({name:e,size:t=16,...r}){return s.jsx("svg",{...x,width:t,height:t,...r,children:m[e]||null})}let m={message:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),settings:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"}),s.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),shieldAlert:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"}),s.jsx("path",{d:"M12 8v4"}),s.jsx("path",{d:"M12 16h.01"})]}),user:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),lock:(0,s.jsxs)(s.Fragment,{children:[s.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),s.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]}),moon:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),sun:(0,s.jsxs)(s.Fragment,{children:[s.jsx("circle",{cx:"12",cy:"12",r:"5"}),s.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),s.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),s.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),s.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),s.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),s.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),s.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),s.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]}),logout:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),s.jsx("polyline",{points:"16 17 21 12 16 7"}),s.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]}),book:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M21 12V7H5a2 2 0 0 1 0-4h14v4"}),s.jsx("path",{d:"M3 5v14a2 2 0 0 0 2 2h16v-5"}),s.jsx("line",{x1:"18",y1:"12",x2:"18",y2:"12"})]}),link:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),s.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),plus:(0,s.jsxs)(s.Fragment,{children:[s.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),s.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),shield:s.jsx(s.Fragment,{children:s.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),users:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),s.jsx("circle",{cx:"9",cy:"7",r:"4"}),s.jsx("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),s.jsx("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]}),file:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),s.jsx("polyline",{points:"14 2 14 8 20 8"}),s.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),s.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),s.jsx("polyline",{points:"10 9 9 9 8 9"})]}),plus2:(0,s.jsxs)(s.Fragment,{children:[s.jsx("path",{d:"M12 5v14"}),s.jsx("path",{d:"M5 12h14"})]}),close:(0,s.jsxs)(s.Fragment,{children:[s.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),s.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),trash:(0,s.jsxs)(s.Fragment,{children:[s.jsx("polyline",{points:"3 6 5 6 21 6"}),s.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})};function f({onOpenChat:e,onClose:t}){let[r,a]=(0,n.useState)(null);return s.jsx("div",{className:"modal active",onClick:e=>{e.target===e.currentTarget&&t()},children:(0,s.jsxs)("div",{className:"modal-content",style:{display:"flex",flexDirection:"column",height:"70vh",maxHeight:"70vh",padding:0,overflow:"hidden"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[s.jsx("h2",{style:{fontSize:18,margin:0},children:"✉️ 私信"}),s.jsx("span",{className:"close",onClick:t,style:{fontSize:24,cursor:"pointer",color:"var(--text-light)",lineHeight:1},children:"\xd7"})]}),s.jsx("div",{id:"messageListContent",style:{flex:1,overflowY:"auto",padding:0},children:null===r?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"加载中..."}):0===r.length?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"暂无私信"}):r.map(t=>{let r=t.unread_count||0,n=t.last_message||"暂无消息",a=t.last_message_time?new Date(t.last_message_time).toLocaleString("zh-CN"):"";return(0,s.jsxs)("div",{className:"message-list-item",style:{display:"flex",alignItems:"center",gap:12,padding:"12px 16px",borderBottom:"1px solid var(--border)",cursor:"pointer",transition:"background 0.15s"},onClick:()=>e(t.id,t.other_user_id,t.other_username),children:[s.jsx("img",{src:t.other_avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(t.other_username||"U")+"&background=6366f1&color=fff&size=64",style:{width:40,height:40,borderRadius:"50%",objectFit:"cover"},alt:""}),(0,s.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsx("span",{style:{fontWeight:600},children:t.other_username}),s.jsx("span",{style:{fontSize:12,color:"var(--text-light)"},children:a})]}),(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[s.jsx("span",{style:{fontSize:13,color:"var(--text-secondary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",maxWidth:200},children:n}),r>0&&s.jsx("span",{style:{background:"#ef4444",color:"#fff",borderRadius:"50%",padding:"2px 8px",fontSize:11,fontWeight:600},children:r})]})]})]},t.id)})})]})})}function y({conversationId:e,otherUserId:t,otherUsername:r,onClose:a,onRefreshList:i}){let{currentUser:l}=h(),[c,d]=(0,n.useState)(null),[p,u]=(0,n.useState)(""),x=(0,n.useRef)(null),g=(0,n.useCallback)(async(t=!1)=>{t||d(null);try{let t=await o.getMessages(e);d(t||[])}catch{t||d([])}},[e]),m=async()=>{if(p.trim())try{await o.sendMessage(e,p.trim()),u(""),g(),i()}catch(e){alert("发送失败:"+e.message)}};return s.jsx("div",{className:"modal active",onClick:e=>{e.target===e.currentTarget&&a()},children:(0,s.jsxs)("div",{className:"modal-content",style:{display:"flex",flexDirection:"column",height:"70vh",maxHeight:"70vh",padding:0,overflow:"hidden"},children:[(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px 20px",borderBottom:"1px solid var(--border)"},children:[s.jsx("span",{id:"chatTitle",style:{fontWeight:600,fontSize:16},children:r}),s.jsx("span",{className:"close",onClick:a,style:{fontSize:24,cursor:"pointer",color:"var(--text-light)",lineHeight:1},children:"\xd7"})]}),s.jsx("div",{id:"chatMessages",ref:x,style:{flex:1,overflowY:"auto",padding:16,minHeight:0},children:null===c?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"加载中..."}):0===c.length?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"还没有消息,打个招呼吧 \uD83D\uDC4B"}):c.map(e=>{let t=e.sender_id===l?.id,r=e.created_at?new Date(e.created_at).toLocaleString("zh-CN"):"";return(0,s.jsxs)("div",{style:{display:"flex",justifyContent:t?"flex-end":"flex-start",marginBottom:12},children:[!t&&s.jsx("img",{src:e.sender_avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(e.sender_username||"U")+"&background=6366f1&color=fff&size=64",style:{width:32,height:32,borderRadius:"50%",objectFit:"cover",marginRight:8,flexShrink:0},alt:""}),(0,s.jsxs)("div",{style:{maxWidth:"70%"},children:[s.jsx("div",{style:{background:t?"var(--primary)":"var(--surface)",color:t?"#fff":"var(--text)",padding:"10px 14px",borderRadius:12,border:t?"none":"1px solid var(--border)",wordBreak:"break-word"},children:e.content}),(0,s.jsxs)("div",{style:{fontSize:11,color:"var(--text-light)",marginTop:4,textAlign:t?"right":"left"},children:[r," ",t?e.is_read?"✓✓":"✓":""]})]})]},e.id)})}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,padding:"12px 16px",borderTop:"1px solid var(--border)",flexShrink:0},children:[s.jsx("input",{type:"text",id:"chatInput",placeholder:"输入消息...",style:{flex:1,padding:"8px 12px",border:"1px solid var(--border)",borderRadius:6,fontSize:14,background:"var(--bg)",color:"var(--text)",outline:"none"},value:p,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&m()}}),s.jsx("button",{className:"btn-primary",style:{padding:"8px 16px"},onClick:m,children:"发送"})]})]})})}function b(){let{currentUser:e}=h(),[t,r]=(0,n.useState)(0);return e?(0,s.jsxs)("button",{className:"nav-icon-btn",title:"私信",style:{position:"relative",padding:"6px 8px",background:"none",border:"none",cursor:"pointer",color:"var(--text-secondary)",borderRadius:4,display:"inline-flex",alignItems:"center",justifyContent:"center"},onClick:()=>window.dispatchEvent(new CustomEvent("forumlify-open-messages")),children:[s.jsx(g,{name:"message",size:20}),t>0&&s.jsx("span",{style:{position:"absolute",top:-2,right:-2,background:"#ef4444",color:"#fff",borderRadius:"50%",padding:"2px 6px",fontSize:10,fontWeight:600,minWidth:18,textAlign:"center",lineHeight:1.4},children:t>99?"99+":t})]}):null}function k(){let[e,t]=(0,n.useState)(!1),[r,a]=(0,n.useState)(null),[i,l]=(0,n.useState)(0),o=(0,n.useCallback)(()=>l(e=>e+1),[]);return(0,s.jsxs)(s.Fragment,{children:[e&&s.jsx(f,{onOpenChat:(e,r,s)=>{a({conversationId:e,otherUserId:r,otherUsername:s}),t(!1)},onClose:()=>t(!1)}),r&&s.jsx(y,{conversationId:r.conversationId,otherUserId:r.otherUserId,otherUsername:r.otherUsername,onClose:()=>{a(null),o()},onRefreshList:o})]})}function v({onOpenModal:e}){let{currentUser:t,forumName:r,theme:a,toggleTheme:i,navigate:l,openCustomPage:o,logout:c}=h(),[d,p]=(0,n.useState)(!1),[u,x]=(0,n.useState)([]),m=t?.avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(t?.username||"U")+"&background=6366f1&color=fff",f=e=>{if("admin"===e&&t?.role!=="admin"){alert("无权限访问");return}p(!1),l(e)};return(0,s.jsxs)("nav",{id:"navbar",children:[(0,s.jsxs)("div",{className:"nav-left",children:[s.jsx("span",{className:"forum-name",onClick:()=>l("feed"),style:{cursor:"pointer"},children:r}),s.jsx("span",{id:"customNavLinks",style:{display:"inline-flex",alignItems:"center",gap:6,marginLeft:16},children:u.map(e=>s.jsx("a",{href:"#",className:"custom-page-nav-link","data-custom":e.name,onClick:t=>{t.preventDefault(),o(e.name)},style:{color:"var(--text-secondary)",textDecoration:"none",fontSize:14,padding:"4px 10px",borderRadius:4,transition:"color 0.15s"},onMouseEnter:e=>{e.currentTarget.style.color="var(--text)"},onMouseLeave:e=>{e.currentTarget.style.color="var(--text-secondary)"},children:e.title},e.id))})]}),(0,s.jsxs)("div",{className:"nav-right",children:[s.jsx(b,{}),s.jsx("div",{id:"userMenu",children:t?(0,s.jsxs)("div",{id:"userDropdown",style:{display:"block"},children:[s.jsx("img",{className:"avatar",src:m,alt:"avatar",onClick:e=>{e.stopPropagation(),p(!d)}}),d&&(0,s.jsxs)("div",{className:"dropdown-menu show",onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("a",{href:"#",onClick:e=>{e.preventDefault(),p(!1),l("messages")},children:[s.jsx(g,{name:"message"})," 消息"]}),(0,s.jsxs)("a",{href:"#",onClick:e=>{e.preventDefault(),f("settings")},children:[s.jsx(g,{name:"settings"})," 设置"]}),"admin"===t.role&&(0,s.jsxs)("a",{href:"#",onClick:e=>{e.preventDefault(),f("admin")},children:[s.jsx(g,{name:"shieldAlert"})," 管理后台"]}),s.jsx("hr",{}),(0,s.jsxs)("a",{href:"#",onClick:e=>{e.preventDefault(),i(),p(!1)},children:[s.jsx(g,{name:"dark"===a?"sun":"moon"})," ","dark"===a?"亮色模式":"暗色模式"]}),s.jsx("hr",{}),(0,s.jsxs)("a",{href:"#",onClick:e=>{e.preventDefault(),confirm("确定要退出吗?")&&(p(!1),c())},children:[s.jsx(g,{name:"logout"})," 退出"]})]})]}):(0,s.jsxs)("div",{id:"authButtons",children:[s.jsx("button",{className:"btn-ghost",onClick:()=>e("login"),children:"登录"}),s.jsx("button",{className:"btn-primary",onClick:()=>e("register"),children:"注册"})]})})]})]})}function j(){let[e,t]=(0,n.useState)({posts:0,users:0,topics:0,online:0}),[r,a]=(0,n.useState)([]);return(0,s.jsxs)("aside",{id:"sidebar",children:[(0,s.jsxs)("div",{className:"stats-box",children:[(0,s.jsxs)("h4",{children:[s.jsx(g,{name:"book",size:14})," 社区统计"]}),(0,s.jsxs)("div",{className:"stat-item",children:[s.jsx("span",{children:"主题"}),s.jsx("span",{children:e.topics||0})]}),(0,s.jsxs)("div",{className:"stat-item",children:[s.jsx("span",{children:"帖子"}),s.jsx("span",{children:e.posts||0})]}),(0,s.jsxs)("div",{className:"stat-item",children:[s.jsx("span",{children:"用户"}),s.jsx("span",{children:e.users||0})]}),(0,s.jsxs)("div",{className:"stat-item",children:[s.jsx("span",{children:"在线"}),s.jsx("span",{children:e.online||0})]})]}),(0,s.jsxs)("div",{className:"links-box",children:[(0,s.jsxs)("h4",{children:[s.jsx(g,{name:"link",size:14})," 友情链接"]}),s.jsx("ul",{id:"friendlyLinks",children:0===r.length?s.jsx("li",{style:{color:"#94a3b8",fontSize:13},children:"暂无链接"}):r.map(e=>s.jsx("li",{children:s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",children:e.title})},e.id))})]})]})}function S({src:e,onClose:t}){return s.jsx("div",{className:"modal active",style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.85)",zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",animation:"fadeIn 0.2s ease-out"},onClick:t,children:s.jsx("img",{src:e,alt:"",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:8,boxShadow:"0 8px 32px rgba(0,0,0,0.5)",cursor:"default",userSelect:"none"},onClick:e=>e.stopPropagation()})})}function w(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var C=w(),z={exec:()=>null};function R(e){let t=[];return r=>{let s=Math.max(0,Math.min(3,r-1)),n=t[s];return n||(n=e(s),t[s]=n),n}}function N(e,t=""){let r="string"==typeof e?e:e.source,s={replace:(e,t)=>{let n="string"==typeof t?t:t.source;return n=n.replace(D.caret,"$1"),r=r.replace(e,n),s},getRegex:()=>new RegExp(r,t)};return s}var P=((e="")=>{try{return RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:R(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:R(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:R(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:R(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:R(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,"i")),blockquoteBeginRegex:R(e=>RegExp(`^ {0,${e}}>`))},T=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,A=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,$=N(A).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),B=N(A).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),L=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,I=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,E=N(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",I).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),M=N(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_).getRegex(),W="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",U=/|$))/,O=N("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",U).replace("tag",W).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),F=e=>N(L).replace("hr",T).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list",e).replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",W).getRegex(),q=F(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),H=F(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),Z={blockquote:N(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",H).getRegex(),code:/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,def:E,fences:/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,hr:T,html:O,lheading:$,list:M,newline:/^(?:[ \t]*(?:\n|$))+/,paragraph:q,table:z,text:/^[^\n]+/},J=N("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",T).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",W).getRegex(),Q={...Z,lheading:B,table:J,paragraph:N(L).replace("hr",T).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",J).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",W).getRegex()},G={...Z,html:N(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",U).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:N(L).replace("hr",T).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",$).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},V=/^( {2,}|\\)\n(?!\s*$)/,X=/[\p{P}\p{S}]/u,K=/[\s\p{P}\p{S}]/u,Y=/[^\s\p{P}\p{S}]/u,ee=N(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,K).getRegex(),et=/(?!~)[\p{P}\p{S}]/u,er=N(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",P?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),es=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,en=N(es,"u").replace(/punct/g,X).getRegex(),ea=N(es,"u").replace(/punct/g,et).getRegex(),ei=N(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,"u").replace(/openQuote/g,/[\p{Pi}\p{Ps}"']/u).replace(/punct/g,X).getRegex(),el="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",eo=N(el,"gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,K).replace(/punct/g,X).getRegex(),ec=N(el,"gu").replace(/notPunctSpace/g,/(?:[^\s\p{P}\p{S}]|~)/u).replace(/punctSpace/g,/(?!~)[\s\p{P}\p{S}]/u).replace(/punct/g,et).getRegex(),ed=N("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,K).replace(/punct/g,X).getRegex(),ep=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,K).replace(/punct/g,X).getRegex(),eh=N("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,K).replace(/punct/g,X).getRegex(),eu=N(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,X).getRegex(),ex=N("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,Y).replace(/punctSpace/g,K).replace(/punct/g,X).getRegex(),eg=N(/\\(punct)/,"gu").replace(/punct/g,X).getRegex(),em=N(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),ef=N(U).replace("(?:-->|$)","-->").getRegex(),ey=N("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",ef).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),eb=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,ek=N(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",eb).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ev=N(/^!?\[(label)\]\[(ref)\]/).replace("label",eb).replace("ref",I).getRegex(),ej=N(/^!?\[(ref)\](?:\[\])?/).replace("ref",I).getRegex(),eS=N("reflink|nolink(?!\\()","g").replace("reflink",ev).replace("nolink",ej).getRegex(),ew=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,eC={_backpedal:z,anyPunctuation:eg,autolink:em,blockSkip:er,br:V,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,del:z,delLDelim:z,delRDelim:z,emStrongLDelim:en,emStrongRDelimAst:eo,emStrongRDelimUnd:ep,escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,link:ek,nolink:ej,punctuation:ee,reflink:ev,reflinkSearch:eS,tag:ey,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},e_=e=>eT[e];function eA(e,t){if(t){if(D.escapeTest.test(e))return e.replace(D.escapeReplace,e_)}else if(D.escapeTestNoEncode.test(e))return e.replace(D.escapeReplaceNoEncode,e_);return e}function e$(e){try{e=encodeURI(e).replace(D.percentDecode,"%")}catch{return null}return e}function eB(e,t){let r=e.replace(D.findPipe,(e,t,r)=>{let s=!1,n=t;for(;--n>=0&&"\\"===r[n];)s=!s;return s?"|":" |"}).split(D.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),t){if(r.length>t)r.splice(t);else for(;r.length=0&&D.blankLine.test(t[r]);)r--;return t.length-r<=2?e:t.slice(0,r+1).join(` `)}function eE(e,t,r,s,n){let a=t.href,i=t.title||null,l=e[1].replace(n.other.outputLinkReplace,"$1");s.state.inLink=!0;let o={type:"!"===e[0].charAt(0)?"image":"link",raw:r,href:a,title:i,text:l,tokens:s.inlineTokens(l)};return s.state.inLink=!1,o}var eM=class{options;rules;lexer;constructor(e){this.options=e||C}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:eI(t[0]),r=e.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e,codeBlockStyle:"indented",text:r}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],r=function(e,t,r){let s=e.match(r.other.indentCodeCompensation);if(null===s)return t;let n=s[1];return t.split(` `).map(e=>{let t=e.match(r.other.beginningSpace);if(null===t)return e;let[s]=t;return s.length>=n.length?e.slice(n.length):e}).join(` `)}(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=eL(e,"#");(this.options.pedantic||!t||this.rules.other.endingSpaceChar.test(t))&&(e=t.trim())}return{type:"heading",raw:eL(t[0],` `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:eL(t[0],` `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=eL(t[0],` `).split(` `),r="",s="",n=[];for(;e.length>0;){let t=!1,a=[],i;for(i=0;i1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let a=this.rules.other.listItemRegex(r),i=!1;for(;e;){let r=!1,s="",l="";if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;s=t[0],e=e.substring(s.length);let o=function(e,t=0){let r=t,s="";for(let t of e)if(" "===t){let e=4-r%4;s+=" ".repeat(e),r+=e}else s+=t,r++;return s}(t[2].split(` `,1)[0],t[1].length),c=e.split(` `,1)[0],d=!o.trim(),p=0;if(this.options.pedantic?(p=2,l=o.trimStart()):d?p=t[1].length+1:(p=(p=o.search(this.rules.other.nonSpaceChar))>4?1:p,l=o.slice(p),p+=t[1].length),d&&this.rules.other.blankLine.test(c)&&(s+=c+` `,e=e.substring(c.length+1),r=!0),!r){let t=this.rules.other.nextBulletRegex(p),r=this.rules.other.hrRegex(p),n=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),i=this.rules.other.htmlBeginRegex(p),h=this.rules.other.blockquoteBeginRegex(p);for(;e;){let u=e.split(` `,1)[0],x;if(c=u,x=this.options.pedantic?c=c.replace(this.rules.other.listReplaceNesting," "):c.replace(this.rules.other.tabCharGlobal," "),n.test(c)||a.test(c)||i.test(c)||h.test(c)||t.test(c)||r.test(c))break;if(x.search(this.rules.other.nonSpaceChar)>=p||!c.trim())l+=` `+x.slice(p);else{if(d||o.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||n.test(o)||a.test(o)||r.test(o))break;l+=` `+c}d=!c.trim(),s+=u+` `,e=e.substring(u.length+1),o=x.slice(p)}}n.loose||(i?n.loose=!0:this.rules.other.doubleBlankLine.test(s)&&(i=!0)),n.items.push({type:"list_item",raw:s,task:!!this.options.gfm&&this.rules.other.listIsTask.test(l),loose:!1,text:l,tokens:[]}),n.raw+=s}let l=n.items.at(-1);if(!l)return;for(let e of(l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd(),n.raw=n.raw.trimEnd(),n.items)){this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]);let t=e.tokens[0];if(e.task&&(t?.type==="text"||t?.type==="paragraph")){e.text=e.text.replace(this.rules.other.listReplaceTask,""),t.raw=t.raw.replace(this.rules.other.listReplaceTask,""),t.text=t.text.replace(this.rules.other.listReplaceTask,"");for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,"");break}let r=this.rules.other.listTaskCheckbox.exec(e.raw);if(r){let t={type:"checkbox",raw:r[0]+" ",checked:"[ ]"!==r[0]};e.checked=t.checked,n.loose?e.tokens[0]&&["paragraph","text"].includes(e.tokens[0].type)&&"tokens"in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:"paragraph",raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&(e.task=!1);if(!n.loose){let t=e.tokens.filter(e=>"space"===e.type),r=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw));n.loose=r}}if(n.loose)for(let e of n.items)for(let t of(e.loose=!0,e.tokens))"text"===t.type&&(t.type="paragraph");return n}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=eI(t[0]);return{type:"html",block:!0,raw:e,pre:"pre"===t[1]||"script"===t[1]||"style"===t[1],text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:eL(t[0],` `),href:r,title:s}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=eB(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(` `):[],a={type:"table",raw:eL(t[0],` `),header:[],align:[],rows:[]};if(r.length===s.length){for(let e of s)this.rules.other.tableAlignRight.test(e)?a.align.push("right"):this.rules.other.tableAlignCenter.test(e)?a.align.push("center"):this.rules.other.tableAlignLeft.test(e)?a.align.push("left"):a.align.push(null);for(let e=0;e({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:"heading",raw:eL(t[0],` `),depth:"="===t[2].charAt(0)?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===` `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let t=eL(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{let e=function(e,t){if(-1===e.indexOf(")"))return -1;let r=0;for(let t=0;t0?-2:-1}(t[2],"()");if(-2===e)return;if(e>-1){let r=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,r).trim(),t[3]=""}}let r=t[2],s="";if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(r);e&&(r=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(r=this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r.slice(1):r.slice(1,-1)),eE(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let e=t[(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," ").toLowerCase()];if(!e){let e=r[0].charAt(0);return{type:"text",raw:e,text:e}}return eE(r,e,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!(!s||!s[1]&&!s[2]&&!s[3]&&!s[4]||s[4]&&r.match(this.rules.other.unicodeAlphaNumeric))&&(!(s[1]||s[3])||!r||this.rules.inline.punctuation.exec(r))){let n=[...s[0]].length-1,a,i,l=n,o=0,c=s[0][0],d=r===c,p="*"===c?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+n);null!==(s=p.exec(t));){if(!(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6]))continue;if(i=[...a].length,s[3]||s[4]){l+=i;continue}if(s[5]||s[6]){if(n%3&&!((n+i)%3)){o+=i;continue}if(d)break}if((l-=i)>0)continue;i=Math.min(i,i+l+o);let t=[...s[0]][0].length,r=e.slice(0,n+s.index+t+i);if(Math.min(n,i)%2){let e=r.slice(1,-1);return{type:"em",raw:r,text:e,tokens:this.lexer.inlineTokens(e)}}let c=r.slice(2,-2);return{type:"strong",raw:r,text:c,tokens:this.lexer.inlineTokens(c)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),s=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&s&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,r=""){let s=this.rules.inline.delLDelim.exec(e);if(s&&(!s[1]||!r||this.rules.inline.punctuation.exec(r))){let r=[...s[0]].length-1,n,a,i=r,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+r);null!==(s=l.exec(t));){if(!(n=s[1]||s[2]||s[3]||s[4]||s[5]||s[6])||(a=[...n].length)!==r)continue;if(s[3]||s[4]){i+=a;continue}if((i-=a)>0)continue;a=Math.min(a,a+i);let t=[...s[0]][0].length,l=e.slice(0,r+s.index+t+a),o=l.slice(r,-r);return{type:"del",raw:l,text:o,tokens:this.lexer.inlineTokens(o)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,r;return r="@"===t[2]?"mailto:"+(e=t[1]):e=t[1],{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,r;if("@"===t[2])r="mailto:"+(e=t[0]);else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);e=t[0],r="www."===t[1]?"http://"+t[0]:t[0]}return{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},eW=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||C,this.options.tokenizer=this.options.tokenizer||new eM,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:D,block:eP.normal,inline:eD.normal};this.options.pedantic?(t.block=eP.pedantic,t.inline=eD.pedantic):this.options.gfm&&(t.block=eP.gfm,this.options.breaks?t.inline=eD.breaks:t.inline=eD.gfm),this.tokenizer.rules=t}static get rules(){return{block:eP,inline:eD}}static lex(t,r){return new e(r).lex(t)}static lexInline(t,r){return new e(r).inlineTokens(t)}lex(e){e=e.replace(D.carriageReturn,` `),this.blockTokens(e,this.tokens);for(let e=0;e!!(n=r.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))continue;if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length);let r=t.at(-1);1===n.raw.length&&void 0!==r?r.raw+=` `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(` `)?"":` `)+n.raw,r.text+=` `+n.text,this.inlineQueue.at(-1).src=r.text):t.push(n);continue}if((n=this.tokenizer.fences(e))||(n=this.tokenizer.heading(e))||(n=this.tokenizer.hr(e))||(n=this.tokenizer.blockquote(e))||(n=this.tokenizer.list(e))||(n=this.tokenizer.html(e))){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length);let r=t.at(-1);r?.type==="paragraph"||r?.type==="text"?(r.raw+=(r.raw.endsWith(` `)?"":` `)+n.raw,r.text+=` `+n.raw,this.inlineQueue.at(-1).src=r.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title},t.push(n));continue}if((n=this.tokenizer.table(e))||(n=this.tokenizer.lheading(e))){e=e.substring(n.raw.length),t.push(n);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,r=e.slice(1),s;this.options.extensions.startBlock.forEach(e=>{"number"==typeof(s=e.call({lexer:this},r))&&s>=0&&(t=Math.min(t,s))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(a))){let s=t.at(-1);r&&s?.type==="paragraph"?(s.raw+=(s.raw.endsWith(` `)?"":` `)+n.raw,s.text+=` `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=s.text):t.push(n),r=a.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length);let r=t.at(-1);r?.type==="text"?(r.raw+=(r.raw.endsWith(` `)?"":` `)+n.raw,r.text+=` `+n.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(n);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let r=e;if(this.tokens.links){let e=Object.keys(this.tokens.links);e.length>0&&(r=r.replace(this.tokenizer.rules.inline.reflinkSearch,t=>e.includes(t.slice(t.lastIndexOf("[")+1,-1))?"["+"a".repeat(t.length-2)+"]":t))}r=(r=r.replace(this.tokenizer.rules.inline.anyPunctuation,"++")).replace(this.tokenizer.rules.inline.blockSkip,(e,t,r)=>{let s=r?r.length:0;return e.slice(0,s)+"["+"a".repeat(e.length-s-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r;let s=!1,n="",a=1/0;for(;e;){let i;if(e.length!!(i=r.call({lexer:this},e,t))&&(e=e.substring(i.raw.length),t.push(i),!0)))continue;if((i=this.tokenizer.escape(e))||(i=this.tokenizer.tag(e))||(i=this.tokenizer.link(e))){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length);let r=t.at(-1);"text"===i.type&&r?.type==="text"?(r.raw+=i.raw,r.text+=i.text):t.push(i);continue}if((i=this.tokenizer.emStrong(e,r,n))||(i=this.tokenizer.codespan(e))||(i=this.tokenizer.br(e))||(i=this.tokenizer.del(e,r,n))||(i=this.tokenizer.autolink(e))||!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),t.push(i);continue}let l=e;if(this.options.extensions?.startInline){let t=1/0,r=e.slice(1),s;this.options.extensions.startInline.forEach(e=>{"number"==typeof(s=e.call({lexer:this},r))&&s>=0&&(t=Math.min(t,s))}),t<1/0&&t>=0&&(l=e.substring(0,t+1))}if(i=this.tokenizer.inlineText(l)){e=e.substring(i.raw.length),"_"!==i.raw.slice(-1)&&(n=i.raw.slice(-1)),s=!0;let r=t.at(-1);r?.type==="text"?(r.raw+=i.raw,r.text+=i.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t="Infinite loop on byte: "+e;if(this.options.silent)console.error(t);else throw Error(t)}},eU=class{options;parser;constructor(e){this.options=e||C}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(D.notSpaceStart)?.[0],n=e.replace(D.endingNewline,"")+` `;return s?'
'+(r?n:eA(n,!0))+`
`:"
"+(r?n:eA(n,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} `}hr(e){return`
`}list(e){let t=e.ordered,r=e.start,s="";for(let t=0;t `+s+" `}listitem(e){return`
  • ${this.parser.parse(e.tokens)}
  • `}checkbox({checked:e}){return" '}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    `}table(e){let t="",r="";for(let t=0;t${s}`),` `+t+` `+s+`
    `}tablerow({text:e}){return` ${e} `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+` `}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${eA(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=e$(e);if(null===n)return s;let a='
    "}image({href:e,title:t,text:r,tokens:s}){s&&(r=this.parser.parseInline(s,this.parser.textRenderer));let n=e$(e);if(null===n)return eA(r);e=n;let a=`${eA(r)}{let n=e[s].flat(1/0);r=r.concat(this.walkTokens(n,t))}):e.tokens&&(r=r.concat(this.walkTokens(e.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error("extension name required");if("renderer"in e){let r=t.renderers[e.name];r?t.renderers[e.name]=function(...t){let s=e.renderer.apply(this,t);return!1===s&&(s=r.apply(this,t)),s}:t.renderers[e.name]=e.renderer}if("tokenizer"in e){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw Error("extension level must be 'block' or 'inline'");let r=t[e.level];r?r.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&("block"===e.level?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:"inline"===e.level&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}"childTokens"in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),r.extensions=t),e.renderer){let t=this.defaults.renderer||new eU(this.defaults);for(let r in e.renderer){if(!(r in t))throw Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let s=e.renderer[r],n=t[r];t[r]=(...e)=>{let r=s.apply(t,e);return!1===r&&(r=n.apply(t,e)),r||""}}r.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new eM(this.defaults);for(let r in e.tokenizer){if(!(r in t))throw Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let s=e.tokenizer[r],n=t[r];t[r]=(...e)=>{let r=s.apply(t,e);return!1===r&&(r=n.apply(t,e)),r}}r.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new eq;for(let r in e.hooks){if(!(r in t))throw Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let s=e.hooks[r],n=t[r];eq.passThroughHooks.has(r)?t[r]=e=>{if(this.defaults.async&&eq.passThroughHooksRespectAsync.has(r))return(async()=>{let r=await s.call(t,e);return n.call(t,r)})();let a=s.call(t,e);return n.call(t,a)}:t[r]=(...e)=>{if(this.defaults.async)return(async()=>{let r=await s.apply(t,e);return!1===r&&(r=await n.apply(t,e)),r})();let r=s.apply(t,e);return!1===r&&(r=n.apply(t,e)),r}}r.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,s=e.walkTokens;r.walkTokens=function(e){let r=[];return r.push(s.call(this,e)),t&&(r=r.concat(t.call(this,e))),r}}this.defaults={...this.defaults,...r}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return eW.lex(e,t??this.defaults)}parser(e,t){return eF.parse(e,t??this.defaults)}parseMarkdown(e){return(t,r)=>{let s={...r},n={...this.defaults,...s},a=this.onError(!!n.silent,!!n.async);if(!0===this.defaults.async&&!1===s.async)return a(Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||null===t)return a(Error("marked(): input parameter is undefined or null"));if("string"!=typeof t)return a(Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(n.hooks&&(n.hooks.options=n,n.hooks.block=e),n.async)return(async()=>{let r=n.hooks?await n.hooks.preprocess(t):t,s=await (n.hooks?await n.hooks.provideLexer(e):e?eW.lex:eW.lexInline)(r,n),a=n.hooks?await n.hooks.processAllTokens(s):s;n.walkTokens&&await Promise.all(this.walkTokens(a,n.walkTokens));let i=await (n.hooks?await n.hooks.provideParser(e):e?eF.parse:eF.parseInline)(a,n);return n.hooks?await n.hooks.postprocess(i):i})().catch(a);try{n.hooks&&(t=n.hooks.preprocess(t));let r=(n.hooks?n.hooks.provideLexer(e):e?eW.lex:eW.lexInline)(t,n);n.hooks&&(r=n.hooks.processAllTokens(r)),n.walkTokens&&this.walkTokens(r,n.walkTokens);let s=(n.hooks?n.hooks.provideParser(e):e?eF.parse:eF.parseInline)(r,n);return n.hooks&&(s=n.hooks.postprocess(s)),s}catch(e){return a(e)}}}onError(e,t){return r=>{if(r.message+=` Please report this to https://github.com/markedjs/marked.`,e){let e="

    An error occurred:

    "+eA(r.message+"",!0)+"
    ";return t?Promise.resolve(e):e}if(t)return Promise.reject(r);throw r}}};function eZ(e,t){return eH.parse(e,t)}function eJ(e){if(!e)return"";try{return eZ.parse(e)}catch{return e.replace(/\n/g,"
    ")}}function eQ({onOpenModal:e,onReport:t}){let{currentUser:r,sort:a,setSort:i,openPost:l,openUser:c,navigate:d,refreshKey:p}=h(),[u,x]=(0,n.useState)(null),[m,f]=(0,n.useState)(null),[y,b]=(0,n.useState)(!0),[k,v]=(0,n.useState)(1),[j,w]=(0,n.useState)(1),[C,z]=(0,n.useState)(null),R=(0,n.useRef)(null),N=(0,n.useCallback)(async e=>{x(null),f(null);try{let t=await o.getPosts(a,null,e,20);x(t.data||[]),w(t.pagination?.totalPages||1),v(t.pagination?.page||1)}catch(e){f(e.message),x([])}},[a,p]),P=async e=>{if(confirm("确定要删除这条帖子吗?"))try{await o.deletePost(e),N(k)}catch(e){alert("删除失败:"+e.message)}};return(0,s.jsxs)("main",{id:"feed",children:[(0,s.jsxs)("div",{className:"feed-header",children:[(0,s.jsxs)("div",{className:"feed-header-left",children:[s.jsx("button",{className:"tab"+("latest"===a?" active":""),onClick:()=>i("latest"),children:"最新发布"}),s.jsx("button",{className:"tab"+("hot"===a?" active":""),onClick:()=>i("hot"),children:"最新回复"})]}),(0,s.jsxs)("button",{className:"btn-primary fab-btn",onClick:()=>{if(!r){alert("请先登录");return}d("new")},children:[s.jsx(g,{name:"plus"})," 发布新帖"]})]}),s.jsx("div",{id:"postList",ref:R,children:null===u?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"加载中..."}):m?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#ef4444",padding:"40px 0"},children:["加载失败:",m]}):0===u.length?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"60px 0"},children:"✨ 还没有帖子,快来发布第一条吧!"}):u.map(e=>{let n=e.created_at?new Date(e.created_at).toLocaleString("zh-CN"):"";return(0,s.jsxs)("div",{className:"post-card",style:{cursor:"pointer"},onClick:()=>l(e.id),children:[e.is_pinned&&s.jsx("div",{style:{fontSize:12,color:"var(--primary)",fontWeight:600,marginBottom:4},children:"\uD83D\uDCCC 置顶"}),(0,s.jsxs)("div",{className:"post-header",children:[s.jsx("img",{src:e.avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(e.username||"匿名用户")+"&background=6366f1&color=fff&size=64",className:"post-avatar",alt:""}),s.jsx("span",{className:"post-username",style:{cursor:"pointer",color:"var(--primary)"},onClick:t=>{t.stopPropagation(),c(e.username)},children:e.username||"匿名用户"}),s.jsx("span",{className:"post-time",children:n}),e.edited_at&&s.jsx("span",{style:{fontSize:11,color:"var(--text-light)",marginLeft:6},children:"(已编辑)"})]}),s.jsx("div",{className:"post-title",children:e.title||"无标题"}),s.jsx("div",{className:"post-content",dangerouslySetInnerHTML:{__html:eJ(e.content)}}),e.images&&e.images.length>0&&s.jsx("div",{className:"post-images",children:e.images.map((e,t)=>s.jsx("img",{src:e,className:"post-image",alt:"",style:{cursor:"pointer"},onClick:t=>{t.stopPropagation(),z(e)}},t))}),(0,s.jsxs)("div",{className:"post-actions",children:[(0,s.jsxs)("span",{children:[s.jsx(g,{name:"message",size:14})," ",e.reply_count||0]}),(0,s.jsxs)("button",{className:"action-report",onClick:s=>{if(s.stopPropagation(),!r){alert("请先登录");return}t(e.id)},children:[s.jsx(g,{name:"flag",size:14})," 举报"]}),r&&(r.id===e.user_id||"admin"===r.role)&&(0,s.jsxs)("button",{className:"action-delete",onClick:t=>{t.stopPropagation(),P(e.id)},children:[s.jsx(g,{name:"trash",size:14})," 删除"]})]})]},e.id)})}),j>1&&u&&u.length>0&&(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",gap:6,padding:"16px 0",marginTop:8,borderTop:"1px solid var(--border)",flexWrap:"wrap"},children:[s.jsx("button",{className:"page-btn",disabled:k<=1,onClick:()=>N(k-1),style:{padding:"6px 12px",border:"1px solid var(--border)",borderRadius:4,background:"var(--surface)",color:"var(--text)",cursor:k<=1?"not-allowed":"pointer",fontSize:13,opacity:k<=1?.4:1},children:"\xab"}),Array.from({length:j},(e,t)=>t+1).map(e=>s.jsx("button",{className:"page-btn",disabled:e===k,onClick:()=>N(e),style:{padding:"6px 10px",border:"1px solid var(--border)",borderRadius:4,fontSize:13,minWidth:32,textAlign:"center",background:e===k?"var(--primary)":"var(--surface)",color:e===k?"#fff":"var(--text)",cursor:e===k?"default":"pointer",borderColor:e===k?"var(--primary)":"var(--border)"},children:e},e)),s.jsx("button",{className:"page-btn",disabled:k>=j,onClick:()=>N(k+1),style:{padding:"6px 12px",border:"1px solid var(--border)",borderRadius:4,background:"var(--surface)",color:"var(--text)",cursor:k>=j?"not-allowed":"pointer",fontSize:13,opacity:k>=j?.4:1},children:"\xbb"})]}),C&&s.jsx(S,{src:C,onClose:()=>z(null)})]})}function eG({captcha:e,onRefresh:t}){let r=(0,n.useRef)(null);return s.jsx("canvas",{ref:r,width:120,height:40,onClick:t,title:"看不清?点击刷新",style:{cursor:"pointer",borderRadius:6,border:"1px solid var(--glass-border)",verticalAlign:"middle"}})}function eV({postId:e,onRefresh:t}){let{currentUser:r,openUser:a}=h(),[i,l]=(0,n.useState)([]),[c,p]=(0,n.useState)(""),[u,x]=(0,n.useState)(null),[m,f]=(0,n.useState)(""),y=(0,n.useCallback)(async()=>{try{let t=await o.getReplies(e);l(t||[])}catch{l([])}},[e]),b=async()=>{if(!r){alert("请先登录");return}if(!c.trim()){alert("请填写回复内容");return}if(!u||parseInt(m)!==u.answer){alert("验证码错误,请重新计算"),x(d()),f("");return}try{await o.createReply(e,c.trim()),o.logEvent("create_reply").catch(()=>{}),p(""),f(""),x(d()),y(),t()}catch(e){alert("回复失败:"+e.message)}},k=async e=>{if(confirm("确定要删除这条回复吗?"))try{await o.deleteReply(e),y()}catch(e){alert("删除失败:"+e.message)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:{marginTop:20,fontSize:14,color:"#64748b"},children:[s.jsx(g,{name:"message",size:14})," ",i.length," 条回复"]}),s.jsx("div",{style:{marginTop:12},children:0===i.length?s.jsx("div",{style:{color:"#94a3b8",padding:"20px 0",textAlign:"center"},children:"还没有回复,快来抢沙发吧 \uD83D\uDECB️"}):i.map(e=>{let t=e.created_at?new Date(e.created_at).toLocaleString("zh-CN"):"";return(0,s.jsxs)("div",{className:"reply-item",children:[(0,s.jsxs)("div",{className:"reply-header",children:[s.jsx("img",{src:e.avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(e.username||"匿名用户")+"&background=6366f1&color=fff&size=64",className:"reply-avatar",alt:""}),s.jsx("span",{className:"reply-username",style:{cursor:"pointer",color:"var(--primary)"},onClick:()=>a(e.username),children:e.username||"匿名用户"}),s.jsx("span",{className:"reply-time",children:t}),r&&(r.id===e.user_id||"admin"===r.role)&&(0,s.jsxs)("button",{className:"btn-sm btn-danger reply-delete-btn",onClick:()=>k(e.id),children:[s.jsx(g,{name:"trash",size:12})," 删除"]})]}),s.jsx("div",{className:"reply-content",dangerouslySetInnerHTML:{__html:eJ(e.content)}})]},e.id)})}),(0,s.jsxs)("div",{id:"replyArea",style:{marginTop:24,borderTop:"1px solid var(--border)",paddingTop:20},children:[(0,s.jsxs)("h3",{style:{fontSize:16,marginBottom:12},children:[s.jsx(g,{name:"message",size:16})," 发表回复"]}),s.jsx("textarea",{rows:3,placeholder:"写下你的回复...",style:{width:"100%",padding:"10px 12px",border:"1px solid var(--border)",borderRadius:4,fontSize:14,fontFamily:"inherit",resize:"vertical",background:"var(--bg)",color:"var(--text)"},value:c,onChange:e=>p(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.ctrlKey||e.metaKey)&&b()}}),(0,s.jsxs)("div",{className:"captcha-row",style:{margin:"10px 0",display:"flex",alignItems:"center",gap:10},children:[u?s.jsx(eG,{captcha:u,onRefresh:()=>{x(d()),f("")}}):s.jsx("span",{style:{color:"var(--text-light)"},children:"验证码加载中..."}),s.jsx("input",{type:"text",placeholder:"答案",style:{width:80,padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,background:"var(--bg)",color:"var(--text)",outline:"none"},value:m,onChange:e=>f(e.target.value)})]}),s.jsx("button",{className:"btn-primary",style:{padding:"8px 24px"},onClick:b,children:"提交回复"})]})]})}function eX({postId:e}){let{currentUser:t,navigate:r,openUser:a,refreshKey:i}=h(),[l,d]=(0,n.useState)(null),[p,u]=(0,n.useState)(null),[x,m]=(0,n.useState)(null),[f,y]=(0,n.useState)(!1),[b,k]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[w,C]=(0,n.useState)([]),[z,R]=(0,n.useState)(!1),N=(0,n.useRef)(null),P=(0,n.useCallback)(async()=>{u(null);try{let t=await o.getPost(e);d(t)}catch(e){u(e.message)}},[e,i]);if(p)return(0,s.jsxs)("div",{id:"pagePost",className:"page-slide active",style:{padding:"40px 0",textAlign:"center",color:"#ef4444"},children:["加载失败:",p]});if(!l)return s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"加载中..."});let D=l.created_at?new Date(l.created_at).toLocaleString("zh-CN"):"",T=t&&(t.id===l.user_id||"admin"===t.role);t&&(t.id,l.user_id);let _=async()=>{if(confirm("确定要删除这条帖子吗?"))try{await o.deletePost(e),alert("删除成功"),r("feed")}catch(e){alert("删除失败:"+e.message)}},A=async()=>{if(confirm("确定要"+(l.is_pinned?"取消":"")+"置顶吗?"))try{await o.togglePinPost(e),P()}catch(e){alert("操作失败:"+e.message)}},$=async()=>{if(!v.trim()){alert("请填写内容");return}try{await o.updatePost(e,b.trim()||"无标题",v.trim(),w),y(!1),P()}catch(e){alert("编辑失败:"+e.message)}},B=async e=>{if(e){if(!e.type.startsWith("image/")){alert("请选择图片文件");return}if(e.size>5242880){alert("图片不能超过 5MB");return}R(!0);try{let t=await c(e);C(e=>[...e,t])}catch(e){alert("上传失败:"+e.message)}finally{R(!1)}}},L=e=>{C(t=>t.filter(t=>t!==e))};return(0,s.jsxs)("div",{id:"pagePost",className:"page-slide active",children:[s.jsx("div",{className:"page-header",style:{maxWidth:700,margin:"0 auto",width:"100%"},children:s.jsx("h2",{children:l.title||"帖子详情"})}),(0,s.jsxs)("div",{id:"postDetailContent",style:{maxWidth:700,margin:"0 auto",width:"100%"},children:[(0,s.jsxs)("div",{className:"post-detail-card",children:[(0,s.jsxs)("div",{className:"post-header",children:[s.jsx("img",{src:l.avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(l.username||"匿名用户")+"&background=6366f1&color=fff&size=64",className:"post-avatar",alt:""}),s.jsx("span",{className:"post-username",style:{cursor:"pointer",color:"var(--primary)"},onClick:()=>a(l.username),children:l.username||"匿名用户"}),s.jsx("span",{className:"post-time",children:D}),l.edited_at&&(0,s.jsxs)("span",{style:{fontSize:12,color:"var(--text-light)",marginLeft:8},children:["(已编辑 ",new Date(l.edited_at).toLocaleString("zh-CN"),")"]}),l.is_pinned&&s.jsx("span",{style:{fontSize:12,color:"var(--primary)",marginLeft:8},children:"\uD83D\uDCCC 置顶"}),(0,s.jsxs)("div",{style:{display:"flex",gap:4,marginLeft:"auto"},children:[t&&"admin"===t.role&&s.jsx("button",{className:"btn-sm btn-secondary",style:{padding:"4px 10px"},onClick:A,children:l.is_pinned?"\uD83D\uDCCC 取消置顶":"\uD83D\uDCCC 置顶"}),T&&s.jsx("button",{className:"btn-sm btn-secondary",style:{padding:"4px 10px"},onClick:()=>{k(l.title||""),j(l.content||""),C(l.images||[]),y(!0)},children:"✏️ 编辑"}),T&&(0,s.jsxs)("button",{className:"btn-sm btn-danger",style:{padding:"4px 10px"},onClick:_,children:[s.jsx(g,{name:"trash",size:14})," 删除"]})]})]}),s.jsx("div",{className:"post-content",style:{fontSize:16,lineHeight:1.8},dangerouslySetInnerHTML:{__html:eJ(l.content)}}),l.images&&l.images.length>0&&s.jsx("div",{className:"post-images",children:l.images.map((e,t)=>s.jsx("img",{src:e,className:"post-image",alt:"",style:{cursor:"pointer"},onClick:()=>m(e)},t))}),l.signature&&s.jsx("div",{style:{marginTop:16,paddingTop:12,borderTop:"1px solid var(--border-light)",fontSize:12,color:"var(--text-secondary)"},dangerouslySetInnerHTML:{__html:eJ(l.signature)}})]}),s.jsx(eV,{postId:e,onRefresh:P})]}),f&&s.jsx("div",{className:"modal active",style:{display:"flex"},onClick:e=>{e.target===e.currentTarget&&y(!1)},children:(0,s.jsxs)("div",{className:"modal-content",style:{maxWidth:600,position:"relative"},children:[s.jsx("span",{className:"close",style:{position:"absolute",top:12,right:16,fontSize:24,cursor:"pointer",color:"var(--text-light)"},onClick:()=>y(!1),children:"\xd7"}),s.jsx("h2",{style:{marginBottom:16},children:"✏️ 编辑帖子"}),s.jsx("input",{type:"text",placeholder:"标题",value:b,onChange:e=>k(e.target.value),style:{width:"100%",padding:"10px 14px",border:"1px solid var(--border)",borderRadius:6,fontSize:15,fontWeight:600,marginBottom:12,background:"var(--bg)",color:"var(--text)"}}),s.jsx("textarea",{rows:6,placeholder:"说点什么...",value:v,onChange:e=>j(e.target.value),style:{width:"100%",padding:12,border:"1px solid var(--border)",borderRadius:6,fontSize:15,fontFamily:"inherit",resize:"vertical",background:"var(--bg)",color:"var(--text)"}}),w.length>0&&s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:8,marginTop:10},children:w.map((e,t)=>(0,s.jsxs)("div",{style:{position:"relative"},children:[s.jsx("img",{src:e,alt:"",style:{width:72,height:72,objectFit:"cover",borderRadius:6,border:"1px solid var(--border)"}}),s.jsx("button",{type:"button",title:"删除图片",onClick:()=>L(e),style:{position:"absolute",top:-6,right:-6,width:20,height:20,borderRadius:"50%",background:"#ef4444",color:"#fff",border:"none",cursor:"pointer",fontSize:12,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center"},children:"\xd7"})]},e+t))}),(0,s.jsxs)("div",{style:{display:"flex",gap:8,marginTop:12},children:[s.jsx("button",{type:"button",className:"btn-secondary",style:{padding:"8px 16px",border:"1px solid var(--border)",borderRadius:4,background:"var(--surface)",cursor:"pointer",color:"var(--text)"},onClick:()=>N.current?.click(),children:z?"上传中...":"\uD83D\uDCF7 上传图片"}),s.jsx("input",{type:"file",ref:N,accept:"image/*",multiple:!0,style:{display:"none"},onChange:e=>{let t=e.target.files;t&&t.length>0&&([...t].forEach(e=>B(e)),e.target.value="")}})]}),s.jsx("button",{className:"btn-primary",style:{padding:"10px 32px",fontSize:15,marginTop:12,width:"100%"},onClick:$,children:"保存"})]})}),x&&s.jsx(S,{src:x,onClose:()=>m(null)})]})}eZ.options=eZ.setOptions=function(e){return eH.setOptions(e),eZ.defaults=eH.defaults,C=eZ.defaults,eZ},eZ.getDefaults=w,eZ.defaults=C,eZ.use=function(...e){return eH.use(...e),eZ.defaults=eH.defaults,C=eZ.defaults,eZ},eZ.walkTokens=function(e,t){return eH.walkTokens(e,t)},eZ.parseInline=eH.parseInline,eZ.Parser=eF,eZ.parser=eF.parse,eZ.Renderer=eU,eZ.TextRenderer=eO,eZ.Lexer=eW,eZ.lexer=eW.lex,eZ.Tokenizer=eM,eZ.Hooks=eq,eZ.parse=eZ,eZ.options,eZ.setOptions,eZ.walkTokens,eZ.parseInline,eF.parse,eW.lex;var eK=r(7494);function eY(){let{currentUser:e,navigate:t,refresh:r}=h(),{toast:a}=(0,eK.p)(),[i,l]=(0,n.useState)(""),[p,u]=(0,n.useState)(""),[x,m]=(0,n.useState)([]),[f,y]=(0,n.useState)([]),[b,k]=(0,n.useState)(null),[v,j]=(0,n.useState)(""),[S,w]=(0,n.useState)(!1),C=async e=>{w(!0);try{let t=[];for(let r of e){if(!r.type.startsWith("image/"))continue;if(r.size>5242880){alert("图片 "+r.name+" 超过 5MB,请压缩后上传");continue}let e=await new Promise(e=>{let t=new FileReader;t.onload=t=>e(t.target.result),t.readAsDataURL(r)});t.push(e);let s=await c(r);m(e=>[...e,s])}y(e=>[...e,...t])}catch(e){alert("上传失败:"+e.message)}finally{w(!1)}},[z,R]=(0,n.useState)(!1),N=(0,n.useRef)(null),P=async()=>{if(!e||!e.id){a("请先登录","error"),t("feed");return}if(!p.trim()){a("请填写内容","error");return}if(!b||parseInt(v)!==b.answer){a("验证码错误,请重新计算","error"),k(d()),j("");return}try{await o.createPost(i.trim()||"无标题",p.trim(),x),o.logEvent("create_post").catch(()=>{}),a("发布成功","success"),t("feed"),r()}catch(e){a("发布失败:"+e.message,"error")}};return(0,s.jsxs)("div",{className:"page-slide active",children:[s.jsx("div",{className:"page-header",style:{maxWidth:600,margin:"0 auto",width:"100%"},children:(0,s.jsxs)("h2",{children:[s.jsx(g,{name:"plus",size:20})," 发布新帖"]})}),(0,s.jsxs)("div",{style:{maxWidth:600,margin:"0 auto",width:"100%"},children:[s.jsx("input",{type:"text",placeholder:"标题",style:{width:"100%",padding:"10px 14px",border:"1.5px solid var(--border)",borderRadius:6,fontSize:15,fontWeight:600,marginBottom:12,fontFamily:"inherit",background:"var(--bg)",color:"var(--text)"},value:i,onChange:e=>l(e.target.value)}),s.jsx("textarea",{rows:6,placeholder:"说点什么...",style:{width:"100%",padding:12,border:"1.5px solid var(--border)",borderRadius:6,fontSize:15,fontFamily:"inherit",resize:"vertical",background:"var(--bg)",color:"var(--text)"},value:p,onChange:e=>u(e.target.value)}),s.jsx("div",{id:"imagePreview",style:{display:"flex",flexWrap:"wrap",gap:8,margin:"8px 0"},children:f.map((e,t)=>s.jsx("img",{src:e,alt:"",style:{width:80,height:80,objectFit:"cover",borderRadius:4,border:"1px solid var(--border)"}},t))}),s.jsx("div",{id:"dropZone",style:{border:"2px dashed "+(z?"var(--primary)":"var(--border)"),borderRadius:8,padding:24,textAlign:"center",cursor:"pointer",transition:"all 0.3s",margin:"8px 0 12px",background:z?"var(--primary-bg)":"var(--bg)"},onClick:()=>N.current?.click(),onDragOver:e=>{e.preventDefault(),R(!0)},onDragLeave:e=>{e.preventDefault(),R(!1)},onDrop:e=>{e.preventDefault(),R(!1),e.dataTransfer.files&&C(Array.from(e.dataTransfer.files))},children:s.jsx("div",{style:{fontSize:13,color:"var(--text-secondary)"},children:S?"上传中...":z?"松开上传":"\uD83D\uDCF7 点击或拖拽上传图片"})}),s.jsx("input",{type:"file",id:"fileInput",accept:"image/*",multiple:!0,ref:N,style:{display:"none"},onChange:e=>{e.target.files&&C(Array.from(e.target.files))}}),(0,s.jsxs)("div",{className:"captcha-row",style:{margin:"12px 0",display:"flex",alignItems:"center",gap:10},children:[b?s.jsx(eG,{captcha:b,onRefresh:()=>{k(d()),j("")}}):s.jsx("span",{style:{color:"var(--text-light)"},children:"验证码加载中..."}),s.jsx("input",{type:"text",placeholder:"答案",style:{width:80,padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,background:"var(--bg)",color:"var(--text)",outline:"none"},value:v,onChange:e=>j(e.target.value)})]}),s.jsx("button",{className:"btn-primary",style:{padding:"10px 32px",fontSize:15},onClick:P,children:S?"上传中...":"发布帖子"})]})]})}let e0={pending:"⏳ 待处理",approved:"✅ 已删除",rejected:"❌ 已驳回"};function e1(){let[e,t]=(0,n.useState)(null),[r,a]=(0,n.useState)(null),i=()=>{o.getReports().then(e=>{t(e||[]),a(null)}).catch(e=>{a(e.message),t([])})},l=async(e,t)=>{if("approve"!==t||confirm("确定要删除该帖子并标记举报为已处理吗?"))try{await o.updateReport(e.id,"approve"===t?"approved":"rejected","approve"===t?"已删除违规帖子":"举报不成立"),"approve"===t&&e.post_id&&o.deletePost(e.post_id).catch(()=>{}),i()}catch(e){alert("操作失败:"+e.message)}};return r?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#ef4444",padding:20},children:["加载失败:",r]}):e?0===e.length?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:40},children:"✅ 暂无举报"}):e.map(e=>(0,s.jsxs)("div",{className:"report-item",children:[(0,s.jsxs)("div",{children:[s.jsx("strong",{children:e.reporter_name||"匿名"})," 举报了帖子"]}),(0,s.jsxs)("div",{style:{fontSize:13,color:"#64748b",margin:"4px 0"},children:["原因:",e.reason]}),(0,s.jsxs)("div",{style:{fontSize:13,color:"#64748b",margin:"4px 0"},children:["帖子:",e.post_title||"无标题"," — ",(e.post_content||"").substring(0,30),(e.post_content||"").length>30?"...":""]}),(0,s.jsxs)("div",{style:{fontSize:13,fontWeight:600},children:["状态:",e0[e.status]||e.status]}),e.handler_name&&(0,s.jsxs)("div",{style:{fontSize:12,color:"#94a3b8"},children:["处理人:",e.handler_name,e.handler_note?" ("+e.handler_note+")":""]}),"pending"===e.status&&(0,s.jsxs)("div",{className:"report-actions",children:[(0,s.jsxs)("button",{className:"btn-sm btn-danger",onClick:()=>l(e,"approve"),children:[s.jsx(g,{name:"trash",size:12})," 删除帖子"]}),(0,s.jsxs)("button",{className:"btn-sm btn-secondary",onClick:()=>l(e,"reject"),children:[s.jsx(g,{name:"close",size:12})," 驳回举报"]})]})]},e.id)):s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:20},children:"加载中..."})}function e2(){let{currentUser:e}=h(),[t,r]=(0,n.useState)(null),[a,i]=(0,n.useState)(null),l=()=>{o.getUsers().then(e=>{r(e||[]),i(null)}).catch(e=>{i(e.message),r([])})},c=async(e,t)=>{let r="admin"===t?"管理员":"普通用户";if(confirm(`确定要将该用户设为「${r}」吗?`))try{await o.updateUserRole(e.id,t),l()}catch(e){alert("操作失败:"+e.message)}};return a?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#ef4444",padding:20},children:["加载失败:",a]}):t?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:{marginBottom:12,fontSize:13,color:"#94a3b8"},children:["共 ",s.jsx("strong",{children:t.length})," 位用户"]}),s.jsx("div",{style:{overflowX:"auto"},children:(0,s.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:14},children:[s.jsx("thead",{children:(0,s.jsxs)("tr",{style:{textAlign:"left",borderBottom:"2px solid var(--border)"},children:[s.jsx("th",{style:{padding:"10px 12px"},children:"用户"}),s.jsx("th",{style:{padding:"10px 12px"},children:"角色"}),s.jsx("th",{style:{padding:"10px 12px"},children:"注册时间"}),s.jsx("th",{style:{padding:"10px 12px",textAlign:"center"},children:"操作"})]})}),s.jsx("tbody",{children:t.map(t=>{let r="admin"===t.role,n=e&&e.id===t.id;return(0,s.jsxs)("tr",{style:{borderBottom:"1px solid #f1f5f9"},children:[s.jsx("td",{style:{padding:"10px 12px"},children:(0,s.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("img",{src:t.avatar_url||"https://ui-avatars.com/api/?name="+encodeURIComponent(t.username)+"&background=6366f1&color=fff&size=64",style:{width:28,height:28,borderRadius:"50%",objectFit:"cover"},alt:""}),s.jsx("span",{style:{fontWeight:500},children:t.username}),n&&s.jsx("span",{style:{fontSize:11,color:"#94a3b8",background:"#eef2ff",padding:"1px 8px",borderRadius:4},children:"你"})]})}),s.jsx("td",{style:{padding:"10px 12px"},children:s.jsx("span",{style:{display:"inline-block",padding:"2px 10px",borderRadius:4,fontSize:12,fontWeight:500,...r?{background:"#6366f1",color:"#fff"}:{background:"var(--border)",color:"var(--text-secondary)"}},children:r?"管理员":"普通用户"})}),s.jsx("td",{style:{padding:"10px 12px",color:"#94a3b8",fontSize:13},children:t.created_at?new Date(t.created_at).toLocaleDateString("zh-CN"):"—"}),s.jsx("td",{style:{padding:"10px 12px",textAlign:"center"},children:n?s.jsx("span",{style:{fontSize:12,color:"#94a3b8"},children:"不可操作自己"}):r?s.jsx("button",{className:"btn-sm btn-secondary",style:{padding:"4px 12px"},onClick:()=>c(t,"user"),children:"设为普通用户"}):s.jsx("button",{className:"btn-sm btn-primary",style:{padding:"4px 12px",background:"#6366f1",color:"#fff",border:"none",borderRadius:4,cursor:"pointer"},onClick:()=>c(t,"admin"),children:"设为管理员"})})]},t.id)})})]})})]}):s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:20},children:"加载中..."})}function e4(){let[e,t]=(0,n.useState)(null),[r,a]=(0,n.useState)(null);return r?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#ef4444",padding:20},children:["加载失败:",r]}):e?0===e.length?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:40},children:"暂无日志"}):(0,s.jsxs)("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13},children:[s.jsx("thead",{children:(0,s.jsxs)("tr",{style:{textAlign:"left",borderBottom:"1px solid var(--border)"},children:[s.jsx("th",{children:"时间"}),s.jsx("th",{children:"用户"}),s.jsx("th",{children:"操作"})]})}),s.jsx("tbody",{children:e.map(e=>(0,s.jsxs)("tr",{style:{borderBottom:"1px solid #f1f5f9"},children:[s.jsx("td",{style:{padding:"6px 0"},children:new Date(e.created_at).toLocaleString("zh-CN")}),s.jsx("td",{style:{padding:"6px 0"},children:e.username||"系统"}),s.jsx("td",{style:{padding:"6px 0"},children:e.action})]},e.id))})]}):s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:20},children:"加载中..."})}function e3(){let[e,t]=(0,n.useState)([]),[r,a]=(0,n.useState)(""),[i,l]=(0,n.useState)(""),c=()=>{o.getLinks().then(t).catch(()=>{})},d=async()=>{if(!r.trim()||!i.trim()){alert("请填写完整信息");return}try{await o.addLink(r.trim(),i.trim()),a(""),l(""),c()}catch(e){alert("添加失败:"+e.message)}},p=async e=>{if(confirm("确定删除该链接吗?"))try{await o.deleteLink(e),c()}catch(e){alert("删除失败:"+e.message)}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{style:{marginBottom:16,display:"flex",gap:8,flexWrap:"wrap"},children:[s.jsx("input",{type:"text",placeholder:"链接名称",style:{flex:1,minWidth:120,padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,background:"var(--bg)",color:"var(--text)"},value:r,onChange:e=>a(e.target.value)}),s.jsx("input",{type:"url",placeholder:"链接地址",style:{flex:2,minWidth:160,padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,background:"var(--bg)",color:"var(--text)"},value:i,onChange:e=>l(e.target.value)}),s.jsx("button",{className:"btn-primary",style:{padding:"8px 16px"},onClick:d,children:"添加"})]}),s.jsx("div",{id:"linkList",children:0===e.length?s.jsx("div",{style:{color:"#94a3b8",fontSize:13},children:"暂无友情链接"}):e.map(e=>(0,s.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 0",borderBottom:"1px solid #f1f5f9"},children:[s.jsx("span",{children:s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",style:{color:"#6366f1",textDecoration:"none"},children:e.title})}),(0,s.jsxs)("button",{className:"btn-sm btn-danger",onClick:()=>p(e.id),children:[s.jsx(g,{name:"trash",size:12})," 删除"]})]},e.id))})]})}function e8(){let{updateForumName:e}=h(),[t,r]=(0,n.useState)(""),[a,i]=(0,n.useState)(null),l=async()=>{if(!t.trim()){alert("请输入论坛名称");return}try{await o.updateSettings(t.trim()),e(t.trim()),i({ok:!0,msg:"✅ 保存成功!"})}catch{i({ok:!1,msg:"❌ 保存失败"})}};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("h3",{style:{marginBottom:16},children:[s.jsx(g,{name:"settings",size:16})," 论坛设置"]}),(0,s.jsxs)("div",{style:{maxWidth:400},children:[s.jsx("label",{style:{fontWeight:600,fontSize:14,display:"block",marginBottom:6},children:"论坛名称"}),s.jsx("input",{type:"text",style:{width:"100%",padding:"10px 14px",border:"1.5px solid var(--border)",borderRadius:6,fontSize:15,marginBottom:12,fontFamily:"inherit",background:"var(--bg)",color:"var(--text)"},value:t,onChange:e=>r(e.target.value)}),s.jsx("button",{className:"btn-primary",style:{padding:"10px 24px"},onClick:l,children:"保存"}),a&&s.jsx("span",{style:{marginLeft:12,fontSize:14,color:a.ok?"#22c55e":"#ef4444"},children:a.msg})]})]})}function e6({page:e,onClose:t,onSaved:r}){let a=!!e,[i,l]=(0,n.useState)(e?.name||""),[c,d]=(0,n.useState)(e?.title||""),[p,h]=(0,n.useState)(e?.content||""),[u,x]=(0,n.useState)(e?.enabled!==!1),g=async()=>{if(!i.trim()){alert("请输入页面名称");return}if(!c.trim()){alert("请输入导航栏显示名称");return}if(!p.trim()){alert("请输入页面内容");return}if(!/^[a-zA-Z0-9\-_]+$/.test(i.trim())){alert("页面名称只允许字母、数字、短横线和下划线");return}try{a?await o.adminUpdateCustomPage(e.id,c.trim(),p.trim(),u):await o.adminCreateCustomPage(i.trim(),c.trim(),p.trim()),r()}catch(e){alert("保存失败:"+e.message)}};return s.jsx("div",{className:"modal active",style:{display:"flex"},onClick:e=>{e.target===e.currentTarget&&t()},children:(0,s.jsxs)("div",{className:"modal-content",style:{maxWidth:600,maxHeight:"90vh",overflowY:"auto",position:"relative"},children:[s.jsx("span",{className:"close",style:{position:"absolute",top:12,right:16,fontSize:24,cursor:"pointer",color:"var(--text-light)"},onClick:t,children:"\xd7"}),s.jsx("h2",{style:{marginBottom:16},children:a?"✏️ 编辑页面":"\uD83D\uDCC4 添加页面"}),(0,s.jsxs)("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{fontWeight:600,fontSize:14,display:"block",marginBottom:4},children:"页面名称"}),s.jsx("input",{type:"text",value:i,readOnly:a,placeholder:"about (用于 URL: ?custom=about)",style:{width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,fontSize:14,background:a?"var(--border-light)":"var(--bg)",color:"var(--text)"},onChange:e=>l(e.target.value)}),a?s.jsx("div",{style:{fontSize:12,color:"var(--text-light)",marginTop:2},children:"⚠️ 名称不可修改"}):s.jsx("div",{style:{fontSize:12,color:"var(--text-light)",marginTop:2},children:"只允许字母、数字、短横线和下划线"})]}),(0,s.jsxs)("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{fontWeight:600,fontSize:14,display:"block",marginBottom:4},children:"导航栏显示名称"}),s.jsx("input",{type:"text",value:c,placeholder:"关于我们",style:{width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,fontSize:14,background:"var(--bg)",color:"var(--text)"},onChange:e=>d(e.target.value)})]}),(0,s.jsxs)("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{fontWeight:600,fontSize:14,display:"block",marginBottom:4},children:"状态"}),(0,s.jsxs)("select",{value:String(u),style:{width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,fontSize:14,background:"var(--bg)",color:"var(--text)"},onChange:e=>x("true"===e.target.value),children:[s.jsx("option",{value:"true",children:"启用"}),s.jsx("option",{value:"false",children:"禁用"})]})]}),(0,s.jsxs)("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{fontWeight:600,fontSize:14,display:"block",marginBottom:4},children:"页面内容(HTML + CSS + JS)"}),s.jsx("textarea",{rows:12,value:p,style:{width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,fontSize:13,fontFamily:"monospace",background:"var(--bg)",color:"var(--text)",resize:"vertical"},onChange:e=>h(e.target.value)}),s.jsx("div",{style:{fontSize:12,color:"var(--text-light)",marginTop:2},children:"支持 HTML、CSS( ${t} `;return s.jsx("div",{style:{padding:"84px 32px 40px",background:"var(--bg)",minHeight:"100vh"},children:s.jsx("iframe",{style:{width:"100%",minHeight:"70vh",border:"none",borderRadius:8,background:"var(--surface)"},sandbox:"allow-scripts allow-modals allow-same-origin",srcDoc:l,title:e})})}let tc={reply:"\uD83D\uDCAC",post_deleted:"\uD83D\uDDD1️",report_handled:"\uD83D\uDEE1️",system:"\uD83D\uDCE2"};function td(){let{currentUser:e}=h(),[t,r]=(0,n.useState)(null),[a,i]=(0,n.useState)(null);return e?(0,s.jsxs)("div",{className:"page-slide active",children:[s.jsx("div",{className:"page-header",style:{maxWidth:700,margin:"0 auto",width:"100%"},children:(0,s.jsxs)("h2",{children:[s.jsx(g,{name:"message",size:20})," 消息"]})}),s.jsx("div",{style:{maxWidth:700,margin:"0 auto",width:"100%"},children:a?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#ef4444",padding:20},children:["加载失败:",a]}):null===t?s.jsx("div",{style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"加载中..."}):0===t.length?(0,s.jsxs)("div",{style:{textAlign:"center",color:"#94a3b8",padding:"60px 0"},children:[s.jsx(g,{name:"message",size:48}),s.jsx("p",{style:{fontSize:16},children:"暂无消息"}),s.jsx("p",{style:{fontSize:13},children:"当有人回复你的帖子或处理你的举报时,会在这里通知你"})]}):t.map(e=>{let t=tc[e.type]||"\uD83D\uDCCC",r=e.created_at?new Date(e.created_at).toLocaleString("zh-CN"):"";return(0,s.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:12,padding:"14px 16px",borderBottom:"1px solid var(--border-light)",background:"var(--surface)",borderRadius:6,marginBottom:6},children:[s.jsx("span",{style:{fontSize:20},children:t}),(0,s.jsxs)("div",{style:{flex:1,minWidth:0},children:[s.jsx("div",{style:{fontWeight:600,fontSize:14},children:e.title}),s.jsx("div",{style:{color:"var(--text-secondary)",fontSize:13,marginTop:2},children:e.content}),e.link&&s.jsx("a",{href:e.link,style:{color:"var(--primary)",fontSize:13,textDecoration:"none",marginTop:4,display:"inline-block"},children:"查看详情 →"}),s.jsx("div",{style:{fontSize:12,color:"var(--text-light)",marginTop:4},children:r})]})]},e.id)})})]}):s.jsx("div",{className:"page-slide active",style:{textAlign:"center",color:"#94a3b8",padding:"40px 0"},children:"请先登录"})}function tp({modal:e,onClose:t,reportPostId:r}){let{login:a,register:i,currentUser:l,refresh:c}=h(),[p,u]=(0,n.useState)(""),[x,m]=(0,n.useState)(""),[f,y]=(0,n.useState)(""),[b,k]=(0,n.useState)(""),[v,j]=(0,n.useState)(""),[S,w]=(0,n.useState)(null),[C,z]=(0,n.useState)(""),[R,N]=(0,n.useState)("spam");if(!e)return null;let P=e=>{e&&e.target!==e.currentTarget||t()},D=async()=>{if(!p.trim()||!x){alert("请填写完整信息");return}try{(await a(p.trim(),x)).user&&(t(),u(""),m(""),c())}catch(e){alert("登录失败:"+e.message)}},T=async()=>{if(!f.trim()||!b.trim()||!v){alert("请填写完整信息");return}if(v.length<6){alert("密码至少6位");return}if(!S||parseInt(C)!==S.answer){alert("验证码错误,请重新计算"),w(d()),z("");return}try{await i(b.trim(),v,f.trim()),t(),y(""),k(""),j(""),z(""),alert("注册成功!"),c()}catch(e){alert("注册失败:"+e.message)}},_=async()=>{if(r)try{await o.createReport(r,R),t(),alert("举报已提交,管理员将尽快处理")}catch(e){alert("举报失败:"+e.message)}};return(0,s.jsxs)(s.Fragment,{children:["login"===e&&s.jsx("div",{className:"modal active",onClick:P,children:(0,s.jsxs)("div",{className:"modal-content",children:[s.jsx("span",{className:"close",onClick:t,children:s.jsx(g,{name:"close",size:20})}),s.jsx("h2",{style:{marginBottom:16},children:"登录"}),s.jsx("input",{type:"email",placeholder:"邮箱",value:p,onChange:e=>u(e.target.value)}),s.jsx("input",{type:"password",placeholder:"密码",value:x,onChange:e=>m(e.target.value),onKeyDown:e=>{"Enter"===e.key&&D()}}),s.jsx("button",{className:"btn-primary",style:{width:"100%"},onClick:D,children:"登录"})]})}),"register"===e&&s.jsx("div",{className:"modal active",onClick:P,children:(0,s.jsxs)("div",{className:"modal-content",children:[s.jsx("span",{className:"close",onClick:t,children:s.jsx(g,{name:"close",size:20})}),s.jsx("h2",{style:{marginBottom:16},children:"注册"}),s.jsx("input",{type:"text",placeholder:"用户名",value:f,onChange:e=>y(e.target.value)}),s.jsx("input",{type:"email",placeholder:"邮箱",value:b,onChange:e=>k(e.target.value)}),s.jsx("input",{type:"password",placeholder:"密码(至少6位)",value:v,onChange:e=>j(e.target.value)}),(0,s.jsxs)("div",{className:"captcha-row",style:{display:"flex",alignItems:"center",gap:10,margin:"12px 0"},children:[S?s.jsx(eG,{captcha:S,onRefresh:()=>{w(d()),z("")}}):s.jsx("span",{style:{color:"var(--text-light)"},children:"验证码加载中..."}),s.jsx("input",{type:"text",placeholder:"答案",style:{width:80,background:"var(--bg)",color:"var(--text)",border:"1px solid var(--border)",padding:"8px 12px",borderRadius:4},value:C,onChange:e=>z(e.target.value)})]}),s.jsx("button",{className:"btn-primary",style:{width:"100%"},onClick:T,children:"注册"})]})}),"report"===e&&l&&s.jsx("div",{className:"modal active",onClick:P,children:(0,s.jsxs)("div",{className:"modal-content",children:[s.jsx("span",{className:"close",onClick:t,children:s.jsx(g,{name:"close",size:20})}),(0,s.jsxs)("h2",{style:{marginBottom:16},children:[s.jsx(g,{name:"shieldAlert",size:20})," 举报帖子"]}),s.jsx("p",{style:{fontSize:14,color:"#64748b",marginBottom:12},children:"请选择举报原因:"}),(0,s.jsxs)("select",{style:{width:"100%",padding:"8px 12px",border:"1px solid var(--border)",borderRadius:4,marginBottom:16,background:"var(--bg)",color:"var(--text)"},value:R,onChange:e=>N(e.target.value),children:[s.jsx("option",{value:"spam",children:"垃圾广告"}),s.jsx("option",{value:"abuse",children:"人身攻击"}),s.jsx("option",{value:"illegal",children:"违法内容"}),s.jsx("option",{value:"nsfw",children:"不适当内容"}),s.jsx("option",{value:"other",children:"其他"})]}),s.jsx("button",{className:"btn-primary",style:{width:"100%"},onClick:_,children:"提交举报"})]})})]})}function th({forumName:e,forumNameLoaded:t}){return s.jsx("div",{className:"loading-screen",children:(0,s.jsxs)("div",{className:"loading-inner",children:[s.jsx("div",{className:"loading-spinner"}),t&&e&&s.jsx("div",{className:"loading-title loading-title-appear",children:e}),s.jsx("div",{className:"loading-sub",children:"加载中..."})]})})}function tu(){let{view:e,currentPostId:t,currentUsername:r,currentPageName:a,ready:i,forumName:l,forumNameLoaded:o}=h(),[c,d]=(0,n.useState)(null),[p,u]=(0,n.useState)(null),x=e=>d(e);return i?(0,s.jsxs)("div",{className:"app-fade-in",children:[s.jsx(v,{onOpenModal:x}),s.jsx(k,{}),(0,s.jsxs)("div",{id:"app",style:{display:"feed"===e?"flex":"none"},children:[s.jsx(j,{}),s.jsx(eQ,{onOpenModal:x,onReport:e=>{u(e),d("report")}})]}),(0,s.jsxs)("div",{style:{display:"feed"!==e?"block":"none"},children:["post"===e&&t&&s.jsx(eX,{postId:t}),"user"===e&&r&&s.jsx(tl,{username:r}),"custom"===e&&a&&s.jsx(to,{pageName:a}),"new"===e&&s.jsx(eY,{}),"admin"===e&&s.jsx(te,{}),"settings"===e&&s.jsx(ti,{}),"messages"===e&&s.jsx(td,{})]}),s.jsx(tp,{modal:c,onClose:()=>d(null),reportPostId:p})]}):s.jsx(th,{forumName:l,forumNameLoaded:o})}function tx(){return s.jsx(u,{children:s.jsx(tu,{})})}},4646:(e,t,r)=>{"use strict";function s(){return null}r.d(t,{default:()=>s}),r(7577)},7494:(e,t,r)=>{"use strict";r.d(t,{ToastProvider:()=>c,p:()=>l});var s=r(326),n=r(7577),a=r(962);let i=(0,n.createContext)(null);function l(){return(0,n.useContext)(i)}let o=0;function c({children:e}){let[t,r]=(0,n.useState)([]),l=(0,n.useRef)({}),c=(0,n.useCallback)((e,t="success",s=3e3)=>{let n=++o;r(r=>[...r,{id:n,message:e,type:t}]),l.current[n]&&clearTimeout(l.current[n]),l.current[n]=setTimeout(()=>{r(e=>e.filter(e=>e.id!==n)),delete l.current[n]},s)},[]),d=(0,n.useCallback)(e=>{r(t=>t.filter(t=>t.id!==e)),l.current[e]&&(clearTimeout(l.current[e]),delete l.current[e])},[]);return(0,s.jsxs)(i.Provider,{value:{toast:c},children:[e,"undefined"!=typeof document&&(0,a.createPortal)(s.jsx("div",{className:"toast-container",children:t.map(e=>s.jsx("div",{className:"toast toast-"+e.type,onClick:()=>d(e.id),children:e.message},e.id))}),document.body)]})}},3397:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>o,metadata:()=>l});var s=r(9510);r(7272);var n=r(8570);let a=(0,n.createProxy)(String.raw`/Users/home/Projects/forumlify/components/CustomCssLoader.js#default`);(0,n.createProxy)(String.raw`/Users/home/Projects/forumlify/components/Toast.js#useToast`);let i=(0,n.createProxy)(String.raw`/Users/home/Projects/forumlify/components/Toast.js#ToastProvider`),l={title:"Loading...",description:"Forumlify - 简洁优雅的现代社区系统"};function o({children:e}){return(0,s.jsxs)("html",{lang:"zh-CN",suppressHydrationWarning:!0,children:[s.jsx("head",{children:s.jsx("script",{dangerouslySetInnerHTML:{__html:`(function(){ try { var t = localStorage.getItem('forumlify-theme'); if (!t) { t = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; } document.documentElement.setAttribute('data-theme', t); } catch (e) {} })();`}})}),s.jsx("body",{children:(0,s.jsxs)(i,{children:[s.jsx(a,{}),e]})})]})}},2232:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>s});let s=(0,r(8570).createProxy)(String.raw`/Users/home/Projects/forumlify/app/page.js#default`)},7272:()=>{}};var t=require("../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[948,471],()=>r(2530));module.exports=s})();