ci: GHCR docker build for Lite branch + compose updates

- .github/workflows/docker-lite.yml: build & push ghcr.io/lezi-fun/
  forumlify-deploy:lite on Lite branch push (linux/amd64+arm64)
- docker-compose.yml: pull :lite image from GHCR, add PORT / ENABLE_
  CAPTCHA env, restart: unless-stopped on both services
This commit is contained in:
lezi-fun committed 2026-08-12 09:21:12 +08:00
1 parent 8f88f803f5
commit 9e407d0a2d
1532 files changed
+645187 -1

No files matched your search

@@ -0,0 +1,92 @@
(()=>{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),adminGetCustoLine truncated
]`).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",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",P?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).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:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\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]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,url:z},ez={...eC,emStrongLDelim:ei,emStrongRDelimAst:ed,emStrongRDelimUnd:eh,link:N(/^!?\[(label)\]\((.*?)\)/).replace("label",eb).getRegex(),reflink:N(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",eb).getRegex()},eR={...eC,emStrongRDelimAst:ec,emStrongLDelim:ea,delLDelim:eu,delRDelim:ex,url:N(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",ew).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Line truncated
`),r=t.length-1;for(;r>=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;i<e.length;i++)if(this.rules.other.blockquoteStart.test(e[i]))a.push(e[i]),t=!0;else if(t)break;else a.push(e[i]);e=e.slice(i);let l=a.join(`
`),o=l.replace(this.rules.other.blockquoteSetextReplace,`
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
${l}`:l,s=s?`${s}
${o}`:o;let c=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(o,n,!0),this.lexer.state.top=c,0===e.length)break;let d=n.at(-1);if(d?.type==="code")break;if(d?.type==="blockquote"){let t=e.join(`
`),a=d.raw+`
`+t.replace(this.rules.other.blockquoteSetextReplace2,""),i=this.blockquote(a);n[n.length-1]=i,r=`${r}
${t}`,s=s.substring(0,s.length-d.text.length)+i.text;break}if(d?.type==="list"){let t=d.raw+`
`+e.join(`
`),a=this.list(t);n[n.length-1]=a,r=r.substring(0,r.length-d.raw.length)+a.raw,s=s.substring(0,s.length-d.raw.length)+a.raw,e=t.substring(n.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:r,tokens:n,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),s=r.length>1,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<r.length;e++)a.header.push({text:r[e],tokens:this.lexer.inline(r[e]),header:!0,align:a.align[e]});for(let e of n)a.rows.push(eB(e,a.header.length).map((e,t)=>({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;t<e.length;t++)if("\\"===e[t])t++;else if("("===e[t])r++;else if(")"===e[t]&&--r<0)return t;return r>0?-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 Line truncated
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(D.tabCharGlobal," ").replace(D.spaceLine,""));let s=1/0;for(;e;){let n;if(e.length<s)s=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}if(this.options.extensions?.block?.some(r=>!!(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<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}if(s||(n=""),s=!1,this.options.extensions?.inline?.some(r=>!!(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?'<pre><code class="language-'+eA(s)+'">'+(r?n:eA(n,!0))+`</code></pre>
`:"<pre><code>"+(r?n:eA(n,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}def(e){return""}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){let t=e.ordered,r=e.start,s="";for(let t=0;t<e.items.length;t++){let r=e.items[t];s+=this.listitem(r)}let n=t?"ol":"ul";return"<"+n+(t&&1!==r?' start="'+r+'"':"")+`>
`+s+"</"+n+`>
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t="",r="";for(let t=0;t<e.header.length;t++)r+=this.tablecell(e.header[t]);t+=this.tablerow({text:r});let s="";for(let t=0;t<e.rows.length;t++){let n=e.rows[t];r="";for(let e=0;e<n.length;e++)r+=this.tablecell(n[e]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+s+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${eA(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=e$(e);if(null===n)return s;let a='<a href="'+(e=n)+'"';return t&&(a+=' title="'+eA(t)+'"'),a+=">"+s+"</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=`<img src="${e}" alt="${eA(r)}"`;return t&&(a+=` title="${eA(t)}"`),a+=">"}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:eA(e.text)}},eO=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},eF=class e{options;renderer;textRenderer;constructor(e){this.options=e||C,this.options.renderer=this.options.renderer||new eU,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new eO}static parse(t,r){return new e(r).parse(t)}static parseInline(t,r){return new e(r).parseInline(t)}parse(e){this.renderer.parser=this;let t="";for(let r=0;r<e.length;r++){let s=e[r];if(this.options.extensions?.renderers?.[s.type]){let e=this.options.extensions.renderers[s.type].call({parser:this},s);if(!1!==e||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(s.type)){t+=e||"";continue}}switch(s.type){case"space":t+=this.renderer.space(s);break;case"hr":t+=this.renderer.hr(s);break;case"heading":t+=this.renderer.heading(s);break;case"code":t+=this.renderer.code(s);break;case"table":t+=this.renderer.table(s);break;case"blockquote":t+=this.renderer.blockquote(s);break;case"list":t+=this.renderer.list(s);break;case"checkbox":t+=this.renderer.checkbox(s);break;case"html":t+=this.renderer.html(s);break;case"def":t+=this.renderer.def(s);break;case"paragraph":t+=this.renderer.paragraph(s);break;case"text":t+=this.renderer.text(s);break;default:{let e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let e=this.options.extensions.renderers[n.type].call({parser:this},n);if(!1!==e||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(n.type)){r+=e||"";continue}}switch(n.type){case"escape":case"text":r+=t.text(n);break;case"html":r+=t.html(n);break;case"link":r+=t.link(n);break;case"image":r+=t.image(n);break;case"checkbox":r+=t.checkbox(n);break;case"strong":r+=t.strong(n);break;case"em":r+=t.em(n);break;case"codespan":r+=t.codespan(n);break;case"br":r+=t.br(n);break;case"del":r+=t.del(n);break;default:{let e='Token with "'+n.type+'" type was not found.';if(this.options.silent)return console.error(e),"";throw Error(e)}}}return r}},eq=class{options;block;constructor(e){this.options=e||C}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?eW.lex:eW.lexInline}provideParser(e=this.block){return e?eF.parse:eF.parseInline}},eH=new class{defaults=w();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=eF;Renderer=eU;TextRenderer=eO;Lexer=eW;Tokenizer=eM;Hooks=eq;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":for(let e of s.header)r=r.concat(this.walkTokens(e.tokens,t));for(let e of s.rows)for(let s of e)r=r.concat(this.walkTokens(s.tokens,t));break;case"list":r=r.concat(this.walkTokens(s.items,t));break;default:{let e=s;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(s=>{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 leveLine truncated
Please report this to https://github.com/markedjs/marked.`,e){let e="<p>An error occurred:</p><pre>"+eA(r.message+"",!0)+"</pre>";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,"<br>")}}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:1 Line truncated
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
padding: 24px;
background: var(--bg, #f6f8fc);
color: var(--text, #0a0e1a);
}
@media (prefers-color-scheme: dark) {
body { background: #0f1117; color: #e8edf5; }
}
</style>
</head>
<body>${t}</body>
</html>`;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.Line truncated
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})();