1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9301],{49301:(e,t,s)=>{"use strict";s.r(t),s.d(t,{AdminInvites:()=>j});var n=s(71588),r=s(48360),i=s(38933),a=s(75800);function c(e,t=0){return{...e.query.trim()?{query:e.query.trim()}:{},..."all"!==e.status?{status:e.status}:{},...e.batch.trim()?{batch:e.batch.trim()}:{},limit:50,offset:Math.max(0,50*Math.floor(t/50))}}var l=s(74561),d=s(81399),o=s.n(d);let u={list:a.TxM,generate:a.GWb,voidCode:a.gKl,voidBatch:a.blC},h={query:"",status:"all",batch:""},m={count:"25",batch:"",expiry:"7"},x={unused:"å¾
ç¨",used:"å·²ç¨",void:"å·²ä½åº"},f=i.CK;function j({refreshSignal:e=0,onError:t,api:s=u}){var i;let[a,d]=(0,r.useState)(h),[b,p]=(0,r.useState)(()=>c(h)),[v,_]=(0,r.useState)(null),[g,y]=(0,r.useState)(!0),[C,N]=(0,r.useState)(""),[w,A]=(0,r.useState)(0),[I,E]=(0,r.useState)(!1),[S,k]=(0,r.useState)(m),[Q,$]=(0,r.useState)(""),[q,H]=(0,r.useState)(!1),[M,D]=(0,r.useState)(null),[B,z]=(0,r.useState)(""),[L,O]=(0,r.useState)(null),[F,G]=(0,r.useState)(""),[R,W]=(0,r.useState)(!1),[J,K]=(0,r.useState)(null),P=(0,r.useRef)(0),T=(0,r.useRef)(!1),V=(0,r.useRef)(!1),X=(0,r.useRef)(t);X.current=t;let Z=(0,r.useRef)(M);Z.current=M,(0,r.useEffect)(()=>(V.current=!0,()=>{V.current=!1,P.current++}),[]),(0,r.useEffect)(()=>{let e=++P.current;return y(!0),N(""),s.list(b).then(t=>{if(e===P.current){if(t.offset!==b.offset||t.limit!==b.limit||!Number.isSafeInteger(t.total)||t.total<0)throw Error("å
æµç å页忧ä¸å®æ´ï¼è¯·éæ°è¯»åã");if(b.offset>0&&b.offset>=t.total)return void p({...b,offset:Math.max(0,Math.floor((t.total-1)/b.limit)*b.limit)});_({query:b,data:t})}}).catch(t=>{e===P.current&&N(t instanceof Error?t.message:"å
æµç 读å失败")}).finally(()=>{e===P.current&&y(!1)}),()=>{P.current++}},[s,b,e,w]);let U=v?.query===b?v.data:null,Y=U?(i=U.total,b.batch&&i>0?Object.freeze({kind:"batch",batch:b.batch}):null):null,ee=async()=>{let e;if(!T.current&&!q){try{e=function(e){if(!/^[1-9]\d{0,2}$/.test(e.count)||Number(e.count)>200)throw Error("请è¾å
¥ 1 è³ 200 ä¹é´çæ´æ°æ°éã");let t=e.batch.trim();if(t.length>128)throw Error("æ¹æ¬¡åä¸è½è¶
è¿ 128 个å符ã");if(!["7","14","30","none"].includes(e.expiry))throw Error("è¯·éæ©æ¯æçæææã");return Object.freeze({count:Number(e.count),batch:t,expiresDays:"none"===e.expiry?null:Number(e.expiry)})}(S)}catch(e){$(e instanceof Error?e.message:"è¯·æ£æ¥çææ¡ä»¶ã");return}T.current=!0,W(!0),$(""),X.current?.("");try{let t=await s.generate(e.count,e.batch,e.expiresDays),n=function(e,t){if(!Array.isArray(t.codes)||t.codes.some(e=>"string"!=typeof e||!e.trim())||t.count!==t.codes.length||new Set(t.codes).size!==t.codes.length||t.count>e.count)throw Error("çæåæ§ä¸å®æ´ï¼è¯·å
å·æ°å
æµç åè¡¨æ ¸å¯¹ï¼é¿å
éå¤çæã");return Object.freeze({batch:e.batch,expiresDays:e.expiresDays,requestedCount:e.count,generatedCount:t.count,codes:Object.freeze([...t.codes])})}(e,t);if(!V.current)return;D(n),z(""),E(!1),K({tone:n.generatedCount===n.requestedCount?"success":"warning",title:`æå¡ç«¯å·²çæ ${n.generatedCount} 个å
æµç ${n.generatedCount<n.requestedCount?`ï¼æ¬æ¬¡ç³è¯· ${n.requestedCount} 个`:""}ã`}),A(e=>e+1)}catch(t){if(!V.current)return;let e=t instanceof Error?t.message:"çæè¯·æ±æªç¡®è®¤";$(`${e} 请å
æ¥çåè¡¨æ ¸å¯¹ï¼åå³å®æ¯å¦éæ°çæã`),H(!0),K({tone:"warning",title:"çæç»æå°æªç¡®è®¤ï¼è¯·å
å·æ°åè¡¨æ ¸å¯¹ï¼é¿å
éå¤çæã"})}finally{T.current=!1,V.current&&W(!1)}}},et=async()=>{if(L&&!T.current){T.current=!0,W(!0),G(""),X.current?.("");try{let e;if("code"===L.kind){let t=await s.voidCode(L.code);if("boolean"!=typeof t.success)throw Error("ä½åºåæ§ä¸å®æ´");e=+!!t.success}else{let t=await s.voidBatch(L.batch);if(!0!==t.success||!Number.isSafeInteger(t.voided)||t.voided<0)throw Error("æ¹æ¬¡ä½åºåæ§ä¸å®æ´");e=t.voided}if(!V.current)return;K({tone:e>0?"success":"warning",title:e>0?"code"===L.kind?`å
æµç ${L.code} å·²ä½åºã`:`æ¹æ¬¡ã${L.batch}ãå·²ä½åº ${e} 个å¾
ç¨ç ã`:"没æå
æµç 被ä½åºãè®°å½å¯è½å·²ä½¿ç¨æå·²ä½åºï¼è¯·ä»¥å·æ°åçå表为åã"}),O(null),A(e=>e+1)}catch(e){V.current&&G(`${e instanceof Error?e.message:"ä½åºè¯·æ±æªç¡®è®¤"}ã请å
³éå¼¹çªå¹¶å·æ°åè¡¨æ ¸å¯¹ï¼å·²ç¨ç ä¸ä¼è¢«ä½åºã`)}finally{T.current=!1,V.current&&W(!1)}}},es=async()=>
1{if(M?.codes.length)try{await navigator.clipboard.writeText(M.codes.join("\n")),V.current&&Z.current===M&&z("å·²å¤å¶å
¨é¨æ°ç ")}catch{V.current&&Z.current===M&&z("å¤å¶å¤±è´¥ï¼å¯å¨ä¸æ¹æå¨éæ©å¤å¶")}};return(0,n.jsxs)("div",{className:o().root,children:[(0,n.jsx)(l.wc,{title:"å
æµç ",description:"䏿¬¡æ§ä½¿ç¨ï¼1 个ç å¯¹åº 1 次注åãçæãåæ¾èå´ä¸ä½åºç»æå弿 ¸å¯¹ã",actions:(0,n.jsx)(l.QH,{variant:"primary",disabled:R,onClick:()=>{E(!0),$(""),H(!1)},children:"çæå
æµç "})}),J&&(0,n.jsx)(l.Qj,{tone:J.tone,title:J.title}),C&&(0,n.jsx)(l.Qj,{tone:"error",title:U?"åè¡¨å·æ°å¤±è´¥ï¼ä¿ç䏿¬¡æåæ°æ®":"å
æµç å表读å失败",action:(0,n.jsx)(l.QH,{disabled:g,onClick:()=>A(e=>e+1),children:"éæ°å è½½"}),children:C}),U&&(0,n.jsx)("div",{className:o().stats,children:[[U.stats.total,"累计çæ"],[U.stats.unused,"æªå
æ¢ï¼å«è¿æï¼"],[U.stats.used,"已注å使ç¨"],[U.stats.void,"å·²ä½åº"]].map(([e,t])=>(0,n.jsxs)("div",{className:o().stat,children:[(0,n.jsx)("strong",{children:e}),(0,n.jsxs)("span",{children:[t," \xb7 å
¨é¨æ¹æ¬¡"]})]},t))}),M&&(0,n.jsxs)(l.IE,{title:`æ¬æ¬¡çæ ${M.generatedCount} 个å
æµç `,description:`æ¹æ¬¡ï¼${M.batch||"æªå½å"} \xb7 ${null==M.expiresDays?"é¿æææ":`æææ ${M.expiresDays} 天`}ï¼ç²¾ç¡®å°ææ¶é´è§å表ã`,actions:M.codes.length>0?(0,n.jsx)(l.QH,{onClick:()=>void es(),children:"å¤å¶æ¬æ¬¡æ°ç "}):void 0,children:[B&&(0,n.jsx)("p",{className:o().muted,role:"status",children:B}),(0,n.jsx)("div",{className:o().codeList,children:M.codes.map(e=>(0,n.jsx)("code",{children:e},e))}),M.generatedCount<M.requestedCount&&(0,n.jsxs)("p",{className:o().muted,children:["æ¬æ¬¡ç³è¯· ",M.requestedCount," 个ï¼å®é
çæ ",M.generatedCount," 个ï¼åªå±ç¤ºæå¡ç«¯è¿åçæ°ç ã"]})]}),(0,n.jsxs)(l.IE,{title:"å
æµç å表",children:[(0,n.jsxs)("form",{className:o().filters,onSubmit:e=>{e.preventDefault(),p(c(a))},children:[(0,n.jsxs)("label",{className:o().field,children:["æç´¢",(0,n.jsx)("input",{type:"search",value:a.query,onChange:e=>d(t=>({...t,query:e.target.value})),placeholder:"å
æµç ãæ¹æ¬¡æå
æ¢ç¨æ·"})]}),(0,n.jsxs)("label",{className:o().field,children:["ç¶æ",(0,n.jsxs)("select",{value:a.status,onChange:e=>d(t=>({...t,status:e.target.value})),children:[(0,n.jsx)("option",{value:"all",children:"å
¨é¨ç¶æ"}),(0,n.jsx)("option",{value:"unused",children:"å¾
ç¨"}),(0,n.jsx)("option",{value:"used",children:"å·²ç¨"}),(0,n.jsx)("option",{value:"void",children:"å·²ä½åº"})]})]}),(0,n.jsxs)("label",{className:o().field,children:["ç²¾ç¡®æ¹æ¬¡",(0,n.jsx)("input",{value:a.batch,maxLength:128,onChange:e=>d(t=>({...t,batch:e.target.value})),placeholder:"è¾å
¥å®æ´æ¹æ¬¡å",list:"admin-invite-batches"}),(0,n.jsx)("datalist",{id:"admin-invite-batches",children:Array.from(new Set(U?.invites.flatMap(e=>e.batch?[e.batch]:[])??[])).map(e=>(0,n.jsx)("option",{value:e},e))})]}),(0,n.jsxs)("div",{className:o().actions,children:[(0,n.jsx)(l.QH,{type:"submit",disabled:g,children:"æ¥è¯¢"}),(0,n.jsx)(l.QH,{variant:"ghost",onClick:()=>{d(h),p(c(h))},children:"éç½®"})]})]}),(0,n.jsxs)("div",{className:`${o().row} ${o().sectionGap}`,children:[(0,n.jsxs)("p",{className:o().muted,children:["å½åç»æï¼",b.batch?`æ¹æ¬¡ã${b.batch}ã`:"å
¨é¨æ¹æ¬¡"," \xb7 ",b.status?x[b.status]:"å
¨é¨ç¶æ",b.query?` \xb7 æç´¢ã${b.query}ã`:""]}),Y&&(0,n.jsx)(l.QH,{variant:"danger",compact:!0,disabled:R||g,onClick:()=>{G(""),O(Y)},children:"ä½åºè¯¥æ¹æ¬¡å¾
ç¨ç "})]}),g&&!U?(0,n.jsx)(l.eA,{label:"æ£å¨è¯»åå
æµç â¦"}):U?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:o().tableWrap,children:(0,n.jsxs)("table",{className:o().table,children:[(0,n.jsx)("thead",{children:(0,n.jsxs)("tr",{children:[(0,n.jsx)("th",{scope:"col",children:"å
æµç "}),(0,n.jsx)("th",{scope:"col",children:"æ¹æ¬¡"}),(0,n.jsx)("th",{scope:"col",children:"ç¶æ"}),(0,n.jsx)("th",{scope:"col",children:"æææ / çææ¶é´"}),(0,n.jsx)("th",{scope:"col",children:"å
æ¢ç¨æ· / æ¶é´"}),(0,n.jsx)("th",{scope:"col",children:"æä½"})]})}),(0,n.jsx)("tbody",{children:U.invites.map(e=>(0,n.jsxs)("tr",{children:[(0,n.jsx)("td",{className:o().code,children:e.code}),(0,n.jsx)("td",{children:e.batch||"æªå½å"}),(0,n.jsx)("td",{children:(0,n.jsx)(l.lB,{tone:"used"===e.status?"success":"neutral",children:x[e.status]})}),(0,n.jsxs)("td",{children:[e.expires_at?f(e.expires_at):"é¿æææ",(0,n.jsxs)("small",{children:["çæäº ",f(e.created_at)]})]}),(0,n.jsxs)("td",{children:[e.used_by||"â",(0,n.jsx)("small",{children:e.used_at?f(e.used_at):""})]}),(0,n.jsx)("td",{children:"unused"===e.status&&(0,n.jsx)(l.QH,{variant:"ghost",compact:!0,disabled:R||g,onClick:()=>{G(""),O("unused"===e.status?Object.freeze({kind:"code",code:e.code,batch:e.batch}):null)},children:"ä½åº"})})]},e.code))})]})}),!U.invites.length&&(0,n.jsx)(l.tc,{title:"å½åèå´æ²¡æå
æµç ",description:"å¯ä»¥è°æ´æ¥è¯¢æ¡ä»¶ï¼æçææ°ç䏿¹å
æµç ã"}),(0,n.jsxs)("div",{className:o().pagination,children:[(0,n.jsxs)("span",{children:["ç¬¦åæ¥è¯¢ ",U.total," 个 \xb7 æ¯é¡µ ",b.limit," 个 \xb7 第 ",Math.floor(b.offset/b.limit)+1," 页"]}),(0,n.jsx)(l.QH,{compact:!0,disabled:g||0===b.offset,onClick:()=>p(e=>
1({...e,offset:Math.max(0,e.offset-e.limit)})),children:"ä¸ä¸é¡µ"}),(0,n.jsx)(l.QH,{compact:!0,disabled:g||b.offset+b.limit>=U.total,onClick:()=>p(e=>({...e,offset:e.offset+e.limit})),children:"ä¸ä¸é¡µ"})]})]}):null]}),I&&(0,n.jsx)(l.Ql,{title:"çæå
æµç ",description:"åªçæå
æµç ï¼ç±è¿è¥èªè¡å®ååæ¾ãæ¹æ¬¡åç¨äºåç»åç¡®æ¥è¯¢ä¸ä½åºã",onClose:()=>{T.current||E(!1)},busy:R,footer:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.QH,{disabled:R,onClick:()=>{E(!1),q&&A(e=>e+1)},children:q?"è¿ååè¡¨æ ¸å¯¹":"åæ¶"}),(0,n.jsx)(l.QH,{type:"submit",form:"admin-invite-generate",variant:"primary",disabled:R||q,children:R?"æ£å¨çæâ¦":"确认çæ"})]}),children:(0,n.jsxs)("form",{id:"admin-invite-generate",className:o().form,onSubmit:e=>{e.preventDefault(),ee()},children:[(0,n.jsxs)("label",{className:o().field,children:["æ°éï¼1â200ï¼",(0,n.jsx)("input",{inputMode:"numeric",value:S.count,onChange:e=>k(t=>({...t,count:e.target.value})),disabled:R,"aria-invalid":!!Q})]}),(0,n.jsxs)("label",{className:o().field,children:["æ¹æ¬¡å / åæ¾å¯¹è±¡ï¼å¯éï¼",(0,n.jsx)("input",{maxLength:128,value:S.batch,onChange:e=>k(t=>({...t,batch:e.target.value})),disabled:R,placeholder:"å¦ï¼9 ææ·±è®¿"})]}),(0,n.jsxs)("label",{className:o().field,children:["æææ",(0,n.jsxs)("select",{value:S.expiry,onChange:e=>k(t=>({...t,expiry:e.target.value})),disabled:R,children:[(0,n.jsx)("option",{value:"7",children:"7 天"}),(0,n.jsx)("option",{value:"14",children:"14 天"}),(0,n.jsx)("option",{value:"30",children:"30 天"}),(0,n.jsx)("option",{value:"none",children:"é¿æææ"})]})]}),Q&&(0,n.jsx)("p",{className:o().formError,role:"alert",children:Q})]})}),L&&(0,n.jsxs)(l.Ql,{title:"code"===L.kind?"确认ä½åºå
æµç ":"确认ä½åºæ¹æ¬¡å¾
ç¨ç ",onClose:()=>{T.current||O(null)},busy:R,footer:(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(l.QH,{disabled:R,onClick:()=>{O(null),F&&A(e=>e+1)},children:F?"å
³éå¹¶æ ¸å¯¹":"åæ¶"}),(0,n.jsx)(l.QH,{variant:"danger",disabled:R||!!F,onClick:()=>void et(),children:R?"æ£å¨ä½åºâ¦":"确认ä½åº"})]}),children:["code"===L.kind?(0,n.jsxs)("p",{children:["ä½åºå
æµç ",(0,n.jsx)("strong",{className:o().code,children:L.code}),"ï¼æ¹æ¬¡ï¼",L.batch||"æªå½å","ã"]}):(0,n.jsxs)("p",{children:["ä½åºæ¹æ¬¡ ",(0,n.jsx)("strong",{className:o().exactBatch,children:L.batch})," å½åææå¾
ç¨å
æµç ï¼èå´å
å«å½åæç´¢ãç¶æçéåå页ä¹å¤çåæ¹æ¬¡ç ã"]}),(0,n.jsx)("p",{className:o().muted,children:"已使ç¨çç ä¸å·²æ³¨åç¨æ·ä¸åå½±åãä½åºåçç ä¸è½å注åï¼ä¸è½æ¢å¤ä¸ºå¾
ç¨ã"}),F&&(0,n.jsx)("p",{className:o().formError,role:"alert",children:F})]})]})}},81399:e=>{e.exports={root:"AdminInvites_root__ivbBe",stats:"AdminInvites_stats__inCEN",stat:"AdminInvites_stat__fFP7d",filters:"AdminInvites_filters__nJ0Ku",field:"AdminInvites_field__qxFa4",form:"AdminInvites_form__VXCQ7",row:"AdminInvites_row__UAh21",actions:"AdminInvites_actions__yiv_J",muted:"AdminInvites_muted__opJDl",tableWrap:"AdminInvites_tableWrap__nBPiY",table:"AdminInvites_table__TVMfX",code:"AdminInvites_code__n91wf",codeList:"AdminInvites_codeList__W8L9C",pagination:"AdminInvites_pagination__Jh0Z8",exactBatch:"AdminInvites_exactBatch__49OyC",formError:"AdminInvites_formError__Zg_fN",sectionGap:"AdminInvites_sectionGap__7bPs0",empty:"AdminInvites_empty__uy0Gg"}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.