diff --git a/README.md b/README.md index 674cb2e..a74a336 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ npm run preview 3. **代理(可选)**:服务器能直接访问 x.com 就选「直连」;否则准备一个代理节点。支持 sing-box 的任意 outbound 类型(anytls、socks、http、shadowsocks、vmess、vless、trojan 等),也可以直接粘贴完整 sing-box 配置。 4. **Stripe 公钥**:X 结账页面使用的 `pk_live_` 开头公钥。使用默认 X Premium 目录时向导会说明;它与商户、商品、价格一起保存在「目录」配置中,也可以完全自定义。 -网络路径独立配置:X 账号与资格检查始终直连;生成付款链接所需的地区报价校验与创建链接使用同一个 `proxy` 出口,避免币种和金额因地区不同而变化;X 请求不读取环境代理;Stripe 可使用包含 `direct` 的 `payment-outbounds` 节点池。连接故障触发 6 小时冷却,安全查询最多尝试 3 个出口;付款确认不会自动重放。未配置或空数组时,新订单直连。Stripe 不读取环境代理。详见 [付款节点池配置](docs/payment-outbounds.md)。直接在浏览器打开 Stripe 链接时使用浏览器网络。 +网络路径独立配置:X 账号与资格检查始终直连;生成付款链接所需的地区报价校验与创建链接使用同一个 `proxy` 出口,避免币种和金额因地区不同而变化;X 请求不读取环境代理;Stripe 可使用包含 `direct` 的 `payment-outbounds` 节点池。连接故障触发 30 分钟冷却,安全查询最多尝试 3 个出口;付款确认不会自动重放。未配置或空数组时,新订单直连。Stripe 不读取环境代理。详见 [付款节点池配置](docs/payment-outbounds.md)。直接在浏览器打开 Stripe 链接时使用浏览器网络。 另外需要:一台 Linux 服务器、一个指向该服务器的域名、服务器上安装 Go 1.27+(或在自己电脑上构建后上传二进制)。 diff --git a/docs/payment-outbounds.md b/docs/payment-outbounds.md index 704efd8..ccb629e 100644 --- a/docs/payment-outbounds.md +++ b/docs/payment-outbounds.md @@ -95,9 +95,9 @@ PY - 以前没有节点绑定的待处理订单,在功能启用后首次访问 Stripe 时建立绑定。绑定不代表已付款。 - 明确银行卡拒付不会在同一个组合上重复扣款。金额校验、幂等、付款间隔和支付方禁止重试指令继续生效。 -## 网络重试与 6 小时冷却 +## 网络重试与 30 分钟冷却 -- Stripe 连接失败、TLS/连接超时或成功响应中断,会把当前节点冷却 6 小时;银行卡拒付触发的是 30 分钟的出口 IP 冷却(先冷却 IP 再考虑冷却卡)。冷却按节点、服务器地址,以及最近探测到的公网 IP 共同排除;共享出口 IP 的节点一起退出可选池。`direct` 也适用。取消操作和 API 重定向拒绝不触发冷却。 +- Stripe 连接失败、TLS/连接超时或成功响应中断,会把当前节点冷却 30 分钟;银行卡拒付触发的是 30 分钟的出口 IP 冷却(先冷却 IP 再考虑冷却卡)。冷却按节点、服务器地址,以及最近探测到的公网 IP 共同排除;共享出口 IP 的节点一起退出可选池。`direct` 也适用。取消操作和 API 重定向拒绝不触发冷却。 - 冷却记录保存在加密的 `payment-node-cooldown:*`,服务重启不会清除;到期自动恢复候选资格。所有节点均冷却时停止,不偷偷走未配置出口。 - **GET 查询及 `payment_pages//init` 初始化核验**可换节点重试,每个请求最多 3 次(含首次)。这不包含生成新账单的 X mutation。 - **卡信息提交、付款确认等写请求不自动重放**。即使网络出错并记录冷却,也立即返回失败/待核实状态;之后只能查询原结果,不会在别的出口重新扣款。 diff --git a/frontend/src/PaymentStatusPanel.tsx b/frontend/src/PaymentStatusPanel.tsx index 47f5416..de0922c 100644 --- a/frontend/src/PaymentStatusPanel.tsx +++ b/frontend/src/PaymentStatusPanel.tsx @@ -157,7 +157,7 @@ function NetworkCard({ component="p" sx={{ mt: 2 }} > - 节点连接故障后冷却 6 小时;安全查询每个请求最多尝试 3 + 节点连接故障后冷却 30 分钟;安全查询每个请求最多尝试 3 次;付款提交失败不自动重扣。 diff --git a/frontend/src/admin.tsx b/frontend/src/admin.tsx index 9afba9d..c6671b6 100644 --- a/frontend/src/admin.tsx +++ b/frontend/src/admin.tsx @@ -487,7 +487,7 @@ function Admin() { 生成兑换码 - 每批最多 500 枚。同名批次自动归入同一个文件夹。 + 每批最多 2000 枚。同名批次自动归入同一个文件夹。 500; + Number(count) > 2000; setBatchError(invalidBatch); setCountError(invalidCount); if ( @@ -548,9 +548,9 @@ function Admin() { disabled={busy} error={countError} helperText={ - countError ? "请输入 1–500 之间的整数" : "每批 1–500 枚" + countError ? "请输入 1–2000 之间的整数" : "每批 1–2000 枚" } - slotProps={{ htmlInput: { min: 1, max: 500, step: 1 } }} + slotProps={{ htmlInput: { min: 1, max: 2000, step: 1 } }} /> time.Now().Unix() { cooling++ - if until < before.Add(6*time.Hour).Unix() || until > time.Now().Add(6*time.Hour).Unix() { - t.Fatal("cooldown duration not six hours") + if until < before.Add(paymentNodeCooldown).Unix() || until > time.Now().Add(paymentNodeCooldown).Unix() { + t.Fatal("cooldown duration wrong") } } } diff --git a/internal/checkout/replacement.go b/internal/checkout/replacement.go index 089b555..c15e723 100644 --- a/internal/checkout/replacement.go +++ b/internal/checkout/replacement.go @@ -171,9 +171,6 @@ func replacementEvidence(v *vault.Vault, r *Record) error { if r.Status == "succeeded" || r.Status == "requires_action" { return errors.New("original payment is not replaceable") } - if r.ReplacementCount >= 3 { - return errors.New("replacement link limit reached") - } if unsubmitted(r) && r.Status == "created" { return nil } diff --git a/internal/site/assets/admin.html b/internal/site/assets/admin.html index 2f2f1e2..ede8667 100644 --- a/internal/site/assets/admin.html +++ b/internal/site/assets/admin.html @@ -29,7 +29,7 @@ /> XGift · 兑换码管理 - +
diff --git a/internal/site/assets/admin.js b/internal/site/assets/admin.js index a0d0cc9..d0a58b2 100644 --- a/internal/site/assets/admin.js +++ b/internal/site/assets/admin.js @@ -233,9 +233,9 @@ To suppress this warning, you need to explicitly provide the \`palette.${t}Chann transparent )`,content:'""',position:"absolute",transform:"translateX(-100%)",bottom:0,left:0,right:0,top:0}}},{props:{animation:"wave"},style:d8||{"&::after":{animation:`${Rv} 2s linear 0.5s infinite`}}}]}})),y8=aw.forwardRef(function(t,o){let r=G({props:t,name:"MuiSkeleton"}),{animation:n="pulse",className:a,component:s="span",height:i,style:l,variant:p="text",width:c,...d}=r,f={...r,animation:n,component:s,variant:p,hasChildren:!!d.children},u=u8(f);return(0,sw.jsx)(m8,{as:s,ref:o,className:B(u.root,a),ownerState:f,...d,style:{width:c,height:i,...l}})}),Ya=y8;var th=P(L(),1);var Zp=P(L(),1);function h8(e={}){let{autoHideDuration:t=null,disableWindowBlurListener:o=!1,onClose:r,open:n,resumeHideDuration:a}=e,s=ar();Zp.useEffect(()=>{if(!n)return;function m(y){y.defaultPrevented||y.key==="Escape"&&r?.(y,"escapeKeyDown")}return document.addEventListener("keydown",m),()=>{document.removeEventListener("keydown",m)}},[n,r]);let i=zr((m,y)=>{r?.(m,y)}),l=zr(m=>{!r||m==null||s.start(m,()=>{i(null,"timeout")})});Zp.useEffect(()=>(n&&l(t),s.clear),[n,t,l,s]);let p=m=>{r?.(m,"clickaway")},c=s.clear,d=Zp.useCallback(()=>{t!=null&&l(a??t*.5)},[t,a,l]),f=m=>y=>{let h=m.onBlur;h?.(y),d()},u=m=>y=>{let h=m.onFocus;h?.(y),c()},g=m=>y=>{let h=m.onMouseEnter;h?.(y),c()},b=m=>y=>{let h=m.onMouseLeave;h?.(y),d()};return Zp.useEffect(()=>{if(!o&&n)return window.addEventListener("focus",d),window.addEventListener("blur",c),()=>{window.removeEventListener("focus",d),window.removeEventListener("blur",c)}},[o,n,d,c]),{getRootProps:(m={})=>{let y={...Cs(e),...Cs(m)};return{role:"presentation",...m,...y,onBlur:f(y),onFocus:u(y),onMouseEnter:g(y),onMouseLeave:b(y)}},onClickAway:p}}var iw=h8;var pw=P(L(),1);function lw(e){return V("MuiSnackbarContent",e)}var D0e=q("MuiSnackbarContent",["root","message","action"]);var vf=P(_(),1),g8=e=>{let{classes:t}=e;return F({root:["root"],action:["action"],message:["message"]},lw,t)},T8=M(tt,{name:"MuiSnackbarContent",slot:"Root"})(J(({theme:e})=>{let t=e.palette.mode==="light"?.8:.98;return{...e.typography.body2,color:e.vars?e.vars.palette.SnackbarContent.color:e.palette.getContrastText(Cm(e.palette.background.default,t)),backgroundColor:e.vars?e.vars.palette.SnackbarContent.bg:Cm(e.palette.background.default,t),display:"flex",alignItems:"center",flexWrap:"wrap",padding:"6px 16px",flexGrow:1,[e.breakpoints.up("sm")]:{flexGrow:"initial",minWidth:288}}})),b8=M("div",{name:"MuiSnackbarContent",slot:"Message"})({padding:"8px 0"}),v8=M("div",{name:"MuiSnackbarContent",slot:"Action"})({display:"flex",alignItems:"center",marginLeft:"auto",paddingLeft:16,marginRight:-8}),x8=pw.forwardRef(function(t,o){let r=G({props:t,name:"MuiSnackbarContent"}),{action:n,className:a,message:s,role:i="alert",...l}=r,p=r,c=g8(p);return(0,vf.jsxs)(T8,{role:i,elevation:6,className:B(c.root,a),ownerState:p,ref:o,...l,children:[(0,vf.jsx)(b8,{className:c.message,ownerState:p,children:s}),n?(0,vf.jsx)(v8,{className:c.action,ownerState:p,children:n}):null]})}),wv=x8;function cw(e){return V("MuiSnackbar",e)}var K0e=q("MuiSnackbar",["root","anchorOriginTopCenter","anchorOriginBottomCenter","anchorOriginTopRight","anchorOriginBottomRight","anchorOriginTopLeft","anchorOriginBottomLeft"]);var xf=P(_(),1),P8=e=>{let{classes:t,anchorOrigin:o}=e,r={root:["root",`anchorOrigin${I(o.vertical)}${I(o.horizontal)}`]};return F(r,cw,t)},S8=M("div",{name:"MuiSnackbar",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,t[`anchorOrigin${I(o.anchorOrigin.vertical)}${I(o.anchorOrigin.horizontal)}`]]}})(J(({theme:e})=>({zIndex:(e.vars||e).zIndex.snackbar,position:"fixed",display:"flex",left:8,right:8,justifyContent:"center",alignItems:"center",variants:[{props:({ownerState:t})=>t.anchorOrigin.vertical==="top",style:{top:8,[e.breakpoints.up("sm")]:{top:24}}},{props:({ownerState:t})=>t.anchorOrigin.vertical!=="top",style:{bottom:8,[e.breakpoints.up("sm")]:{bottom:24}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="left",style:{justifyContent:"flex-start",[e.breakpoints.up("sm")]:{left:24,right:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="right",style:{justifyContent:"flex-end",[e.breakpoints.up("sm")]:{right:24,left:"auto"}}},{props:({ownerState:t})=>t.anchorOrigin.horizontal==="center",style:{[e.breakpoints.up("sm")]:{left:"50%",right:"auto",transform:"translateX(-50%)"}}}]}))),C8=th.forwardRef(function(t,o){let r=G({props:t,name:"MuiSnackbar"}),n=qt(),a={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{action:s,anchorOrigin:{vertical:i,horizontal:l}={vertical:"bottom",horizontal:"left"},autoHideDuration:p=null,children:c,className:d,ClickAwayListenerProps:f,ContentProps:u,disableWindowBlurListener:g=!1,message:b,onBlur:x,onClose:m,onFocus:y,onMouseEnter:h,onMouseLeave:T,open:S,resumeHideDuration:C,slots:E={},slotProps:R={},TransitionComponent:O,transitionDuration:w=a,TransitionProps:{onEnter:A,onExited:v,...N}={},...k}=r,z={...r,anchorOrigin:{vertical:i,horizontal:l},autoHideDuration:p,disableWindowBlurListener:g,TransitionComponent:O,transitionDuration:w},j=P8(z),{getRootProps:W,onClickAway:Z}=iw(z),[X,de]=th.useState(!0),me=H=>{de(!0),v&&v(H)},fe=(H,U)=>{de(!1),A&&A(H,U)},ie={slots:{transition:O,...E},slotProps:{content:u,clickAwayListener:f,transition:N,...R}},[we,Te]=pe("root",{ref:o,className:[j.root,d],elementType:S8,getSlotProps:W,externalForwardedProps:{...ie,...k},ownerState:z}),[le,{ownerState:Pe,...ye}]=pe("clickAwayListener",{elementType:Fb,externalForwardedProps:ie,getSlotProps:H=>({onClickAway:(...U)=>{let Se=U[0];H.onClickAway?.(...U),!Se?.defaultMuiPrevented&&Z(...U)}}),ownerState:z}),[Oe,he]=pe("content",{elementType:wv,shouldForwardComponentProp:!0,externalForwardedProps:ie,additionalProps:{message:b,action:s},ownerState:z}),[ge,be]=pe("transition",{elementType:nl,externalForwardedProps:ie,getSlotProps:H=>({onEnter:(...U)=>{H.onEnter?.(...U),fe(...U)},onExited:(...U)=>{H.onExited?.(...U),me(...U)}}),additionalProps:{appear:!0,in:S,timeout:w,direction:i==="top"?"down":"up"},ownerState:z});return!S&&X?null:(0,xf.jsx)(le,{...ye,...E.clickAwayListener&&{ownerState:Pe},children:(0,xf.jsx)(we,{...Te,children:(0,xf.jsx)(ge,{...be,children:c||(0,xf.jsx)(Oe,{...he})})})})}),oh=C8;var to=P(L(),1);function uw(e){return V("MuiTooltip",e)}var E8=q("MuiTooltip",["popper","popperInteractive","popperArrow","popperClose","tooltip","tooltipArrow","touch","tooltipPlacementLeft","tooltipPlacementRight","tooltipPlacementTop","tooltipPlacementBottom","arrow"]),$t=E8;var zs=P(_(),1);function R8(e){return Math.round(e*1e5)/1e5}var w8=e=>{let{classes:t,disableInteractive:o,arrow:r,touch:n,placement:a}=e,s={popper:["popper",!o&&"popperInteractive",r&&"popperArrow"],tooltip:["tooltip",r&&"tooltipArrow",n&&"touch",`tooltipPlacement${I(a.split("-")[0])}`],arrow:["arrow"]};return F(s,uw,t)},O8=M(vy,{name:"MuiTooltip",slot:"Popper",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.popper,!o.disableInteractive&&t.popperInteractive,o.arrow&&t.popperArrow,!o.open&&t.popperClose]}})(J(({theme:e})=>({zIndex:(e.vars||e).zIndex.tooltip,pointerEvents:"none",variants:[{props:({ownerState:t})=>!t.disableInteractive,style:{pointerEvents:"auto"}},{props:({open:t})=>!t,style:{pointerEvents:"none"}},{props:({ownerState:t})=>t.arrow,style:{[`&[data-popper-placement*="bottom"] .${$t.arrow}`]:{top:0,marginTop:"-0.71em","&::before":{transformOrigin:"0 100%"}},[`&[data-popper-placement*="top"] .${$t.arrow}`]:{bottom:0,marginBottom:"-0.71em","&::before":{transformOrigin:"100% 0"}},[`&[data-popper-placement*="right"] .${$t.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"100% 100%"}},[`&[data-popper-placement*="left"] .${$t.arrow}`]:{height:"1em",width:"0.71em","&::before":{transformOrigin:"0 0"}}}},{props:({ownerState:t})=>t.arrow&&!t.isRtl,style:{[`&[data-popper-placement*="right"] .${$t.arrow}`]:{left:0,marginLeft:"-0.71em"}}},{props:({ownerState:t})=>t.arrow&&!!t.isRtl,style:{[`&[data-popper-placement*="right"] .${$t.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:t})=>t.arrow&&!t.isRtl,style:{[`&[data-popper-placement*="left"] .${$t.arrow}`]:{right:0,marginRight:"-0.71em"}}},{props:({ownerState:t})=>t.arrow&&!!t.isRtl,style:{[`&[data-popper-placement*="left"] .${$t.arrow}`]:{left:0,marginLeft:"-0.71em"}}}]}))),N8=M("div",{name:"MuiTooltip",slot:"Tooltip",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.tooltip,o.touch&&t.touch,o.arrow&&t.tooltipArrow,t[`tooltipPlacement${I(o.placement.split("-")[0])}`]]}})(J(({theme:e})=>({backgroundColor:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.92),borderRadius:(e.vars||e).shape.borderRadius,color:(e.vars||e).palette.common.white,fontFamily:e.typography.fontFamily,padding:"4px 8px",fontSize:e.typography.pxToRem(11),maxWidth:300,margin:2,wordWrap:"break-word",fontWeight:e.typography.fontWeightMedium,[`.${$t.popper}[data-popper-placement*="left"] &`]:{transformOrigin:"right center"},[`.${$t.popper}[data-popper-placement*="right"] &`]:{transformOrigin:"left center"},[`.${$t.popper}[data-popper-placement*="top"] &`]:{transformOrigin:"center bottom",marginBottom:"14px"},[`.${$t.popper}[data-popper-placement*="bottom"] &`]:{transformOrigin:"center top",marginTop:"14px"},variants:[{props:({ownerState:t})=>t.arrow,style:{position:"relative",margin:0}},{props:({ownerState:t})=>t.touch,style:{padding:"8px 16px",fontSize:e.typography.pxToRem(14),lineHeight:`${R8(16/14)}em`,fontWeight:e.typography.fontWeightRegular}},{props:({ownerState:t})=>!t.isRtl,style:{[`.${$t.popper}[data-popper-placement*="left"] &`]:{marginRight:"14px"},[`.${$t.popper}[data-popper-placement*="right"] &`]:{marginLeft:"14px"}}},{props:({ownerState:t})=>!t.isRtl&&t.touch,style:{[`.${$t.popper}[data-popper-placement*="left"] &`]:{marginRight:"24px"},[`.${$t.popper}[data-popper-placement*="right"] &`]:{marginLeft:"24px"}}},{props:({ownerState:t})=>!!t.isRtl,style:{[`.${$t.popper}[data-popper-placement*="left"] &`]:{marginLeft:"14px"},[`.${$t.popper}[data-popper-placement*="right"] &`]:{marginRight:"14px"}}},{props:({ownerState:t})=>!!t.isRtl&&t.touch,style:{[`.${$t.popper}[data-popper-placement*="left"] &`]:{marginLeft:"24px"},[`.${$t.popper}[data-popper-placement*="right"] &`]:{marginRight:"24px"}}},{props:({ownerState:t})=>t.touch,style:{[`.${$t.popper}[data-popper-placement*="top"] &`]:{marginBottom:"24px"}}},{props:({ownerState:t})=>t.touch,style:{[`.${$t.popper}[data-popper-placement*="bottom"] &`]:{marginTop:"24px"}}}]}))),M8=M("span",{name:"MuiTooltip",slot:"Arrow"})(J(({theme:e})=>({overflow:"hidden",position:"absolute",width:"1em",height:"0.71em",boxSizing:"border-box",color:e.vars?e.vars.palette.Tooltip.bg:e.alpha(e.palette.grey[700],.9),"&::before":{content:'""',margin:"auto",display:"block",width:"100%",height:"100%",backgroundColor:"currentColor",transform:"rotate(45deg)"}}))),rh=!1,fw=new Pp,Pf={x:0,y:0};function nh(e,t){return(o,...r)=>{t&&t(o,...r),e(o,...r)}}var A8=to.forwardRef(function(t,o){let r=G({props:t,name:"MuiTooltip"}),{arrow:n=!1,children:a,classes:s,components:i={},componentsProps:l={},describeChild:p=!1,disableFocusListener:c=!1,disableHoverListener:d=!1,disableInteractive:f=!1,disableTouchListener:u=!1,enterDelay:g=100,enterNextDelay:b=0,enterTouchDelay:x=700,followCursor:m=!1,id:y,leaveDelay:h=0,leaveTouchDelay:T=1500,onClose:S,onOpen:C,open:E,placement:R="bottom",PopperComponent:O,PopperProps:w={},slotProps:A={},slots:v={},title:N,TransitionComponent:k,TransitionProps:z,...j}=r,W=to.isValidElement(a)?a:(0,zs.jsx)("span",{children:a}),Z=qt(),X=vs(),[de,me]=to.useState(),[fe,ie]=to.useState(null),we=to.useRef(!1),Te=f||m,le=ar(),Pe=ar(),ye=ar(),Oe=ar(),[he,ge]=Da({controlled:E,default:!1,name:"Tooltip",state:"open"}),be=he,H=_i(y),U=to.useRef(),Se=xs(()=>{U.current!==void 0&&(document.body.style.WebkitUserSelect=U.current,U.current=void 0),Oe.clear()});to.useEffect(()=>Se,[Se]);let De=Ee=>{fw.clear(),rh=!0,ge(!0),C&&!be&&C(Ee)},Ce=xs(Ee=>{fw.start(800+h,()=>{rh=!1}),ge(!1),S&&be&&S(Ee),le.start(Z.transitions.duration.shortest,()=>{we.current=!1})}),_e=Ee=>{we.current&&Ee.type!=="touchstart"||(de&&de.removeAttribute("title"),Pe.clear(),ye.clear(),g||rh&&b?Pe.start(rh?b:g,()=>{De(Ee)}):De(Ee))},He=Ee=>{Pe.clear(),ye.start(h,()=>{Ce(Ee)})},[,ot]=to.useState(!1),ne=Ee=>{let uo=Ee?.target??de;if(!uo||!Mn(uo)){ot(!1);let fs=Ee??new Event("blur");!Ee&&uo&&(Object.defineProperty(fs,"target",{value:uo}),Object.defineProperty(fs,"currentTarget",{value:uo})),He(fs)}},te=Ee=>{de||me(Ee.currentTarget),Mn(Ee.target)&&(ot(!0),_e(Ee))},Me=Ee=>{we.current=!0;let uo=W.props;uo.onTouchStart&&uo.onTouchStart(Ee)},je=Ee=>{Me(Ee),ye.clear(),le.clear(),Se(),U.current=document.body.style.WebkitUserSelect,document.body.style.WebkitUserSelect="none",Oe.start(x,()=>{document.body.style.WebkitUserSelect=U.current,_e(Ee)})},Mt=Ee=>{W.props.onTouchEnd&&W.props.onTouchEnd(Ee),Se(),ye.start(T,()=>{Ce(Ee)})};to.useEffect(()=>{if(!be)return;function Ee(uo){uo.key==="Escape"&&Ce(uo)}return document.addEventListener("keydown",Ee),()=>{document.removeEventListener("keydown",Ee)}},[Ce,be]);let Fe=kt(Yo(W),me,o);!N&&N!==0&&(be=!1);let Ne=to.useRef(),Ae=Ee=>{let uo=W.props;uo.onMouseMove&&uo.onMouseMove(Ee),Pf={x:Ee.clientX,y:Ee.clientY},Ne.current&&Ne.current.update()},rt={},Ot=typeof N=="string";p?(rt.title=!be&&Ot&&!d?N:null,rt["aria-describedby"]=be?H:null):(rt["aria-label"]=Ot?N:null,rt["aria-labelledby"]=be&&!Ot?H:null);let Re={...rt,...j,...W.props,className:B(j.className,W.props.className),onTouchStart:Me,ref:Fe,...m?{onMouseMove:Ae}:{}},Ft={};u||(Re.onTouchStart=je,Re.onTouchEnd=Mt),d||(Re.onMouseOver=nh(_e,Re.onMouseOver),Re.onMouseLeave=nh(He,Re.onMouseLeave),Te||(Ft.onMouseOver=_e,Ft.onMouseLeave=He)),c||(Re.onFocus=nh(te,Re.onFocus),Re.onBlur=nh(ne,Re.onBlur),Te||(Ft.onFocus=te,Ft.onBlur=ne));let Nt={...r,isRtl:X,arrow:n,disableInteractive:Te,placement:R,PopperComponentProp:O,touch:we.current},Qr=typeof A.popper=="function"?A.popper(Nt):A.popper,Kn=to.useMemo(()=>{let Ee=[{name:"arrow",enabled:!!fe,options:{element:fe,padding:4}}];return w.popperOptions?.modifiers&&(Ee=Ee.concat(w.popperOptions.modifiers)),Qr?.popperOptions?.modifiers&&(Ee=Ee.concat(Qr.popperOptions.modifiers)),{...w.popperOptions,...Qr?.popperOptions,modifiers:Ee}},[fe,w.popperOptions,Qr?.popperOptions]),gr=w8(Nt),Ca=typeof A.transition=="function"?A.transition(Nt):A.transition,Qn={slots:{popper:i.Popper,transition:i.Transition??k,tooltip:i.Tooltip,arrow:i.Arrow,...v},slotProps:{arrow:A.arrow??l.arrow,popper:{...w,...Qr??l.popper},tooltip:A.tooltip??l.tooltip,transition:{...z,...Ca??l.transition}}},[Zr,ve]=pe("popper",{elementType:O8,externalForwardedProps:Qn,ownerState:Nt,className:B(gr.popper,w?.className)}),[qe,Bt]=pe("transition",{elementType:nl,externalForwardedProps:Qn,ownerState:Nt}),[Q,Ge]=pe("tooltip",{elementType:N8,className:gr.tooltip,externalForwardedProps:Qn,ownerState:Nt}),[Lt,Ea]=pe("arrow",{elementType:M8,className:gr.arrow,externalForwardedProps:Qn,ownerState:Nt,ref:ie});return(0,zs.jsxs)(to.Fragment,{children:[to.cloneElement(W,Re),(0,zs.jsx)(Zr,{as:O??vy,placement:R,anchorEl:m?{getBoundingClientRect:()=>({top:Pf.y,left:Pf.x,right:Pf.x,bottom:Pf.y,width:0,height:0})}:de,popperRef:Ne,open:de?be:!1,id:H,transition:!0,...Ft,...ve,popperOptions:Kn,children:({TransitionProps:Ee})=>(0,zs.jsx)(qe,{timeout:Z.transitions.duration.shorter,...Ee,...Bt,children:(0,zs.jsxs)(Q,{...Ge,children:[N,n?(0,zs.jsx)(Lt,{...Ea}):null]})})})]})}),$n=A8;var k8=zm({createStyledComponent:M("div",{name:"MuiStack",slot:"Root"}),useThemeProps:e=>G({props:e,name:"MuiStack"})}),ce=k8;var Bs=P(L(),1);var Ov=P(L(),1),_8=Ov.createContext({});var js=_8;var Nv=P(L(),1),D8=Nv.createContext({});var Jp=D8;function dw(e){return V("MuiStep",e)}var W1e=q("MuiStep",["root","horizontal","vertical","alternativeLabel","completed"]);var Sf=P(_(),1),z8=e=>{let{classes:t,orientation:o,alternativeLabel:r,completed:n}=e;return F({root:["root",o,r&&"alternativeLabel",n&&"completed"]},dw,t)},j8=M("div",{name:"MuiStep",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,t[o.orientation],o.alternativeLabel&&t.alternativeLabel,o.completed&&t.completed]}})({variants:[{props:{orientation:"horizontal"},style:{paddingLeft:8,paddingRight:8}},{props:{alternativeLabel:!0},style:{flex:1,position:"relative"}}]}),B8=Bs.forwardRef(function(t,o){let r=G({props:t,name:"MuiStep"}),{active:n,children:a,className:s,component:i="div",completed:l,disabled:p,expanded:c=!1,index:d,last:f,...u}=r,{activeStep:g,connector:b,alternativeLabel:x,orientation:m,nonLinear:y}=Bs.useContext(js),[h=!1,T=!1,S=!1]=[n,l,p];g===d?h=n!==void 0?n:!0:!y&&g>d?T=l!==void 0?l:!0:!y&&g({index:d,last:f,expanded:c,icon:d+1,active:h,completed:T,disabled:S}),[d,f,c,h,T,S]),E={...r,active:h,orientation:m,alternativeLabel:x,completed:T,disabled:S,expanded:c,component:i},R=z8(E),O=(0,Sf.jsxs)(j8,{as:i,className:B(R.root,s),ref:o,ownerState:E,...u,children:[b&&x&&d!==0?b:null,a]});return(0,Sf.jsx)(Jp.Provider,{value:C,children:b&&!x&&d!==0?(0,Sf.jsxs)(Bs.Fragment,{children:[b,O]}):O})}),ah=B8;var Cf=P(L(),1);var vw=P(L(),1);var mw=P(_(),1),yw=ae((0,mw.jsx)("path",{d:"M12 0a12 12 0 1 0 0 24 12 12 0 0 0 0-24zm-2 17l-5-5 1.4-1.4 3.6 3.6 7.6-7.6L19 8l-9 9z"}),"CheckCircle");var hw=P(_(),1),gw=ae((0,hw.jsx)("path",{d:"M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"}),"Warning");function Tw(e){return V("MuiStepIcon",e)}var L8=q("MuiStepIcon",["root","active","completed","error","text"]),sh=L8;var al=P(_(),1),bw,U8=e=>{let{classes:t,active:o,completed:r,error:n}=e;return F({root:["root",o&&"active",r&&"completed",n&&"error"],text:["text"]},Tw,t)},Mv=M(dp,{name:"MuiStepIcon",slot:"Root"})(J(({theme:e})=>({display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),color:(e.vars||e).palette.text.disabled,[`&.${sh.completed}, &.${sh.active}`]:{color:(e.vars||e).palette.primary.main},[`&.${sh.error}`]:{color:(e.vars||e).palette.error.main}}))),I8=M("text",{name:"MuiStepIcon",slot:"Text"})(J(({theme:e})=>({fill:(e.vars||e).palette.primary.contrastText,fontSize:e.typography.caption.fontSize,fontFamily:e.typography.fontFamily}))),$8=vw.forwardRef(function(t,o){let r=G({props:t,name:"MuiStepIcon"}),{active:n=!1,className:a,completed:s=!1,error:i=!1,icon:l,...p}=r,c={...r,active:n,completed:s,error:i},d=U8(c);if(typeof l=="number"||typeof l=="string"){let f=B(a,d.root);return i?(0,al.jsx)(Mv,{as:gw,className:f,ref:o,ownerState:c,...p}):s?(0,al.jsx)(Mv,{as:yw,className:f,ref:o,ownerState:c,...p}):(0,al.jsxs)(Mv,{className:f,ref:o,ownerState:c,...p,children:[bw||(bw=(0,al.jsx)("circle",{cx:"12",cy:"12",r:"12"})),(0,al.jsx)(I8,{className:d.text,x:"12",y:"12",textAnchor:"middle",dominantBaseline:"central",ownerState:c,children:l})]})}return l}),Av=$8;function xw(e){return V("MuiStepLabel",e)}var H8=q("MuiStepLabel",["root","horizontal","vertical","label","active","completed","error","disabled","iconContainer","alternativeLabel","labelContainer"]),Wa=H8;var sl=P(_(),1),V8=e=>{let{classes:t,orientation:o,active:r,completed:n,error:a,disabled:s,alternativeLabel:i}=e;return F({root:["root",o,a&&"error",s&&"disabled",i&&"alternativeLabel"],label:["label",r&&"active",n&&"completed",a&&"error",s&&"disabled",i&&"alternativeLabel"],iconContainer:["iconContainer",r&&"active",n&&"completed",a&&"error",s&&"disabled",i&&"alternativeLabel"],labelContainer:["labelContainer",i&&"alternativeLabel"]},xw,t)},F8=M("span",{name:"MuiStepLabel",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,t[o.orientation]]}})({display:"flex",alignItems:"center",[`&.${Wa.alternativeLabel}`]:{flexDirection:"column"},[`&.${Wa.disabled}`]:{cursor:"default"},variants:[{props:{orientation:"vertical"},style:{textAlign:"left",padding:"8px 0"}}]}),q8=M("span",{name:"MuiStepLabel",slot:"Label"})(J(({theme:e})=>({...e.typography.body2,display:"block",transition:e.transitions.create("color",{duration:e.transitions.duration.shortest}),[`&.${Wa.active}, &.${Wa.completed}`]:{color:(e.vars||e).palette.text.primary,fontWeight:500},[`&.${Wa.alternativeLabel}`]:{marginTop:16},[`&.${Wa.error}`]:{color:(e.vars||e).palette.error.main}}))),G8=M("span",{name:"MuiStepLabel",slot:"IconContainer"})({flexShrink:0,display:"flex",paddingRight:8,[`&.${Wa.alternativeLabel}`]:{paddingRight:0}}),Y8=M("span",{name:"MuiStepLabel",slot:"LabelContainer"})(J(({theme:e})=>({width:"100%",color:(e.vars||e).palette.text.secondary,[`&.${Wa.alternativeLabel}`]:{textAlign:"center"}}))),Pw=Cf.forwardRef(function(t,o){let r=G({props:t,name:"MuiStepLabel"}),{children:n,className:a,componentsProps:s={},error:i=!1,icon:l,optional:p,slots:c={},slotProps:d={},StepIconComponent:f,StepIconProps:u,...g}=r,{alternativeLabel:b,orientation:x}=Cf.useContext(js),{active:m,disabled:y,completed:h,icon:T}=Cf.useContext(Jp),S=l||T,C=f;S&&!C&&(C=Av);let E={...r,active:m,alternativeLabel:b,completed:h,disabled:y,error:i,orientation:x},R=V8(E),O={slots:c,slotProps:{stepIcon:u,...s,...d}},[w,A]=pe("root",{elementType:F8,externalForwardedProps:{...O,...g},ownerState:E,ref:o,className:B(R.root,a)}),[v,N]=pe("label",{elementType:q8,externalForwardedProps:O,ownerState:E}),[k,z]=pe("stepIcon",{elementType:C,externalForwardedProps:O,ownerState:E});return(0,sl.jsxs)(w,{...A,children:[S||k?(0,sl.jsx)(G8,{className:R.iconContainer,ownerState:E,children:(0,sl.jsx)(k,{completed:h,active:m,error:i,icon:S,...z})}):null,(0,sl.jsxs)(Y8,{className:R.labelContainer,ownerState:E,children:[n?(0,sl.jsx)(v,{...N,className:B(R.label,N?.className),children:n}):null,p]})]})});Pw.muiName="StepLabel";var ih=Pw;var Ef=P(L(),1);function Sw(e){return V("MuiStepConnector",e)}var YPe=q("MuiStepConnector",["root","horizontal","vertical","alternativeLabel","active","completed","disabled","line","lineHorizontal","lineVertical"]);var kv=P(_(),1),W8=e=>{let{classes:t,orientation:o,alternativeLabel:r,active:n,completed:a,disabled:s}=e,i={root:["root",o,r&&"alternativeLabel",n&&"active",a&&"completed",s&&"disabled"],line:["line",`line${I(o)}`]};return F(i,Sw,t)},X8=M("div",{name:"MuiStepConnector",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,t[o.orientation],o.alternativeLabel&&t.alternativeLabel,o.completed&&t.completed]}})({flex:"1 1 auto",variants:[{props:{orientation:"vertical"},style:{marginLeft:12}},{props:{alternativeLabel:!0},style:{position:"absolute",top:12,left:"calc(-50% + 20px)",right:"calc(50% + 20px)"}}]}),K8=M("span",{name:"MuiStepConnector",slot:"Line",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.line,t[`line${I(o.orientation)}`]]}})(J(({theme:e})=>{let t=e.palette.mode==="light"?e.palette.grey[400]:e.palette.grey[600];return{display:"block",borderColor:e.vars?e.vars.palette.StepConnector.border:t,variants:[{props:{orientation:"horizontal"},style:{borderTopStyle:"solid",borderTopWidth:1}},{props:{orientation:"vertical"},style:{borderLeftStyle:"solid",borderLeftWidth:1,minHeight:24}}]}})),Q8=Ef.forwardRef(function(t,o){let r=G({props:t,name:"MuiStepConnector"}),{className:n,...a}=r,{alternativeLabel:s,orientation:i="horizontal"}=Ef.useContext(js),{active:l,disabled:p,completed:c}=Ef.useContext(Jp),d={...r,alternativeLabel:s,orientation:i,active:l,completed:c,disabled:p},f=W8(d);return(0,kv.jsx)(X8,{className:B(f.root,n),ref:o,ownerState:d,...a,children:(0,kv.jsx)(K8,{className:f.line,ownerState:d})})}),_v=Q8;var Ls=P(L(),1);function Cw(e){return V("MuiStepper",e)}var cSe=q("MuiStepper",["root","horizontal","vertical","nonLinear","alternativeLabel"]);var lh=P(_(),1),Z8=e=>{let{orientation:t,nonLinear:o,alternativeLabel:r,classes:n}=e;return F({root:["root",t,o&&"nonLinear",r&&"alternativeLabel"]},Cw,n)},J8=M("div",{name:"MuiStepper",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,t[o.orientation],o.alternativeLabel&&t.alternativeLabel,o.nonLinear&&t.nonLinear]}})({display:"flex",variants:[{props:{orientation:"horizontal"},style:{flexDirection:"row",alignItems:"center"}},{props:{orientation:"vertical"},style:{flexDirection:"column"}},{props:{alternativeLabel:!0},style:{alignItems:"flex-start"}}]}),eU=(0,lh.jsx)(_v,{}),tU=Ls.forwardRef(function(t,o){let r=G({props:t,name:"MuiStepper"}),{activeStep:n=0,alternativeLabel:a=!1,children:s,className:i,component:l="div",connector:p=eU,nonLinear:c=!1,orientation:d="horizontal",...f}=r,u={...r,nonLinear:c,alternativeLabel:a,orientation:d,component:l},g=Z8(u),b=Ls.Children.toArray(s).filter(Boolean),x=b.map((y,h)=>Ls.cloneElement(y,{index:h,last:h+1===b.length,...y.props})),m=Ls.useMemo(()=>({activeStep:n,alternativeLabel:a,connector:p,nonLinear:c,orientation:d}),[n,a,p,c,d]);return(0,lh.jsx)(js.Provider,{value:m,children:(0,lh.jsx)(J8,{as:l,ownerState:u,className:B(g.root,i),ref:o,...f,children:x})})}),ph=tU;var uh=P(L(),1);var Ew=P(L(),1),oU=Ew.createContext(),ch=oU;function Rw(e){return V("MuiTable",e)}var wSe=q("MuiTable",["root","stickyHeader"]);var Dv=P(_(),1),rU=e=>{let{classes:t,stickyHeader:o}=e;return F({root:["root",o&&"stickyHeader"]},Rw,t)},nU=M("table",{name:"MuiTable",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,o.stickyHeader&&t.stickyHeader]}})(J(({theme:e})=>({display:"table",width:"100%",borderCollapse:"collapse",borderSpacing:0,"& caption":{...e.typography.body2,padding:e.spacing(2),color:(e.vars||e).palette.text.secondary,textAlign:"left",captionSide:"bottom"},variants:[{props:({ownerState:t})=>t.stickyHeader,style:{borderCollapse:"separate"}}]}))),ww="table",aU=uh.forwardRef(function(t,o){let r=G({props:t,name:"MuiTable"}),{className:n,component:a=ww,padding:s="normal",size:i="medium",stickyHeader:l=!1,...p}=r,c={...r,component:a,padding:s,size:i,stickyHeader:l},d=rU(c),f=uh.useMemo(()=>({padding:s,size:i,stickyHeader:l}),[s,i,l]);return(0,Dv.jsx)(ch.Provider,{value:f,children:(0,Dv.jsx)(nU,{as:a,role:a===ww?null:"table",ref:o,className:B(d.root,n),ownerState:c,...p})})}),ec=aU;var Aw=P(L(),1);var Ow=P(L(),1),sU=Ow.createContext(),Us=sU;function Nw(e){return V("MuiTableBody",e)}var VSe=q("MuiTableBody",["root"]);var zv=P(_(),1),iU=e=>{let{classes:t}=e;return F({root:["root"]},Nw,t)},lU=M("tbody",{name:"MuiTableBody",slot:"Root"})({display:"table-row-group"}),pU={variant:"body"},Mw="tbody",cU=Aw.forwardRef(function(t,o){let r=G({props:t,name:"MuiTableBody"}),{className:n,component:a=Mw,...s}=r,i={...r,component:a},l=iU(i);return(0,zv.jsx)(Us.Provider,{value:pU,children:(0,zv.jsx)(lU,{className:B(l.root,n),as:a,ref:o,role:a===Mw?null:"rowgroup",ownerState:i,...s})})}),tc=cU;var Rf=P(L(),1);function kw(e){return V("MuiTableCell",e)}var uU=q("MuiTableCell",["root","head","body","footer","sizeSmall","sizeMedium","paddingCheckbox","paddingNone","alignLeft","alignCenter","alignRight","alignJustify","stickyHeader"]),_w=uU;var Dw=P(_(),1),fU=e=>{let{classes:t,variant:o,align:r,padding:n,size:a,stickyHeader:s}=e,i={root:["root",o,s&&"stickyHeader",r!=="inherit"&&`align${I(r)}`,n!=="normal"&&`padding${I(n)}`,`size${I(a)}`]};return F(i,kw,t)},dU=M("td",{name:"MuiTableCell",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,t[o.variant],t[`size${I(o.size)}`],o.padding!=="normal"&&t[`padding${I(o.padding)}`],o.align!=="inherit"&&t[`align${I(o.align)}`],o.stickyHeader&&t.stickyHeader]}})(J(({theme:e})=>({...e.typography.body2,display:"table-cell",verticalAlign:"inherit",borderBottom:e.vars?`1px solid ${e.vars.palette.TableCell.border}`:`1px solid ${e.palette.mode==="light"?e.lighten(e.alpha(e.palette.divider,1),.88):e.darken(e.alpha(e.palette.divider,1),.68)}`,textAlign:"left",padding:16,variants:[{props:{variant:"head"},style:{color:(e.vars||e).palette.text.primary,lineHeight:e.typography.pxToRem(24),fontWeight:e.typography.fontWeightMedium}},{props:{variant:"body"},style:{color:(e.vars||e).palette.text.primary}},{props:{variant:"footer"},style:{color:(e.vars||e).palette.text.secondary,lineHeight:e.typography.pxToRem(21),fontSize:e.typography.pxToRem(12)}},{props:{size:"small"},style:{padding:"6px 16px",[`&.${_w.paddingCheckbox}`]:{width:24,padding:"0 12px 0 16px","& > *":{padding:0}}}},{props:{padding:"checkbox"},style:{width:48,padding:"0 0 0 4px"}},{props:{padding:"none"},style:{padding:0}},{props:{align:"left"},style:{textAlign:"left"}},{props:{align:"center"},style:{textAlign:"center"}},{props:{align:"right"},style:{textAlign:"right",flexDirection:"row-reverse"}},{props:{align:"justify"},style:{textAlign:"justify"}},{props:({ownerState:t})=>t.stickyHeader,style:{position:"sticky",top:0,zIndex:2,backgroundColor:(e.vars||e).palette.background.default}}]}))),mU=Rf.forwardRef(function(t,o){let r=G({props:t,name:"MuiTableCell"}),{align:n="inherit",className:a,component:s,padding:i,scope:l,size:p,sortDirection:c,variant:d,...f}=r,u=Rf.useContext(ch),g=Rf.useContext(Us),b=g&&g.variant==="head",x;s?x=s:x=b?"th":"td";let m=l;x==="td"?m=void 0:!m&&b&&(m="col");let y=d||g&&g.variant,h={...r,align:n,component:x,padding:i||(u&&u.padding?u.padding:"normal"),size:p||(u&&u.size?u.size:"medium"),sortDirection:c,stickyHeader:y==="head"&&u&&u.stickyHeader,variant:y},T=fU(h),S=null;return c&&(S=c==="asc"?"ascending":"descending"),(0,Dw.jsx)(dU,{as:x,ref:o,className:B(T.root,a),"aria-sort":S,scope:m,ownerState:h,...f})}),io=mU;var jw=P(L(),1);function zw(e){return V("MuiTableContainer",e)}var bCe=q("MuiTableContainer",["root"]);var Bw=P(_(),1),yU=e=>{let{classes:t}=e;return F({root:["root"]},zw,t)},hU=M("div",{name:"MuiTableContainer",slot:"Root"})({width:"100%",overflowX:"auto"}),gU=jw.forwardRef(function(t,o){let r=G({props:t,name:"MuiTableContainer"}),{className:n,component:a="div",...s}=r,i={...r,component:a},l=yU(i);return(0,Bw.jsx)(hU,{ref:o,as:a,className:B(l.root,n),ownerState:i,...s})}),oc=gU;var Iw=P(L(),1);function Lw(e){return V("MuiTableHead",e)}var kCe=q("MuiTableHead",["root"]);var jv=P(_(),1),TU=e=>{let{classes:t}=e;return F({root:["root"]},Lw,t)},bU=M("thead",{name:"MuiTableHead",slot:"Root"})({display:"table-header-group"}),vU={variant:"head"},Uw="thead",xU=Iw.forwardRef(function(t,o){let r=G({props:t,name:"MuiTableHead"}),{className:n,component:a=Uw,...s}=r,i={...r,component:a},l=TU(i);return(0,jv.jsx)(Us.Provider,{value:vU,children:(0,jv.jsx)(bU,{as:a,className:B(l.root,n),ref:o,role:a===Uw?null:"rowgroup",ownerState:i,...s})})}),rc=xU;var fh=P(L(),1);function $w(e){return V("MuiTableRow",e)}var PU=q("MuiTableRow",["root","selected","hover","head","footer"]),Bv=PU;var Vw=P(_(),1),SU=e=>{let{classes:t,selected:o,hover:r,head:n,footer:a}=e;return F({root:["root",o&&"selected",r&&"hover",n&&"head",a&&"footer"]},$w,t)},CU=M("tr",{name:"MuiTableRow",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:o}=e;return[t.root,o.head&&t.head,o.footer&&t.footer]}})(J(({theme:e})=>({color:"inherit",display:"table-row",verticalAlign:"middle",outline:0,[`&.${Bv.hover}:hover`]:{backgroundColor:(e.vars||e).palette.action.hover},[`&.${Bv.selected}`]:{backgroundColor:e.alpha((e.vars||e).palette.primary.main,(e.vars||e).palette.action.selectedOpacity),"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.primary.main,`${(e.vars||e).palette.action.selectedOpacity} + ${(e.vars||e).palette.action.hoverOpacity}`)}}}))),Hw="tr",EU=fh.forwardRef(function(t,o){let r=G({props:t,name:"MuiTableRow"}),{className:n,component:a=Hw,hover:s=!1,selected:i=!1,...l}=r,p=fh.useContext(Us),c={...r,component:a,hover:s,selected:i,head:p&&p.variant==="head",footer:p&&p.variant==="footer"},d=SU(c);return(0,Vw.jsx)(CU,{as:a,ref:o,className:B(d.root,n),role:a===Hw?null:"row",ownerState:c,...l})}),Xa=EU;var qw=P(L(),1);function Fw(e){return V("MuiTextField",e)}var s2e=q("MuiTextField",["root"]);var il=P(_(),1),RU={standard:uf,filled:pf,outlined:Tf},wU=e=>{let{classes:t}=e;return F({root:["root"]},Fw,t)},OU=M(Zb,{name:"MuiTextField",slot:"Root"})({}),NU=qw.forwardRef(function(t,o){let r=G({props:t,name:"MuiTextField"}),{autoComplete:n,autoFocus:a=!1,children:s,className:i,color:l="primary",defaultValue:p,disabled:c=!1,error:d=!1,FormHelperTextProps:f,fullWidth:u=!1,helperText:g,id:b,InputLabelProps:x,inputProps:m,InputProps:y,inputRef:h,label:T,maxRows:S,minRows:C,multiline:E=!1,name:R,onBlur:O,onChange:w,onFocus:A,placeholder:v,required:N=!1,rows:k,select:z=!1,SelectProps:j,slots:W={},slotProps:Z={},type:X,value:de,variant:me="outlined",...fe}=r,ie={...r,autoFocus:a,color:l,disabled:c,error:d,fullWidth:u,multiline:E,required:N,select:z,variant:me},we=wU(ie),Te=rn(b),le=g&&Te?`${Te}-helper-text`:void 0,Pe=T&&Te?`${Te}-label`:void 0,ye=RU[me],Oe={slots:W,slotProps:{input:y,inputLabel:x,htmlInput:m,formHelperText:f,select:j,...Z}},he={},ge=Oe.slotProps.inputLabel;me==="outlined"&&(ge&&typeof ge.shrink<"u"&&(he.notched=ge.shrink),he.label=T),z&&((!j||!j.native)&&(he.id=void 0),he["aria-describedby"]=void 0);let[be,H]=pe("root",{elementType:OU,shouldForwardComponentProp:!0,externalForwardedProps:{...Oe,...fe},ownerState:ie,className:B(we.root,i),ref:o,additionalProps:{disabled:c,error:d,fullWidth:u,required:N,color:l,variant:me}}),[U,Se]=pe("input",{elementType:ye,externalForwardedProps:Oe,additionalProps:he,ownerState:ie}),[De,Ce]=pe("inputLabel",{elementType:av,externalForwardedProps:Oe,ownerState:ie}),[_e,He]=pe("htmlInput",{elementType:"input",externalForwardedProps:Oe,ownerState:ie}),[ot,ne]=pe("formHelperText",{elementType:tv,externalForwardedProps:Oe,ownerState:ie}),[te,Me]=pe("select",{elementType:Sv,externalForwardedProps:Oe,ownerState:ie}),je=(0,il.jsx)(U,{"aria-describedby":le,autoComplete:n,autoFocus:a,defaultValue:p,fullWidth:u,multiline:E,name:R,rows:k,maxRows:S,minRows:C,type:X,value:de,id:Te,inputRef:h,onBlur:O,onChange:w,onFocus:A,placeholder:v,inputProps:He,slots:{input:W.htmlInput?_e:void 0},...Se});return(0,il.jsxs)(be,{...H,children:[T!=null&&T!==""&&(0,il.jsx)(De,{htmlFor:Te,id:Pe,...Ce,children:T}),z?(0,il.jsx)(te,{"aria-describedby":le,id:Te,labelId:Pe,value:de,input:je,...Me,children:s}):je,g&&(0,il.jsx)(ot,{id:le,...ne,children:g})]})}),Ht=NU;var MU=LT({themeId:fo}),Lv=MU;var Gw=P(_(),1),Yw=ae((0,Gw.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"BlockOutlined");var Ww=P(_(),1),wf=ae((0,Ww.jsx)("path",{d:"M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2m0 16H8V7h11z"}),"ContentCopyOutlined");var Xw=P(_(),1),Kw=ae((0,Xw.jsx)("path",{d:"M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2m0 12H4V6h5.17l1.41 1.41.59.59H20zm-7.84-6H8v2h4.16l-1.59 1.59L11.99 17 16 13.01 11.99 9l-1.41 1.41z"}),"DriveFileMoveOutlined");var Qw=P(_(),1),Zw=ae((0,Qw.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded");var Jw=P(_(),1),eO=ae((0,Jw.jsx)("path",{d:"M16.59 9H15V4c0-.55-.45-1-1-1h-4c-.55 0-1 .45-1 1v5H7.41c-.89 0-1.34 1.08-.71 1.71l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.63-.63.19-1.71-.7-1.71M5 19c0 .55.45 1 1 1h12c.55 0 1-.45 1-1s-.45-1-1-1H6c-.55 0-1 .45-1 1"}),"DownloadRounded");var tO=P(_(),1),oO=ae((0,tO.jsx)("path",{d:"M17.65 6.35c-1.63-1.63-3.94-2.57-6.48-2.31-3.67.37-6.69 3.35-7.1 7.02C3.52 15.91 7.27 20 12 20c3.19 0 5.93-1.87 7.21-4.56.32-.67-.16-1.44-.9-1.44-.37 0-.72.2-.88.53-1.13 2.43-3.84 3.97-6.8 3.31-2.22-.49-4.01-2.3-4.48-4.52C5.31 9.44 8.26 6 12 6c1.66 0 3.14.69 4.22 1.78l-1.51 1.51c-.63.63-.19 1.71.7 1.71H19c.55 0 1-.45 1-1V6.41c0-.89-1.08-1.34-1.71-.71z"}),"RefreshRounded");var rO=P(_(),1),Uv=ae((0,rO.jsx)("path",{d:"M22 10V6c0-1.11-.9-2-2-2H4c-1.1 0-1.99.89-1.99 2v4c1.1 0 1.99.9 1.99 2s-.89 2-2 2v4c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-4c-1.1 0-2-.9-2-2s.9-2 2-2m-2-1.46c-1.19.69-2 1.99-2 3.46s.81 2.77 2 3.46V18H4v-2.54c1.19-.69 2-1.99 2-3.46 0-1.48-.8-2.77-1.99-3.46L4 6h16zM11 15h2v2h-2zm0-4h2v2h-2zm0-4h2v2h-2z"}),"ConfirmationNumberOutlined");var uM=P(L(),1),fM=P(nM(),1);var yOe=P(L(),1);var aM=P(_(),1),sM=ae((0,aM.jsx)("path",{d:"M12 1.27a11 11 0 00-3.48 21.46c.55.09.73-.28.73-.55v-1.84c-3.03.64-3.67-1.46-3.67-1.46-.55-1.29-1.28-1.65-1.28-1.65-.92-.65.1-.65.1-.65 1.1 0 1.73 1.1 1.73 1.1.92 1.65 2.57 1.2 3.21.92a2 2 0 01.64-1.47c-2.47-.27-5.04-1.19-5.04-5.5 0-1.1.46-2.1 1.2-2.84a3.76 3.76 0 010-2.93s.91-.28 3.11 1.1c1.8-.49 3.7-.49 5.5 0 2.1-1.38 3.02-1.1 3.02-1.1a3.76 3.76 0 010 2.93c.83.74 1.2 1.74 1.2 2.94 0 4.21-2.57 5.13-5.04 5.4.45.37.82.92.82 2.02v3.03c0 .27.1.64.73.55A11 11 0 0012 1.27"}),"GitHub");var Nd={light:{primary:{main:"#415F91",light:"#D6E3FF",dark:"#284777",contrastText:"#FFFFFF"},secondary:{main:"#875078",light:"#FFD7EF",dark:"#6C395F",contrastText:"#FFFFFF"},background:{default:"#F5F5F5",paper:"#FFFFFF"},text:{primary:"#1C1C1C",secondary:"#484848"},success:{main:"#326B43",contrastText:"#FFFFFF"},warning:{main:"#805600",contrastText:"#FFFFFF"},error:{main:"#BA1A1A",contrastText:"#FFFFFF"},info:{main:"#415F91",contrastText:"#FFFFFF"},divider:"#CACACA"},dark:{primary:{main:"#AAC7FF",light:"#D6E3FF",dark:"#7BA4DF",contrastText:"#0A305F"},secondary:{main:"#FAAFE0",light:"#FFD7EF",dark:"#DB94C3",contrastText:"#511F48"},background:{default:"#121212",paper:"#1E1E1E"},text:{primary:"#E6E6E6",secondary:"#C7C7C7"},success:{main:"#99D5A5",contrastText:"#003917"},warning:{main:"#F3BF61",contrastText:"#432C00"},error:{main:"#FFB4AB",contrastText:"#690005"},info:{main:"#AAC7FF",contrastText:"#0A305F"},divider:"#484848"}};var iM=ra({cssVariables:{colorSchemeSelector:"data"},colorSchemes:{light:{palette:Nd.light},dark:{palette:Nd.dark}},shape:{borderRadius:12},spacing:8,typography:{fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif',h1:{fontSize:"2.25rem",fontWeight:650,lineHeight:1.3,letterSpacing:"-0.025em"},h2:{fontSize:"1.5rem",fontWeight:650,lineHeight:1.4},h3:{fontSize:"1.125rem",fontWeight:650},button:{fontWeight:600,textTransform:"none"},body1:{lineHeight:1.75},body2:{lineHeight:1.65}},components:{MuiButton:{defaultProps:{disableElevation:!0},styleOverrides:{root:{borderRadius:24,minHeight:44,paddingInline:24}}},MuiIconButton:{styleOverrides:{root:{minWidth:44,minHeight:44}}},MuiPaper:{defaultProps:{elevation:0},styleOverrides:{root:{backgroundImage:"none"}}},MuiTextField:{defaultProps:{fullWidth:!0,variant:"outlined"}},MuiOutlinedInput:{styleOverrides:{root:{borderRadius:12},notchedOutline:({theme:e})=>({borderColor:e.vars.palette.text.secondary})}},MuiInputBase:{styleOverrides:{input:({theme:e})=>({"&::placeholder":{color:e.vars.palette.text.secondary,opacity:1}})}},MuiFormHelperText:{styleOverrides:{root:({theme:e})=>({fontSize:".8125rem","&.Mui-disabled":{color:e.vars.palette.text.secondary}})}},MuiStepIcon:{styleOverrides:{root:({theme:e})=>({color:e.vars.palette.text.secondary}),text:({theme:e})=>({fill:e.vars.palette.background.paper})}},MuiChip:{styleOverrides:{root:{fontWeight:600,maxWidth:"100%",height:"auto",minHeight:32},label:{whiteSpace:"normal",paddingBlock:4}}},MuiAlert:{styleOverrides:{root:{borderRadius:12},message:{minWidth:0,overflowWrap:"anywhere"}}},MuiCssBaseline:{styleOverrides:e=>({body:{minWidth:320,overflowWrap:"anywhere"},":focus-visible":{outline:`3px solid ${e.vars.palette.primary.main}`,outlineOffset:3},"@media (prefers-reduced-motion: reduce)":{html:{scrollBehavior:"auto"},".MuiLinearProgress-bar, .MuiTouchRipple-child, .MuiCircularProgress-root":{animation:"none",transition:"none"}}})}}});var Pa=P(L(),1);var Jo=P(_(),1),Qg=null,j1=new Set,lM=()=>j1.forEach(e=>e()),z$=e=>(j1.add(e),()=>{j1.delete(e)}),Md;function j$(){return window.turnstile?Promise.resolve(window.turnstile):Md||(Md=new Promise((e,t)=>{let o=document.createElement("script");o.src="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit",o.async=!0,o.nonce=document.querySelector('meta[name="csp-nonce"]')?.content||"";let r=setTimeout(()=>n(),15e3);function n(){clearTimeout(r),o.remove(),Md=void 0,t(new Error("\u9A8C\u8BC1\u7EC4\u4EF6\u52A0\u8F7D\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5\u3002"))}o.onerror=n,o.onload=()=>{clearTimeout(r),window.turnstile?e(window.turnstile):n()},document.head.appendChild(o)}),Md)}async function pM(e,t){let o=await fetch("/api/security",{cache:"no-store",signal:t??AbortSignal.timeout(1e4)});if(!o.ok)throw new Error("\u6682\u65F6\u65E0\u6CD5\u52A0\u8F7D\u4EBA\u673A\u9A8C\u8BC1\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");let r=await o.json();if(r.turnstile_enabled===!1)return"";if(r.turnstile_enabled!==!0||!r.turnstile_site_key)throw new Error("\u4EBA\u673A\u9A8C\u8BC1\u914D\u7F6E\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");if(Qg)throw new Error("\u8BF7\u5148\u5B8C\u6210\u6B63\u5728\u8FDB\u884C\u7684\u4EBA\u673A\u9A8C\u8BC1\u3002");return t?.throwIfAborted(),new Promise((n,a)=>{let s=!1,i=()=>p(""),l=setTimeout(i,12e4);function p(c){s||(s=!0,clearTimeout(l),t?.removeEventListener("abort",i),Qg=null,lM(),c?n(c):a(new Error("\u4EBA\u673A\u9A8C\u8BC1\u672A\u5B8C\u6210\uFF0C\u672C\u6B21\u64CD\u4F5C\u5C1A\u672A\u63D0\u4EA4\uFF0C\u8BF7\u91CD\u8BD5\u3002")))}Qg={siteKey:r.turnstile_site_key,action:e,finish:p},t?.addEventListener("abort",i,{once:!0}),lM()})}function B$({challenge:e}){let t=(0,Pa.useRef)(null),[o,r]=(0,Pa.useState)(""),[n,a]=(0,Pa.useState)(!0),[s,i]=(0,Pa.useState)(0);return(0,Pa.useEffect)(()=>{let l=!0,p,c;return a(!0),r(""),j$().then(d=>{!l||!t.current||(c=d,p=c.render(t.current,{sitekey:e.siteKey,action:e.action,theme:"auto",size:window.innerWidth<380?"compact":"flexible","response-field":!1,callback:f=>{l&&e.finish(f)},"error-callback":()=>{l&&(a(!1),r("\u9A8C\u8BC1\u672A\u80FD\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5\uFF0C\u6216\u68C0\u67E5\u6D4F\u89C8\u5668\u662F\u5426\u62E6\u622A\u4E86\u9A8C\u8BC1\u7EC4\u4EF6\u3002"))},"expired-callback":()=>{l&&r("\u9A8C\u8BC1\u5DF2\u8FC7\u671F\uFF0C\u8BF7\u91CD\u65B0\u9A8C\u8BC1\u3002")},"timeout-callback":()=>{l&&r("\u9A8C\u8BC1\u8D85\u65F6\uFF0C\u8BF7\u91CD\u65B0\u9A8C\u8BC1\u3002")}}),a(!1))}).catch(d=>{l&&(a(!1),r(d.message))}),()=>{l=!1,p&&c&&c.remove(p)}},[e,s]),(0,Jo.jsxs)(ce,{spacing:2,children:[(0,Jo.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u8BF7\u5B8C\u6210 Cloudflare \u5B89\u5168\u9A8C\u8BC1\uFF0C\u901A\u8FC7\u540E\u4F1A\u7EE7\u7EED\u521A\u624D\u7684\u64CD\u4F5C\u3002"}),n&&(0,Jo.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",role:"status",children:[(0,Jo.jsx)(aa,{size:18}),(0,Jo.jsx)(D,{variant:"body2",children:"\u6B63\u5728\u52A0\u8F7D\u9A8C\u8BC1\u2026"})]}),(0,Jo.jsx)(oe,{ref:t,sx:{minHeight:65,minWidth:0}}),o&&(0,Jo.jsx)(ze,{severity:"warning",sx:{alignItems:"center","& .MuiAlert-action":{flexShrink:0}},action:(0,Jo.jsx)(ue,{color:"inherit",sx:{whiteSpace:"nowrap",minWidth:56},onClick:()=>i(l=>l+1),children:"\u91CD\u8BD5"}),children:o})]})}function cM(){let e=(0,Pa.useSyncExternalStore)(z$,()=>Qg,()=>null);return(0,Jo.jsxs)(lr,{open:!!e,onClose:()=>e?.finish(""),maxWidth:"xs",fullWidth:!0,"aria-labelledby":"human-verification-title",sx:{"& .MuiDialog-paper":{m:2,width:"calc(100% - 32px)"}},children:[(0,Jo.jsx)(ur,{id:"human-verification-title",children:"\u4EBA\u673A\u9A8C\u8BC1"}),(0,Jo.jsx)(cr,{sx:{px:2},children:e&&(0,Jo.jsx)(B$,{challenge:e})}),(0,Jo.jsx)(pr,{children:(0,Jo.jsx)(ue,{onClick:()=>e?.finish(""),children:"\u53D6\u6D88"})})]})}var Kt=P(_(),1);async function Sa(e,t,o){let r={"/api/redeem":"redeem","/api/check":"check","/api/manual-link":"manual_link"},n="";if(t!==void 0&&r[e])try{n=await pM(r[e],o),o?.throwIfAborted()}catch(i){return{ok:!1,data:{status:"verification_required",message:i instanceof Error&&i.name!=="TimeoutError"&&i.name!=="AbortError"?i.message:"\u4EBA\u673A\u9A8C\u8BC1\u5DF2\u8D85\u65F6\uFF0C\u672C\u6B21\u64CD\u4F5C\u5C1A\u672A\u63D0\u4EA4\uFF0C\u8BF7\u91CD\u8BD5\u3002"}}}let a=await fetch(e,{method:t===void 0?"GET":"POST",headers:t===void 0?void 0:{"Content-Type":"application/json",...n?{"X-Turnstile-Token":n}:{}},body:t===void 0?void 0:JSON.stringify(t),cache:"no-store",signal:o??AbortSignal.timeout(45e3)}),s;try{s=await a.json()}catch{throw new Error("\u670D\u52A1\u6682\u65F6\u4E0D\u53EF\u7528\uFF0C\u8BF7\u7A0D\u540E\u67E5\u8BE2\u3002")}return{ok:a.ok,data:s,status:a.status}}var B1=class extends uM.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){if(this.state.failed){let t=window.location.pathname.startsWith("/admin");return(0,Kt.jsxs)(nf,{sx:{py:8},children:[(0,Kt.jsx)(ze,{severity:"error",children:t?"\u7BA1\u7406\u9875\u6682\u65F6\u65E0\u6CD5\u663E\u793A\u3002\u8FDB\u884C\u4E2D\u7684\u5151\u6362\u4E0D\u53D7\u5F71\u54CD\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u540E\u7EE7\u7EED\u6838\u5B9E\u3002":"\u9875\u9762\u6682\u65F6\u65E0\u6CD5\u663E\u793A\u3002\u82E5\u5DF2\u63D0\u4EA4\u5151\u6362\uFF0C\u8BF7\u4FDD\u7559\u5151\u6362\u7801\uFF0C\u91CD\u65B0\u6253\u5F00\u9875\u9762\u540E\u67E5\u8BE2\u539F\u8BA2\u5355\uFF1B\u4E0D\u8981\u91CD\u590D\u5151\u6362\u3002"}),(0,Kt.jsx)(ue,{href:t?"/admin":"/",sx:{mt:2},children:t?"\u91CD\u65B0\u6253\u5F00\u7BA1\u7406\u9875":"\u91CD\u65B0\u6253\u5F00\u5151\u6362\u9875"})]})}return this.props.children}};function dM(e){let t=Fd({key:"xgift",nonce:document.querySelector('meta[name="csp-nonce"]')?.content,prepend:!0});(0,fM.createRoot)(document.getElementById("root")).render((0,Kt.jsx)(ST,{value:t,children:(0,Kt.jsxs)(Im,{theme:iM,defaultMode:"system",modeStorageKey:"xgift-mode",children:[(0,Kt.jsx)(wy,{}),(0,Kt.jsxs)(B1,{children:[e,(0,Kt.jsx)(cM,{})]})]})}))}function mM({admin:e=!1,maxWidth:t,children:o}){return(0,Kt.jsxs)(Kt.Fragment,{children:[(0,Kt.jsx)(Yp,{href:"#main",sx:{position:"absolute",left:16,top:-64,zIndex:r=>r.zIndex.tooltip,px:2,py:1,borderRadius:1,bgcolor:"background.paper",color:"text.primary",fontWeight:600,transition:"top 160ms ease","&:focus-visible":{top:16},"@media (prefers-reduced-motion: reduce)":{transition:"none"}},children:"\u8DF3\u8F6C\u5230\u4E3B\u8981\u5185\u5BB9"}),(0,Kt.jsxs)(nf,{id:"main",component:"main",tabIndex:-1,maxWidth:t??(e?"lg":"sm"),sx:{py:{xs:3,sm:6},"&:focus-visible":{outline:"none"}},children:[o,(0,Kt.jsxs)(oe,{component:"footer",sx:{mt:{xs:4,sm:6},pt:2,borderTop:1,borderColor:"divider",display:"flex",justifyContent:"center",alignItems:"center",flexWrap:"wrap",gap:.75,color:"text.secondary"},children:[(0,Kt.jsx)(D,{variant:"body2",component:"span",children:"\xA9 2026 mizorewww"}),(0,Kt.jsx)(D,{variant:"body2",component:"span","aria-hidden":"true",children:"\xB7"}),(0,Kt.jsx)(Yp,{variant:"body2",color:"inherit",underline:"hover",href:"https://github.com/mizorewww/x_gift_bot/blob/main/LICENSE",target:"_blank",rel:"noopener noreferrer",children:"MIT License"}),(0,Kt.jsx)(D,{variant:"body2",component:"span","aria-hidden":"true",children:"\xB7"}),(0,Kt.jsxs)(Yp,{variant:"body2",color:"inherit",underline:"hover",href:"https://github.com/mizorewww/x_gift_bot",target:"_blank",rel:"noopener noreferrer",sx:{display:"inline-flex",alignItems:"center",gap:.5},children:[(0,Kt.jsx)(sM,{sx:{fontSize:16},"aria-hidden":"true"}),"GitHub"]})]})]})]})}var Zg=P(L(),1);var yM=P(_(),1),hM=ae((0,yM.jsx)("path",{d:"M12 9c1.65 0 3 1.35 3 3s-1.35 3-3 3-3-1.35-3-3 1.35-3 3-3m0-2c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5M2 13h2c.55 0 1-.45 1-1s-.45-1-1-1H2c-.55 0-1 .45-1 1s.45 1 1 1m18 0h2c.55 0 1-.45 1-1s-.45-1-1-1h-2c-.55 0-1 .45-1 1s.45 1 1 1M11 2v2c0 .55.45 1 1 1s1-.45 1-1V2c0-.55-.45-1-1-1s-1 .45-1 1m0 18v2c0 .55.45 1 1 1s1-.45 1-1v-2c0-.55-.45-1-1-1s-1 .45-1 1M5.99 4.58c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0s.39-1.03 0-1.41zm12.37 12.37c-.39-.39-1.03-.39-1.41 0-.39.39-.39 1.03 0 1.41l1.06 1.06c.39.39 1.03.39 1.41 0 .39-.39.39-1.03 0-1.41zm1.06-10.96c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0zM7.05 18.36c.39-.39.39-1.03 0-1.41-.39-.39-1.03-.39-1.41 0l-1.06 1.06c-.39.39-.39 1.03 0 1.41s1.03.39 1.41 0z"}),"LightModeOutlined");var gM=P(_(),1),TM=ae((0,gM.jsx)("path",{d:"M9.37 5.51c-.18.64-.27 1.31-.27 1.99 0 4.08 3.32 7.4 7.4 7.4.68 0 1.35-.09 1.99-.27C17.45 17.19 14.93 19 12 19c-3.86 0-7-3.14-7-7 0-2.93 1.81-5.45 4.37-6.49M12 3c-4.97 0-9 4.03-9 9s4.03 9 9 9 9-4.03 9-9c0-.46-.04-.92-.1-1.36-.98 1.37-2.58 2.26-4.4 2.26-2.98 0-5.4-2.42-5.4-5.4 0-1.81.89-3.42 2.26-4.4-.44-.06-.9-.1-1.36-.1"}),"DarkModeOutlined");var bM=P(_(),1),vM=ae((0,bM.jsx)("path",{d:"M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16.01H3V4.99h18zM8 16h2.5l1.5 1.5 1.5-1.5H16v-2.5l1.5-1.5-1.5-1.5V8h-2.5L12 6.5 10.5 8H8v2.5L6.5 12 8 13.5zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3z"}),"SettingsBrightnessOutlined");var xn=P(_(),1),L1=[{value:"system",label:"\u8DDF\u968F\u7CFB\u7EDF",Icon:vM},{value:"light",label:"\u6D45\u8272",Icon:hM},{value:"dark",label:"\u6DF1\u8272",Icon:TM}];function xM(){let{mode:e,setMode:t,systemMode:o}=vC(),[r,n]=(0,Zg.useState)(null);(0,Zg.useEffect)(()=>{if(!e)return;let i=e==="dark"||e==="system"&&o==="dark";document.querySelector('meta[name="theme-color"]')?.setAttribute("content",Nd[i?"dark":"light"].background.default)},[e,o]);function a(){let i=r;n(null),requestAnimationFrame(()=>i?.focus({preventScroll:!0}))}let s=L1.find(i=>i.value===e)??L1[0];return(0,xn.jsxs)(xn.Fragment,{children:[(0,xn.jsx)(sn,{"aria-label":`\u5916\u89C2\uFF1A${s.label}`,title:`\u5916\u89C2\uFF1A${s.label}`,"aria-haspopup":"menu","aria-expanded":!!r,"aria-controls":r?"appearance-menu":void 0,onClick:i=>n(i.currentTarget),sx:{color:"text.secondary",flexShrink:0},children:(0,xn.jsx)(s.Icon,{})}),(0,xn.jsx)(Wp,{disableScrollLock:!0,disableRestoreFocus:!0,id:"appearance-menu",anchorEl:r,open:!!r,onClose:a,slotProps:{list:{"aria-label":"\u9009\u62E9\u5916\u89C2"}},children:L1.map(({value:i,label:l,Icon:p})=>(0,xn.jsxs)(In,{selected:s.value===i,role:"menuitemradio","aria-checked":s.value===i,onClick:()=>{t(i),a()},sx:{minHeight:44},children:[(0,xn.jsx)(Hy,{children:(0,xn.jsx)(p,{fontSize:"small"})}),(0,xn.jsx)(Fy,{children:l})]},i))})]})}var Ad=P(L(),1);var PM=P(_(),1),U1=ae((0,PM.jsx)("path",{d:"M15 20H5V7c0-.55-.45-1-1-1s-1 .45-1 1v13c0 1.1.9 2 2 2h10c.55 0 1-.45 1-1s-.45-1-1-1m5-4V4c0-1.1-.9-2-2-2H9c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h9c1.1 0 2-.9 2-2m-2 0H9V4h9z"}),"ContentCopyRounded");var SM=P(_(),1),CM=ae((0,SM.jsx)("path",{d:"M9 16.17 5.53 12.7a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.18 4.18c.39.39 1.02.39 1.41 0L20.29 7.71c.39-.39.39-1.02 0-1.41a.996.996 0 0 0-1.41 0z"}),"CheckRounded");var hr=P(_(),1);function EM({codes:e}){let[t,o]=(0,Ad.useState)(null),[r,n]=(0,Ad.useState)(!1);(0,Ad.useEffect)(()=>{if(t===null)return;let s=setTimeout(()=>o(null),5e3);return()=>clearTimeout(s)},[t]);async function a(s){try{await navigator.clipboard.writeText(s==="all"?e.join(` -`):e[s]),o(s),n(!1)}catch{o(null),n(!0)}}return(0,hr.jsxs)(oe,{sx:{my:2},children:[(0,hr.jsxs)(ce,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{mb:1},children:[(0,hr.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u70B9\u51FB\u5355\u679A\u5151\u6362\u7801\u5373\u53EF\u590D\u5236"}),(0,hr.jsx)(ue,{size:"small",color:"secondary",startIcon:(0,hr.jsx)(U1,{}),onClick:()=>{a("all")},sx:{px:1.5,flexShrink:0},children:"\u590D\u5236\u5168\u90E8"})]}),(0,hr.jsx)(oe,{component:"ul","aria-label":"\u65B0\u751F\u6210\u7684\u5151\u6362\u7801",tabIndex:0,sx:{m:0,p:0,listStyle:"none",maxHeight:300,overflowY:"auto",border:1,borderColor:"divider",borderRadius:2},children:e.map((s,i)=>(0,hr.jsx)(oe,{component:"li",children:(0,hr.jsx)(ue,{fullWidth:!0,"aria-label":`\u590D\u5236\u7B2C ${i+1} \u679A\u5151\u6362\u7801`,onClick:()=>{a(i)},endIcon:t===i?(0,hr.jsx)(CM,{}):(0,hr.jsx)(U1,{}),sx:{py:1.5,px:2,borderRadius:0,justifyContent:"space-between",textAlign:"left",borderBottom:iString(r).padStart(2,"0");return`${t.getFullYear()}-${o(t.getMonth()+1)}-${o(t.getDate())} ${o(t.getHours())}:${o(t.getMinutes())}:${o(t.getSeconds())}`}var hi={active:{label:"\u53EF\u4F7F\u7528",color:"primary"},processing:{label:"\u5904\u7406\u4E2D",color:"primary"},succeeded:{label:"\u5DF2\u5B8C\u6210",color:"success"},review:{label:"\u5F85\u6838\u5B9E",color:"warning"},revoked:{label:"\u5DF2\u505C\u7528",color:"default"}};var kd=P(L(),1);var wM=P(_(),1),OM=ae((0,wM.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");var NM=P(_(),1),MM=ae((0,NM.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined");var jt=P(_(),1);function AM({folders:e,stats:t,filter:o,disabled:r,onSelect:n,onBusyChange:a,onChanged:s}){let[i,l]=(0,kd.useState)(null),[p,c]=(0,kd.useState)(""),[d,f]=(0,kd.useState)(""),[u,g]=(0,kd.useState)(!1);async function b(){if(!(!i||u)){if(!p.trim()||new TextEncoder().encode(p.trim()).length>120){f("\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u6700\u591A 120 \u5B57\u8282\u3002");return}g(!0),a(!0);try{await vo("/api/admin/folders/rename",{id:i.id,name:p.trim()}),await s(),l(null)}catch(x){f(x.message)}finally{g(!1),a(!1)}}}return(0,jt.jsxs)(oe,{sx:{mb:3},children:[(0,jt.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"baseline",sx:{mb:1.5},children:[(0,jt.jsx)(D,{variant:"h2",children:"\u6279\u6B21"}),(0,jt.jsxs)(D,{variant:"body2",color:"text.secondary",children:[t?.total??"\u2014"," \u679A\u5151\u6362\u7801"]})]}),(0,jt.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"\u70B9\u51FB\u6279\u6B21\u6587\u4EF6\u5939\u67E5\u770B\u5151\u6362\u7801\uFF0C\u5DE6\u53F3\u6ED1\u52A8\u53EF\u67E5\u770B\u5168\u90E8\u6279\u6B21\u3002"}),(0,jt.jsx)(ce,{direction:"row",useFlexGap:!0,gap:1,sx:{minHeight:80,overflowX:"auto",alignItems:"center",pb:1},role:"region","aria-label":"\u6279\u6B21\u6587\u4EF6\u5939\uFF0C\u53EF\u6A2A\u5411\u6EDA\u52A8",tabIndex:0,children:[{id:"",name:"\u5168\u90E8\u5151\u6362\u7801",count:t?.total??0},...t?.unfiled?[{id:"unfiled",name:"\u672A\u5206\u7C7B",count:t.unfiled}]:[],...e].map(x=>(0,jt.jsxs)(oe,{sx:{display:"flex",border:1,borderColor:o===x.id?"primary.main":"divider",borderRadius:2,bgcolor:o===x.id?"action.selected":"background.paper",maxWidth:"100%",flexShrink:0},children:[(0,jt.jsxs)(ue,{disabled:r,"aria-pressed":o===x.id,startIcon:(0,jt.jsx)(OM,{}),onClick:()=>n(x.id),sx:{px:2,py:1.5,justifyContent:"flex-start",textAlign:"left",overflowWrap:"anywhere",minWidth:0},children:[x.name," \xB7 ",x.count]}),x.id&&x.id!=="unfiled"&&(0,jt.jsx)($n,{describeChild:!0,title:`\u91CD\u547D\u540D\u6279\u6B21\uFF1A${x.name}`,children:(0,jt.jsx)("span",{children:(0,jt.jsx)(sn,{"aria-label":`\u91CD\u547D\u540D\u6279\u6B21\uFF1A${x.name}`,disabled:r,onClick:()=>{l(x),c(x.name),f("")},sx:{m:.5,border:1,borderColor:"divider",width:44,height:44},children:(0,jt.jsx)(MM,{fontSize:"small"})})})})]},x.id))}),(0,jt.jsx)(lr,{open:!!i,onClose:()=>!u&&l(null),fullWidth:!0,maxWidth:"xs","aria-labelledby":"batch-rename-title","aria-describedby":"batch-rename-content",children:(0,jt.jsxs)(oe,{component:"form",noValidate:!0,onSubmit:x=>{x.preventDefault(),b()},children:[(0,jt.jsx)(ur,{id:"batch-rename-title",children:"\u91CD\u547D\u540D\u6279\u6B21"}),(0,jt.jsxs)(cr,{id:"batch-rename-content",children:[(0,jt.jsx)(Ht,{autoFocus:!0,label:"\u6279\u6B21\u540D\u79F0",value:p,onChange:x=>{c(x.target.value),d&&f("")},disabled:u,required:!0,error:!!d,sx:{mt:1},helperText:"\u8BE5\u6279\u6B21\u5185\u7684\u5151\u6362\u7801\u4F1A\u540C\u6B65\u66F4\u65B0\u540D\u79F0"}),d&&(0,jt.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:d})]}),(0,jt.jsxs)(pr,{sx:{p:2},children:[(0,jt.jsx)(ue,{variant:"outlined",disabled:u,onClick:()=>l(null),children:"\u53D6\u6D88"}),(0,jt.jsx)(ue,{variant:"contained",disabled:u,type:"submit",children:"\u4FDD\u5B58"})]})]})})]})}var Mr=P(L(),1);var kM=P(_(),1),_M=ae((0,kM.jsx)("path",{d:"M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H7.07L2.4 12l4.66-7H22zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z"}),"BackspaceOutlined");var DM=P(_(),1),zM=ae((0,DM.jsx)("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"CodeOutlined");var jM=P(_(),1),BM=ae((0,jM.jsx)("path",{d:"M7 6h10l-5.01 6.3zm-2.75-.39C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAltOutlined");var eu=P(_(),1),LM=ae([(0,eu.jsx)("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),(0,eu.jsx)("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),(0,eu.jsx)("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),(0,eu.jsx)("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),(0,eu.jsx)("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")],"PaletteOutlined");var UM=["active","processing","review","succeeded","revoked"],IM=["folder","status","months","username"];function L$(e){let t="",o=!1,r=!1;for(let s of e){if(o){if(r){t+=s,r=!1;continue}if(s==="\\"){t+=s,r=!0;continue}if(s==='"'||/["“”]/.test(s)){t+='"',o=!1;continue}t+=s;continue}let i=/["“”]/.test(s)?'"':s;i==='"'&&(o=!0),t+=i.replace(/(/g,"(").replace(/)/g,")").replace(/:/g,":").replace(/!/g,"!").replace(/=/g,"=")}e=t;let n=[],a=0;for(;a=e.length)throw new Error("\u5F15\u53F7\u4E0D\u5339\u914D\uFF1A\u6279\u6B21\u540D\u79F0\u7684\u82F1\u6587\u53CC\u5F15\u53F7\u6CA1\u6709\u95ED\u5408\u3002");if(e[c]==="\\"&&c+1t[r],a=()=>t[r++];function s(){return i()}function i(){let u=l();for(;n()?.kind==="or";)a(),o.push({kind:"or"}),u={type:"or",left:u,right:l()};return u}function l(){let u=p();for(;n()?.kind==="and";)a(),o.push({kind:"and"}),u={type:"and",left:u,right:p()};return u}function p(){if(n()?.kind==="not"){if(a(),o.push({kind:"not"}),!n())throw new Error("\u300Cnot\u300D\u540E\u7F3A\u5C11\u6761\u4EF6\u3002");return{type:"not",operand:p()}}return c()}function c(){let u=n();if(!u)throw new Error("\u8868\u8FBE\u5F0F\u610F\u5916\u7684\u7ED3\u5C3E\uFF1A\u7F3A\u5C11\u6761\u4EF6\u3002");if(u.kind==="and"||u.kind==="or")throw new Error(`\u300C${u.kind==="and"?"and":"or"}\u300D\u540E\u7F3A\u5C11\u6761\u4EF6\u3002`);if(u.kind==="rparen")throw new Error("\u62EC\u53F7\u4E0D\u5339\u914D\uFF1A\u53F3\u62EC\u53F7\u524D\u7F3A\u5C11\u6761\u4EF6\u3002");if(u.kind==="lparen"){a(),o.push({kind:"lparen"});let g=s();if(n()?.kind!=="rparen")throw new Error("\u62EC\u53F7\u4E0D\u5339\u914D\uFF1A\u7F3A\u5C11\u53F3\u62EC\u53F7\u3002");return a(),o.push({kind:"rparen"}),g}return d()}function d(){let u=a();if(u.kind!=="word")throw new Error("\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u4EF6\uFF1A\u8BF7\u4F7F\u7528 folder:\u6279\u6B21\u540D\u3001status:\u72B6\u6001\u3001months:\u65F6\u957F\u6216 username:\u8D26\u53F7\u3002");let g=u.text.toLowerCase();if(!IM.includes(g))throw new Error(`\u672A\u77E5\u5B57\u6BB5\u300C${u.text}\u300D\uFF0C\u4EC5\u652F\u6301 ${IM.join("\u3001")}\u3002`);let b=n(),x=b?.kind==="neq";if(b?.kind!=="colon"&&b?.kind!=="eq"&&b?.kind!=="neq")throw new Error(`\u300C${u.text}\u300D\u540E\u7F3A\u5C11 : \u6216 !=\u3002`);a();let m=n();if(!m||m.kind!=="word"&&m.kind!=="string")throw m&&(m.kind==="and"||m.kind==="or"||m.kind==="not")?new Error(`\u300C${u.text}:\u300D\u540E\u9047\u5230\u903B\u8F91\u8FD0\u7B97\u7B26\uFF1B\u5982\u679C\u540D\u79F0\u672C\u8EAB\u542B and / or / not / \u975E\uFF0C\u8BF7\u7528\u82F1\u6587\u5F15\u53F7\u5305\u88F9\uFF0C\u5982 ${u.text}:"\u975E"\u3002`):new Error(`\u300C${u.text}:\u300D\u540E\u7F3A\u5C11\u503C\u3002`);a();let y=m.text;if(g==="status"){if(y=m.text.toLowerCase(),!UM.includes(y))throw new Error(`\u4E0D\u652F\u6301\u7684\u72B6\u6001\u503C\u300C${m.text}\u300D\uFF0C\u53EF\u7528\uFF1A${UM.join("\u3001")}\u3002`)}else if(g==="months"){if(!/^\d+$/.test(m.text))throw new Error(`\u300Cmonths:\u300D\u540E\u9700\u8981\u6570\u5B57\uFF08\u5982 3\u30016\uFF09\uFF0C\u6536\u5230\u300C${m.text}\u300D\u3002`)}else if(g==="folder"){if(!m.text)throw new Error("\u300Cfolder:\u300D\u540E\u7F3A\u5C11\u6279\u6B21\u540D\uFF1B\u672A\u5206\u7C7B\u8BF7\u4F7F\u7528 folder:-\u3002")}else if(!m.text)throw new Error("\u300Cusername:\u300D\u540E\u9700\u8981\u8D26\u53F7\u540D\uFF1B\u672A\u7ED1\u5B9A\u8BF7\u4F7F\u7528 username:-\u3002");return o.push({kind:"condition",field:g,value:y,negate:x,literal:m.kind==="string"}),{type:"condition",field:g,value:y,negate:x,literal:m.kind==="string"}}let f=s();if(ro(t,r)}function I1(e){return $M(e).flat}var VM='\u6761\u4EF6\uFF1Afolder:\u6279\u6B21\u540D\u3001status:\u72B6\u6001\u3001months:\u65F6\u957F\u3001username:\u8D26\u53F7\uFF1B\u903B\u8F91\uFF1Aand\u3001or\u3001not\u3001\u62EC\u53F7\uFF1B!= \u53D6\u53CD\uFF1Bfolder:- \u672A\u5206\u7C7B\u3001username:- \u672A\u7ED1\u5B9A\uFF1B\u540D\u79F0\u542B\u7A7A\u683C\u3001\u5192\u53F7\u6216\u4FDD\u7559\u5B57\u65F6\u7528\u82F1\u6587\u5F15\u53F7\u5305\u88F9\uFF0C\u5982 folder:"and"\u3002';var xe=P(_(),1),U$="\u70B9\u51FB\u8C03\u8272\u677F\u6309\u94AE\u62FC\u63A5\u6761\u4EF6\uFF1B\u70B9\u51FB\u753B\u5E03\u4E2D\u7684\u6761\u4EF6\u53EF\u5207\u6362 = / \u2260\uFF1B\u753B\u5E03\u805A\u7126\u65F6\u6309 Backspace \u64A4\u9500\u3001Enter \u5E94\u7528\u3002",I$=["active","processing","review","succeeded","revoked"],$1={active:{label:"\u53EF\u4F7F\u7528",tone:"primary"},processing:{label:"\u5904\u7406\u4E2D",tone:"primary"},review:{label:"\u5F85\u6838\u5B9E",tone:"warning"},succeeded:{label:"\u5DF2\u5B8C\u6210",tone:"success"},revoked:{label:"\u5DF2\u505C\u7528",tone:"neutral"}};function tu(e){return e.vars?e.vars.palette:e.palette}function FM(e,t){let o=tu(e);return t==="neutral"?o.text.secondary:o[t].main}function $$(e){return t=>{let o=FM(t,e);return{color:o,bgcolor:t.alpha(o,.14),"& .MuiChip-deleteIcon":{color:t.alpha(o,.65),"&:hover":{color:o}}}}}function H$(e){return{color:tu(e).text.primary,borderColor:tu(e).divider,fontFamily:"monospace",letterSpacing:".06em"}}var V$={border:"none",color:"text.secondary",bgcolor:"transparent",fontFamily:"monospace",fontSize:"1rem",minWidth:30,"& .MuiChip-label":{px:.5},"&:hover":{bgcolor:"action.hover"}};function F$(e){let t=tu(e);return{bgcolor:t.text.primary,color:t.background.paper,fontFamily:"monospace",letterSpacing:".06em","&:hover":{bgcolor:t.text.secondary},"& .MuiChip-deleteIcon":{color:e.alpha(t.background.paper,.65),"&:hover":{color:t.background.paper}}}}var Jg={height:30,minHeight:30,borderRadius:"16px",fontWeight:600,"& .MuiChip-deleteIcon":{boxSizing:"content-box",width:"18px",height:"18px",padding:"3px",margin:"-3px"}};function q$(e){return e.kind!=="condition"?"neutral":e.field==="folder"?"secondary":e.field==="months"?"success":e.field==="username"?"warning":$1[e.value]?.tone??"neutral"}function G$(e){let t=e.negate?"\u2260":":";switch(e.field){case"folder":return e.value==="-"&&!e.literal?`\u6279\u6B21${t}\u672A\u5206\u7C7B`:`\u6279\u6B21${t}${e.value}`;case"status":return`\u72B6\u6001${t}${$1[e.value]?.label??e.value}`;case"months":return`\u65F6\u957F${t}${e.value} \u4E2A\u6708`;case"username":return e.value==="-"&&!e.literal?`\u8D26\u53F7${t}\u672A\u7ED1\u5B9A`:`\u8D26\u53F7${t}${e.value}`}}function Pn(e){switch(e.kind){case"condition":return G$(e);case"not":return"NOT";case"and":return"AND";case"or":return"OR";case"lparen":return"\uFF08";case"rparen":return"\uFF09"}}function Y$(e,t=!1){return/^(and|or|not|非|&&|\|\|)$/i.test(e)||e==="-"&&t?`"${e}"`:/[\s()":=!≠\\:()!="“”]/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/["“”]/g,"\\$&")}"`:e}function eT(e){return e.map((t,o)=>{let r;switch(t.kind){case"condition":{let a=t.negate?"!=":":";r=t.field==="folder"||t.field==="username"?`${t.field}${a}${Y$(t.value,t.literal)}`:`${t.field}${a}${t.value}`;break}case"lparen":r="(";break;case"rparen":r=")";break;default:r=t.kind}if(o===0)return r;let n=e[o-1];return t.kind==="rparen"||n.kind==="lparen"?r:` ${r}`}).join("")}function Sn({label:e,ariaLabel:t,tooltip:o,disabled:r,onClick:n,dot:a,mono:s}){return(0,xe.jsx)($n,{title:o,describeChild:!0,children:(0,xe.jsx)("span",{children:(0,xe.jsx)(ue,{variant:"outlined",size:"small",disabled:r,onClick:n,"aria-label":t,startIcon:a?(0,xe.jsx)(oe,{component:"span","aria-hidden":!0,sx:i=>({width:8,height:8,borderRadius:"50%",bgcolor:FM(i,a)})}):void 0,sx:{minHeight:30,minWidth:44,px:1.5,py:0,borderRadius:"16px",fontSize:".8125rem",lineHeight:1.5,fontFamily:s?"monospace":void 0,letterSpacing:s?".05em":void 0,"& .MuiButton-startIcon":{mr:.75,ml:0},"&:disabled .MuiButton-startIcon":{opacity:.38}},children:e})})})}function qM({value:e,onChange:t,onApply:o,onClear:r,applied:n,error:a,disabled:s,folders:i,appliedSource:l="",resultCount:p,applySeq:c=0,clearNotice:d}){let[f,u]=(0,Mr.useState)([]),[g,b]=(0,Mr.useState)("palette"),[x,m]=(0,Mr.useState)({seq:0,text:""}),y=H=>m(U=>({seq:U.seq+1,text:H})),[h,T]=(0,Mr.useState)(""),[S,C]=(0,Mr.useState)(""),E=(0,Mr.useRef)(null);(0,Mr.useEffect)(()=>{if(!(g!=="palette"||e===eT(f)))try{u(e.trim()?I1(e):[])}catch{let H="\u65E0\u6CD5\u89E3\u6790\u6587\u672C\u8868\u8FBE\u5F0F\uFF0C\u5DF2\u6062\u590D\u4E3A\u8C03\u8272\u677F\u4E2D\u7684\u6761\u4EF6\u3002";T(H),y(H),t(eT(f))}},[e,g]);let R=(0,Mr.useRef)(n),O=(0,Mr.useRef)(0),w=(0,Mr.useRef)(0);(0,Mr.useEffect)(()=>{if(c>O.current&&(O.current=c,y(p==null?"\u7B5B\u9009\u5DF2\u5E94\u7528":`\u7B5B\u9009\u5DF2\u5E94\u7528\uFF0C\u5171 ${p} \u6761\u7ED3\u679C`)),!n&&R.current){let H="\u7B5B\u9009\u5DF2\u6E05\u9664\uFF0C\u5DF2\u663E\u793A\u5B8C\u6574\u5217\u8868";d&&d.seq>w.current&&(w.current=d.seq,H=d.text),y(H)}R.current=n},[n,c,p,d]);function A(H,U){u(H),y(U),T(""),t(eT(H)),requestAnimationFrame(()=>E.current?.focus())}function v(H){s||A([...f,H],`\u5DF2\u6DFB\u52A0 ${Pn(H)}`)}let N=/^[A-Za-z0-9_]+$/.test(S.trim());function k(){s||!N||ie||(v({kind:"condition",field:"username",value:S.trim(),negate:!1}),C(""))}function z(H){if(s)return;let U=f[H];U&&A(f.filter((Se,De)=>De!==H),`\u5DF2\u5220\u9664 ${Pn(U)}`)}function j(){s||f.length===0||A(f.slice(0,-1),`\u5DF2\u64A4\u9500 ${Pn(f[f.length-1])}`)}function W(H){if(s||f[H]?.kind!=="condition")return;let Se=f.map((Ce,_e)=>_e===H&&Ce.kind==="condition"?{...Ce,negate:!Ce.negate}:Ce),De=Se[H];A(Se,`\u5DF2\u5207\u6362\u4E3A ${Pn(De)}`)}function Z(H){return U=>{s||(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),z(H))}}let X=f[f.length-1],de=!X||X.kind==="and"||X.kind==="or"||X.kind==="not"||X.kind==="lparen",me=!!X&&(X.kind==="condition"||X.kind==="rparen"),fe=f.reduce((H,U)=>H+(U.kind==="lparen"?1:U.kind==="rparen"?-1:0),0),ie=s||!de,we=s||!me,Te=s||!me||fe<=0,le=s||f.length===0,Pe=!!X&&(X.kind==="and"||X.kind==="or"||X.kind==="not"||X.kind==="lparen"),ye="";if(f.length>0)if(fe>0)ye=`\u62EC\u53F7\u672A\u95ED\u5408\uFF0C\u8FD8\u5DEE ${fe} \u4E2A\u53F3\u62EC\u53F7 \uFF09`;else if(fe<0)ye="\u5B58\u5728\u591A\u4F59\u7684\u53F3\u62EC\u53F7 \uFF09";else if(Pe)ye="\u8868\u8FBE\u5F0F\u4E0D\u5B8C\u6574\uFF0C\u672B\u5C3E\u8FD8\u9700\u8981\u4E00\u4E2A\u6761\u4EF6";else try{I1(eT(f))}catch(H){let U=H.message;/[后前]缺少条件/.test(U)?ye=`${U}\u53EF\u5220\u9664\u591A\u4F59\u7684\u8FD0\u7B97\u7B26\u6216\u62EC\u53F7\u3002`:/前缺少逻辑运算符/.test(U)?ye=`${U}\u53EF\u4ECE\u672B\u5C3E\u64A4\u9500\u540E\u91CD\u65B0\u7528 AND / OR \u8FDE\u63A5\u3002`:ye=U}let Oe=s||(g==="palette"?f.length===0||!!ye:!e.trim()),he=f.length?"\u8BF7\u5148\u6DFB\u52A0 AND / OR \u8FDE\u63A5\u7B26":"\u8868\u8FBE\u5F0F\u4E3A\u7A7A\uFF0C\u53EF\u76F4\u63A5\u6DFB\u52A0",ge=f.length?"\u8FD0\u7B97\u7B26\u9700\u8DDF\u5728\u6761\u4EF6\u6216 \uFF09\u4E4B\u540E":"\u8BF7\u5148\u6DFB\u52A0\u6761\u4EF6",be=n&&!!l&&e!==l;return(0,xe.jsxs)(tt,{variant:"outlined",sx:{p:{xs:2,sm:2.5},mb:3},children:[(0,xe.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:.5,flexWrap:"wrap",rowGap:.5},children:[(0,xe.jsx)(BM,{color:"primary",sx:{flexShrink:0}}),(0,xe.jsx)(D,{variant:"h2",sx:{whiteSpace:"nowrap",flexShrink:0,fontSize:21},children:"\u9AD8\u7EA7\u7B5B\u9009"}),n&&(0,xe.jsx)(jo,{size:"small",color:be?"warning":"primary",variant:"outlined",label:be?"\u7B5B\u9009\u751F\u6548\u4E2D \xB7 \u5DF2\u4FEE\u6539":"\u7B5B\u9009\u751F\u6548\u4E2D",title:be?"\u542B\u672A\u5E94\u7528\u7684\u66F4\u6539\uFF0C\u70B9\u51FB \u7B5B\u9009 \u91CD\u65B0\u5E94\u7528":void 0,sx:{flexShrink:0,"& .MuiChip-label":{whiteSpace:"nowrap"}}}),(0,xe.jsx)(oe,{sx:{flexGrow:1}}),(0,xe.jsx)(ue,{variant:"text",size:"small",startIcon:g==="palette"?(0,xe.jsx)(zM,{}):(0,xe.jsx)(LM,{}),"aria-label":g==="palette"?"\u5207\u6362\u5230\u6587\u672C\u6A21\u5F0F":"\u5207\u6362\u5230\u8C03\u8272\u677F\u6A21\u5F0F",onClick:()=>{T(""),b(H=>H==="palette"?"text":"palette")},sx:{minHeight:36,px:1.5,flexShrink:0},children:g==="palette"?"\u6587\u672C\u6A21\u5F0F":"\u8C03\u8272\u677F"})]}),(0,xe.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"\u7EC4\u5408\u6279\u6B21\u4E0E\u72B6\u6001\u6761\u4EF6\uFF0C\u5728\u6240\u6709\u5151\u6362\u7801\u4E2D\u7B5B\u9009\u3002"}),g==="text"?(0,xe.jsx)(Ht,{label:"\u7B5B\u9009\u8868\u8FBE\u5F0F",placeholder:"folder:\u793A\u4F8B\u6279\u6B21 and (status:active or status:review)",value:e,disabled:s,onChange:H=>t(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),o())},error:!!a,slotProps:{htmlInput:{"aria-label":"\u7B5B\u9009\u8868\u8FBE\u5F0F",spellCheck:!1,sx:{fontFamily:"monospace"}}}}):(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(oe,{ref:E,tabIndex:s?-1:0,role:"group","aria-label":"\u7B5B\u9009\u8868\u8FBE\u5F0F\u753B\u5E03\uFF1B\u6309 Backspace \u64A4\u9500\u672B\u5C3E\u8BCD\u5143\uFF0C\u6309 Enter \u5E94\u7528\u7B5B\u9009",onKeyDown:H=>{s||H.target===H.currentTarget&&(H.key==="Backspace"?(H.preventDefault(),j()):H.key==="Enter"&&(H.preventDefault(),Oe?ye&&y(ye):o()))},sx:H=>({display:"flex",flexWrap:"wrap",gap:1,alignItems:"center",minHeight:56,p:1.25,borderRadius:2,border:1,borderColor:a||ye?"error.main":"divider",bgcolor:tu(H).background.default,opacity:s?.6:1,"&:focus-visible":{outline:"none",borderColor:"primary.main",boxShadow:`0 0 0 3px ${H.alpha(tu(H).primary.main,.3)}`}}),children:f.length===0?(0,xe.jsx)(D,{variant:"body2",color:"text.secondary",sx:{px:.5},children:"\u70B9\u51FB\u4E0B\u65B9\u8C03\u8272\u677F\u62FC\u63A5\u7B5B\u9009\u6761\u4EF6"}):f.map((H,U)=>H.kind==="lparen"||H.kind==="rparen"?(0,xe.jsx)(jo,{variant:"outlined",label:Pn(H),"aria-label":`\u62EC\u53F7 ${Pn(H)}\uFF0C\u6309 Enter\u3001Delete \u6216 Backspace \u5220\u9664`,onDelete:s?void 0:()=>z(U),onKeyDown:Z(U),sx:[Jg,V$]},U):H.kind==="condition"?(0,xe.jsx)($n,{title:"\u70B9\u51FB\u6216\u6309 Enter \u5207\u6362 = / \u2260",describeChild:!0,children:(0,xe.jsx)(jo,{label:Pn(H),"aria-label":`${Pn(H)}\uFF0C\u6309 Enter \u6216\u70B9\u51FB\u5207\u6362 = / \u2260\uFF0C\u6309 Delete \u6216 Backspace \u5220\u9664`,onClick:s?void 0:()=>W(U),onDelete:s?void 0:()=>z(U),sx:[Jg,$$(q$(H)),{cursor:s?"default":"pointer"}]})},U):H.kind==="not"?(0,xe.jsx)(jo,{label:Pn(H),"aria-label":`\u903B\u8F91 ${Pn(H)}\uFF08\u8865\u96C6\uFF09\uFF0C\u6309 Enter\u3001Delete \u6216 Backspace \u5220\u9664`,onDelete:s?void 0:()=>z(U),onKeyDown:Z(U),sx:[Jg,F$]},U):(0,xe.jsx)(jo,{variant:"outlined",label:Pn(H),"aria-label":`\u903B\u8F91 ${Pn(H)}\uFF0C\u6309 Enter\u3001Delete \u6216 Backspace \u5220\u9664`,onDelete:s?void 0:()=>z(U),onKeyDown:Z(U),sx:[Jg,H$]},U))}),h&&(0,xe.jsx)(ze,{severity:"warning",closeText:"\u5173\u95ED",sx:{mt:1.5},onClose:()=>T(""),children:h}),(0,xe.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"auto 1fr"},columnGap:2,rowGap:1.25,alignItems:"start",mt:2},children:[(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u72B6\u6001"}),(0,xe.jsx)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:I$.map(H=>{let U=$1[H];return(0,xe.jsx)(Sn,{label:U.label,dot:U.tone,disabled:ie,tooltip:ie?he:`\u6DFB\u52A0 \u72B6\u6001:${U.label}`,onClick:()=>v({kind:"condition",field:"status",value:H,negate:!1}),ariaLabel:`\u6DFB\u52A0\u72B6\u6001\u6761\u4EF6 ${U.label}`},H)})}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u6279\u6B21"}),(0,xe.jsxs)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:[i.map(H=>(0,xe.jsx)(Sn,{label:H.name,dot:"secondary",disabled:ie,tooltip:ie?he:`\u6DFB\u52A0 \u6279\u6B21:${H.name}`,onClick:()=>v({kind:"condition",field:"folder",value:H.name,negate:!1,literal:H.name==="-"?!0:void 0}),ariaLabel:`\u6DFB\u52A0\u6279\u6B21\u6761\u4EF6 ${H.name}`},H.id)),(0,xe.jsx)(Sn,{label:"\u672A\u5206\u7C7B",dot:"secondary",disabled:ie,tooltip:ie?he:"\u6DFB\u52A0 \u6279\u6B21:\u672A\u5206\u7C7B",onClick:()=>v({kind:"condition",field:"folder",value:"-",negate:!1}),ariaLabel:"\u6DFB\u52A0\u6279\u6B21\u6761\u4EF6 \u672A\u5206\u7C7B"})]}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u65F6\u957F"}),(0,xe.jsx)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:["3","6"].map(H=>(0,xe.jsx)(Sn,{label:`${H} \u4E2A\u6708`,dot:"success",disabled:ie,tooltip:ie?he:`\u6DFB\u52A0 \u65F6\u957F:${H} \u4E2A\u6708`,onClick:()=>v({kind:"condition",field:"months",value:H,negate:!1}),ariaLabel:`\u6DFB\u52A0\u65F6\u957F\u6761\u4EF6 ${H} \u4E2A\u6708`},H))}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u8D26\u53F7"}),(0,xe.jsxs)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",alignItems:"center",children:[(0,xe.jsx)(Ht,{size:"small",fullWidth:!1,placeholder:"\u63A5\u6536\u8D26\u53F7",value:S,disabled:s,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),S.trim()&&!N?y("\u8D26\u53F7\u540D\u9700\u4E3A\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u3002"):k())},slotProps:{htmlInput:{"aria-label":"\u63A5\u6536\u8D26\u53F7\u7528\u6237\u540D\uFF08\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\uFF09",spellCheck:!1,sx:{fontFamily:"monospace",py:.5}}},sx:{width:160}}),(0,xe.jsx)(Sn,{label:"\u6DFB\u52A0\u8D26\u53F7",dot:"warning",disabled:s||!N||ie,tooltip:N?ie?he:`\u6DFB\u52A0 \u8D26\u53F7:${S.trim()}`:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u7EC4\u6210\u7684\u8D26\u53F7\u540D",onClick:k,ariaLabel:"\u6DFB\u52A0\u8D26\u53F7\u6761\u4EF6"}),(0,xe.jsx)(Sn,{label:"\u672A\u7ED1\u5B9A",dot:"warning",disabled:ie,tooltip:ie?he:"\u6DFB\u52A0 \u8D26\u53F7:\u672A\u7ED1\u5B9A",onClick:()=>v({kind:"condition",field:"username",value:"-",negate:!1}),ariaLabel:"\u6DFB\u52A0\u8D26\u53F7\u6761\u4EF6 \u672A\u7ED1\u5B9A"})]}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u903B\u8F91"}),(0,xe.jsxs)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:[(0,xe.jsx)(Sn,{label:"AND",mono:!0,disabled:we,tooltip:we?ge:"\u6DFB\u52A0\u903B\u8F91\u4E0E AND",onClick:()=>v({kind:"and"}),ariaLabel:"\u6DFB\u52A0\u903B\u8F91\u4E0E AND"}),(0,xe.jsx)(Sn,{label:"OR",mono:!0,disabled:we,tooltip:we?ge:"\u6DFB\u52A0\u903B\u8F91\u6216 OR",onClick:()=>v({kind:"or"}),ariaLabel:"\u6DFB\u52A0\u903B\u8F91\u6216 OR"}),(0,xe.jsx)(Sn,{label:"\u975E NOT",mono:!0,disabled:ie,tooltip:ie?he:"\u6DFB\u52A0\u8865\u96C6 NOT\uFF08\u975E\uFF09",onClick:()=>v({kind:"not"}),ariaLabel:"\u6DFB\u52A0\u8865\u96C6 NOT"}),(0,xe.jsx)(Sn,{label:"\uFF08",mono:!0,disabled:ie,tooltip:ie?he:"\u6DFB\u52A0\u5DE6\u62EC\u53F7",onClick:()=>v({kind:"lparen"}),ariaLabel:"\u6DFB\u52A0\u5DE6\u62EC\u53F7"}),(0,xe.jsx)(Sn,{label:"\uFF09",mono:!0,disabled:Te,tooltip:Te?fe<=0?"\u6CA1\u6709\u672A\u95ED\u5408\u7684\u5DE6\u62EC\u53F7":"\u53F3\u62EC\u53F7\u9700\u8DDF\u5728\u6761\u4EF6\u6216 \uFF09\u4E4B\u540E":"\u6DFB\u52A0\u53F3\u62EC\u53F7",onClick:()=>v({kind:"rparen"}),ariaLabel:"\u6DFB\u52A0\u53F3\u62EC\u53F7"}),(0,xe.jsx)(Sn,{label:(0,xe.jsxs)(ce,{component:"span",direction:"row",spacing:.5,alignItems:"center",children:[(0,xe.jsx)(_M,{sx:{fontSize:"1rem"},"aria-hidden":!0}),"\u64A4\u9500"]}),disabled:le,tooltip:le?"\u6CA1\u6709\u53EF\u64A4\u9500\u7684\u8BCD\u5143":"\u64A4\u9500\u672B\u5C3E\u8BCD\u5143",onClick:j,ariaLabel:"\u64A4\u9500\u672B\u5C3E\u8BCD\u5143"})]})]})]}),a&&(0,xe.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:a}),(0,xe.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1.5,sx:{mt:2,justifyContent:"space-between",alignItems:{xs:"stretch",sm:"center"}},children:[(0,xe.jsx)(D,{variant:"caption",color:g==="palette"&&ye?"error.main":"text.secondary",role:g==="palette"&&ye?"alert":void 0,children:g==="palette"&&ye?ye:g==="palette"?U$:VM}),(0,xe.jsxs)(ce,{direction:"row",spacing:1,sx:{flexShrink:0,justifyContent:{xs:"end",sm:"auto"}},children:[(0,xe.jsx)(ue,{variant:"outlined",disabled:s||!e&&!n,onClick:r,"aria-label":"\u6E05\u9664\u7B5B\u9009\u5E76\u8FD4\u56DE\u5B8C\u6574\u5217\u8868",children:"\u6E05\u9664"}),(0,xe.jsx)(ue,{variant:"contained",disabled:Oe,onClick:o,"aria-label":"\u5E94\u7528\u7B5B\u9009\u8868\u8FBE\u5F0F",children:"\u7B5B\u9009"})]})]}),(0,xe.jsx)(oe,{component:"span",role:"status","aria-live":"polite",sx:eh,children:x.text},x.seq)]})}var Wn=P(L(),1);var H1=P(_(),1),GM=ae([(0,H1.jsx)("circle",{cx:"10",cy:"8",r:"4"},"0"),(0,H1.jsx)("path",{d:"M10.35 14.01C7.62 13.91 2 15.27 2 18v1c0 .55.45 1 1 1h8.54c-2.47-2.76-1.23-5.89-1.19-5.99m9.08 4.01c.47-.8.7-1.77.48-2.82-.34-1.64-1.72-2.95-3.38-3.16-2.63-.34-4.85 1.87-4.5 4.5.22 1.66 1.52 3.04 3.16 3.38 1.05.22 2.02-.01 2.82-.48l1.86 1.86c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41zM16 18c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"},"1")],"PersonSearchRounded");var Ve=P(_(),1);function YM({selected:e,onPrepare:t}){let[o,r]=(0,Wn.useState)(""),[n,a]=(0,Wn.useState)(null),[s,i]=(0,Wn.useState)(!1),[l,p]=(0,Wn.useState)(!1),[c,d]=(0,Wn.useState)(""),[f,u]=(0,Wn.useState)(""),g=(0,Wn.useRef)(0);async function b(h){let T=++g.current;p(!0),d(""),u(""),a(null),i(!0);try{let S=await vo(`/api/admin/customer?${h?`id=${encodeURIComponent(h)}`:`username=${encodeURIComponent(o.trim())}`}`);T===g.current&&a(S)}catch(S){T===g.current&&d(S.message)}finally{T===g.current&&p(!1)}}(0,Wn.useEffect)(()=>{e&&b(e.id)},[e]);function x(){g.current++,i(!1),a(null),p(!1),d(""),u("")}async function m(){try{await navigator.clipboard.writeText(n?.code||""),u("\u5B8C\u6574\u5151\u6362\u7801\u5DF2\u590D\u5236\u3002")}catch{u("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u4E2D\u4E0B\u65B9\u5B8C\u6574\u5151\u6362\u7801\u624B\u52A8\u590D\u5236\u3002")}}function y(h){if(!n)return;let T=n.order.id;x(),t(T,h)}return(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsxs)(tt,{variant:"outlined",component:"section","aria-labelledby":"customer-panel-title",sx:{p:{xs:2,sm:3},height:"100%"},children:[(0,Ve.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",children:[(0,Ve.jsx)(GM,{color:"primary","aria-hidden":"true"}),(0,Ve.jsx)(D,{id:"customer-panel-title",variant:"h2",sx:{fontSize:21},children:"\u6309\u5BA2\u6237\u67E5\u8BE2"})]}),(0,Ve.jsx)(oe,{component:"form",onSubmit:h=>{h.preventDefault(),b()},sx:{mt:2},children:(0,Ve.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1,children:[(0,Ve.jsx)(Ht,{label:"\u5BA2\u6237 X \u7528\u6237\u540D",placeholder:"\u8F93\u5165 @\u7528\u6237\u540D",value:o,onChange:h=>r(h.target.value),size:"small",fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{maxLength:16,spellCheck:!1}}}),(0,Ve.jsx)(ue,{type:"submit",variant:"outlined",disabled:l||!o.trim(),sx:{whiteSpace:"nowrap"},children:"\u67E5\u8BE2\u5BA2\u6237\u8BA2\u5355"})]})}),(0,Ve.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\u76F4\u63A5\u67E5\u770B\u5BA2\u6237\u5BF9\u5E94\u7684\u5B8C\u6574\u5151\u6362\u7801\u548C\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u65E0\u9700\u6309\u6279\u6B21\u7FFB\u9875\u3002"})]}),(0,Ve.jsxs)(lr,{open:s,onClose:x,fullWidth:!0,maxWidth:"sm","aria-labelledby":"customer-title","aria-describedby":"customer-dialog-description",children:[(0,Ve.jsx)(ur,{id:"customer-title",children:n?n.order.username?`@${n.order.username} \u7684\u8BA2\u5355`:"\u5151\u6362\u7801\u8BE6\u60C5":c?"\u67E5\u8BE2\u7ED3\u679C":"\u5BA2\u6237\u8BA2\u5355\u8BE6\u60C5"}),(0,Ve.jsxs)(cr,{id:"customer-dialog-description",children:[l&&(0,Ve.jsx)(D,{children:"\u6B63\u5728\u8BFB\u53D6\u8BA2\u5355\u2026"}),c&&(0,Ve.jsx)(ze,{severity:"error",role:"alert",children:c}),n&&(0,Ve.jsxs)(ce,{spacing:2,children:[(0,Ve.jsxs)(D,{children:[n.order.months," \u4E2A\u6708 \xB7 ",n.order.batch||"\u672A\u5206\u7C7B"," \xB7"," ",hi[n.order.status]?.label||n.order.status]}),n.order.message&&(0,Ve.jsx)(D,{variant:"body2",color:"text.secondary",children:n.order.message}),n.code?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Ht,{label:"\u5BA2\u6237\u5BF9\u5E94\u7684\u5B8C\u6574\u5151\u6362\u7801",multiline:!0,value:n.code,slotProps:{input:{readOnly:!0}},sx:{"& textarea":{fontFamily:"monospace",overflowWrap:"anywhere"}}}),(0,Ve.jsx)(ue,{variant:"outlined",onClick:()=>{m()},children:"\u590D\u5236\u5B8C\u6574\u5151\u6362\u7801"})]}):(0,Ve.jsxs)(ze,{severity:"info",children:["\u6B64\u5386\u53F2\u5151\u6362\u7801\u4EC5\u4FDD\u5B58\u4E86\u6821\u9A8C\u503C\uFF0C\u65E0\u6CD5\u8FD8\u539F\u5B8C\u6574\u5185\u5BB9\u3002",n.can_recover&&"\u4ECD\u53EF\u6309\u6B64\u5BA2\u6237\u8BA2\u5355\u5355\u72EC\u8865\u5355\u3002"]}),f&&(0,Ve.jsx)(ze,{severity:"info",role:"status",children:f}),n.checkout_url&&(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Ht,{label:"\u5F53\u524D\u4ED8\u6B3E\u94FE\u63A5\uFF08\u6253\u5F00\u524D\u8BF7\u5148\u6838\u5BF9\u4ED8\u6B3E\u7ED3\u679C\uFF09",multiline:!0,value:n.checkout_url,slotProps:{input:{readOnly:!0}}}),(0,Ve.jsx)(ue,{component:"a",href:n.checkout_url,target:"_blank",rel:"noopener noreferrer",children:"\u6253\u5F00\u5F53\u524D\u4ED8\u6B3E\u94FE\u63A5"})]}),n.previous_checkout_url&&(0,Ve.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5DF2\u751F\u6210\u8FC7 ",n.replacement_count," ","\u6B21\u66FF\u4EE3\u94FE\u63A5\uFF0C\u65E7\u8D26\u5355\u8BB0\u5F55\u5DF2\u4FDD\u7559\u3002"]}),n.can_recover&&(0,Ve.jsx)(ze,{severity:"info",children:"\u300C\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5\u300D\u4E0D\u4F1A\u4ED8\u6B3E\uFF1B\u300C\u5355\u72EC\u8865\u5355\u300D\u4F1A\u5148\u5C55\u793A\u8FD9\u4E00\u7B14\u8BA2\u5355\uFF0C\u786E\u8BA4\u540E\u624D\u5C1D\u8BD5\u4ED8\u6B3E\u3002"})]})]}),(0,Ve.jsxs)(pr,{sx:{flexWrap:"wrap",gap:1},children:[(0,Ve.jsx)(ue,{onClick:x,children:"\u5173\u95ED"}),n?.can_recover&&(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(ue,{variant:"outlined",onClick:()=>y("links"),children:"\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5"}),(0,Ve.jsx)(ue,{variant:"contained",onClick:()=>y("pay"),children:"\u5355\u72EC\u8865\u5355"})]})]})]})]})}var Cn=P(L(),1);var WM=P(_(),1),XM=ae((0,WM.jsx)("path",{d:"M6 9H3c-.55 0-1-.45-1-1s.45-1 1-1h3c.55 0 1 .45 1 1s-.45 1-1 1m0 3H3c-.55 0-1 .45-1 1s.45 1 1 1h3c.55 0 1-.45 1-1s-.45-1-1-1m13.88 6.29-3.12-3.12c-.86.56-1.89.88-3 .82-2.37-.11-4.4-1.96-4.72-4.31-.44-3.35 2.45-6.18 5.83-5.61 1.95.33 3.57 1.85 4 3.78.33 1.46.01 2.82-.7 3.9l3.13 3.13c.39.39.39 1.02 0 1.41s-1.03.39-1.42 0M17 11c0-1.65-1.35-3-3-3s-3 1.35-3 3 1.35 3 3 3 3-1.35 3-3M3 19h8c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1s.45 1 1 1"}),"ManageSearchRounded");var Tt=P(_(),1);function KM({disabled:e,refreshSignal:t,onCopy:o,onViewCustomer:r,onRevoke:n}){let[a,s]=(0,Cn.useState)(""),[i,l]=(0,Cn.useState)(!1),[p,c]=(0,Cn.useState)(!1),[d,f]=(0,Cn.useState)(""),[u,g]=(0,Cn.useState)(null),b=(0,Cn.useRef)(""),x=(0,Cn.useRef)(0),m=(0,Cn.useRef)(null),y=a.replace(/\s+/g,"").toUpperCase(),h=/^XG-[A-F0-9]{48}$/.test(y);async function T(E){let R=++x.current;l(!0),f("");try{let O=await vo("/api/admin/lookup",{code:E});R===x.current&&(g(O),b.current=E)}catch(O){R===x.current&&(g(null),f(O.message))}finally{R===x.current&&l(!1)}}function S(){if(c(!h),!h||i||e){h||m.current?.focus();return}T(y)}(0,Cn.useEffect)(()=>{t>0&&u&&b.current===y&&T(b.current)},[t]);let C=u?[["\u63A5\u6536\u8D26\u53F7",u.username?`@${u.username}`:"\u2014"],["\u6279\u6B21",u.batch||"\u672A\u5206\u7C7B"],["\u751F\u6210\u65F6\u95F4",_l(u.created)],...u.status==="processing"||u.status==="review"?[["\u8BA2\u5355\u8FDB\u5EA6",`${Math.min(100,Math.max(0,u.progress??0))}%`]]:[]]:[];return(0,Tt.jsxs)(tt,{variant:"outlined",component:"section","aria-labelledby":"lookup-title",sx:{p:{xs:2,sm:3},height:"100%"},children:[(0,Tt.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",children:[(0,Tt.jsx)(XM,{color:"primary","aria-hidden":"true"}),(0,Tt.jsx)(D,{id:"lookup-title",variant:"h2",sx:{fontSize:21},children:"\u6309\u5151\u6362\u7801\u67E5\u8BE2"})]}),(0,Tt.jsx)(oe,{component:"form",noValidate:!0,onSubmit:E=>{E.preventDefault(),S()},sx:{mt:2},children:(0,Tt.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1,children:[(0,Tt.jsx)(Ht,{label:"\u5B8C\u6574\u5151\u6362\u7801",placeholder:"XG-\u2026",value:a,onChange:E=>{x.current++,s(E.target.value),g(null),f(""),p&&c(!1)},size:"small",fullWidth:!0,autoComplete:"off",error:p,helperText:p?"\u8BF7\u8F93\u5165 XG- \u5F00\u5934\u3001\u540E\u63A5 48 \u4F4D\u5341\u516D\u8FDB\u5236\u5B57\u7B26\uFF080-9\u3001A-F\uFF09\u7684\u5B8C\u6574\u5151\u6362\u7801\u3002":" ",slotProps:{htmlInput:{maxLength:80,spellCheck:!1,ref:m},input:{sx:{fontFamily:"monospace",fontSize:16}}}}),(0,Tt.jsx)(ue,{type:"submit",variant:"outlined",disabled:i||e||!a.trim(),startIcon:i?(0,Tt.jsx)(aa,{size:16,"aria-hidden":"true"}):void 0,sx:{whiteSpace:"nowrap",alignSelf:{sm:"flex-start"}},children:i?"\u6B63\u5728\u67E5\u8BE2\u2026":"\u67E5\u8BE2\u5151\u6362\u7801"})]})}),(0,Tt.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u7C98\u8D34\u5BA2\u6237\u63D0\u4F9B\u7684\u5B8C\u6574\u5151\u6362\u7801\uFF0C\u76F4\u63A5\u67E5\u770B\u72B6\u6001\u3001\u6279\u6B21\u548C\u63A5\u6536\u8D26\u53F7\uFF0C\u65E0\u9700\u6309\u6279\u6B21\u7FFB\u9875\u3002"}),d&&(0,Tt.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:d}),(0,Tt.jsx)(oe,{"aria-live":"polite",children:u&&(0,Tt.jsxs)(oe,{sx:{mt:2,p:2,border:1,borderColor:"divider",borderRadius:2,bgcolor:"background.default"},children:[(0,Tt.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[(0,Tt.jsx)(jo,{size:"small",variant:"outlined",color:hi[u.status]?.color??"default",label:hi[u.status]?.label??u.status}),(0,Tt.jsxs)(D,{variant:"body2",fontWeight:600,children:[u.months," \u4E2A\u6708"]}),(0,Tt.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{fontFamily:"monospace"},children:["\u5C3E\u53F7 \u2026",u.hint]})]}),(0,Tt.jsx)(oe,{component:"dl",sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:2,rowGap:.5,m:0,mt:1.5},children:C.map(([E,R])=>(0,Tt.jsxs)(oe,{component:"div",sx:{display:"contents"},children:[(0,Tt.jsx)(D,{component:"dt",variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:E}),(0,Tt.jsx)(D,{component:"dd",variant:"body2",sx:{m:0,overflowWrap:"anywhere"},children:R})]},E))}),u.message&&(0,Tt.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:1,overflowWrap:"anywhere"},children:u.message}),(0,Tt.jsxs)(ce,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,sx:{mt:1.5},children:[(0,Tt.jsx)(ue,{size:"small",variant:"outlined",disabled:e,onClick:()=>r(u.id),children:"\u67E5\u770B\u5151\u6362\u7801 / \u8865\u5355"}),u.copyable&&(0,Tt.jsx)(ue,{size:"small",variant:"outlined",disabled:e,onClick:()=>o(u),children:"\u590D\u5236\u5B8C\u6574\u5151\u6362\u7801"}),u.status==="active"&&(0,Tt.jsx)(ue,{size:"small",variant:"outlined",color:"error",disabled:e,onClick:()=>n(u),children:"\u505C\u7528"})]})]})})]})}var ro=P(L(),1);var QM=P(_(),1),tT=ae((0,QM.jsx)("path",{d:"M15.88 9.29 12 13.17 8.12 9.29a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0"}),"ExpandMoreRounded");var ZM=P(_(),1),JM=ae((0,ZM.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2m-1 14H5c-.55 0-1-.45-1-1v-5h16v5c0 .55-.45 1-1 1m1-10H4V6h16z"}),"CreditCardRounded");var eA=P(_(),1),tA=ae((0,eA.jsx)("path",{d:"M19 13H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2M7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M19 3H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"}),"DnsRounded");var Le=P(_(),1),W$={"card, cardholder name or email is incomplete":"\u5361\u4FE1\u606F\u4E0D\u5B8C\u6574","card number checksum is invalid":"\u5361\u53F7\u6821\u9A8C\u5931\u8D25","card has expired":"\u5361\u7247\u5DF2\u8FC7\u671F","Stripe requires a billing address; supply the card billing country and applicable address fields":"\u7F3A\u5C11\u8D26\u5355\u5730\u5740","invalid supplied billing country":"\u8D26\u5355\u56FD\u5BB6\u65E0\u6548",do_not_try_again:"\u94F6\u884C\u8981\u6C42\u505C\u6B62\u91CD\u8BD5",declined_multi_node:"\u591A\u4E2A\u8282\u70B9\u62D2\u4ED8",requires_action:"\u9700\u8981\u94F6\u884C\u9A8C\u8BC1"};function oA(e){return W$[e]||e}function _d(e){return e==="direct"?"\u76F4\u8FDE":e}function V1({label:e,value:t}){return(0,Le.jsxs)(oe,{sx:{border:1,borderColor:"divider",borderRadius:2,p:2,minWidth:0},children:[(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",children:e}),(0,Le.jsx)(D,{variant:"h3",component:"p",sx:{mt:.25},children:t})]})}function rA({icon:e,id:t,title:o}){return(0,Le.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:2},children:[e,(0,Le.jsx)(D,{id:t,variant:"h2",sx:{fontSize:21},children:o})]})}function X$({network:e,failed:t}){let o=e?e.available??e.nodes:0;return(0,Le.jsxs)(tt,{component:"section","aria-labelledby":"payment-nodes-title",variant:"outlined",sx:{p:{xs:2,sm:3}},children:[(0,Le.jsx)(rA,{icon:(0,Le.jsx)(tA,{color:"primary","aria-hidden":"true"}),id:"payment-nodes-title",title:"\u4ED8\u6B3E\u8282\u70B9"}),!e&&!t&&(0,Le.jsx)(ce,{direction:"row",spacing:1.5,role:"status","aria-label":"\u6B63\u5728\u8BFB\u53D6\u4ED8\u6B3E\u8282\u70B9\u72B6\u6001",children:[0,1,2].map(r=>(0,Le.jsx)(Ya,{variant:"rounded",height:78,sx:{flex:1}},r))}),!e&&t&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002"}),e?.mode==="direct"&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u65B0\u8BA2\u5355\u7684 Stripe \u8BF7\u6C42\u8D70\u670D\u52A1\u5668\u76F4\u8FDE\uFF1B\u5DF2\u6709\u8282\u70B9\u7ED1\u5B9A\u7684\u8BA2\u5355\u4FDD\u7559\u539F\u8282\u70B9\u3002"}),e?.mode==="pool"&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1.5},children:[(0,Le.jsx)(V1,{label:"\u8282\u70B9\u603B\u6570",value:String(e.nodes)}),(0,Le.jsx)(V1,{label:"\u53EF\u7528",value:String(o)}),(0,Le.jsx)(V1,{label:"\u51B7\u5374\u4E2D",value:String(e.cooling??0)})]}),o===0&&(0,Le.jsx)(ze,{severity:"warning",sx:{mt:2},children:"\u8282\u70B9\u6C60\u5168\u90E8\u5728\u51B7\u5374\u4E2D\uFF0C\u65B0\u8BA2\u5355\u6682\u65F6\u65E0\u6CD5\u4ED8\u6B3E\u3002"}),(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:2},children:"\u8282\u70B9\u8FDE\u63A5\u6545\u969C\u540E\u51B7\u5374 6 \u5C0F\u65F6\uFF1B\u5B89\u5168\u67E5\u8BE2\u6BCF\u4E2A\u8BF7\u6C42\u6700\u591A\u5C1D\u8BD5 3 \u6B21\uFF1B\u4ED8\u6B3E\u63D0\u4EA4\u5931\u8D25\u4E0D\u81EA\u52A8\u91CD\u6263\u3002"})]}),e&&(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1},children:"X \u751F\u6210\u94FE\u63A5\u8D70\u914D\u7F6E\u4EE3\u7406\uFF1B\u624B\u52A8\u6253\u5F00\u4ED8\u6B3E\u94FE\u63A5\u65F6\uFF0C\u4F7F\u7528\u5F53\u524D\u6D4F\u89C8\u5668\u7684\u7F51\u7EDC\u3002"})]})}function K$({cards:e,rotation:t,paths:o,failed:r}){let n=!t&&!r,a=e.length>0&&e.every(s=>!s.usable||!!s.blocked||(s.cooling_seconds||0)>0||o!==void 0&&o>0&&(s.pair_cooling||0)>=o);return(0,Le.jsxs)(tt,{component:"section","aria-labelledby":"payment-cards-title",variant:"outlined",sx:{p:{xs:2,sm:3}},children:[(0,Le.jsx)(rA,{icon:(0,Le.jsx)(JM,{color:"primary","aria-hidden":"true"}),id:"payment-cards-title",title:"\u4ED8\u6B3E\u5361"}),n&&(0,Le.jsxs)(ce,{spacing:1.5,role:"status","aria-label":"\u6B63\u5728\u8BFB\u53D6\u4ED8\u6B3E\u5361\u72B6\u6001",children:[(0,Le.jsx)(Ya,{variant:"text",width:"60%"}),(0,Le.jsx)(ce,{direction:"row",spacing:1,children:[88,120,104].map(s=>(0,Le.jsx)(Ya,{variant:"rounded",width:s,height:32,sx:{borderRadius:4}},s))})]}),!n&&!t&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002"}),t&&e.length===0&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u5C1A\u672A\u914D\u7F6E\u4ED8\u6B3E\u5361\uFF1B\u4ED8\u6B3E\u5361\u8865\u5355\u4E0D\u53EF\u7528\uFF0C\u4ECD\u53EF\u300C\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5\u300D\u7531\u5BA2\u6237\u81EA\u884C\u4ED8\u6B3E\u3002"}),t&&e.length>0&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5171 ",e.length," \u5F20",t.card_last4?t.used>=t.batch_size?` \xB7 \u5F53\u524D\u7EC4\u5408\uFF1A\u5C3E\u53F7 ${t.card_last4} \xD7 ${_d(t.node)}\uFF08\u672C\u7EC4 ${t.used}/${t.batch_size} \u7B14\u5DF2\u7528\u6EE1\uFF0C\u4E0B\u4E00\u7B14\u81EA\u52A8\u66F4\u6362\uFF09`:` \xB7 \u5F53\u524D\u7EC4\u5408\uFF1A\u5C3E\u53F7 ${t.card_last4} \xD7 ${_d(t.node)}\uFF08\u672C\u7EC4\u5DF2\u7528 ${t.used}/${t.batch_size} \u7B14\uFF09`:" \xB7 \u5C1A\u672A\u5F00\u59CB\u8F6E\u6362\uFF0C\u9996\u7B14\u4ED8\u6B3E\u65F6\u968F\u673A\u9009\u62E9\u7EC4\u5408"]}),a&&(0,Le.jsx)(ze,{severity:"warning",sx:{mt:1.5},children:"\u6240\u6709\u4ED8\u6B3E\u5361\u90FD\u5728\u51B7\u5374\u6216\u4E0D\u53EF\u7528\uFF0C\u65B0\u8BA2\u5355\u6682\u65F6\u65E0\u6CD5\u4ED8\u6B3E\u3002"}),(0,Le.jsx)(ce,{direction:"row",spacing:1,useFlexGap:!0,sx:{mt:1.5,flexWrap:"wrap",alignItems:"center"},children:e.map(s=>{let i=s.cooling_seconds||0,l=!!s.blocked&&i===0,p=s.usable?l?`\u5C3E\u53F7 ${s.last4} \u5DF2\u5C01\u9501\uFF08${oA(s.blocked)}\uFF09`:i>0?`\u5C3E\u53F7 ${s.last4} \u51B7\u5374 ${Math.ceil(i/60)} \u5206\u949F`:`\u5C3E\u53F7 ${s.last4} \u53EF\u7528`:`\u5C3E\u53F7 ${s.last4} \u4E0D\u53EF\u7528${s.problem?`\uFF08${oA(s.problem)}\uFF09`:""}`,c=s.pair_cooling?` \xB7 ${s.pair_cooling} \u7EC4\u7EC4\u5408\u51B7\u5374`:"";return(0,Le.jsx)(jo,{size:"small",variant:"outlined",color:!s.usable||l?"error":i>0?"warning":"success",label:`${p}${c}`},s.last4)})}),(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1.5},children:"\u300CN \u7EC4\u7EC4\u5408\u51B7\u5374\u300D\u6307\u8BE5\u5361\u4E0E\u90E8\u5206\u8282\u70B9\u7684\u7EC4\u5408\u6682\u4E0D\u53EF\u7528\uFF1B\u540C\u4E00\u5361\u5728\u591A\u4E2A\u8282\u70B9\u88AB\u62D2\u540E\u624D\u4F1A\u6574\u5361\u51B7\u5374\u3002"}),(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:.5},children:`\u6BCF ${t.batch_size} \u7B14\u4ED8\u6B3E\u5171\u7528\u540C\u4E00\u5361\u4E0E\u8282\u70B9\u7684\u7EC4\u5408\uFF0C\u7528\u6EE1\u6216\u88AB\u62D2\u540E\u81EA\u52A8\u66F4\u6362\u3002`})]})]})}function nA({network:e,cards:t,rotation:o,failed:r}){let n=e?e.mode==="pool"?e.available??e.nodes:1:void 0;return(0,Le.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"minmax(0, 1fr) minmax(0, 1fr)"},gap:3,mb:3,alignItems:"stretch"},children:[(0,Le.jsx)(X$,{network:e,failed:r}),(0,Le.jsx)(K$,{cards:t,rotation:o,paths:n,failed:r})]})}var ee=P(_(),1),F1={preview:"\u5F85\u786E\u8BA4",pending:"\u5F85\u5904\u7406",running:"\u5904\u7406\u4E2D",stopping:"\u6B63\u5728\u505C\u6B62",stopped:"\u5DF2\u505C\u6B62",completed:"\u6279\u6B21\u5DF2\u7ED3\u675F",interrupted:"\u670D\u52A1\u91CD\u542F\u540E\u6682\u505C",succeeded:"\u5DF2\u786E\u8BA4\u6210\u529F",declined:"\u4ED8\u6B3E\u88AB\u62D2",requires_action:"\u9700\u94F6\u884C\u9A8C\u8BC1",skipped:"\u5DF2\u8DF3\u8FC7",blocked:"\u5F85\u6838\u5B9E",link_ready:"\u94FE\u63A5\u5DF2\u5C31\u7EEA \xB7 \u672A\u4ED8\u6B3E",needs_verification:"\u9700\u6838\u5BF9\u539F\u6263\u6B3E"};function sA(e){let t=r=>e.filter(n=>r.includes(n.state)).length,o=[["\u6210\u529F",t(["succeeded"])],["\u94FE\u63A5\u5C31\u7EEA",t(["link_ready"])],["\u8DF3\u8FC7",t(["skipped"])],["\u5F85\u6838\u5B9E",t(["declined","requires_action","blocked","needs_verification"])],["\u672A\u5904\u7406",t(["pending"])],["\u5904\u7406\u4E2D",t(["running"])]];return[`\u5171 ${e.length} \u7B14`,...o.filter(([,r])=>r>0).map(([r,n])=>`${r} ${n} \u7B14`)].join(" \xB7 ")}function q1(e){return e?_l(e):"\u65F6\u95F4\u672A\u8BB0\u5F55"}function aA({batch:e}){return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)(ce,{direction:"row",flexWrap:"wrap",gap:1,alignItems:"center",children:[(0,ee.jsx)(jo,{size:"small",label:F1[e.state]||e.state}),(0,ee.jsxs)(D,{variant:"body2",children:[e.mode==="links"?"\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5":e.cards&&e.cards>1?`\u4ED8\u6B3E\u5361 ${e.cards} \u5F20\u968F\u673A\u8F6E\u6362\uFF08\u5F53\u524D\u5C3E\u53F7 ${e.last4}\uFF09`:`\u4ED8\u6B3E\u5361\u5C3E\u53F7 ${e.last4}`," \xB7 ",sA(e.items)]})]}),(0,ee.jsxs)(D,{variant:"caption",color:"text.secondary",display:"block",sx:{mt:1},children:["\u521B\u5EFA\u4E8E ",q1(e.created)," \xB7 \u66F4\u65B0\u4E8E ",q1(e.updated||e.created)]}),(0,ee.jsx)(D,{variant:"body2",color:"text.secondary",sx:{my:1},children:e.message}),e.items.length>0&&(0,ee.jsx)(iA,{items:e.items})]})}function Q$(e){let t={};for(let o of e)o.state==="pending"&&(t[o.currency]=(t[o.currency]||0)+o.amount);return Object.entries(t).map(([o,r])=>`${o} ${(r/100).toFixed(2)}`).join(" + ")||"0.00"}function iA({items:e}){return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)(ce,{spacing:1,sx:{display:{xs:"flex",sm:"none"},mb:1},children:e.map(t=>(0,ee.jsxs)(oe,{sx:{p:1.5,border:1,borderColor:"divider",borderRadius:1},children:[(0,ee.jsxs)(D,{variant:"body2",fontWeight:600,sx:{overflowWrap:"anywhere"},children:["@",t.username," \xB7 \u5151\u6362\u7801\u5C3E\u53F7 ",t.hint]}),t.payment_node&&(0,ee.jsxs)(D,{variant:"caption",children:["\u4ED8\u6B3E\u8282\u70B9 ",_d(t.payment_node)]}),(0,ee.jsxs)(D,{variant:"body2",children:[t.months," \u4E2A\u6708 \xB7 ",t.currency," ",(t.amount/100).toFixed(2)]}),(0,ee.jsx)(D,{variant:"body2",fontWeight:600,sx:{mt:1},children:F1[t.state]||t.state}),(0,ee.jsx)(D,{variant:"caption",color:"text.secondary",sx:{overflowWrap:"anywhere"},children:t.detail}),t.state==="link_ready"&&t.checkout_url&&(0,ee.jsx)(ue,{component:"a",href:t.checkout_url,target:"_blank",rel:"noopener noreferrer",size:"small",children:"\u6253\u5F00\u4ED8\u6B3E\u94FE\u63A5"})]},t.id))}),(0,ee.jsx)(oc,{tabIndex:0,role:"region","aria-label":"\u8865\u5355\u8BA2\u5355\u6E05\u5355\uFF0C\u53EF\u6EDA\u52A8\u67E5\u770B",sx:{maxHeight:380,display:{xs:"none",sm:"block"}},children:(0,ee.jsxs)(ec,{size:"small",stickyHeader:!0,"aria-label":"\u8865\u5355\u8BA2\u5355\u6E05\u5355",children:[(0,ee.jsx)(rc,{children:(0,ee.jsxs)(Xa,{children:[(0,ee.jsx)(io,{children:"\u5BA2\u6237 / \u5957\u9910"}),(0,ee.jsx)(io,{children:"\u8D26\u5355\u91D1\u989D"}),(0,ee.jsx)(io,{children:"\u5904\u7406\u7ED3\u679C"})]})}),(0,ee.jsx)(tc,{children:e.map(t=>(0,ee.jsxs)(Xa,{children:[(0,ee.jsxs)(io,{sx:{verticalAlign:"top",minWidth:140},children:[(0,ee.jsxs)(D,{variant:"body2",children:["@",t.username]}),(0,ee.jsxs)(D,{variant:"caption",display:"block",children:["\u5151\u6362\u7801\u5C3E\u53F7 ",t.hint,t.payment_node&&` \xB7 \u4ED8\u6B3E\u8282\u70B9 ${_d(t.payment_node)}`]}),(0,ee.jsxs)(D,{variant:"caption",color:"text.secondary",children:[t.months," \u4E2A\u6708"]})]}),(0,ee.jsxs)(io,{sx:{whiteSpace:"nowrap",verticalAlign:"top"},children:[t.currency," ",(t.amount/100).toFixed(2)]}),(0,ee.jsxs)(io,{sx:{minWidth:180},children:[(0,ee.jsx)(D,{variant:"body2",fontWeight:600,children:F1[t.state]||t.state}),(0,ee.jsx)(D,{variant:"caption",color:"text.secondary",sx:{overflowWrap:"anywhere"},children:t.detail}),t.state==="link_ready"&&t.checkout_url&&(0,ee.jsx)(ue,{component:"a",href:t.checkout_url,target:"_blank",rel:"noopener noreferrer",size:"small",children:"\u6253\u5F00\u4ED8\u6B3E\u94FE\u63A5"})]})]},t.id))})]})})]})}function lA({selection:e}){let[t,o]=(0,ro.useState)(null),[r,n]=(0,ro.useState)(null),[a,s]=(0,ro.useState)([]),[i,l]=(0,ro.useState)(null),[p,c]=(0,ro.useState)(!1),[d,f]=(0,ro.useState)(null),[u,g]=(0,ro.useState)(""),[b,x]=(0,ro.useState)(!1),[m,y]=(0,ro.useState)(""),[h,T]=(0,ro.useState)(!1),[S,C]=(0,ro.useState)(!1),[E,R]=(0,ro.useState)(!1),[O,w]=(0,ro.useState)(!1),A=t?.mode==="links",v=(0,ro.useRef)(!1),N=(0,ro.useRef)(0),k=(0,ro.useRef)(null),z=t?.state==="running"||t?.state==="stopping",j=t?.items.filter(Z=>Z.state==="pending").length||0;(0,ro.useEffect)(()=>{let Z=!1,X;async function de(){let me=N.current;try{let fe=await vo("/api/admin/recovery");!Z&&!v.current&&me===N.current&&(o(fe.batch),n(fe.network||null),s(fe.cards||[]),l(fe.rotation||null),c(!!fe.paused),f(fe.summary||null),g(""))}catch(fe){!Z&&!v.current&&me===N.current&&(g(fe.message),f(null))}finally{Z||(X=setTimeout(de,5e3))}}return de(),()=>{Z=!0,clearTimeout(X)}},[]),(0,ro.useEffect)(()=>{e&&(v.current?k.current=e:W("preview",e))},[e]);async function W(Z,X){if(!v.current){v.current=!0,N.current++,x(!0),y("");try{let de=await vo(`/api/admin/recovery/${Z}`,Z==="preview"?{id:X?.id||"",mode:X?.mode||"pay"}:Z==="start"?{id:t?.id,confirm:S,reset_pause:E,verified_unpaid:O}:{id:t?.id});o(de.batch),Z==="preview"&&(C(!1),R(!1),w(!1),T(!0)),Z==="start"&&T(!1)}catch(de){y(de.message)}finally{v.current=!1,N.current++,x(!1);let de=k.current;de&&(k.current=null,W("preview",de))}}}return(0,ee.jsxs)(ee.Fragment,{children:[u&&(0,ee.jsxs)(ze,{severity:"error",role:"alert",sx:{mb:3},children:["\u5F53\u524D\u72B6\u6001\u8BFB\u53D6\u5931\u8D25\uFF1A",u]}),(0,ee.jsx)(nA,{network:r,cards:a,rotation:i,failed:!!u}),(0,ee.jsxs)(tt,{component:"section","aria-labelledby":"recovery-panel-title",variant:"outlined",sx:{p:{xs:2,sm:3},mb:3},children:[(0,ee.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:2,children:[(0,ee.jsxs)(oe,{children:[(0,ee.jsx)(D,{id:"recovery-panel-title",variant:"h2",sx:{fontSize:21},children:"\u7BA1\u7406\u5458\u624B\u52A8\u8865\u5355"}),(0,ee.jsx)(D,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\u652F\u6301\u53EA\u751F\u6210\u8865\u5355\u94FE\u63A5\uFF0C\u6216\u786E\u8BA4\u540E\u4F7F\u7528\u5DF2\u4FDD\u5B58\u7684\u4ED8\u6B3E\u5361\u4ED8\u6B3E\u3002\u670D\u52A1\u5668\u9010\u7B14\u5904\u7406\uFF0C\u95F4\u9694\u81F3\u5C11 30 \u79D2\u3002"})]}),(0,ee.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{flexWrap:"wrap",rowGap:1},children:[(0,ee.jsx)(ue,{variant:"outlined",disabled:b||z,onClick:()=>{W("preview",{mode:"links"})},children:"\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5"}),(0,ee.jsx)(ue,{variant:"contained",disabled:b||z,onClick:()=>{W("preview")},children:"\u9884\u89C8\u5E76\u8865\u5355"}),z&&(0,ee.jsx)(ue,{variant:"outlined",color:"error",disabled:b||t?.state==="stopping",onClick:()=>{W("stop")},children:"\u505C\u6B62\u540E\u7EED\u8BA2\u5355"})]})]}),p&&(0,ee.jsx)(ze,{severity:"warning",sx:{mt:2},children:"\u4ED8\u6B3E\u4FDD\u62A4\u5DF2\u89E6\u53D1\uFF1A\u7528\u6237\u5145\u503C\u4E0E\u4ED8\u6B3E\u5361\u4ED8\u6B3E\u5747\u5DF2\u6682\u505C\u3002\u542F\u52A8\u8865\u5355\u65F6\uFF0C\u9700\u5728\u786E\u8BA4\u6846\u4E2D\u52FE\u9009\u89E3\u9664\u6682\u505C\u3002"}),m&&!h&&(0,ee.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:m}),(0,ee.jsxs)(oe,{sx:{mt:2},children:[(0,ee.jsx)(D,{variant:"body2",fontWeight:600,"aria-live":"polite",children:u?"\u5F53\u524D\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5":z?"\u5F53\u524D\u6709\u8865\u5355\u4EFB\u52A1\u8FD0\u884C\u4E2D":d?"\u5F53\u524D\u6CA1\u6709\u8FD0\u884C\u4E2D\u7684\u8865\u5355\u4EFB\u52A1":"\u6B63\u5728\u8BFB\u53D6\u5F53\u524D\u72B6\u6001\u2026"}),d&&(0,ee.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["\u5F53\u524D\u8BA2\u5355\uFF1A\u5F85\u6838\u5B9E ",d.review," \u7B14 \xB7 \u5145\u503C\u5904\u7406\u4E2D ",d.processing," \u7B14"]})]}),t&&z&&!u&&(0,ee.jsx)(oe,{sx:{mt:2},children:(0,ee.jsx)(aA,{batch:t})}),t&&!z&&(0,ee.jsxs)(oy,{disableGutters:!0,elevation:0,sx:{mt:2,border:1,borderColor:"divider","&::before":{display:"none"}},children:[(0,ee.jsx)(cy,{expandIcon:(0,ee.jsx)(tT,{}),"aria-controls":"recovery-history-content",id:"recovery-history-heading",children:(0,ee.jsxs)(oe,{children:[(0,ee.jsx)(D,{variant:"body2",fontWeight:600,children:t.state==="preview"?"\u4E0A\u6B21\u9884\u89C8\uFF08\u672A\u542F\u52A8\uFF09":"\u4E0A\u6B21\u8865\u5355\u8BB0\u5F55\uFF08\u5386\u53F2\uFF09"}),(0,ee.jsxs)(D,{variant:"caption",color:"text.secondary",children:[q1(t.updated||t.created)," \xB7 ",sA(t.items)]})]})}),(0,ee.jsxs)(ry,{id:"recovery-history-content",children:[(0,ee.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"\u4EE5\u4E0B\u4E3A\u8FD9\u6B21\u4EFB\u52A1\u4FDD\u5B58\u7684\u5904\u7406\u7ED3\u679C\u3002\u5F53\u524D\u8BA2\u5355\u6570\u91CF\u663E\u793A\u5728\u4E0A\u65B9\uFF1B\u5237\u65B0\u9875\u9762\u4E0D\u4F1A\u91CD\u65B0\u6267\u884C\u6B64\u4EFB\u52A1\u3002"}),(0,ee.jsx)(aA,{batch:t})]})]},`${t.id}-${t.state}`),(0,ee.jsxs)(lr,{open:h,onClose:()=>{b||T(!1)},fullWidth:!0,maxWidth:"md",slotProps:{paper:{sx:{m:{xs:2,sm:4},width:{xs:"calc(100% - 32px)",sm:"calc(100% - 64px)"}}}},"aria-labelledby":"recovery-title","aria-describedby":"recovery-dialog-description",children:[(0,ee.jsx)(ur,{id:"recovery-title",children:A?"\u786E\u8BA4\u751F\u6210\u8865\u5355\u94FE\u63A5\uFF08\u4E0D\u4ED8\u6B3E\uFF09":"\u786E\u8BA4\u624B\u52A8\u8865\u5355"}),(0,ee.jsxs)(cr,{id:"recovery-dialog-description",children:[m&&(0,ee.jsx)(ze,{severity:"error",role:"alert",sx:{mb:2},children:m}),(0,ee.jsxs)(D,{sx:{mb:1},children:[A?"\u53EA\u751F\u6210\u6216\u66F4\u65B0\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u4E0D\u4F7F\u7528\u4ED8\u6B3E\u5361\u4ED8\u6B3E\uFF1B\u6838\u9A8C\u5E76\u5904\u7406":(0,ee.jsxs)(ee.Fragment,{children:[t?.cards&&t.cards>1?(0,ee.jsxs)(ee.Fragment,{children:["\u4F7F\u7528 ",(0,ee.jsx)("strong",{children:t.cards})," \u5F20\u4ED8\u6B3E\u5361\u968F\u673A\u8F6E\u6362\uFF08\u5F53\u524D\u5C3E\u53F7 ",(0,ee.jsx)("strong",{children:t?.last4}),"\uFF09"]}):(0,ee.jsxs)(ee.Fragment,{children:["\u4F7F\u7528\u4ED8\u6B3E\u5361\u5C3E\u53F7 ",(0,ee.jsx)("strong",{children:t?.last4})]}),"\uFF0C\u6838\u9A8C\u5E76\u5904\u7406"]})," ",(0,ee.jsx)("strong",{children:j})," \u7B14\u8BA2\u5355\uFF0C\u8D26\u5355\u603B\u989D"," ",(0,ee.jsx)("strong",{children:Q$(t?.items||[])}),"\u3002"]}),(0,ee.jsx)(ze,{severity:"warning",sx:{mb:2},children:A?"\u8FD9\u4E00\u6B65\u53EA\u51C6\u5907\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u4E0D\u4ED8\u6B3E\u3002\u6709\u6548\u94FE\u63A5\u4F1A\u590D\u7528\uFF1B\u65E7\u94FE\u63A5\u5931\u6548\u65F6\uFF0C\u6838\u9A8C\u5E76\u4FDD\u7559\u65E7\u8BB0\u5F55\u540E\u751F\u6210\u65B0\u94FE\u63A5\u3002":"\u786E\u8BA4\u540E\u4F1A\u5C1D\u8BD5\u771F\u5B9E\u4ED8\u6B3E\u3002\u65E7\u94FE\u63A5\u5931\u6548\u65F6\u53EF\u5148\u751F\u6210\u65B0\u94FE\u63A5\uFF1B\u5DF2\u4ED8\u6B3E\u53EA\u540C\u6B65\u7ED3\u679C\uFF0C\u4E0D\u7B26\u5408\u6761\u4EF6\u7684\u8BA2\u5355\u8DF3\u8FC7\u3002\u666E\u901A\u62D2\u4ED8\u53EA\u6807\u8BB0\u8BE5\u5355\u5931\u8D25\uFF1B\u7ED3\u679C\u4E0D\u660E\u3001\u9700\u94F6\u884C\u9A8C\u8BC1\u6216\u652F\u4ED8\u65B9\u660E\u786E\u7981\u6B62\u91CD\u8BD5\u65F6\u505C\u6B62\u4EFB\u52A1\u3002"}),t&&(0,ee.jsx)(iA,{items:t.items}),t?.paused&&!A&&(0,ee.jsx)(Ms,{control:(0,ee.jsx)(Bn,{checked:E,disabled:b,onChange:Z=>R(Z.target.checked)}),label:"\u6211\u5DF2\u68C0\u67E5\u4ED8\u6B3E\u65B9\u5F0F\uFF0C\u786E\u8BA4\u89E3\u9664\u672C\u8F6E\u6682\u505C\u5E76\u91CD\u65B0\u5C1D\u8BD5\uFF1B\u62D2\u4ED8\u4FDD\u62A4\u7EE7\u7EED\u751F\u6548\u3002"}),t?.items.some(Z=>Z.needs_unpaid_verification)&&(0,ee.jsx)(Ms,{control:(0,ee.jsx)(Bn,{checked:O,disabled:b,onChange:Z=>w(Z.target.checked)}),label:"\u6211\u5DF2\u6838\u5BF9\u539F\u8BA2\u5355\u672A\u6263\u6B3E\uFF1B\u82E5\u65E7\u94FE\u63A5\u5931\u6548\uFF0C\u5141\u8BB8\u4FDD\u7559\u65E7\u8BB0\u5F55\u5E76\u751F\u6210\u65B0\u94FE\u63A5\u3002\u672A\u52FE\u9009\u5219\u4E0D\u4F1A\u66FF\u6362\u65E0\u6CD5\u5728\u7EBF\u786E\u8BA4\u7684\u8D26\u5355\u3002"}),(0,ee.jsx)(Ms,{control:(0,ee.jsx)(Bn,{checked:S,disabled:b,onChange:Z=>C(Z.target.checked)}),label:A?"\u6211\u5DF2\u6838\u5BF9\u5BA2\u6237\u548C\u5957\u9910\uFF0C\u786E\u8BA4\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5\uFF0C\u4E0D\u4ED8\u6B3E\u3002":"\u6211\u5DF2\u6838\u5BF9\u5BA2\u6237\u3001\u5957\u9910\u3001\u8D26\u5355\u91D1\u989D\u548C\u4ED8\u6B3E\u5361\uFF0C\u786E\u8BA4\u542F\u52A8\u672C\u6279\u6B21\u4ED8\u6B3E\u3002"})]}),(0,ee.jsxs)(pr,{children:[(0,ee.jsx)(ue,{disabled:b,onClick:()=>T(!1),children:"\u53D6\u6D88"}),(0,ee.jsx)(ue,{variant:"contained",disabled:b||!S||!j||!A&&t?.paused&&!E||t?.state!=="preview",onClick:()=>{W("start")},children:b?"\u6B63\u5728\u63D0\u4EA4\u2026":A?"\u786E\u8BA4\u751F\u6210\u94FE\u63A5\uFF08\u4E0D\u4ED8\u6B3E\uFF09":"\u786E\u8BA4\u4ED8\u6B3E\u5E76\u542F\u52A8\u8865\u5355"})]})]})]})]})}var Xn=P(L(),1);var pA=P(_(),1),cA=ae((0,pA.jsx)("path",{d:"M19.88 18.47c.48-.77.75-1.67.69-2.66-.13-2.15-1.84-3.97-3.97-4.2-2.72-.3-5.02 1.81-5.02 4.47 0 2.49 2.01 4.5 4.49 4.5.88 0 1.7-.26 2.39-.7l2.41 2.41c.39.39 1.03.39 1.42 0s.39-1.03 0-1.42zm-3.8.11c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5m-.36-8.5c-.74.02-1.45.18-2.1.45l-.55-.83-3.08 5.01c-.36.58-1.17.64-1.61.13l-2.12-2.47-3.06 4.9c-.31.49-.97.62-1.44.28-.42-.31-.54-.89-.26-1.34l3.78-6.05c.36-.57 1.17-.63 1.61-.12L9 12.5l3.18-5.17c.38-.62 1.28-.64 1.68-.03zm2.59.5c-.64-.28-1.33-.45-2.05-.49L20.8 2.9c.31-.49.97-.61 1.43-.27.43.31.54.9.26 1.34z"}),"QueryStatsRounded");var se=P(_(),1),uA={position:"absolute",width:"1px",height:"1px",p:0,m:"-1px",overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ou({label:e,value:t,hint:o}){return(0,se.jsxs)(oe,{sx:{border:1,borderColor:"divider",borderRadius:2,p:2,minWidth:0},children:[(0,se.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",children:e}),(0,se.jsx)(D,{variant:"h3",component:"p",sx:{mt:.25},children:t}),o&&(0,se.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",children:o})]})}var Z$=[{key:"created",label:"\u751F\u6210"},{key:"redeemed",label:"\u5151\u6362"},{key:"succeeded",label:"\u6210\u529F"}];function J$({daily:e}){let t=qt(),o={created:t.vars.palette.primary.main,redeemed:t.vars.palette.secondary.main,succeeded:t.vars.palette.success.main},r=t.vars.palette.divider,n=e.reduce((f,u)=>({created:f.created+u.created,redeemed:f.redeemed+u.redeemed,succeeded:f.succeeded+u.succeeded}),{created:0,redeemed:0,succeeded:0}),a=720,s=40,i=a/e.length,l=e[0],p=e[Math.floor((e.length-1)/2)],c=e[e.length-1],d=f=>f.slice(5).replace("-","/");return(0,se.jsxs)(oe,{children:[(0,se.jsxs)(oe,{role:"img","aria-label":`\u6700\u8FD1 30 \u5929\u5171\u751F\u6210 ${n.created} \u679A\uFF0C\u5151\u6362 ${n.redeemed} \u679A\uFF0C\u6210\u529F ${n.succeeded} \u679A\u3002`,children:[(0,se.jsx)(ce,{spacing:1.5,children:Z$.map(f=>{let u=e.map(b=>b[f.key]),g=Math.max(1,...u);return(0,se.jsxs)(oe,{children:[(0,se.jsxs)(ce,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:.5},children:[(0,se.jsx)(D,{variant:"body2",fontWeight:600,children:f.label}),(0,se.jsxs)(D,{variant:"caption",color:"text.secondary",children:["\u5171 ",n[f.key]]})]}),(0,se.jsxs)(oe,{component:"svg","aria-hidden":!0,viewBox:`0 0 ${a} ${s}`,preserveAspectRatio:"none",sx:{display:"block",width:"100%",height:{xs:36,sm:44}},children:[(0,se.jsx)(oe,{component:"line",x1:0,x2:a,y1:s-.5,y2:s-.5,stroke:r,strokeWidth:1}),u.map((b,x)=>{if(b===0)return null;let m=Math.max(2,b/g*(s-4));return(0,se.jsx)(oe,{component:"rect",x:x*i+i*.22,y:s-m,width:i*.56,height:m,rx:2,fill:o[f.key]},e[x].date)})]})]},f.key)})}),(0,se.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",mt:.75},children:[(0,se.jsx)(D,{variant:"caption",color:"text.secondary",children:d(l.date)}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",textAlign:"center",children:d(p.date)}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",textAlign:"right",children:d(c.date)})]})]}),(0,se.jsxs)(oe,{component:"table",sx:uA,children:[(0,se.jsx)("caption",{children:"\u6700\u8FD1 30 \u5929\u6BCF\u65E5\u751F\u6210\u3001\u5151\u6362\u548C\u6210\u529F\u7684\u5151\u6362\u7801\u6570\u91CF"}),(0,se.jsx)("thead",{children:(0,se.jsxs)("tr",{children:[(0,se.jsx)("th",{scope:"col",children:"\u65E5\u671F"}),(0,se.jsx)("th",{scope:"col",children:"\u751F\u6210"}),(0,se.jsx)("th",{scope:"col",children:"\u5151\u6362"}),(0,se.jsx)("th",{scope:"col",children:"\u6210\u529F"})]})}),(0,se.jsx)("tbody",{children:e.map(f=>(0,se.jsxs)("tr",{children:[(0,se.jsx)("th",{scope:"row",children:f.date}),(0,se.jsx)("td",{children:f.created}),(0,se.jsx)("td",{children:f.redeemed}),(0,se.jsx)("td",{children:f.succeeded})]},f.date))})]})]})}function fA({refreshSignal:e}){let[t,o]=(0,Xn.useState)(!0),[r,n]=(0,Xn.useState)(null),[a,s]=(0,Xn.useState)(!0),[i,l]=(0,Xn.useState)(""),p=(0,Xn.useRef)(0),c=qt(),d=Lv("(prefers-reduced-motion: reduce)"),f=(0,Xn.useCallback)(async()=>{let y=++p.current;s(!0),l("");try{let h=await RM();y===p.current&&n(h)}catch(h){y===p.current&&l(h.message)}finally{y===p.current&&s(!1)}},[]);(0,Xn.useEffect)(()=>{f()},[f,e]);let u=r&&r.codes.redeemed>0?`${Math.round(r.rates.redeemed*100)}%`:"\u2014",g=r&&r.codes.redeemed>0?`${Math.round(r.rates.success*100)}%`:"\u2014",b=Math.max(1,r?.codes.total??1),x=Math.max(1,...(r?.review_stages??[]).map(y=>y.count)),m=c.vars.palette.divider;return(0,se.jsxs)(tt,{variant:"outlined",sx:{mb:3,overflow:"hidden"},children:[(0,se.jsxs)(ue,{fullWidth:!0,"aria-expanded":t,"aria-controls":"stats-panel-content",onClick:()=>o(y=>!y),sx:{justifyContent:"flex-start",gap:1,px:{xs:2.5,sm:3},py:1.5,borderRadius:0,color:"text.primary"},children:[(0,se.jsx)(cA,{color:"primary"}),(0,se.jsx)(D,{variant:"h2",component:"span",sx:{flexGrow:1,textAlign:"left"},children:"\u7EDF\u8BA1\u6982\u89C8"}),r&&(0,se.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5171 ",r.codes.total," \u679A"]}),(0,se.jsx)(tT,{sx:y=>({transform:t?"rotate(180deg)":"none",transition:y.transitions.create("transform"),"@media (prefers-reduced-motion: reduce)":{transition:"none"}})})]}),(0,se.jsx)(Cp,{in:t,timeout:d?0:void 0,children:(0,se.jsxs)(oe,{id:"stats-panel-content",role:"region","aria-label":"\u7EDF\u8BA1\u6982\u89C8",sx:{px:{xs:2.5,sm:3},pb:3,pt:1},children:[(0,se.jsx)(D,{variant:"h2",sx:uA,children:"\u7EDF\u8BA1\u6982\u89C8"}),a&&(0,se.jsxs)(ce,{spacing:2,role:"status","aria-label":"\u6B63\u5728\u52A0\u8F7D\u7EDF\u8BA1\u6570\u636E",children:[(0,se.jsx)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)"},gap:1.5},children:Array.from({length:6},(y,h)=>(0,se.jsx)(Ya,{variant:"rounded",height:92},h))}),(0,se.jsx)(Ya,{variant:"rounded",height:160})]}),!a&&i&&(0,se.jsxs)(ze,{severity:"error",role:"alert",children:[i,r&&" \u4EE5\u4E0B\u4FDD\u7559\u4E0A\u6B21\u52A0\u8F7D\u7684\u6570\u636E\u3002",(0,se.jsx)(ue,{onClick:()=>{f()},children:"\u91CD\u65B0\u52A0\u8F7D"})]}),!a&&!i&&r&&r.codes.total===0&&(0,se.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u8FD8\u6CA1\u6709\u5151\u6362\u7801\u3002\u751F\u6210\u7B2C\u4E00\u6279\u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u5151\u6362\u7EDF\u8BA1\u3002"}),r&&r.codes.total>0&&(0,se.jsxs)(ce,{spacing:3,children:[(0,se.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)"},gap:1.5},children:[(0,se.jsx)(ou,{label:"\u5151\u6362\u7801\u603B\u6570",value:String(r.codes.total)}),(0,se.jsx)(ou,{label:"\u5DF2\u5151\u6362",value:String(r.codes.redeemed),hint:`\u5151\u6362\u7387 ${u}`}),(0,se.jsx)(ou,{label:"\u5151\u6362\u6210\u529F",value:String(r.codes.succeeded),hint:`\u6210\u529F\u7387 ${g}`}),(0,se.jsx)(ou,{label:"\u5904\u7406\u4E2D",value:String(r.codes.processing)}),(0,se.jsx)(ou,{label:"\u5F85\u6838\u5B9E",value:String(r.codes.review)}),(0,se.jsx)(ou,{label:"\u5DF2\u505C\u7528",value:String(r.codes.revoked)})]}),r.daily.length>0&&(0,se.jsxs)(oe,{component:"section","aria-labelledby":"stats-daily-title",children:[(0,se.jsx)(D,{id:"stats-daily-title",variant:"h3",sx:{mb:1.5},children:"\u6700\u8FD1 30 \u5929\u6D3B\u52A8"}),(0,se.jsx)(J$,{daily:r.daily})]}),r.months.length>0&&(0,se.jsxs)(oe,{component:"section","aria-labelledby":"stats-months-title",children:[(0,se.jsx)(D,{id:"stats-months-title",variant:"h3",sx:{mb:1.5},children:"\u5957\u9910\u5206\u5E03"}),(0,se.jsxs)(ce,{component:"ul",direction:"row",useFlexGap:!0,flexWrap:"wrap",gap:2,sx:{listStyle:"none",m:0,p:0,mb:1.5},children:[(0,se.jsxs)(ce,{component:"li",direction:"row",alignItems:"center",spacing:.75,children:[(0,se.jsx)(oe,{"aria-hidden":!0,sx:{width:10,height:10,borderRadius:"50%",bgcolor:"success.main"}}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",children:"\u6210\u529F"})]}),(0,se.jsxs)(ce,{component:"li",direction:"row",alignItems:"center",spacing:.75,children:[(0,se.jsx)(oe,{"aria-hidden":!0,sx:{width:10,height:10,borderRadius:"50%",bgcolor:m}}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",children:"\u672A\u5B8C\u6210"})]})]}),(0,se.jsx)(ce,{spacing:1.5,children:r.months.map(y=>(0,se.jsxs)(oe,{children:[(0,se.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"baseline",spacing:1,sx:{mb:.75},children:[(0,se.jsxs)(D,{variant:"body2",fontWeight:600,children:[y.months," \u4E2A\u6708"]}),(0,se.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5171 ",y.total," \xB7 \u6210\u529F ",y.succeeded,"\uFF08",Math.round(y.succeeded/y.total*100),"%\uFF09"]})]}),(0,se.jsxs)(oe,{"aria-hidden":!0,sx:{display:"flex",width:`${y.total/b*100}%`,height:22,borderRadius:1,overflow:"hidden"},children:[(0,se.jsx)(oe,{sx:{width:`${y.succeeded/y.total*100}%`,bgcolor:"success.main"}}),(0,se.jsx)(oe,{sx:{flex:1,bgcolor:m}})]})]},y.months))})]}),r.review_stages.length>0&&(0,se.jsxs)(oe,{component:"section","aria-labelledby":"stats-stages-title",children:[(0,se.jsx)(D,{id:"stats-stages-title",variant:"h3",sx:{mb:1.5},children:"\u5F85\u6838\u5B9E\u9636\u6BB5\u5206\u5E03"}),(0,se.jsx)(ce,{spacing:1.5,children:[...r.review_stages].sort((y,h)=>y.progress-h.progress).map(y=>(0,se.jsxs)(ce,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,se.jsxs)(D,{variant:"body2",sx:{minWidth:72},children:["\u9636\u6BB5 ",y.progress,"%"]}),(0,se.jsx)(oe,{sx:{flex:1},children:(0,se.jsx)(oe,{"aria-hidden":!0,sx:{width:`${y.count/x*100}%`,height:22,borderRadius:1,bgcolor:"warning.main"}})}),(0,se.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{minWidth:40,textAlign:"right"},children:[y.count," \u679A"]})]},y.progress))}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1},children:"\u9636\u6BB5\u767E\u5206\u6BD4\u5BF9\u5E94\u5151\u6362\u6D41\u7A0B\u7684\u8FDB\u5EA6\u4F4D\u7F6E\u3002"})]})]})]})})]})}var Ke=P(L(),1);var dA=P(_(),1),G1=ae((0,dA.jsx)("path",{d:"M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5m-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1m2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1"}),"LinkRounded");var mA=P(_(),1),yA=ae((0,mA.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m3.88-11.71L10 14.17l-1.88-1.88a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l2.59 2.59c.39.39 1.02.39 1.41 0L17.3 9.7c.39-.39.39-1.02 0-1.41s-1.03-.39-1.42 0"}),"CheckCircleOutlineRounded");var oT=P(L(),1);var hA=P(_(),1),gA=ae((0,hA.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m-.22-13h-.06c-.4 0-.72.32-.72.72v4.72c0 .35.18.68.49.86l4.15 2.49c.34.2.78.1.98-.24.21-.34.1-.79-.25-.99l-3.87-2.3V7.72c0-.4-.32-.72-.72-.72"}),"ScheduleRounded");var TA=P(_(),1),bA=ae((0,TA.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"LockOutlined");var Ue=P(_(),1);function vA({progress:e,username:t,months:o,price:r,onCancel:n,cancelling:a,reconnecting:s,onNotify:i,notifyReady:l}){let p=(0,oT.useRef)(null);(0,oT.useEffect)(()=>{p.current?.focus({preventScroll:!0})},[]);let c=e.status==="submitting",d=e.status==="processing",f=e.estimated_wait_seconds,u=typeof f=="number"&&Number.isFinite(f)&&f>0,g=u&&f>=3600?"\u5C0F\u65F6":u&&f>=60?"\u5206\u949F":"\u79D2",b=u?Math.ceil(f/(f>=3600?3600:f>=60?60:1)):null;return(0,Ue.jsx)(jp,{ref:p,tabIndex:-1,role:"region",variant:"outlined","aria-labelledby":"payment-queue-title",sx:{borderRadius:2,bgcolor:"background.paper",outlineOffset:4},children:(0,Ue.jsxs)(Bp,{sx:{p:{xs:2.5,sm:3},"&:last-child":{pb:{xs:2.5,sm:3}}},children:[(0,Ue.jsxs)(ce,{direction:"row",spacing:1.5,alignItems:"center",sx:{mb:3},children:[(0,Ue.jsx)(oe,{sx:{display:"grid",placeItems:"center",width:48,height:48,flexShrink:0,borderRadius:"50%",bgcolor:"action.selected",color:"primary.main"},children:(0,Ue.jsx)(gA,{"aria-hidden":"true"})}),(0,Ue.jsxs)(oe,{role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,Ue.jsx)(D,{id:"payment-queue-title",variant:"h3",children:s?"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u91CD\u8FDE":c?"\u6B63\u5728\u63D0\u4EA4\u8BF7\u6C42":d?"\u6B63\u5728\u4E3A\u4F60\u751F\u6210\u94FE\u63A5":"\u5DF2\u52A0\u5165\u961F\u5217"}),(0,Ue.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:.25},children:s?"\u6B63\u5728\u6062\u590D\u539F\u6392\u961F\uFF0C\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4":c?"\u8BF7\u7A0D\u5019\uFF0C\u6B63\u5728\u786E\u8BA4\u4F60\u7684\u8BF7\u6C42":d?"\u5B8C\u6210\u540E\u5C06\u5728\u8FD9\u91CC\u663E\u793A\u4ED8\u6B3E\u5165\u53E3":"\u4F60\u7684\u8BF7\u6C42\u5C06\u6309\u987A\u5E8F\u5904\u7406"})]})]}),(0,Ue.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:"minmax(0, 1.35fr) minmax(0, 1fr)",gap:2,mb:3},children:[(0,Ue.jsxs)(oe,{children:[(0,Ue.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u9884\u8BA1\u8FD8\u9700"}),(0,Ue.jsx)(ce,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:.5},children:b===null?(0,Ue.jsx)(D,{sx:{fontSize:28,lineHeight:1.5,fontWeight:600},children:"\u4F30\u7B97\u4E2D"}):(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(D,{component:"span",sx:{fontSize:{xs:44,sm:52},lineHeight:1.15,fontWeight:600,letterSpacing:"-0.03em",fontVariantNumeric:"tabular-nums",color:"primary.main"},children:b}),(0,Ue.jsx)(D,{component:"span",color:"text.secondary",children:g})]})}),(0,Ue.jsx)(D,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:1},children:"\u524D\u65B9\u8BA2\u5355\u5B8C\u6210\u540E\uFF0C\u7B49\u5F85\u65F6\u95F4\u4F1A\u7F29\u77ED"})]}),(0,Ue.jsxs)(oe,{sx:{borderLeft:1,borderColor:"divider",pl:{xs:2,sm:3}},children:[(0,Ue.jsx)(D,{variant:"body2",color:"text.secondary",children:d?"\u5F53\u524D\u8FDB\u5EA6":"\u524D\u65B9\u7B49\u5F85"}),d?(0,Ue.jsx)(D,{sx:{mt:1,fontSize:24,fontWeight:600},children:"\u5DF2\u8F6E\u5230\u4F60"}):(0,Ue.jsxs)(ce,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:1},children:[(0,Ue.jsx)(D,{component:"span",sx:{fontSize:32,lineHeight:1.25,fontWeight:600,fontVariantNumeric:"tabular-nums"},children:e.ahead??"\u2014"}),(0,Ue.jsx)(D,{component:"span",color:"text.secondary",children:"\u4EBA"})]})]})]}),(0,Ue.jsx)(ks,{"aria-label":d?"\u6B63\u5728\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5":"\u6B63\u5728\u7B49\u5F85\u5904\u7406",sx:{height:4,borderRadius:2,mb:3}}),(0,Ue.jsx)(ph,{alternativeLabel:!0,activeStep:c?0:d?2:1,sx:{mx:-1,mb:3,"& .MuiStepLabel-label":{fontSize:12,mt:1},"& .MuiStepIcon-root":{fontSize:22}},children:["\u63D0\u4EA4\u8BF7\u6C42","\u6392\u961F\u7B49\u5F85","\u751F\u6210\u94FE\u63A5"].map(m=>(0,Ue.jsx)(ah,{children:(0,Ue.jsx)(ih,{children:m})},m))}),i&&(0,Ue.jsx)(ue,{variant:"outlined",fullWidth:!0,onClick:i,disabled:l,sx:{mb:2,minHeight:44},children:l?"\u5DF2\u5F00\u542F\u5C31\u7EEA\u901A\u77E5":"\u94FE\u63A5\u5C31\u7EEA\u65F6\u901A\u77E5\u6211"}),(0,Ue.jsxs)(ze,{severity:"warning",icon:!1,sx:{mb:3},children:[(0,Ue.jsx)(D,{variant:"body2",fontWeight:600,children:"\u8F6E\u5230\u4F60\u540E\uFF0C\u4ED8\u6B3E\u94FE\u63A5\u53EA\u4FDD\u7559 3 \u5206\u949F"}),(0,Ue.jsx)(D,{variant:"body2",sx:{mt:.5},children:"\u8BF7\u63D0\u524D\u51C6\u5907\u597D\u94F6\u884C\u5361\uFF0C\u8D85\u65F6\u672A\u4ED8\u6B3E\u94FE\u63A5\u4F1A\u4F5C\u5E9F\uFF0C\u9700\u8981\u91CD\u65B0\u6392\u961F\u3002\u7B49\u5F85\u65F6\u8BF7\u8BA9\u672C\u9875\u4FDD\u6301\u6253\u5F00\uFF1A\u624B\u673A\u5207\u5230\u5176\u4ED6\u5E94\u7528\u8D85\u8FC7\u7EA6 1.5 \u5206\u949F\u4F1A\u6682\u505C\u4F60\u7684\u6392\u961F\uFF0C\u8D85\u8FC7 5 \u5206\u949F\u4F1A\u88AB\u79FB\u51FA\u961F\u5217\u3002\u9875\u9762\u6807\u9898\u4F1A\u663E\u793A\u6392\u961F\u8FDB\u5EA6\u548C\u4ED8\u6B3E\u5012\u8BA1\u65F6\u3002"})]}),(0,Ue.jsx)(Vp,{sx:{mb:2}}),(0,Ue.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:.5,children:[(0,Ue.jsxs)(D,{variant:"body2",fontWeight:600,sx:{overflowWrap:"anywhere"},children:["@",t]}),(0,Ue.jsxs)(D,{variant:"body2",color:"text.secondary",children:[o," \u4E2A\u6708 Premium \xB7 ",r]})]}),(0,Ue.jsxs)(ce,{direction:"row",spacing:.75,alignItems:"flex-start",sx:{mt:2},children:[(0,Ue.jsx)(bA,{sx:{fontSize:16,color:"text.secondary",mt:"3px"},"aria-hidden":"true"}),(0,Ue.jsx)(D,{variant:"caption",color:"text.secondary",children:"\u5237\u65B0\u9875\u9762\u4E0D\u4F1A\u9000\u51FA\u6392\u961F\uFF1B\u5173\u95ED\u6216\u79BB\u5F00\u7F51\u7AD9\u540E\u4F1A\u81EA\u52A8\u9000\u51FA\u3002\u751F\u6210\u94FE\u63A5\u4E0D\u4F1A\u6263\u6B3E\u3002"})]}),n&&(0,Ue.jsx)(ue,{variant:"outlined",fullWidth:!0,onClick:n,disabled:a,sx:{mt:2,minHeight:44},children:a?"\u6B63\u5728\u9000\u51FA\u2026":"\u653E\u5F03\u6392\u961F"})]})})}var xA=P(_(),1),rT=ae((0,xA.jsx)("path",{d:"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1M14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1h-5c-.55 0-1 .45-1 1"}),"OpenInNewRounded");function eH(e){return e===429||e===502||e===503||e===504}async function PA(e,t,o=()=>new Promise(a=>setTimeout(a,3e3)),r=Date.now,n={}){let a=r()+(n.maxWaitMs??Number.POSITIVE_INFINITY);for(;;){t.throwIfAborted();try{let s=await e();if(!eH(s.status)||r()>=a)return s}catch(s){if(t.throwIfAborted(),r()>=a)throw s}n.onRetry?.(),await o()}}function SA(e,t,o){if(!e||typeof e!="object")return!1;let r=e;if(r.username!==t||!Number.isSafeInteger(r.months)||r.months<1||r.months>24||!Number.isSafeInteger(r.amount)||r.amount<=0||typeof r.currency!="string"||!/^[A-Z]{3}$/.test(r.currency))return!1;if(r.status==="succeeded")return!0;if(r.status!=="created"&&r.status!=="requires_action"||r.months!==o.months||r.amount!==o.amount||r.currency!==o.currency||typeof r.checkout_url!="string")return!1;try{let n=new URL(r.checkout_url);return n.protocol==="https:"&&n.hostname==="checkout.stripe.com"&&!n.port&&!n.username&&!n.password&&/^\/(?:c\/)?pay\/cs_(?:live|test)_[A-Za-z0-9]+$/.test(n.pathname)}catch{return!1}}var Dd=P(L(),1);var Y1=P(_(),1),CA=ae([(0,Y1.jsx)("path",{d:"M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2zM15 20H6c-.55 0-1-.45-1-1v-1h10zm4-1c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11z"},"0"),(0,Y1.jsx)("path",{d:"M9 7h6v2H9zm7 0h2v2h-2zm-7 3h6v2H9zm7 0h2v2h-2z"},"1")],"ReceiptLongOutlined");var Dl=P(_(),1);function tH(e){return new Date(e*1e3).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function W1({username:e}){let[t,o]=(0,Dd.useState)(!1),[r,n]=(0,Dd.useState)(null);(0,Dd.useEffect)(()=>n(null),[e]);let a=/^[a-z0-9_]{1,15}$/.test(e);async function s(){o(!0);try{let{ok:i,data:l}=await Sa(`/api/manual-link/order?username=${encodeURIComponent(e)}`);if(!i){n({severity:"info",text:l.message||"\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"});return}let p=`@${l.username} \xB7 ${l.months} \u4E2A\u6708 Premium\uFF08${tH(l.created)} \u751F\u6210\u94FE\u63A5\uFF09`;n({paid:{severity:"success",text:`${p}\uFF1A\u5DF2\u786E\u8BA4\u4ED8\u6B3E\u3002Premium \u76F4\u63A5\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\uFF0C\u6CA1\u6709\u5151\u6362\u7801\uFF0C\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u67E5\u770B\u3002`},open:{severity:"info",text:`${p}\uFF1A\u4ED8\u6B3E\u94FE\u63A5\u4ECD\u5728 3 \u5206\u949F\u6709\u6548\u671F\u5185\uFF0C\u8BF7\u56DE\u5230\u672C\u9875\u7684\u4ED8\u6B3E\u5165\u53E3\u5B8C\u6210\u4ED8\u6B3E\u3002`},ended:{severity:"warning",text:`${p}\uFF1A\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u672C\u7AD9\u6682\u672A\u8BB0\u5F55\u5230\u4ED8\u6B3E\u786E\u8BA4\u3002\u8FD9\u4E0D\u4E00\u5B9A\u8868\u793A\u672A\u4ED8\u6B3E\u2014\u2014\u5982\u5DF2\u6263\u6B3E\uFF0C\u8BF7\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\uFF0C\u5207\u52FF\u91CD\u590D\u4ED8\u6B3E\uFF1B\u786E\u8BA4\u672A\u4ED8\u6B3E\u65F6\u53EF\u91CD\u65B0\u6392\u961F\u3002`},not_created:{severity:"info",text:`${p}\uFF1A\u672A\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u6CA1\u6709\u4EA7\u751F\u4ED8\u6B3E\u3002`}}[l.state]??{severity:"info",text:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u8BA2\u5355\u72B6\u6001\u3002"})}catch{n({severity:"error",text:"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"})}finally{o(!1)}}return(0,Dl.jsxs)(oe,{sx:{mt:2},children:[(0,Dl.jsx)(ue,{size:"small",startIcon:(0,Dl.jsx)(CA,{}),disabled:!a||t,onClick:()=>{s()},sx:{ml:-1},children:t?"\u6B63\u5728\u67E5\u8BE2\u2026":a?`\u67E5\u8BE2 @${e} \u7684\u4ED8\u6B3E\u72B6\u6001`:"\u586B\u5199\u7528\u6237\u540D\u540E\u53EF\u67E5\u8BE2\u4ED8\u6B3E\u72B6\u6001"}),r?(0,Dl.jsx)(ze,{severity:r.severity,sx:{mt:1},role:"status",children:r.text}):(0,Dl.jsx)(oe,{component:"p",sx:{m:0,mt:.5,color:"text.secondary",fontSize:12},children:"\u53EA\u67E5\u8BE2\u672C\u6D4F\u89C8\u5668\u751F\u6210\u8FC7\u7684\u8BA2\u5355\uFF0C\u4E0D\u4F1A\u6392\u961F\u6216\u5EFA\u5355\u3002"})]})}var re=P(_(),1),K1="xgift-public-queue";function gi(e){try{e?sessionStorage.setItem(K1,JSON.stringify(e)):sessionStorage.removeItem(K1)}catch{}}function oH(){try{let e=JSON.parse(sessionStorage.getItem(K1)||"null");return!e||typeof e.ticket!="string"||!/^[a-z0-9_]{1,15}$/.test(e.username)||!Number.isInteger(e.months)||e.months<1||e.months>24?null:typeof e.expires_at=="number"&&e.expires_at*1e3<=Date.now()?(gi(null),null):e}catch{return null}}function X1(e){if(e<60)return"1 \u5206\u949F\u5185";let t=Math.ceil(e/60);if(t<60)return`\u7EA6 ${t} \u5206\u949F`;let o=t%60;return`\u7EA6 ${Math.floor(t/60)} \u5C0F\u65F6${o?` ${o} \u5206\u949F`:""}`}function nT(e){return`${e.currency} ${(e.amount/100).toFixed(2)}`}function EA({publicMode:e=!1,onShow:t}){let o=e?"/api/manual-link":"/api/admin/manual-link",[r,n]=(0,Ke.useState)([]),[a,s]=(0,Ke.useState)(6),[i,l]=(0,Ke.useState)(""),[p,c]=(0,Ke.useState)(!1),[d,f]=(0,Ke.useState)(""),[u,g]=(0,Ke.useState)(""),[b,x]=(0,Ke.useState)(null),[m,y]=(0,Ke.useState)(!1),[h,T]=(0,Ke.useState)(!1),[S,C]=(0,Ke.useState)(""),[E,R]=(0,Ke.useState)({status:"submitting"}),O=(0,Ke.useRef)(null),w=(0,Ke.useRef)(null),A=(0,Ke.useRef)(null),v=(0,Ke.useRef)(!1),N=(0,Ke.useRef)(null),[k,z]=(0,Ke.useState)(!1),[j,W]=(0,Ke.useState)(!1),[Z,X]=(0,Ke.useState)(!1),de=typeof Notification<"u"&&Notification.permission!=="denied",[me,fe]=(0,Ke.useState)(()=>typeof Notification<"u"&&Notification.permission==="granted"),ie=(0,Ke.useRef)(null),we=(0,Ke.useRef)(document.title),Te=(0,Ke.useRef)(null),le=(0,Ke.useRef)(!0),[,Pe]=(0,Ke.useState)(0),[ye,Oe]=(0,Ke.useState)(null),he=e&&!p&&!b;(0,Ke.useEffect)(()=>{if(!he)return;let ne=()=>{document.visibilityState==="visible"&&Sa(o+"/queue").then(({ok:Me,data:je})=>Oe(Me&&Number.isInteger(je.waiting)?je:null)).catch(()=>Oe(null))};ne();let te=setInterval(ne,3e4);return()=>clearInterval(te)},[he]),(0,Ke.useEffect)(()=>{if(!b?.expires_at||!b.checkout_url)return;let ne=setInterval(()=>Pe(te=>te+1),1e3);return()=>clearInterval(ne)},[b]);let ge=b?.expires_at?Math.max(0,Math.floor(b.expires_at-Date.now()/1e3)):null,be=ge===0;(0,Ke.useEffect)(()=>{e&&be&&gi(null)},[e,be]),(0,Ke.useEffect)(()=>{if(!e)return;let ne=we.current;b?.checkout_url&&ge!==null?ne=ge>0?`${Math.floor(ge/60)}:${String(ge%60).padStart(2,"0")} \u5185\u8BF7\u4ED8\u6B3E \xB7 XGift`:"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u8FC7\u671F \xB7 XGift":b?.status==="succeeded"?ne="\u8BA2\u5355\u5DF2\u4ED8\u6B3E \xB7 XGift":p&&E.status==="processing"?ne="\u5373\u5C06\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5 \xB7 XGift":p&&E.status==="queued"&&(ne=`\u6392\u961F\u4E2D \xB7 \u524D\u65B9 ${E.ahead??"\u2014"} \u4EBA \xB7 XGift`),document.title=ne}),(0,Ke.useEffect)(()=>()=>{document.title=we.current},[]);let H=i.trim().replace(/^@/,"").toLowerCase(),U=/^[a-z0-9_]{1,15}$/.test(H);async function Se(ne=!1){g("");try{let te=await vo(o+"/plans");if(n(te.plans),s(te.plans.some(Me=>Me.months===6)?6:te.plans[0]?.months??0),te.plans.length||g("\u6682\u65E0\u53EF\u7528\u5957\u9910\u3002"),ne&&e&&te.plans.length&&le.current&&!v.current){let Me=oH();if(!Me){let je=await Sa(o+"/queue/current");je.ok&&je.data?.ticket&&(Me=je.data)}if(Me&&le.current&&!v.current){let je=te.plans.find(Mt=>Mt.months===Me.months);je&&(t?.(),l(Me.username),s(Me.months),He(Me,je))}}}catch(te){g(te.message)}}(0,Ke.useEffect)(()=>(le.current=!0,Se(!0),()=>{le.current=!1}),[]),(0,Ke.useEffect)(()=>{let ne=()=>{let Me=N.current;if(Me){let je=`/api/manual-link/queue/${encodeURIComponent(Me)}/leave`;navigator.sendBeacon(je,"")||fetch(je,{method:"POST",keepalive:!0,credentials:"same-origin"}).catch(()=>{}),A.current?.abort()}},te=Me=>{Me.persisted&&(v.current=!1,Se(!0))};return window.addEventListener("pagehide",ne),window.addEventListener("pageshow",te),()=>{A.current?.abort(),window.removeEventListener("pagehide",ne),window.removeEventListener("pageshow",te)}},[]);async function De(){let ne=N.current;if(!(!ne||k)){z(!0);try{let te=await Sa(`${o}/queue/${encodeURIComponent(ne)}/cancel`,{});if(!te.ok){f(te.data.message||"\u6682\u65F6\u65E0\u6CD5\u9000\u51FA\u6392\u961F\uFF0C\u8BF7\u91CD\u8BD5\u3002");return}te.data.cancelled&&(N.current=null,gi(null),A.current?.abort(),C("\u5DF2\u9000\u51FA\u6392\u961F\u3002"),f(""))}catch{f("\u6682\u65F6\u65E0\u6CD5\u9000\u51FA\u6392\u961F\uFF0C\u8BF7\u91CD\u8BD5\u3002")}finally{z(!1)}}}(0,Ke.useEffect)(()=>{b&&e&&O.current?.focus({preventScroll:!0})},[b,e]),(0,Ke.useEffect)(()=>{p||!d||(w.current?.focus({preventScroll:!0}),e&&ie.current?.scrollIntoView({block:"nearest"}))},[p,d]);function Ce(){e&&gi(null),x(null),f(""),C(""),y(!1),T(!1)}async function _e(){if(!("Notification"in window)){C("\u6B64\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u7CFB\u7EDF\u901A\u77E5\uFF0C\u8BF7\u4FDD\u6301\u9875\u9762\u6253\u5F00\uFF0C\u94FE\u63A5\u751F\u6210\u540E\u9875\u9762\u6807\u9898\u4E5F\u4F1A\u63D0\u9192\u3002");return}try{let ne=await Notification.requestPermission();ne==="granted"&&"serviceWorker"in navigator&&await navigator.serviceWorker.register("/payment-notifications.js"),fe(ne==="granted"),C(ne==="granted"?"\u5DF2\u5F00\u542F\u94FE\u63A5\u5C31\u7EEA\u901A\u77E5\uFF0C\u8BF7\u4FDD\u6301\u7F51\u9875\u6253\u5F00\u3002":"\u672A\u5F00\u542F\u7CFB\u7EDF\u901A\u77E5\uFF0C\u8BF7\u7559\u610F\u6B64\u9875\u9762\u7684\u6392\u961F\u8FDB\u5EA6\u3002")}catch{C("\u6682\u65F6\u65E0\u6CD5\u5F00\u542F\u7CFB\u7EDF\u901A\u77E5\uFF0C\u8BF7\u7559\u610F\u6B64\u9875\u9762\u3002")}}async function He(ne,te){let Me=te??r.find(Fe=>Fe.months===a),je=ne?.username??H;if(v.current||!/^[a-z0-9_]{1,15}$/.test(je)||!Me)return;v.current=!0,c(!0),f(""),C(""),x(null),R({status:"submitting"});let Mt=new AbortController;A.current=Mt,ne?N.current=ne.ticket:gi(null);try{let Fe=Re=>PA(()=>Sa(Re,void 0,AbortSignal.any([Mt.signal,AbortSignal.timeout(2e4)])),Mt.signal,void 0,void 0,{onRetry:()=>X(!0)}),{ok:Ne,data:Ae,status:rt}=ne?await Fe(`${o}/queue/${encodeURIComponent(ne.ticket)}`):await Sa(o,{username:je,months:Me.months,verified_unpaid:m&&h,queue_protocol:e?1:void 0},AbortSignal.any([Mt.signal,AbortSignal.timeout(12e4)]));for(ne&&(N.current=ne.ticket);Ne&&typeof Ae?.ticket=="string"&&Ae.ticket&&(Ae.status==="queued"||Ae.status==="processing");){N.current=Ae.ticket,gi({ticket:Ae.ticket,username:je,months:Me.months}),X(!1),R({status:Ae.status,ahead:Ae.ahead??Math.max(0,(Ae.position??1)-1),estimated_wait_seconds:Ae.estimated_wait_seconds}),await new Promise(Ft=>setTimeout(Ft,3e3)),Mt.signal.throwIfAborted();let Re=`${o}/queue/${encodeURIComponent(Ae.ticket)}`;({ok:Ne,data:Ae,status:rt}=await Fe(Re))}let Ot=N.current;if(N.current=null,X(!1),Ne||gi(null),!Ne&&rt===410)return;if(!Ne){y(!!Ae?.needs_unpaid_verification),f(Ae?.message||"\u751F\u6210\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");return}if(!SA(Ae,je,Me)){f("\u5C1A\u672A\u53D6\u5F97\u5B8C\u6574\u7684\u4ED8\u6B3E\u8BA2\u5355\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002\u7CFB\u7EDF\u4F1A\u5148\u68C0\u67E5\u5DF2\u6709\u94FE\u63A5\u3002");return}y(!1),T(!1),x(Ae),t?.(),e&&gi(Ot&&Ae.checkout_url&&Ae.expires_at?{ticket:Ot,username:je,months:Me.months,expires_at:Ae.expires_at}:null),e&&Ot&&Te.current!==Ot&&(Te.current=Ot,navigator.vibrate?.([200,100,200]),"Notification"in window&&Notification.permission==="granted"&&(async()=>{try{let Re=Ae.status==="succeeded"?"\u8BA2\u5355\u5DF2\u4ED8\u6B3E":"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u5C31\u7EEA",Ft={body:"\u8BF7\u8FD4\u56DE\u7F51\u9875\u67E5\u770B\u8BA2\u5355\u53CA\u4ED8\u6B3E\u72B6\u6001\u3002",tag:"xgift-payment-ready"};if("serviceWorker"in navigator)await navigator.serviceWorker.register("/payment-notifications.js"),await(await navigator.serviceWorker.ready).showNotification(Re,Ft);else{let Nt=new Notification(Re,Ft);Nt.onclick=()=>{window.focus(),Nt.close()}}}catch{C("\u7CFB\u7EDF\u901A\u77E5\u672A\u80FD\u663E\u793A\uFF0C\u8BF7\u7559\u610F\u6B64\u9875\u9762\u7684\u8BA2\u5355\u72B6\u6001\u3002")}})())}catch(Fe){Mt.signal.aborted||f(Fe.name==="TimeoutError"?"\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u4F7F\u7528\u540C\u4E00\u7528\u6237\u540D\u548C\u5957\u9910\u91CD\u8BD5\uFF0C\u7CFB\u7EDF\u4F1A\u68C0\u67E5\u5DF2\u6709\u8BA2\u5355\u3002":"\u8FDE\u63A5\u6682\u65F6\u4E2D\u65AD\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u6062\u590D\u539F\u6392\u961F\uFF1B\u65E0\u9700\u91CD\u65B0\u751F\u6210\u8BA2\u5355\u3002")}finally{A.current===Mt&&(v.current=!1,c(!1),R({status:"submitting"}),A.current=null,N.current=null)}}async function ot(){if(b?.checkout_url)try{await navigator.clipboard.writeText(b.checkout_url),C("\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u590D\u5236\u3002")}catch{C("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u4E2D\u4E0B\u65B9\u94FE\u63A5\u624B\u52A8\u590D\u5236\u3002")}}return(0,re.jsxs)(tt,{variant:"outlined",component:"section","aria-labelledby":"manual-payment-title",sx:{p:e?0:{xs:2,sm:3},mb:e?0:3,...e?{border:0,bgcolor:"transparent"}:{}},children:[(0,re.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:1},children:[(0,re.jsx)(G1,{color:"primary","aria-hidden":"true"}),(0,re.jsx)(D,{id:"manual-payment-title",variant:"h2",sx:{fontSize:21},children:"\u624B\u52A8\u4ED8\u6B3E\u94FE\u63A5"})]}),!(e&&(p||b))&&(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:e?"\u4E3A\u6307\u5B9A\u7684 X \u8D26\u53F7\u751F\u6210 Stripe \u4ED8\u6B3E\u94FE\u63A5\uFF0C\u4ED8\u6B3E\u6210\u529F\u540E Premium \u76F4\u63A5\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\u3002":"\u586B\u5199 X \u7528\u6237\u540D\u548C\u5957\u9910\u65F6\u957F\uFF0C\u751F\u6210 Stripe \u94FE\u63A5\u540E\u624B\u52A8\u4ED8\u6B3E\uFF0C\u65E0\u9700\u5151\u6362\u7801\u3002"}),e&&!(p||b)&&(0,re.jsx)(oe,{component:"ol",sx:{m:0,mb:3,p:0,listStyle:"none",display:"grid",gap:1},children:["\u586B\u5199 X \u7528\u6237\u540D\u3001\u9009\u62E9\u5957\u9910\u540E\u63D0\u4EA4\uFF0C\u6309\u987A\u5E8F\u6392\u961F\uFF1B\u9AD8\u5CF0\u671F\u53EF\u80FD\u9700\u8981\u7B49\u5F85\u8F83\u4E45\uFF0C\u8BF7\u4FDD\u6301\u672C\u9875\u6253\u5F00","\u8F6E\u5230\u4F60\u65F6\u751F\u6210 Stripe \u4ED8\u6B3E\u94FE\u63A5\uFF0C\u94FE\u63A5\u53EA\u4FDD\u7559 3 \u5206\u949F\uFF0C\u8BF7\u63D0\u524D\u51C6\u5907\u597D\u94F6\u884C\u5361\uFF0C\u770B\u5230\u94FE\u63A5\u7ACB\u5373\u4ED8\u6B3E","\u4ED8\u6B3E\u6210\u529F\u540E Premium \u76F4\u63A5\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\uFF0C\u6CA1\u6709\u5151\u6362\u7801\uFF1B\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26"].map((ne,te)=>(0,re.jsxs)(oe,{component:"li",sx:{display:"flex",gap:1.25,alignItems:"flex-start"},children:[(0,re.jsx)(oe,{"aria-hidden":"true",sx:{flexShrink:0,width:22,height:22,mt:"1px",borderRadius:"50%",bgcolor:"action.selected",color:"text.secondary",display:"grid",placeItems:"center",fontSize:13,fontWeight:600},children:te+1}),(0,re.jsx)(D,{variant:"body2",color:"text.secondary",children:ne})]},ne))}),he&&ye&&(0,re.jsxs)(ze,{severity:ye.waiting>=10?"warning":"info",icon:!1,sx:{mb:2},role:"status",children:[ye.waiting>0?(0,re.jsxs)(re.Fragment,{children:["\u5F53\u524D\u6392\u961F ",(0,re.jsx)("strong",{children:ye.waiting})," \u4EBA\uFF0C\u73B0\u5728\u63D0\u4EA4\u9884\u8BA1",X1(ye.estimated_wait_seconds),"\u540E\u8F6E\u5230\u4F60\u3002"]}):(0,re.jsxs)(re.Fragment,{children:["\u5F53\u524D\u65E0\u4EBA\u6392\u961F\uFF0C\u63D0\u4EA4\u540E\u9884\u8BA1",X1(ye.estimated_wait_seconds),"\u751F\u6210\u94FE\u63A5\u3002"]}),ye.waiting>=10&&" \u7B49\u5F85\u671F\u95F4\u9700\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u8BF7\u786E\u8BA4\u6709\u7A7A\u518D\u63D0\u4EA4\u3002"]}),(0,re.jsxs)(lr,{open:j,onClose:()=>W(!1),"aria-labelledby":"confirm-payment-title","aria-describedby":"confirm-payment-description",fullWidth:!0,maxWidth:"xs",children:[(0,re.jsx)(ur,{id:"confirm-payment-title",children:"\u786E\u8BA4\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5\uFF1F"}),(0,re.jsxs)(cr,{children:[(0,re.jsx)(Ns,{id:"confirm-payment-description",color:"text.primary",children:"\u5982\u679C\u4E0D\u60F3\u8981\u4ED8\u6B3E\uFF0C\u8BF7\u4E0D\u8981\u70B9\u51FB\u751F\u6210\u94FE\u63A5\u3002"}),(0,re.jsxs)(Ns,{sx:{mt:2},children:["\u63D0\u4EA4\u540E\u9700\u8981\u6392\u961F",ye?.waiting?`\uFF08\u5F53\u524D ${ye.waiting} \u4EBA\uFF0C\u9884\u8BA1${X1(ye.estimated_wait_seconds)}\uFF09`:"","\u3002\u8F6E\u5230\u4F60\u65F6\u4ED8\u6B3E\u94FE\u63A5\u53EA\u4FDD\u7559 3 \u5206\u949F\uFF0C\u8D85\u65F6\u4F5C\u5E9F\u5E76\u9700\u91CD\u65B0\u6392\u961F\uFF0C\u8BF7\u63D0\u524D\u51C6\u5907\u597D\u94F6\u884C\u5361\u3002\u4ED8\u6B3E\u6210\u529F\u540E Premium \u4F1A\u76F4\u63A5\u8D60\u9001\u5230 @",H||"\u586B\u5199\u7684\u8D26\u53F7","\uFF0C\u4E0D\u4F1A\u751F\u6210\u5151\u6362\u7801\u3002\u5237\u65B0\u9875\u9762\u4F1A\u4FDD\u7559\u6392\u961F\uFF1B\u5173\u95ED\u6216\u79BB\u5F00\u7F51\u7AD9\u540E\u4F1A\u81EA\u52A8\u9000\u51FA\u6392\u961F\u3002"]})]}),(0,re.jsxs)(pr,{sx:{px:3,pb:2.5,gap:1},children:[(0,re.jsx)(ue,{onClick:()=>W(!1),children:"\u6682\u4E0D\u751F\u6210"}),(0,re.jsx)(ue,{variant:"contained",onClick:()=>{W(!1),He()},children:"\u786E\u8BA4\u751F\u6210"})]})]}),u&&(0,re.jsx)(ze,{severity:"error",sx:{mb:2},action:(0,re.jsx)(ue,{color:"inherit",onClick:()=>{Se(!0)},children:"\u91CD\u65B0\u52A0\u8F7D"}),children:u}),!(e&&(p||b))&&(0,re.jsxs)(oe,{component:"form",onSubmit:ne=>{ne.preventDefault(),e?W(!0):He()},"aria-busy":p,children:[(0,re.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"minmax(0, 1fr)",sm:"minmax(0, 1fr) minmax(0, 1fr)",md:e?"minmax(0, 1fr) minmax(0, 1fr)":"minmax(260px, 1fr) minmax(235px, 320px) auto"},gap:2,alignItems:"start"},children:[(0,re.jsx)(Ht,{inputRef:w,label:"X \u7528\u6237\u540D",placeholder:"\u4F8B\u5982 username \u6216 @username",value:i,disabled:p,required:!0,onChange:ne=>{l(ne.target.value),Ce()},error:i.trim().length>0&&!U,helperText:i.trim()&&!U?"\u7528\u6237\u540D\u987B\u4E3A 1\u201315 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF":"\u586B\u5199\u7528\u6237\u540D\uFF0C\u4E0D\u662F\u663E\u793A\u540D\u79F0",autoComplete:"off",sx:{minWidth:0},slotProps:{htmlInput:{maxLength:32,autoCapitalize:"none",spellCheck:!1}}}),(0,re.jsx)(Ht,{select:!0,label:"\u5957\u9910\u65F6\u957F",value:r.length?a:"",disabled:p||!r.length,onChange:ne=>{s(Number(ne.target.value)),Ce()},sx:{minWidth:0},children:r.map(ne=>(0,re.jsxs)(In,{value:ne.months,children:[ne.months," \u4E2A\u6708 \xB7 ",nT(ne)]},ne.months))}),(0,re.jsx)(ue,{type:"submit",variant:"contained",startIcon:(0,re.jsx)(G1,{}),disabled:p||!U||!r.length||m&&!h,sx:{minHeight:56,px:3,whiteSpace:"nowrap",gridColumn:{sm:"1 / -1",md:e?"1 / -1":"auto"},justifySelf:{xs:"stretch",sm:"end",md:e?"end":"stretch"}},children:p?"\u6B63\u5728\u751F\u6210\u2026":"\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5"})]}),e&&(0,re.jsx)(W1,{username:H}),m&&(0,re.jsx)(Ms,{control:(0,re.jsx)(Bn,{checked:h,disabled:p,onChange:ne=>T(ne.target.checked)}),label:"\u6211\u5DF2\u6838\u5B9E\u539F\u8BA2\u5355\u672A\u4ED8\u6B3E\uFF0C\u4E5F\u6CA1\u6709\u6B63\u5728\u5904\u7406\u7684\u6263\u6B3E\u6216\u94F6\u884C\u9A8C\u8BC1\uFF0C\u5141\u8BB8\u751F\u6210\u65B0\u94FE\u63A5"})]}),e&&p&&(0,re.jsx)(vA,{reconnecting:Z,onNotify:de?()=>{_e()}:void 0,notifyReady:me,onCancel:E.status==="submitting"?void 0:()=>{De()},cancelling:k,progress:E,username:H,months:a,price:r.find(ne=>ne.months===a)?nT(r.find(ne=>ne.months===a)):""}),!e&&p&&(0,re.jsx)(ks,{"aria-label":"\u6B63\u5728\u6838\u5BF9\u8D26\u53F7\u5E76\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5",sx:{mt:1}}),d&&(0,re.jsx)(ze,{ref:ie,severity:"error",sx:{mt:2,scrollMarginTop:24},children:d}),e&&b&&(0,re.jsx)(jp,{variant:"outlined",sx:{borderRadius:2,bgcolor:"background.paper"},children:(0,re.jsxs)(Bp,{sx:{p:{xs:2.5,sm:3},"&:last-child":{pb:{xs:2.5,sm:3}}},children:[(0,re.jsxs)(ce,{direction:"row",spacing:1.5,alignItems:"center",sx:{mb:3},children:[(0,re.jsx)(oe,{sx:{display:"grid",placeItems:"center",width:48,height:48,flexShrink:0,borderRadius:"50%",bgcolor:"action.selected",color:"success.main"},children:(0,re.jsx)(yA,{"aria-hidden":"true"})}),(0,re.jsxs)(oe,{children:[(0,re.jsx)(D,{ref:O,tabIndex:-1,variant:"h3",children:b.status==="succeeded"?"\u8BA2\u5355\u5DF2\u4ED8\u6B3E":"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u5C31\u7EEA"}),(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:b.status==="succeeded"?"\u65E0\u9700\u518D\u6B21\u4ED8\u6B3E":"\u751F\u6210\u94FE\u63A5\u4E0D\u4EE3\u8868\u4ED8\u6B3E\u6210\u529F\uFF0C\u8BF7\u524D\u5F80 Stripe \u4ED8\u6B3E"})]})]}),(0,re.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:.5,sx:{mb:2},children:[(0,re.jsxs)(D,{fontWeight:600,children:["@",b.username]}),(0,re.jsxs)(D,{color:"text.secondary",children:[b.months," \u4E2A\u6708 Premium \xB7 ",nT(b)]})]}),(0,re.jsx)(Vp,{sx:{mb:3}}),b.checkout_url&&be&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(ze,{severity:"warning",children:"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u8D85\u8FC7 3 \u5206\u949F\u6709\u6548\u671F\u5E76\u4F5C\u5E9F\u3002\u5982\u679C\u5C1A\u672A\u4ED8\u6B3E\uFF0C\u8BF7\u91CD\u65B0\u6392\u961F\u83B7\u53D6\u65B0\u94FE\u63A5\uFF1B\u5982\u679C\u5DF2\u7ECF\u4ED8\u6B3E\uFF0C\u8BF7\u52FF\u91CD\u590D\u652F\u4ED8\uFF0C\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\u3002"}),(0,re.jsx)(ue,{variant:"contained",onClick:()=>{Ce(),He()},sx:{mt:2,minHeight:48},children:"\u91CD\u65B0\u6392\u961F\u83B7\u53D6\u94FE\u63A5"})]}),b.checkout_url&&!be&&(0,re.jsxs)(re.Fragment,{children:[ge!==null&&(0,re.jsxs)(ze,{severity:ge<=60?"warning":"info",sx:{mb:2},role:"timer",children:["\u94FE\u63A5\u5269\u4F59 ",(0,re.jsxs)(oe,{component:"strong",sx:{fontVariantNumeric:"tabular-nums"},children:[Math.floor(ge/60),":",String(ge%60).padStart(2,"0")]}),"\uFF0C\u8BF7\u7ACB\u5373\u524D\u5F80 Stripe \u4ED8\u6B3E\uFF0C\u8D85\u65F6\u540E\u9700\u91CD\u65B0\u6392\u961F\u3002"]}),(0,re.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[(0,re.jsx)(ue,{component:"a",href:b.checkout_url,target:"_blank",rel:"noopener noreferrer",variant:"contained",endIcon:(0,re.jsx)(rT,{}),sx:{minHeight:48},children:"\u524D\u5F80 Stripe \u4ED8\u6B3E"}),(0,re.jsx)(ue,{variant:"outlined",onClick:()=>{ot()},startIcon:(0,re.jsx)(wf,{}),children:"\u590D\u5236\u94FE\u63A5"})]}),(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:2},children:"\u82E5 Stripe \u63D0\u793A\u4ED8\u6B3E\u88AB\u62D2\u7EDD\uFF0C\u5219\u5C1A\u672A\u652F\u4ED8\u6210\u529F\u3002\u5DF2\u6263\u6B3E\u6216\u6B63\u5728\u94F6\u884C\u9A8C\u8BC1\u65F6\uFF0C\u8BF7\u52FF\u91CD\u590D\u652F\u4ED8\u3002"}),(0,re.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["\u4ED8\u6B3E\u6210\u529F\u540E Premium \u4F1A\u76F4\u63A5\u8D60\u9001\u5230 @",b.username,"\uFF0C\u6CA1\u6709\u5151\u6362\u7801\uFF0C\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\u3002"]}),(0,re.jsxs)(oe,{component:"details",sx:{mt:1},children:[(0,re.jsx)(oe,{component:"summary",sx:{cursor:"pointer",color:"text.secondary",fontSize:13,py:1.5,minHeight:44},children:"\u67E5\u770B\u5B8C\u6574\u94FE\u63A5"}),(0,re.jsx)(Ht,{label:"Stripe \u4ED8\u6B3E\u94FE\u63A5",value:b.checkout_url,slotProps:{input:{readOnly:!0}},onFocus:ne=>ne.target.select()})]}),(0,re.jsx)(W1,{username:b.username})]}),b.status==="succeeded"&&(0,re.jsxs)(oe,{sx:{mb:2},children:[(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"\u4ED8\u6B3E\u5DF2\u6838\u5B9E\uFF0CPremium \u4F1A\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\uFF0C\u6CA1\u6709\u5151\u6362\u7801\u3002\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\u3002"}),(0,re.jsx)(ue,{component:"a",href:"https://x.com/i/premium",target:"_blank",rel:"noopener noreferrer",variant:"contained",endIcon:(0,re.jsx)(rT,{}),sx:{minHeight:48},children:"\u6253\u5F00 X \u67E5\u770B Premium"})]}),(0,re.jsxs)(ce,{direction:"row",spacing:1,sx:{mt:2,ml:-2},children:[b.checkout_url&&(0,re.jsx)(ue,{onClick:()=>{Ce(),requestAnimationFrame(()=>w.current?.focus())},children:"\u66F4\u6362\u5957\u9910"}),(0,re.jsx)(ue,{onClick:()=>{Ce(),l(""),requestAnimationFrame(()=>w.current?.focus())},children:"\u4E3A\u5176\u4ED6\u8D26\u53F7\u751F\u6210\u94FE\u63A5"})]})]})}),!e&&b&&(0,re.jsxs)(oe,{sx:{mt:2},"aria-live":"polite",children:[(0,re.jsx)(ze,{severity:b.status==="requires_action"?"info":"success",sx:{mb:2},children:b.status==="succeeded"?b.message:b.status==="requires_action"?"\u5DF2\u6709\u4ED8\u6B3E\u7B49\u5F85\u9A8C\u8BC1\uFF0C\u8BF7\u6253\u5F00\u539F\u4ED8\u6B3E\u9875\u9762\u5B8C\u6210\u9A8C\u8BC1\u3002":e?"\u65B0\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u751F\u6210\uFF0C\u5DF2\u6838\u5BF9\u8D26\u53F7\u3001\u5957\u9910\u3001\u91D1\u989D\u53CA\u53EF\u652F\u4ED8\u72B6\u6001\u3002\u8BF7\u5C3D\u5FEB\u6253\u5F00\u4ED8\u6B3E\u3002":"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u5C31\u7EEA\uFF0C\u5C1A\u672A\u81EA\u52A8\u6263\u6B3E\u3002"}),(0,re.jsxs)(D,{sx:{mb:1,fontWeight:600},children:["@",b.username," \xB7 ",b.months," \u4E2A\u6708 \xB7 ",nT(b)]}),b.checkout_url&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(Ht,{fullWidth:!0,label:"Stripe \u4ED8\u6B3E\u94FE\u63A5",value:b.checkout_url,slotProps:{input:{readOnly:!0}},onFocus:ne=>ne.target.select()}),(0,re.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1,sx:{mt:2},children:[(0,re.jsx)(ue,{component:"a",href:b.checkout_url,target:"_blank",rel:"noopener noreferrer",variant:"contained",startIcon:(0,re.jsx)(rT,{}),children:"\u6253\u5F00\u4ED8\u6B3E\u9875\u9762"}),(0,re.jsx)(ue,{variant:"outlined",onClick:()=>{ot()},startIcon:(0,re.jsx)(wf,{}),children:"\u590D\u5236\u94FE\u63A5"})]})]})]}),S&&(0,re.jsx)(ze,{severity:"info",sx:{mt:2},onClose:()=>C(""),children:S})]})}var $=P(_(),1);function rH(){let[e,t]=(0,Ie.useState)(null),[o,r]=(0,Ie.useState)(null),[n,a]=(0,Ie.useState)(null),[s,i]=(0,Ie.useState)(!0),[l,p]=(0,Ie.useState)(""),[c,d]=(0,Ie.useState)(!1),[f,u]=(0,Ie.useState)(6),[g,b]=(0,Ie.useState)("10"),[x,m]=(0,Ie.useState)(""),[y,h]=(0,Ie.useState)(""),[T,S]=(0,Ie.useState)(0),C=(0,Ie.useRef)(!1),[E,R]=(0,Ie.useState)([]),[O,w]=(0,Ie.useState)(!1),[A,v]=(0,Ie.useState)(""),N=(0,Ie.useRef)(""),[k,z]=(0,Ie.useState)(""),[j,W]=(0,Ie.useState)(""),[Z,X]=(0,Ie.useState)(null),[de,me]=(0,Ie.useState)(null),[fe,ie]=(0,Ie.useState)(0),[we,Te]=(0,Ie.useState)(0),[le,Pe]=(0,Ie.useState)({seq:0,text:""}),[ye,Oe]=(0,Ie.useState)(null),[he,ge]=(0,Ie.useState)(null),[be,H]=(0,Ie.useState)(null),[U,Se]=(0,Ie.useState)(!1),[De,Ce]=(0,Ie.useState)(!1),[_e,He]=(0,Ie.useState)(null),[ot,ne]=(0,Ie.useState)(0),te=(0,Ie.useRef)(0),Me=(0,Ie.useRef)(!1),je=(0,Ie.useRef)(null),Mt=(0,Ie.useRef)(null),Fe=(0,Ie.useRef)(null),Ne=(0,Ie.useCallback)(async(Q,Ge=N.current)=>{let Lt=++te.current,Ea=Ge!==N.current;i(!0),p("");try{let Ee=await vo(`/api/admin/codes?page=${Q}&folder=${encodeURIComponent(Ge)}`);Lt===te.current&&(a(Ee),N.current=Ee.folder,Ea&&R([]),Lt>1&&ne(uo=>uo+1))}catch(Ee){Lt===te.current&&p(Ee.message)}finally{Lt===te.current&&i(!1)}},[]);(0,Ie.useEffect)(()=>{Ne(0)},[Ne]);let Ae=(0,Ie.useCallback)(async(Q,Ge=!1)=>{let Lt;try{Lt=HM(Q)}catch(Ee){W(Ee.message);return}W("");let Ea=++te.current;i(!0),p("");try{let Ee=[],uo=0;for(;;){let fs=await vo(`/api/admin/codes?page=${uo}`);if(Ea!==te.current)return;if(Ee.push(...fs.codes),!fs.has_more)break;uo++}me(Ee),X({source:Q,match:Lt}),Te(fs=>fs+1),Ge||ie(0),R([])}catch(Ee){Ea===te.current&&p(Ee.message)}finally{Ea===te.current&&i(!1)}},[]);function rt(Q=!0){X(null),me(null),z(""),W(""),ie(0),R([]),Q&&Ne(0,"")}function Ot(){Z?(Ae(Z.source,!0),ne(Q=>Q+1)):Ne(n?.page??0)}(0,Ie.useEffect)(()=>{if(!_e||be||c||s)return;let Q=setTimeout(()=>{_e==="list"&&Fe.current?.focus(),He(null)},250);return()=>clearTimeout(Q)},[_e,be,c,s]);async function Re(Q){if(!Q.copyable){h("\u5386\u53F2\u5151\u6362\u7801\u672A\u4FDD\u5B58\u5B8C\u6574\u5185\u5BB9\uFF0C\u8BF7\u4F7F\u7528\u539F\u5148\u4E0B\u8F7D\u7684 TXT\u3002"),S(Ge=>Ge+1);return}if(!C.current){C.current=!0;try{let Ge=vo("/api/admin/codes/copy",{id:Q.id});typeof ClipboardItem<"u"&&navigator.clipboard?.write?await navigator.clipboard.write([new ClipboardItem({"text/plain":Ge.then(Lt=>new Blob([Lt.code],{type:"text/plain"}))})]):await navigator.clipboard.writeText((await Ge).code),h(`\u5DF2\u590D\u5236\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801\u3002`)}catch{h("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u526A\u8D34\u677F\u6743\u9650\u6216\u7A0D\u540E\u91CD\u8BD5\u3002")}finally{S(Ge=>Ge+1),C.current=!1}}}async function Ft(){if(!Me.current){Me.current=!0,d(!0),H(null),ge(null);try{let Q=await vo("/api/admin/codes",{months:f,count:Number(g),batch:x.trim()});Oe(Q),ge({text:`\u5DF2\u751F\u6210 ${Q.codes.length} \u679A\u5151\u6362\u7801\uFF0C\u5DF2\u5F52\u5165\u6279\u6B21\u300C${Q.batch}\u300D\u3002\u70B9\u51FB\u5217\u8868\u6761\u76EE\u5373\u53EF\u590D\u5236\u3002`,error:!1}),requestAnimationFrame(()=>Mt.current?.scrollIntoView({block:"nearest"})),Z?Ot():await Ne(0,Q.folder||"unfiled")}catch(Q){ge({text:`${Q.message} \u82E5\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u5148\u5237\u65B0\u5217\u8868\u6838\u5B9E\u6279\u6B21\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u751F\u6210\u3002`,error:!0})}finally{Me.current=!1,d(!1)}}}async function Nt(){if(!(be?.kind!=="revoke"||Me.current)){Me.current=!0,d(!0);try{await vo("/api/admin/revoke",{id:be.code.id}),ge({text:"\u5151\u6362\u7801\u5DF2\u505C\u7528\u3002",error:!1}),R([]),He("list"),H(null),Ot()}catch(Q){ge({text:Q.message,error:!0}),H(null)}finally{Me.current=!1,d(!1)}}}async function Qr(){if(!(Me.current||!E.length)){Me.current=!0,d(!0),ge(null);try{await vo("/api/admin/codes/move",{ids:E,folder:A}),ge({text:`\u5DF2\u79FB\u52A8 ${E.length} \u679A\u5151\u6362\u7801\u3002`,error:!1}),R([]),w(!1),He("list"),Ot()}catch(Q){w(!1),ge({text:`${Q.message} \u82E5\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u6838\u5B9E\u3002`,error:!0})}finally{Me.current=!1,d(!1)}}}function Kn(){if(!ye)return;let Q=URL.createObjectURL(new Blob([ye.codes.join(` +`):e[s]),o(s),n(!1)}catch{o(null),n(!0)}}return(0,hr.jsxs)(oe,{sx:{my:2},children:[(0,hr.jsxs)(ce,{direction:"row",alignItems:"center",justifyContent:"space-between",spacing:1,sx:{mb:1},children:[(0,hr.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u70B9\u51FB\u5355\u679A\u5151\u6362\u7801\u5373\u53EF\u590D\u5236"}),(0,hr.jsx)(ue,{size:"small",color:"secondary",startIcon:(0,hr.jsx)(U1,{}),onClick:()=>{a("all")},sx:{px:1.5,flexShrink:0},children:"\u590D\u5236\u5168\u90E8"})]}),(0,hr.jsx)(oe,{component:"ul","aria-label":"\u65B0\u751F\u6210\u7684\u5151\u6362\u7801",tabIndex:0,sx:{m:0,p:0,listStyle:"none",maxHeight:300,overflowY:"auto",border:1,borderColor:"divider",borderRadius:2},children:e.map((s,i)=>(0,hr.jsx)(oe,{component:"li",children:(0,hr.jsx)(ue,{fullWidth:!0,"aria-label":`\u590D\u5236\u7B2C ${i+1} \u679A\u5151\u6362\u7801`,onClick:()=>{a(i)},endIcon:t===i?(0,hr.jsx)(CM,{}):(0,hr.jsx)(U1,{}),sx:{py:1.5,px:2,borderRadius:0,justifyContent:"space-between",textAlign:"left",borderBottom:iString(r).padStart(2,"0");return`${t.getFullYear()}-${o(t.getMonth()+1)}-${o(t.getDate())} ${o(t.getHours())}:${o(t.getMinutes())}:${o(t.getSeconds())}`}var hi={active:{label:"\u53EF\u4F7F\u7528",color:"primary"},processing:{label:"\u5904\u7406\u4E2D",color:"primary"},succeeded:{label:"\u5DF2\u5B8C\u6210",color:"success"},review:{label:"\u5F85\u6838\u5B9E",color:"warning"},revoked:{label:"\u5DF2\u505C\u7528",color:"default"}};var kd=P(L(),1);var wM=P(_(),1),OM=ae((0,wM.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");var NM=P(_(),1),MM=ae((0,NM.jsx)("path",{d:"m14.06 9.02.92.92L5.92 19H5v-.92zM17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29m-3.6 3.19L3 17.25V21h3.75L17.81 9.94z"}),"EditOutlined");var jt=P(_(),1);function AM({folders:e,stats:t,filter:o,disabled:r,onSelect:n,onBusyChange:a,onChanged:s}){let[i,l]=(0,kd.useState)(null),[p,c]=(0,kd.useState)(""),[d,f]=(0,kd.useState)(""),[u,g]=(0,kd.useState)(!1);async function b(){if(!(!i||u)){if(!p.trim()||new TextEncoder().encode(p.trim()).length>120){f("\u540D\u79F0\u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u6700\u591A 120 \u5B57\u8282\u3002");return}g(!0),a(!0);try{await vo("/api/admin/folders/rename",{id:i.id,name:p.trim()}),await s(),l(null)}catch(x){f(x.message)}finally{g(!1),a(!1)}}}return(0,jt.jsxs)(oe,{sx:{mb:3},children:[(0,jt.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"baseline",sx:{mb:1.5},children:[(0,jt.jsx)(D,{variant:"h2",children:"\u6279\u6B21"}),(0,jt.jsxs)(D,{variant:"body2",color:"text.secondary",children:[t?.total??"\u2014"," \u679A\u5151\u6362\u7801"]})]}),(0,jt.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"\u70B9\u51FB\u6279\u6B21\u6587\u4EF6\u5939\u67E5\u770B\u5151\u6362\u7801\uFF0C\u5DE6\u53F3\u6ED1\u52A8\u53EF\u67E5\u770B\u5168\u90E8\u6279\u6B21\u3002"}),(0,jt.jsx)(ce,{direction:"row",useFlexGap:!0,gap:1,sx:{minHeight:80,overflowX:"auto",alignItems:"center",pb:1},role:"region","aria-label":"\u6279\u6B21\u6587\u4EF6\u5939\uFF0C\u53EF\u6A2A\u5411\u6EDA\u52A8",tabIndex:0,children:[{id:"",name:"\u5168\u90E8\u5151\u6362\u7801",count:t?.total??0},...t?.unfiled?[{id:"unfiled",name:"\u672A\u5206\u7C7B",count:t.unfiled}]:[],...e].map(x=>(0,jt.jsxs)(oe,{sx:{display:"flex",border:1,borderColor:o===x.id?"primary.main":"divider",borderRadius:2,bgcolor:o===x.id?"action.selected":"background.paper",maxWidth:"100%",flexShrink:0},children:[(0,jt.jsxs)(ue,{disabled:r,"aria-pressed":o===x.id,startIcon:(0,jt.jsx)(OM,{}),onClick:()=>n(x.id),sx:{px:2,py:1.5,justifyContent:"flex-start",textAlign:"left",overflowWrap:"anywhere",minWidth:0},children:[x.name," \xB7 ",x.count]}),x.id&&x.id!=="unfiled"&&(0,jt.jsx)($n,{describeChild:!0,title:`\u91CD\u547D\u540D\u6279\u6B21\uFF1A${x.name}`,children:(0,jt.jsx)("span",{children:(0,jt.jsx)(sn,{"aria-label":`\u91CD\u547D\u540D\u6279\u6B21\uFF1A${x.name}`,disabled:r,onClick:()=>{l(x),c(x.name),f("")},sx:{m:.5,border:1,borderColor:"divider",width:44,height:44},children:(0,jt.jsx)(MM,{fontSize:"small"})})})})]},x.id))}),(0,jt.jsx)(lr,{open:!!i,onClose:()=>!u&&l(null),fullWidth:!0,maxWidth:"xs","aria-labelledby":"batch-rename-title","aria-describedby":"batch-rename-content",children:(0,jt.jsxs)(oe,{component:"form",noValidate:!0,onSubmit:x=>{x.preventDefault(),b()},children:[(0,jt.jsx)(ur,{id:"batch-rename-title",children:"\u91CD\u547D\u540D\u6279\u6B21"}),(0,jt.jsxs)(cr,{id:"batch-rename-content",children:[(0,jt.jsx)(Ht,{autoFocus:!0,label:"\u6279\u6B21\u540D\u79F0",value:p,onChange:x=>{c(x.target.value),d&&f("")},disabled:u,required:!0,error:!!d,sx:{mt:1},helperText:"\u8BE5\u6279\u6B21\u5185\u7684\u5151\u6362\u7801\u4F1A\u540C\u6B65\u66F4\u65B0\u540D\u79F0"}),d&&(0,jt.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:d})]}),(0,jt.jsxs)(pr,{sx:{p:2},children:[(0,jt.jsx)(ue,{variant:"outlined",disabled:u,onClick:()=>l(null),children:"\u53D6\u6D88"}),(0,jt.jsx)(ue,{variant:"contained",disabled:u,type:"submit",children:"\u4FDD\u5B58"})]})]})})]})}var Mr=P(L(),1);var kM=P(_(),1),_M=ae((0,kM.jsx)("path",{d:"M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m0 16H7.07L2.4 12l4.66-7H22zm-11.59-2L14 13.41 17.59 17 19 15.59 15.41 12 19 8.41 17.59 7 14 10.59 10.41 7 9 8.41 12.59 12 9 15.59z"}),"BackspaceOutlined");var DM=P(_(),1),zM=ae((0,DM.jsx)("path",{d:"M9.4 16.6 4.8 12l4.6-4.6L8 6l-6 6 6 6zm5.2 0 4.6-4.6-4.6-4.6L16 6l6 6-6 6z"}),"CodeOutlined");var jM=P(_(),1),BM=ae((0,jM.jsx)("path",{d:"M7 6h10l-5.01 6.3zm-2.75-.39C6.27 8.2 10 13 10 13v6c0 .55.45 1 1 1h2c.55 0 1-.45 1-1v-6s3.72-4.8 5.74-7.39c.51-.66.04-1.61-.79-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAltOutlined");var eu=P(_(),1),LM=ae([(0,eu.jsx)("path",{d:"M12 22C6.49 22 2 17.51 2 12S6.49 2 12 2s10 4.04 10 9c0 3.31-2.69 6-6 6h-1.77c-.28 0-.5.22-.5.5 0 .12.05.23.13.33.41.47.64 1.06.64 1.67 0 1.38-1.12 2.5-2.5 2.5m0-18c-4.41 0-8 3.59-8 8s3.59 8 8 8c.28 0 .5-.22.5-.5 0-.16-.08-.28-.14-.35-.41-.46-.63-1.05-.63-1.65 0-1.38 1.12-2.5 2.5-2.5H16c2.21 0 4-1.79 4-4 0-3.86-3.59-7-8-7"},"0"),(0,eu.jsx)("circle",{cx:"6.5",cy:"11.5",r:"1.5"},"1"),(0,eu.jsx)("circle",{cx:"9.5",cy:"7.5",r:"1.5"},"2"),(0,eu.jsx)("circle",{cx:"14.5",cy:"7.5",r:"1.5"},"3"),(0,eu.jsx)("circle",{cx:"17.5",cy:"11.5",r:"1.5"},"4")],"PaletteOutlined");var UM=["active","processing","review","succeeded","revoked"],IM=["folder","status","months","username"];function L$(e){let t="",o=!1,r=!1;for(let s of e){if(o){if(r){t+=s,r=!1;continue}if(s==="\\"){t+=s,r=!0;continue}if(s==='"'||/["“”]/.test(s)){t+='"',o=!1;continue}t+=s;continue}let i=/["“”]/.test(s)?'"':s;i==='"'&&(o=!0),t+=i.replace(/(/g,"(").replace(/)/g,")").replace(/:/g,":").replace(/!/g,"!").replace(/=/g,"=")}e=t;let n=[],a=0;for(;a=e.length)throw new Error("\u5F15\u53F7\u4E0D\u5339\u914D\uFF1A\u6279\u6B21\u540D\u79F0\u7684\u82F1\u6587\u53CC\u5F15\u53F7\u6CA1\u6709\u95ED\u5408\u3002");if(e[c]==="\\"&&c+1t[r],a=()=>t[r++];function s(){return i()}function i(){let u=l();for(;n()?.kind==="or";)a(),o.push({kind:"or"}),u={type:"or",left:u,right:l()};return u}function l(){let u=p();for(;n()?.kind==="and";)a(),o.push({kind:"and"}),u={type:"and",left:u,right:p()};return u}function p(){if(n()?.kind==="not"){if(a(),o.push({kind:"not"}),!n())throw new Error("\u300Cnot\u300D\u540E\u7F3A\u5C11\u6761\u4EF6\u3002");return{type:"not",operand:p()}}return c()}function c(){let u=n();if(!u)throw new Error("\u8868\u8FBE\u5F0F\u610F\u5916\u7684\u7ED3\u5C3E\uFF1A\u7F3A\u5C11\u6761\u4EF6\u3002");if(u.kind==="and"||u.kind==="or")throw new Error(`\u300C${u.kind==="and"?"and":"or"}\u300D\u540E\u7F3A\u5C11\u6761\u4EF6\u3002`);if(u.kind==="rparen")throw new Error("\u62EC\u53F7\u4E0D\u5339\u914D\uFF1A\u53F3\u62EC\u53F7\u524D\u7F3A\u5C11\u6761\u4EF6\u3002");if(u.kind==="lparen"){a(),o.push({kind:"lparen"});let g=s();if(n()?.kind!=="rparen")throw new Error("\u62EC\u53F7\u4E0D\u5339\u914D\uFF1A\u7F3A\u5C11\u53F3\u62EC\u53F7\u3002");return a(),o.push({kind:"rparen"}),g}return d()}function d(){let u=a();if(u.kind!=="word")throw new Error("\u65E0\u6CD5\u8BC6\u522B\u7684\u6761\u4EF6\uFF1A\u8BF7\u4F7F\u7528 folder:\u6279\u6B21\u540D\u3001status:\u72B6\u6001\u3001months:\u65F6\u957F\u6216 username:\u8D26\u53F7\u3002");let g=u.text.toLowerCase();if(!IM.includes(g))throw new Error(`\u672A\u77E5\u5B57\u6BB5\u300C${u.text}\u300D\uFF0C\u4EC5\u652F\u6301 ${IM.join("\u3001")}\u3002`);let b=n(),x=b?.kind==="neq";if(b?.kind!=="colon"&&b?.kind!=="eq"&&b?.kind!=="neq")throw new Error(`\u300C${u.text}\u300D\u540E\u7F3A\u5C11 : \u6216 !=\u3002`);a();let m=n();if(!m||m.kind!=="word"&&m.kind!=="string")throw m&&(m.kind==="and"||m.kind==="or"||m.kind==="not")?new Error(`\u300C${u.text}:\u300D\u540E\u9047\u5230\u903B\u8F91\u8FD0\u7B97\u7B26\uFF1B\u5982\u679C\u540D\u79F0\u672C\u8EAB\u542B and / or / not / \u975E\uFF0C\u8BF7\u7528\u82F1\u6587\u5F15\u53F7\u5305\u88F9\uFF0C\u5982 ${u.text}:"\u975E"\u3002`):new Error(`\u300C${u.text}:\u300D\u540E\u7F3A\u5C11\u503C\u3002`);a();let y=m.text;if(g==="status"){if(y=m.text.toLowerCase(),!UM.includes(y))throw new Error(`\u4E0D\u652F\u6301\u7684\u72B6\u6001\u503C\u300C${m.text}\u300D\uFF0C\u53EF\u7528\uFF1A${UM.join("\u3001")}\u3002`)}else if(g==="months"){if(!/^\d+$/.test(m.text))throw new Error(`\u300Cmonths:\u300D\u540E\u9700\u8981\u6570\u5B57\uFF08\u5982 3\u30016\uFF09\uFF0C\u6536\u5230\u300C${m.text}\u300D\u3002`)}else if(g==="folder"){if(!m.text)throw new Error("\u300Cfolder:\u300D\u540E\u7F3A\u5C11\u6279\u6B21\u540D\uFF1B\u672A\u5206\u7C7B\u8BF7\u4F7F\u7528 folder:-\u3002")}else if(!m.text)throw new Error("\u300Cusername:\u300D\u540E\u9700\u8981\u8D26\u53F7\u540D\uFF1B\u672A\u7ED1\u5B9A\u8BF7\u4F7F\u7528 username:-\u3002");return o.push({kind:"condition",field:g,value:y,negate:x,literal:m.kind==="string"}),{type:"condition",field:g,value:y,negate:x,literal:m.kind==="string"}}let f=s();if(ro(t,r)}function I1(e){return $M(e).flat}var VM='\u6761\u4EF6\uFF1Afolder:\u6279\u6B21\u540D\u3001status:\u72B6\u6001\u3001months:\u65F6\u957F\u3001username:\u8D26\u53F7\uFF1B\u903B\u8F91\uFF1Aand\u3001or\u3001not\u3001\u62EC\u53F7\uFF1B!= \u53D6\u53CD\uFF1Bfolder:- \u672A\u5206\u7C7B\u3001username:- \u672A\u7ED1\u5B9A\uFF1B\u540D\u79F0\u542B\u7A7A\u683C\u3001\u5192\u53F7\u6216\u4FDD\u7559\u5B57\u65F6\u7528\u82F1\u6587\u5F15\u53F7\u5305\u88F9\uFF0C\u5982 folder:"and"\u3002';var xe=P(_(),1),U$="\u70B9\u51FB\u8C03\u8272\u677F\u6309\u94AE\u62FC\u63A5\u6761\u4EF6\uFF1B\u70B9\u51FB\u753B\u5E03\u4E2D\u7684\u6761\u4EF6\u53EF\u5207\u6362 = / \u2260\uFF1B\u753B\u5E03\u805A\u7126\u65F6\u6309 Backspace \u64A4\u9500\u3001Enter \u5E94\u7528\u3002",I$=["active","processing","review","succeeded","revoked"],$1={active:{label:"\u53EF\u4F7F\u7528",tone:"primary"},processing:{label:"\u5904\u7406\u4E2D",tone:"primary"},review:{label:"\u5F85\u6838\u5B9E",tone:"warning"},succeeded:{label:"\u5DF2\u5B8C\u6210",tone:"success"},revoked:{label:"\u5DF2\u505C\u7528",tone:"neutral"}};function tu(e){return e.vars?e.vars.palette:e.palette}function FM(e,t){let o=tu(e);return t==="neutral"?o.text.secondary:o[t].main}function $$(e){return t=>{let o=FM(t,e);return{color:o,bgcolor:t.alpha(o,.14),"& .MuiChip-deleteIcon":{color:t.alpha(o,.65),"&:hover":{color:o}}}}}function H$(e){return{color:tu(e).text.primary,borderColor:tu(e).divider,fontFamily:"monospace",letterSpacing:".06em"}}var V$={border:"none",color:"text.secondary",bgcolor:"transparent",fontFamily:"monospace",fontSize:"1rem",minWidth:30,"& .MuiChip-label":{px:.5},"&:hover":{bgcolor:"action.hover"}};function F$(e){let t=tu(e);return{bgcolor:t.text.primary,color:t.background.paper,fontFamily:"monospace",letterSpacing:".06em","&:hover":{bgcolor:t.text.secondary},"& .MuiChip-deleteIcon":{color:e.alpha(t.background.paper,.65),"&:hover":{color:t.background.paper}}}}var Jg={height:30,minHeight:30,borderRadius:"16px",fontWeight:600,"& .MuiChip-deleteIcon":{boxSizing:"content-box",width:"18px",height:"18px",padding:"3px",margin:"-3px"}};function q$(e){return e.kind!=="condition"?"neutral":e.field==="folder"?"secondary":e.field==="months"?"success":e.field==="username"?"warning":$1[e.value]?.tone??"neutral"}function G$(e){let t=e.negate?"\u2260":":";switch(e.field){case"folder":return e.value==="-"&&!e.literal?`\u6279\u6B21${t}\u672A\u5206\u7C7B`:`\u6279\u6B21${t}${e.value}`;case"status":return`\u72B6\u6001${t}${$1[e.value]?.label??e.value}`;case"months":return`\u65F6\u957F${t}${e.value} \u4E2A\u6708`;case"username":return e.value==="-"&&!e.literal?`\u8D26\u53F7${t}\u672A\u7ED1\u5B9A`:`\u8D26\u53F7${t}${e.value}`}}function Pn(e){switch(e.kind){case"condition":return G$(e);case"not":return"NOT";case"and":return"AND";case"or":return"OR";case"lparen":return"\uFF08";case"rparen":return"\uFF09"}}function Y$(e,t=!1){return/^(and|or|not|非|&&|\|\|)$/i.test(e)||e==="-"&&t?`"${e}"`:/[\s()":=!≠\\:()!="“”]/.test(e)?`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/["“”]/g,"\\$&")}"`:e}function eT(e){return e.map((t,o)=>{let r;switch(t.kind){case"condition":{let a=t.negate?"!=":":";r=t.field==="folder"||t.field==="username"?`${t.field}${a}${Y$(t.value,t.literal)}`:`${t.field}${a}${t.value}`;break}case"lparen":r="(";break;case"rparen":r=")";break;default:r=t.kind}if(o===0)return r;let n=e[o-1];return t.kind==="rparen"||n.kind==="lparen"?r:` ${r}`}).join("")}function Sn({label:e,ariaLabel:t,tooltip:o,disabled:r,onClick:n,dot:a,mono:s}){return(0,xe.jsx)($n,{title:o,describeChild:!0,children:(0,xe.jsx)("span",{children:(0,xe.jsx)(ue,{variant:"outlined",size:"small",disabled:r,onClick:n,"aria-label":t,startIcon:a?(0,xe.jsx)(oe,{component:"span","aria-hidden":!0,sx:i=>({width:8,height:8,borderRadius:"50%",bgcolor:FM(i,a)})}):void 0,sx:{minHeight:30,minWidth:44,px:1.5,py:0,borderRadius:"16px",fontSize:".8125rem",lineHeight:1.5,fontFamily:s?"monospace":void 0,letterSpacing:s?".05em":void 0,"& .MuiButton-startIcon":{mr:.75,ml:0},"&:disabled .MuiButton-startIcon":{opacity:.38}},children:e})})})}function qM({value:e,onChange:t,onApply:o,onClear:r,applied:n,error:a,disabled:s,folders:i,appliedSource:l="",resultCount:p,applySeq:c=0,clearNotice:d}){let[f,u]=(0,Mr.useState)([]),[g,b]=(0,Mr.useState)("palette"),[x,m]=(0,Mr.useState)({seq:0,text:""}),y=H=>m(U=>({seq:U.seq+1,text:H})),[h,T]=(0,Mr.useState)(""),[S,C]=(0,Mr.useState)(""),E=(0,Mr.useRef)(null);(0,Mr.useEffect)(()=>{if(!(g!=="palette"||e===eT(f)))try{u(e.trim()?I1(e):[])}catch{let H="\u65E0\u6CD5\u89E3\u6790\u6587\u672C\u8868\u8FBE\u5F0F\uFF0C\u5DF2\u6062\u590D\u4E3A\u8C03\u8272\u677F\u4E2D\u7684\u6761\u4EF6\u3002";T(H),y(H),t(eT(f))}},[e,g]);let R=(0,Mr.useRef)(n),O=(0,Mr.useRef)(0),w=(0,Mr.useRef)(0);(0,Mr.useEffect)(()=>{if(c>O.current&&(O.current=c,y(p==null?"\u7B5B\u9009\u5DF2\u5E94\u7528":`\u7B5B\u9009\u5DF2\u5E94\u7528\uFF0C\u5171 ${p} \u6761\u7ED3\u679C`)),!n&&R.current){let H="\u7B5B\u9009\u5DF2\u6E05\u9664\uFF0C\u5DF2\u663E\u793A\u5B8C\u6574\u5217\u8868";d&&d.seq>w.current&&(w.current=d.seq,H=d.text),y(H)}R.current=n},[n,c,p,d]);function A(H,U){u(H),y(U),T(""),t(eT(H)),requestAnimationFrame(()=>E.current?.focus())}function v(H){s||A([...f,H],`\u5DF2\u6DFB\u52A0 ${Pn(H)}`)}let N=/^[A-Za-z0-9_]+$/.test(S.trim());function k(){s||!N||ie||(v({kind:"condition",field:"username",value:S.trim(),negate:!1}),C(""))}function z(H){if(s)return;let U=f[H];U&&A(f.filter((Se,De)=>De!==H),`\u5DF2\u5220\u9664 ${Pn(U)}`)}function j(){s||f.length===0||A(f.slice(0,-1),`\u5DF2\u64A4\u9500 ${Pn(f[f.length-1])}`)}function W(H){if(s||f[H]?.kind!=="condition")return;let Se=f.map((Ce,_e)=>_e===H&&Ce.kind==="condition"?{...Ce,negate:!Ce.negate}:Ce),De=Se[H];A(Se,`\u5DF2\u5207\u6362\u4E3A ${Pn(De)}`)}function Z(H){return U=>{s||(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),z(H))}}let X=f[f.length-1],de=!X||X.kind==="and"||X.kind==="or"||X.kind==="not"||X.kind==="lparen",me=!!X&&(X.kind==="condition"||X.kind==="rparen"),fe=f.reduce((H,U)=>H+(U.kind==="lparen"?1:U.kind==="rparen"?-1:0),0),ie=s||!de,we=s||!me,Te=s||!me||fe<=0,le=s||f.length===0,Pe=!!X&&(X.kind==="and"||X.kind==="or"||X.kind==="not"||X.kind==="lparen"),ye="";if(f.length>0)if(fe>0)ye=`\u62EC\u53F7\u672A\u95ED\u5408\uFF0C\u8FD8\u5DEE ${fe} \u4E2A\u53F3\u62EC\u53F7 \uFF09`;else if(fe<0)ye="\u5B58\u5728\u591A\u4F59\u7684\u53F3\u62EC\u53F7 \uFF09";else if(Pe)ye="\u8868\u8FBE\u5F0F\u4E0D\u5B8C\u6574\uFF0C\u672B\u5C3E\u8FD8\u9700\u8981\u4E00\u4E2A\u6761\u4EF6";else try{I1(eT(f))}catch(H){let U=H.message;/[后前]缺少条件/.test(U)?ye=`${U}\u53EF\u5220\u9664\u591A\u4F59\u7684\u8FD0\u7B97\u7B26\u6216\u62EC\u53F7\u3002`:/前缺少逻辑运算符/.test(U)?ye=`${U}\u53EF\u4ECE\u672B\u5C3E\u64A4\u9500\u540E\u91CD\u65B0\u7528 AND / OR \u8FDE\u63A5\u3002`:ye=U}let Oe=s||(g==="palette"?f.length===0||!!ye:!e.trim()),he=f.length?"\u8BF7\u5148\u6DFB\u52A0 AND / OR \u8FDE\u63A5\u7B26":"\u8868\u8FBE\u5F0F\u4E3A\u7A7A\uFF0C\u53EF\u76F4\u63A5\u6DFB\u52A0",ge=f.length?"\u8FD0\u7B97\u7B26\u9700\u8DDF\u5728\u6761\u4EF6\u6216 \uFF09\u4E4B\u540E":"\u8BF7\u5148\u6DFB\u52A0\u6761\u4EF6",be=n&&!!l&&e!==l;return(0,xe.jsxs)(tt,{variant:"outlined",sx:{p:{xs:2,sm:2.5},mb:3},children:[(0,xe.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:.5,flexWrap:"wrap",rowGap:.5},children:[(0,xe.jsx)(BM,{color:"primary",sx:{flexShrink:0}}),(0,xe.jsx)(D,{variant:"h2",sx:{whiteSpace:"nowrap",flexShrink:0,fontSize:21},children:"\u9AD8\u7EA7\u7B5B\u9009"}),n&&(0,xe.jsx)(jo,{size:"small",color:be?"warning":"primary",variant:"outlined",label:be?"\u7B5B\u9009\u751F\u6548\u4E2D \xB7 \u5DF2\u4FEE\u6539":"\u7B5B\u9009\u751F\u6548\u4E2D",title:be?"\u542B\u672A\u5E94\u7528\u7684\u66F4\u6539\uFF0C\u70B9\u51FB \u7B5B\u9009 \u91CD\u65B0\u5E94\u7528":void 0,sx:{flexShrink:0,"& .MuiChip-label":{whiteSpace:"nowrap"}}}),(0,xe.jsx)(oe,{sx:{flexGrow:1}}),(0,xe.jsx)(ue,{variant:"text",size:"small",startIcon:g==="palette"?(0,xe.jsx)(zM,{}):(0,xe.jsx)(LM,{}),"aria-label":g==="palette"?"\u5207\u6362\u5230\u6587\u672C\u6A21\u5F0F":"\u5207\u6362\u5230\u8C03\u8272\u677F\u6A21\u5F0F",onClick:()=>{T(""),b(H=>H==="palette"?"text":"palette")},sx:{minHeight:36,px:1.5,flexShrink:0},children:g==="palette"?"\u6587\u672C\u6A21\u5F0F":"\u8C03\u8272\u677F"})]}),(0,xe.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"\u7EC4\u5408\u6279\u6B21\u4E0E\u72B6\u6001\u6761\u4EF6\uFF0C\u5728\u6240\u6709\u5151\u6362\u7801\u4E2D\u7B5B\u9009\u3002"}),g==="text"?(0,xe.jsx)(Ht,{label:"\u7B5B\u9009\u8868\u8FBE\u5F0F",placeholder:"folder:\u793A\u4F8B\u6279\u6B21 and (status:active or status:review)",value:e,disabled:s,onChange:H=>t(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),o())},error:!!a,slotProps:{htmlInput:{"aria-label":"\u7B5B\u9009\u8868\u8FBE\u5F0F",spellCheck:!1,sx:{fontFamily:"monospace"}}}}):(0,xe.jsxs)(xe.Fragment,{children:[(0,xe.jsx)(oe,{ref:E,tabIndex:s?-1:0,role:"group","aria-label":"\u7B5B\u9009\u8868\u8FBE\u5F0F\u753B\u5E03\uFF1B\u6309 Backspace \u64A4\u9500\u672B\u5C3E\u8BCD\u5143\uFF0C\u6309 Enter \u5E94\u7528\u7B5B\u9009",onKeyDown:H=>{s||H.target===H.currentTarget&&(H.key==="Backspace"?(H.preventDefault(),j()):H.key==="Enter"&&(H.preventDefault(),Oe?ye&&y(ye):o()))},sx:H=>({display:"flex",flexWrap:"wrap",gap:1,alignItems:"center",minHeight:56,p:1.25,borderRadius:2,border:1,borderColor:a||ye?"error.main":"divider",bgcolor:tu(H).background.default,opacity:s?.6:1,"&:focus-visible":{outline:"none",borderColor:"primary.main",boxShadow:`0 0 0 3px ${H.alpha(tu(H).primary.main,.3)}`}}),children:f.length===0?(0,xe.jsx)(D,{variant:"body2",color:"text.secondary",sx:{px:.5},children:"\u70B9\u51FB\u4E0B\u65B9\u8C03\u8272\u677F\u62FC\u63A5\u7B5B\u9009\u6761\u4EF6"}):f.map((H,U)=>H.kind==="lparen"||H.kind==="rparen"?(0,xe.jsx)(jo,{variant:"outlined",label:Pn(H),"aria-label":`\u62EC\u53F7 ${Pn(H)}\uFF0C\u6309 Enter\u3001Delete \u6216 Backspace \u5220\u9664`,onDelete:s?void 0:()=>z(U),onKeyDown:Z(U),sx:[Jg,V$]},U):H.kind==="condition"?(0,xe.jsx)($n,{title:"\u70B9\u51FB\u6216\u6309 Enter \u5207\u6362 = / \u2260",describeChild:!0,children:(0,xe.jsx)(jo,{label:Pn(H),"aria-label":`${Pn(H)}\uFF0C\u6309 Enter \u6216\u70B9\u51FB\u5207\u6362 = / \u2260\uFF0C\u6309 Delete \u6216 Backspace \u5220\u9664`,onClick:s?void 0:()=>W(U),onDelete:s?void 0:()=>z(U),sx:[Jg,$$(q$(H)),{cursor:s?"default":"pointer"}]})},U):H.kind==="not"?(0,xe.jsx)(jo,{label:Pn(H),"aria-label":`\u903B\u8F91 ${Pn(H)}\uFF08\u8865\u96C6\uFF09\uFF0C\u6309 Enter\u3001Delete \u6216 Backspace \u5220\u9664`,onDelete:s?void 0:()=>z(U),onKeyDown:Z(U),sx:[Jg,F$]},U):(0,xe.jsx)(jo,{variant:"outlined",label:Pn(H),"aria-label":`\u903B\u8F91 ${Pn(H)}\uFF0C\u6309 Enter\u3001Delete \u6216 Backspace \u5220\u9664`,onDelete:s?void 0:()=>z(U),onKeyDown:Z(U),sx:[Jg,H$]},U))}),h&&(0,xe.jsx)(ze,{severity:"warning",closeText:"\u5173\u95ED",sx:{mt:1.5},onClose:()=>T(""),children:h}),(0,xe.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"auto 1fr"},columnGap:2,rowGap:1.25,alignItems:"start",mt:2},children:[(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u72B6\u6001"}),(0,xe.jsx)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:I$.map(H=>{let U=$1[H];return(0,xe.jsx)(Sn,{label:U.label,dot:U.tone,disabled:ie,tooltip:ie?he:`\u6DFB\u52A0 \u72B6\u6001:${U.label}`,onClick:()=>v({kind:"condition",field:"status",value:H,negate:!1}),ariaLabel:`\u6DFB\u52A0\u72B6\u6001\u6761\u4EF6 ${U.label}`},H)})}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u6279\u6B21"}),(0,xe.jsxs)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:[i.map(H=>(0,xe.jsx)(Sn,{label:H.name,dot:"secondary",disabled:ie,tooltip:ie?he:`\u6DFB\u52A0 \u6279\u6B21:${H.name}`,onClick:()=>v({kind:"condition",field:"folder",value:H.name,negate:!1,literal:H.name==="-"?!0:void 0}),ariaLabel:`\u6DFB\u52A0\u6279\u6B21\u6761\u4EF6 ${H.name}`},H.id)),(0,xe.jsx)(Sn,{label:"\u672A\u5206\u7C7B",dot:"secondary",disabled:ie,tooltip:ie?he:"\u6DFB\u52A0 \u6279\u6B21:\u672A\u5206\u7C7B",onClick:()=>v({kind:"condition",field:"folder",value:"-",negate:!1}),ariaLabel:"\u6DFB\u52A0\u6279\u6B21\u6761\u4EF6 \u672A\u5206\u7C7B"})]}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u65F6\u957F"}),(0,xe.jsx)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:["3","6"].map(H=>(0,xe.jsx)(Sn,{label:`${H} \u4E2A\u6708`,dot:"success",disabled:ie,tooltip:ie?he:`\u6DFB\u52A0 \u65F6\u957F:${H} \u4E2A\u6708`,onClick:()=>v({kind:"condition",field:"months",value:H,negate:!1}),ariaLabel:`\u6DFB\u52A0\u65F6\u957F\u6761\u4EF6 ${H} \u4E2A\u6708`},H))}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u8D26\u53F7"}),(0,xe.jsxs)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",alignItems:"center",children:[(0,xe.jsx)(Ht,{size:"small",fullWidth:!1,placeholder:"\u63A5\u6536\u8D26\u53F7",value:S,disabled:s,onChange:H=>C(H.target.value),onKeyDown:H=>{H.key==="Enter"&&(H.preventDefault(),S.trim()&&!N?y("\u8D26\u53F7\u540D\u9700\u4E3A\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u3002"):k())},slotProps:{htmlInput:{"aria-label":"\u63A5\u6536\u8D26\u53F7\u7528\u6237\u540D\uFF08\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\uFF09",spellCheck:!1,sx:{fontFamily:"monospace",py:.5}}},sx:{width:160}}),(0,xe.jsx)(Sn,{label:"\u6DFB\u52A0\u8D26\u53F7",dot:"warning",disabled:s||!N||ie,tooltip:N?ie?he:`\u6DFB\u52A0 \u8D26\u53F7:${S.trim()}`:"\u8BF7\u8F93\u5165\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF\u7EC4\u6210\u7684\u8D26\u53F7\u540D",onClick:k,ariaLabel:"\u6DFB\u52A0\u8D26\u53F7\u6761\u4EF6"}),(0,xe.jsx)(Sn,{label:"\u672A\u7ED1\u5B9A",dot:"warning",disabled:ie,tooltip:ie?he:"\u6DFB\u52A0 \u8D26\u53F7:\u672A\u7ED1\u5B9A",onClick:()=>v({kind:"condition",field:"username",value:"-",negate:!1}),ariaLabel:"\u6DFB\u52A0\u8D26\u53F7\u6761\u4EF6 \u672A\u7ED1\u5B9A"})]}),(0,xe.jsx)(D,{variant:"caption",color:"text.secondary",sx:{mt:{md:.75}},children:"\u903B\u8F91"}),(0,xe.jsxs)(ce,{direction:"row",useFlexGap:!0,gap:1,flexWrap:"wrap",children:[(0,xe.jsx)(Sn,{label:"AND",mono:!0,disabled:we,tooltip:we?ge:"\u6DFB\u52A0\u903B\u8F91\u4E0E AND",onClick:()=>v({kind:"and"}),ariaLabel:"\u6DFB\u52A0\u903B\u8F91\u4E0E AND"}),(0,xe.jsx)(Sn,{label:"OR",mono:!0,disabled:we,tooltip:we?ge:"\u6DFB\u52A0\u903B\u8F91\u6216 OR",onClick:()=>v({kind:"or"}),ariaLabel:"\u6DFB\u52A0\u903B\u8F91\u6216 OR"}),(0,xe.jsx)(Sn,{label:"\u975E NOT",mono:!0,disabled:ie,tooltip:ie?he:"\u6DFB\u52A0\u8865\u96C6 NOT\uFF08\u975E\uFF09",onClick:()=>v({kind:"not"}),ariaLabel:"\u6DFB\u52A0\u8865\u96C6 NOT"}),(0,xe.jsx)(Sn,{label:"\uFF08",mono:!0,disabled:ie,tooltip:ie?he:"\u6DFB\u52A0\u5DE6\u62EC\u53F7",onClick:()=>v({kind:"lparen"}),ariaLabel:"\u6DFB\u52A0\u5DE6\u62EC\u53F7"}),(0,xe.jsx)(Sn,{label:"\uFF09",mono:!0,disabled:Te,tooltip:Te?fe<=0?"\u6CA1\u6709\u672A\u95ED\u5408\u7684\u5DE6\u62EC\u53F7":"\u53F3\u62EC\u53F7\u9700\u8DDF\u5728\u6761\u4EF6\u6216 \uFF09\u4E4B\u540E":"\u6DFB\u52A0\u53F3\u62EC\u53F7",onClick:()=>v({kind:"rparen"}),ariaLabel:"\u6DFB\u52A0\u53F3\u62EC\u53F7"}),(0,xe.jsx)(Sn,{label:(0,xe.jsxs)(ce,{component:"span",direction:"row",spacing:.5,alignItems:"center",children:[(0,xe.jsx)(_M,{sx:{fontSize:"1rem"},"aria-hidden":!0}),"\u64A4\u9500"]}),disabled:le,tooltip:le?"\u6CA1\u6709\u53EF\u64A4\u9500\u7684\u8BCD\u5143":"\u64A4\u9500\u672B\u5C3E\u8BCD\u5143",onClick:j,ariaLabel:"\u64A4\u9500\u672B\u5C3E\u8BCD\u5143"})]})]})]}),a&&(0,xe.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:a}),(0,xe.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1.5,sx:{mt:2,justifyContent:"space-between",alignItems:{xs:"stretch",sm:"center"}},children:[(0,xe.jsx)(D,{variant:"caption",color:g==="palette"&&ye?"error.main":"text.secondary",role:g==="palette"&&ye?"alert":void 0,children:g==="palette"&&ye?ye:g==="palette"?U$:VM}),(0,xe.jsxs)(ce,{direction:"row",spacing:1,sx:{flexShrink:0,justifyContent:{xs:"end",sm:"auto"}},children:[(0,xe.jsx)(ue,{variant:"outlined",disabled:s||!e&&!n,onClick:r,"aria-label":"\u6E05\u9664\u7B5B\u9009\u5E76\u8FD4\u56DE\u5B8C\u6574\u5217\u8868",children:"\u6E05\u9664"}),(0,xe.jsx)(ue,{variant:"contained",disabled:Oe,onClick:o,"aria-label":"\u5E94\u7528\u7B5B\u9009\u8868\u8FBE\u5F0F",children:"\u7B5B\u9009"})]})]}),(0,xe.jsx)(oe,{component:"span",role:"status","aria-live":"polite",sx:eh,children:x.text},x.seq)]})}var Wn=P(L(),1);var H1=P(_(),1),GM=ae([(0,H1.jsx)("circle",{cx:"10",cy:"8",r:"4"},"0"),(0,H1.jsx)("path",{d:"M10.35 14.01C7.62 13.91 2 15.27 2 18v1c0 .55.45 1 1 1h8.54c-2.47-2.76-1.23-5.89-1.19-5.99m9.08 4.01c.47-.8.7-1.77.48-2.82-.34-1.64-1.72-2.95-3.38-3.16-2.63-.34-4.85 1.87-4.5 4.5.22 1.66 1.52 3.04 3.16 3.38 1.05.22 2.02-.01 2.82-.48l1.86 1.86c.39.39 1.02.39 1.41 0s.39-1.02 0-1.41zM16 18c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"},"1")],"PersonSearchRounded");var Ve=P(_(),1);function YM({selected:e,onPrepare:t}){let[o,r]=(0,Wn.useState)(""),[n,a]=(0,Wn.useState)(null),[s,i]=(0,Wn.useState)(!1),[l,p]=(0,Wn.useState)(!1),[c,d]=(0,Wn.useState)(""),[f,u]=(0,Wn.useState)(""),g=(0,Wn.useRef)(0);async function b(h){let T=++g.current;p(!0),d(""),u(""),a(null),i(!0);try{let S=await vo(`/api/admin/customer?${h?`id=${encodeURIComponent(h)}`:`username=${encodeURIComponent(o.trim())}`}`);T===g.current&&a(S)}catch(S){T===g.current&&d(S.message)}finally{T===g.current&&p(!1)}}(0,Wn.useEffect)(()=>{e&&b(e.id)},[e]);function x(){g.current++,i(!1),a(null),p(!1),d(""),u("")}async function m(){try{await navigator.clipboard.writeText(n?.code||""),u("\u5B8C\u6574\u5151\u6362\u7801\u5DF2\u590D\u5236\u3002")}catch{u("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u4E2D\u4E0B\u65B9\u5B8C\u6574\u5151\u6362\u7801\u624B\u52A8\u590D\u5236\u3002")}}function y(h){if(!n)return;let T=n.order.id;x(),t(T,h)}return(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsxs)(tt,{variant:"outlined",component:"section","aria-labelledby":"customer-panel-title",sx:{p:{xs:2,sm:3},height:"100%"},children:[(0,Ve.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",children:[(0,Ve.jsx)(GM,{color:"primary","aria-hidden":"true"}),(0,Ve.jsx)(D,{id:"customer-panel-title",variant:"h2",sx:{fontSize:21},children:"\u6309\u5BA2\u6237\u67E5\u8BE2"})]}),(0,Ve.jsx)(oe,{component:"form",onSubmit:h=>{h.preventDefault(),b()},sx:{mt:2},children:(0,Ve.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1,children:[(0,Ve.jsx)(Ht,{label:"\u5BA2\u6237 X \u7528\u6237\u540D",placeholder:"\u8F93\u5165 @\u7528\u6237\u540D",value:o,onChange:h=>r(h.target.value),size:"small",fullWidth:!0,autoComplete:"off",slotProps:{htmlInput:{maxLength:16,spellCheck:!1}}}),(0,Ve.jsx)(ue,{type:"submit",variant:"outlined",disabled:l||!o.trim(),sx:{whiteSpace:"nowrap"},children:"\u67E5\u8BE2\u5BA2\u6237\u8BA2\u5355"})]})}),(0,Ve.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:1},children:"\u76F4\u63A5\u67E5\u770B\u5BA2\u6237\u5BF9\u5E94\u7684\u5B8C\u6574\u5151\u6362\u7801\u548C\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u65E0\u9700\u6309\u6279\u6B21\u7FFB\u9875\u3002"})]}),(0,Ve.jsxs)(lr,{open:s,onClose:x,fullWidth:!0,maxWidth:"sm","aria-labelledby":"customer-title","aria-describedby":"customer-dialog-description",children:[(0,Ve.jsx)(ur,{id:"customer-title",children:n?n.order.username?`@${n.order.username} \u7684\u8BA2\u5355`:"\u5151\u6362\u7801\u8BE6\u60C5":c?"\u67E5\u8BE2\u7ED3\u679C":"\u5BA2\u6237\u8BA2\u5355\u8BE6\u60C5"}),(0,Ve.jsxs)(cr,{id:"customer-dialog-description",children:[l&&(0,Ve.jsx)(D,{children:"\u6B63\u5728\u8BFB\u53D6\u8BA2\u5355\u2026"}),c&&(0,Ve.jsx)(ze,{severity:"error",role:"alert",children:c}),n&&(0,Ve.jsxs)(ce,{spacing:2,children:[(0,Ve.jsxs)(D,{children:[n.order.months," \u4E2A\u6708 \xB7 ",n.order.batch||"\u672A\u5206\u7C7B"," \xB7"," ",hi[n.order.status]?.label||n.order.status]}),n.order.message&&(0,Ve.jsx)(D,{variant:"body2",color:"text.secondary",children:n.order.message}),n.code?(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Ht,{label:"\u5BA2\u6237\u5BF9\u5E94\u7684\u5B8C\u6574\u5151\u6362\u7801",multiline:!0,value:n.code,slotProps:{input:{readOnly:!0}},sx:{"& textarea":{fontFamily:"monospace",overflowWrap:"anywhere"}}}),(0,Ve.jsx)(ue,{variant:"outlined",onClick:()=>{m()},children:"\u590D\u5236\u5B8C\u6574\u5151\u6362\u7801"})]}):(0,Ve.jsxs)(ze,{severity:"info",children:["\u6B64\u5386\u53F2\u5151\u6362\u7801\u4EC5\u4FDD\u5B58\u4E86\u6821\u9A8C\u503C\uFF0C\u65E0\u6CD5\u8FD8\u539F\u5B8C\u6574\u5185\u5BB9\u3002",n.can_recover&&"\u4ECD\u53EF\u6309\u6B64\u5BA2\u6237\u8BA2\u5355\u5355\u72EC\u8865\u5355\u3002"]}),f&&(0,Ve.jsx)(ze,{severity:"info",role:"status",children:f}),n.checkout_url&&(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(Ht,{label:"\u5F53\u524D\u4ED8\u6B3E\u94FE\u63A5\uFF08\u6253\u5F00\u524D\u8BF7\u5148\u6838\u5BF9\u4ED8\u6B3E\u7ED3\u679C\uFF09",multiline:!0,value:n.checkout_url,slotProps:{input:{readOnly:!0}}}),(0,Ve.jsx)(ue,{component:"a",href:n.checkout_url,target:"_blank",rel:"noopener noreferrer",children:"\u6253\u5F00\u5F53\u524D\u4ED8\u6B3E\u94FE\u63A5"})]}),n.previous_checkout_url&&(0,Ve.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5DF2\u751F\u6210\u8FC7 ",n.replacement_count," ","\u6B21\u66FF\u4EE3\u94FE\u63A5\uFF0C\u65E7\u8D26\u5355\u8BB0\u5F55\u5DF2\u4FDD\u7559\u3002"]}),n.can_recover&&(0,Ve.jsx)(ze,{severity:"info",children:"\u300C\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5\u300D\u4E0D\u4F1A\u4ED8\u6B3E\uFF1B\u300C\u5355\u72EC\u8865\u5355\u300D\u4F1A\u5148\u5C55\u793A\u8FD9\u4E00\u7B14\u8BA2\u5355\uFF0C\u786E\u8BA4\u540E\u624D\u5C1D\u8BD5\u4ED8\u6B3E\u3002"})]})]}),(0,Ve.jsxs)(pr,{sx:{flexWrap:"wrap",gap:1},children:[(0,Ve.jsx)(ue,{onClick:x,children:"\u5173\u95ED"}),n?.can_recover&&(0,Ve.jsxs)(Ve.Fragment,{children:[(0,Ve.jsx)(ue,{variant:"outlined",onClick:()=>y("links"),children:"\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5"}),(0,Ve.jsx)(ue,{variant:"contained",onClick:()=>y("pay"),children:"\u5355\u72EC\u8865\u5355"})]})]})]})]})}var Cn=P(L(),1);var WM=P(_(),1),XM=ae((0,WM.jsx)("path",{d:"M6 9H3c-.55 0-1-.45-1-1s.45-1 1-1h3c.55 0 1 .45 1 1s-.45 1-1 1m0 3H3c-.55 0-1 .45-1 1s.45 1 1 1h3c.55 0 1-.45 1-1s-.45-1-1-1m13.88 6.29-3.12-3.12c-.86.56-1.89.88-3 .82-2.37-.11-4.4-1.96-4.72-4.31-.44-3.35 2.45-6.18 5.83-5.61 1.95.33 3.57 1.85 4 3.78.33 1.46.01 2.82-.7 3.9l3.13 3.13c.39.39.39 1.02 0 1.41s-1.03.39-1.42 0M17 11c0-1.65-1.35-3-3-3s-3 1.35-3 3 1.35 3 3 3 3-1.35 3-3M3 19h8c.55 0 1-.45 1-1s-.45-1-1-1H3c-.55 0-1 .45-1 1s.45 1 1 1"}),"ManageSearchRounded");var Tt=P(_(),1);function KM({disabled:e,refreshSignal:t,onCopy:o,onViewCustomer:r,onRevoke:n}){let[a,s]=(0,Cn.useState)(""),[i,l]=(0,Cn.useState)(!1),[p,c]=(0,Cn.useState)(!1),[d,f]=(0,Cn.useState)(""),[u,g]=(0,Cn.useState)(null),b=(0,Cn.useRef)(""),x=(0,Cn.useRef)(0),m=(0,Cn.useRef)(null),y=a.replace(/\s+/g,"").toUpperCase(),h=/^XG-[A-F0-9]{48}$/.test(y);async function T(E){let R=++x.current;l(!0),f("");try{let O=await vo("/api/admin/lookup",{code:E});R===x.current&&(g(O),b.current=E)}catch(O){R===x.current&&(g(null),f(O.message))}finally{R===x.current&&l(!1)}}function S(){if(c(!h),!h||i||e){h||m.current?.focus();return}T(y)}(0,Cn.useEffect)(()=>{t>0&&u&&b.current===y&&T(b.current)},[t]);let C=u?[["\u63A5\u6536\u8D26\u53F7",u.username?`@${u.username}`:"\u2014"],["\u6279\u6B21",u.batch||"\u672A\u5206\u7C7B"],["\u751F\u6210\u65F6\u95F4",_l(u.created)],...u.status==="processing"||u.status==="review"?[["\u8BA2\u5355\u8FDB\u5EA6",`${Math.min(100,Math.max(0,u.progress??0))}%`]]:[]]:[];return(0,Tt.jsxs)(tt,{variant:"outlined",component:"section","aria-labelledby":"lookup-title",sx:{p:{xs:2,sm:3},height:"100%"},children:[(0,Tt.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",children:[(0,Tt.jsx)(XM,{color:"primary","aria-hidden":"true"}),(0,Tt.jsx)(D,{id:"lookup-title",variant:"h2",sx:{fontSize:21},children:"\u6309\u5151\u6362\u7801\u67E5\u8BE2"})]}),(0,Tt.jsx)(oe,{component:"form",noValidate:!0,onSubmit:E=>{E.preventDefault(),S()},sx:{mt:2},children:(0,Tt.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1,children:[(0,Tt.jsx)(Ht,{label:"\u5B8C\u6574\u5151\u6362\u7801",placeholder:"XG-\u2026",value:a,onChange:E=>{x.current++,s(E.target.value),g(null),f(""),p&&c(!1)},size:"small",fullWidth:!0,autoComplete:"off",error:p,helperText:p?"\u8BF7\u8F93\u5165 XG- \u5F00\u5934\u3001\u540E\u63A5 48 \u4F4D\u5341\u516D\u8FDB\u5236\u5B57\u7B26\uFF080-9\u3001A-F\uFF09\u7684\u5B8C\u6574\u5151\u6362\u7801\u3002":" ",slotProps:{htmlInput:{maxLength:80,spellCheck:!1,ref:m},input:{sx:{fontFamily:"monospace",fontSize:16}}}}),(0,Tt.jsx)(ue,{type:"submit",variant:"outlined",disabled:i||e||!a.trim(),startIcon:i?(0,Tt.jsx)(aa,{size:16,"aria-hidden":"true"}):void 0,sx:{whiteSpace:"nowrap",alignSelf:{sm:"flex-start"}},children:i?"\u6B63\u5728\u67E5\u8BE2\u2026":"\u67E5\u8BE2\u5151\u6362\u7801"})]})}),(0,Tt.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u7C98\u8D34\u5BA2\u6237\u63D0\u4F9B\u7684\u5B8C\u6574\u5151\u6362\u7801\uFF0C\u76F4\u63A5\u67E5\u770B\u72B6\u6001\u3001\u6279\u6B21\u548C\u63A5\u6536\u8D26\u53F7\uFF0C\u65E0\u9700\u6309\u6279\u6B21\u7FFB\u9875\u3002"}),d&&(0,Tt.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:d}),(0,Tt.jsx)(oe,{"aria-live":"polite",children:u&&(0,Tt.jsxs)(oe,{sx:{mt:2,p:2,border:1,borderColor:"divider",borderRadius:2,bgcolor:"background.default"},children:[(0,Tt.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",flexWrap:"wrap",useFlexGap:!0,children:[(0,Tt.jsx)(jo,{size:"small",variant:"outlined",color:hi[u.status]?.color??"default",label:hi[u.status]?.label??u.status}),(0,Tt.jsxs)(D,{variant:"body2",fontWeight:600,children:[u.months," \u4E2A\u6708"]}),(0,Tt.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{fontFamily:"monospace"},children:["\u5C3E\u53F7 \u2026",u.hint]})]}),(0,Tt.jsx)(oe,{component:"dl",sx:{display:"grid",gridTemplateColumns:"auto 1fr",columnGap:2,rowGap:.5,m:0,mt:1.5},children:C.map(([E,R])=>(0,Tt.jsxs)(oe,{component:"div",sx:{display:"contents"},children:[(0,Tt.jsx)(D,{component:"dt",variant:"body2",color:"text.secondary",sx:{whiteSpace:"nowrap"},children:E}),(0,Tt.jsx)(D,{component:"dd",variant:"body2",sx:{m:0,overflowWrap:"anywhere"},children:R})]},E))}),u.message&&(0,Tt.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:1,overflowWrap:"anywhere"},children:u.message}),(0,Tt.jsxs)(ce,{direction:"row",spacing:1,flexWrap:"wrap",useFlexGap:!0,sx:{mt:1.5},children:[(0,Tt.jsx)(ue,{size:"small",variant:"outlined",disabled:e,onClick:()=>r(u.id),children:"\u67E5\u770B\u5151\u6362\u7801 / \u8865\u5355"}),u.copyable&&(0,Tt.jsx)(ue,{size:"small",variant:"outlined",disabled:e,onClick:()=>o(u),children:"\u590D\u5236\u5B8C\u6574\u5151\u6362\u7801"}),u.status==="active"&&(0,Tt.jsx)(ue,{size:"small",variant:"outlined",color:"error",disabled:e,onClick:()=>n(u),children:"\u505C\u7528"})]})]})})]})}var ro=P(L(),1);var QM=P(_(),1),tT=ae((0,QM.jsx)("path",{d:"M15.88 9.29 12 13.17 8.12 9.29a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.59 4.59c.39.39 1.02.39 1.41 0l4.59-4.59c.39-.39.39-1.02 0-1.41-.39-.38-1.03-.39-1.42 0"}),"ExpandMoreRounded");var ZM=P(_(),1),JM=ae((0,ZM.jsx)("path",{d:"M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2m-1 14H5c-.55 0-1-.45-1-1v-5h16v5c0 .55-.45 1-1 1m1-10H4V6h16z"}),"CreditCardRounded");var eA=P(_(),1),tA=ae((0,eA.jsx)("path",{d:"M19 13H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-4c0-1.1-.9-2-2-2M7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2M19 3H5c-1.1 0-2 .9-2 2v4c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2M7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2"}),"DnsRounded");var Le=P(_(),1),W$={"card, cardholder name or email is incomplete":"\u5361\u4FE1\u606F\u4E0D\u5B8C\u6574","card number checksum is invalid":"\u5361\u53F7\u6821\u9A8C\u5931\u8D25","card has expired":"\u5361\u7247\u5DF2\u8FC7\u671F","Stripe requires a billing address; supply the card billing country and applicable address fields":"\u7F3A\u5C11\u8D26\u5355\u5730\u5740","invalid supplied billing country":"\u8D26\u5355\u56FD\u5BB6\u65E0\u6548",do_not_try_again:"\u94F6\u884C\u8981\u6C42\u505C\u6B62\u91CD\u8BD5",declined_multi_node:"\u591A\u4E2A\u8282\u70B9\u62D2\u4ED8",requires_action:"\u9700\u8981\u94F6\u884C\u9A8C\u8BC1"};function oA(e){return W$[e]||e}function _d(e){return e==="direct"?"\u76F4\u8FDE":e}function V1({label:e,value:t}){return(0,Le.jsxs)(oe,{sx:{border:1,borderColor:"divider",borderRadius:2,p:2,minWidth:0},children:[(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",children:e}),(0,Le.jsx)(D,{variant:"h3",component:"p",sx:{mt:.25},children:t})]})}function rA({icon:e,id:t,title:o}){return(0,Le.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:2},children:[e,(0,Le.jsx)(D,{id:t,variant:"h2",sx:{fontSize:21},children:o})]})}function X$({network:e,failed:t}){let o=e?e.available??e.nodes:0;return(0,Le.jsxs)(tt,{component:"section","aria-labelledby":"payment-nodes-title",variant:"outlined",sx:{p:{xs:2,sm:3}},children:[(0,Le.jsx)(rA,{icon:(0,Le.jsx)(tA,{color:"primary","aria-hidden":"true"}),id:"payment-nodes-title",title:"\u4ED8\u6B3E\u8282\u70B9"}),!e&&!t&&(0,Le.jsx)(ce,{direction:"row",spacing:1.5,role:"status","aria-label":"\u6B63\u5728\u8BFB\u53D6\u4ED8\u6B3E\u8282\u70B9\u72B6\u6001",children:[0,1,2].map(r=>(0,Le.jsx)(Ya,{variant:"rounded",height:78,sx:{flex:1}},r))}),!e&&t&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002"}),e?.mode==="direct"&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u65B0\u8BA2\u5355\u7684 Stripe \u8BF7\u6C42\u8D70\u670D\u52A1\u5668\u76F4\u8FDE\uFF1B\u5DF2\u6709\u8282\u70B9\u7ED1\u5B9A\u7684\u8BA2\u5355\u4FDD\u7559\u539F\u8282\u70B9\u3002"}),e?.mode==="pool"&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:1.5},children:[(0,Le.jsx)(V1,{label:"\u8282\u70B9\u603B\u6570",value:String(e.nodes)}),(0,Le.jsx)(V1,{label:"\u53EF\u7528",value:String(o)}),(0,Le.jsx)(V1,{label:"\u51B7\u5374\u4E2D",value:String(e.cooling??0)})]}),o===0&&(0,Le.jsx)(ze,{severity:"warning",sx:{mt:2},children:"\u8282\u70B9\u6C60\u5168\u90E8\u5728\u51B7\u5374\u4E2D\uFF0C\u65B0\u8BA2\u5355\u6682\u65F6\u65E0\u6CD5\u4ED8\u6B3E\u3002"}),(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:2},children:"\u8282\u70B9\u8FDE\u63A5\u6545\u969C\u540E\u51B7\u5374 30 \u5206\u949F\uFF1B\u5B89\u5168\u67E5\u8BE2\u6BCF\u4E2A\u8BF7\u6C42\u6700\u591A\u5C1D\u8BD5 3 \u6B21\uFF1B\u4ED8\u6B3E\u63D0\u4EA4\u5931\u8D25\u4E0D\u81EA\u52A8\u91CD\u6263\u3002"})]}),e&&(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1},children:"X \u751F\u6210\u94FE\u63A5\u8D70\u914D\u7F6E\u4EE3\u7406\uFF1B\u624B\u52A8\u6253\u5F00\u4ED8\u6B3E\u94FE\u63A5\u65F6\uFF0C\u4F7F\u7528\u5F53\u524D\u6D4F\u89C8\u5668\u7684\u7F51\u7EDC\u3002"})]})}function K$({cards:e,rotation:t,paths:o,failed:r}){let n=!t&&!r,a=e.length>0&&e.every(s=>!s.usable||!!s.blocked||(s.cooling_seconds||0)>0||o!==void 0&&o>0&&(s.pair_cooling||0)>=o);return(0,Le.jsxs)(tt,{component:"section","aria-labelledby":"payment-cards-title",variant:"outlined",sx:{p:{xs:2,sm:3}},children:[(0,Le.jsx)(rA,{icon:(0,Le.jsx)(JM,{color:"primary","aria-hidden":"true"}),id:"payment-cards-title",title:"\u4ED8\u6B3E\u5361"}),n&&(0,Le.jsxs)(ce,{spacing:1.5,role:"status","aria-label":"\u6B63\u5728\u8BFB\u53D6\u4ED8\u6B3E\u5361\u72B6\u6001",children:[(0,Le.jsx)(Ya,{variant:"text",width:"60%"}),(0,Le.jsx)(ce,{direction:"row",spacing:1,children:[88,120,104].map(s=>(0,Le.jsx)(Ya,{variant:"rounded",width:s,height:32,sx:{borderRadius:4}},s))})]}),!n&&!t&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5\u3002"}),t&&e.length===0&&(0,Le.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u5C1A\u672A\u914D\u7F6E\u4ED8\u6B3E\u5361\uFF1B\u4ED8\u6B3E\u5361\u8865\u5355\u4E0D\u53EF\u7528\uFF0C\u4ECD\u53EF\u300C\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5\u300D\u7531\u5BA2\u6237\u81EA\u884C\u4ED8\u6B3E\u3002"}),t&&e.length>0&&(0,Le.jsxs)(Le.Fragment,{children:[(0,Le.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5171 ",e.length," \u5F20",t.card_last4?t.used>=t.batch_size?` \xB7 \u5F53\u524D\u7EC4\u5408\uFF1A\u5C3E\u53F7 ${t.card_last4} \xD7 ${_d(t.node)}\uFF08\u672C\u7EC4 ${t.used}/${t.batch_size} \u7B14\u5DF2\u7528\u6EE1\uFF0C\u4E0B\u4E00\u7B14\u81EA\u52A8\u66F4\u6362\uFF09`:` \xB7 \u5F53\u524D\u7EC4\u5408\uFF1A\u5C3E\u53F7 ${t.card_last4} \xD7 ${_d(t.node)}\uFF08\u672C\u7EC4\u5DF2\u7528 ${t.used}/${t.batch_size} \u7B14\uFF09`:" \xB7 \u5C1A\u672A\u5F00\u59CB\u8F6E\u6362\uFF0C\u9996\u7B14\u4ED8\u6B3E\u65F6\u968F\u673A\u9009\u62E9\u7EC4\u5408"]}),a&&(0,Le.jsx)(ze,{severity:"warning",sx:{mt:1.5},children:"\u6240\u6709\u4ED8\u6B3E\u5361\u90FD\u5728\u51B7\u5374\u6216\u4E0D\u53EF\u7528\uFF0C\u65B0\u8BA2\u5355\u6682\u65F6\u65E0\u6CD5\u4ED8\u6B3E\u3002"}),(0,Le.jsx)(ce,{direction:"row",spacing:1,useFlexGap:!0,sx:{mt:1.5,flexWrap:"wrap",alignItems:"center"},children:e.map(s=>{let i=s.cooling_seconds||0,l=!!s.blocked&&i===0,p=s.usable?l?`\u5C3E\u53F7 ${s.last4} \u5DF2\u5C01\u9501\uFF08${oA(s.blocked)}\uFF09`:i>0?`\u5C3E\u53F7 ${s.last4} \u51B7\u5374 ${Math.ceil(i/60)} \u5206\u949F`:`\u5C3E\u53F7 ${s.last4} \u53EF\u7528`:`\u5C3E\u53F7 ${s.last4} \u4E0D\u53EF\u7528${s.problem?`\uFF08${oA(s.problem)}\uFF09`:""}`,c=s.pair_cooling?` \xB7 ${s.pair_cooling} \u7EC4\u7EC4\u5408\u51B7\u5374`:"";return(0,Le.jsx)(jo,{size:"small",variant:"outlined",color:!s.usable||l?"error":i>0?"warning":"success",label:`${p}${c}`},s.last4)})}),(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1.5},children:"\u300CN \u7EC4\u7EC4\u5408\u51B7\u5374\u300D\u6307\u8BE5\u5361\u4E0E\u90E8\u5206\u8282\u70B9\u7684\u7EC4\u5408\u6682\u4E0D\u53EF\u7528\uFF1B\u540C\u4E00\u5361\u5728\u591A\u4E2A\u8282\u70B9\u88AB\u62D2\u540E\u624D\u4F1A\u6574\u5361\u51B7\u5374\u3002"}),(0,Le.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:.5},children:`\u6BCF ${t.batch_size} \u7B14\u4ED8\u6B3E\u5171\u7528\u540C\u4E00\u5361\u4E0E\u8282\u70B9\u7684\u7EC4\u5408\uFF0C\u7528\u6EE1\u6216\u88AB\u62D2\u540E\u81EA\u52A8\u66F4\u6362\u3002`})]})]})}function nA({network:e,cards:t,rotation:o,failed:r}){let n=e?e.mode==="pool"?e.available??e.nodes:1:void 0;return(0,Le.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"minmax(0, 1fr) minmax(0, 1fr)"},gap:3,mb:3,alignItems:"stretch"},children:[(0,Le.jsx)(X$,{network:e,failed:r}),(0,Le.jsx)(K$,{cards:t,rotation:o,paths:n,failed:r})]})}var ee=P(_(),1),F1={preview:"\u5F85\u786E\u8BA4",pending:"\u5F85\u5904\u7406",running:"\u5904\u7406\u4E2D",stopping:"\u6B63\u5728\u505C\u6B62",stopped:"\u5DF2\u505C\u6B62",completed:"\u6279\u6B21\u5DF2\u7ED3\u675F",interrupted:"\u670D\u52A1\u91CD\u542F\u540E\u6682\u505C",succeeded:"\u5DF2\u786E\u8BA4\u6210\u529F",declined:"\u4ED8\u6B3E\u88AB\u62D2",requires_action:"\u9700\u94F6\u884C\u9A8C\u8BC1",skipped:"\u5DF2\u8DF3\u8FC7",blocked:"\u5F85\u6838\u5B9E",link_ready:"\u94FE\u63A5\u5DF2\u5C31\u7EEA \xB7 \u672A\u4ED8\u6B3E",needs_verification:"\u9700\u6838\u5BF9\u539F\u6263\u6B3E"};function sA(e){let t=r=>e.filter(n=>r.includes(n.state)).length,o=[["\u6210\u529F",t(["succeeded"])],["\u94FE\u63A5\u5C31\u7EEA",t(["link_ready"])],["\u8DF3\u8FC7",t(["skipped"])],["\u5F85\u6838\u5B9E",t(["declined","requires_action","blocked","needs_verification"])],["\u672A\u5904\u7406",t(["pending"])],["\u5904\u7406\u4E2D",t(["running"])]];return[`\u5171 ${e.length} \u7B14`,...o.filter(([,r])=>r>0).map(([r,n])=>`${r} ${n} \u7B14`)].join(" \xB7 ")}function q1(e){return e?_l(e):"\u65F6\u95F4\u672A\u8BB0\u5F55"}function aA({batch:e}){return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsxs)(ce,{direction:"row",flexWrap:"wrap",gap:1,alignItems:"center",children:[(0,ee.jsx)(jo,{size:"small",label:F1[e.state]||e.state}),(0,ee.jsxs)(D,{variant:"body2",children:[e.mode==="links"?"\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5":e.cards&&e.cards>1?`\u4ED8\u6B3E\u5361 ${e.cards} \u5F20\u968F\u673A\u8F6E\u6362\uFF08\u5F53\u524D\u5C3E\u53F7 ${e.last4}\uFF09`:`\u4ED8\u6B3E\u5361\u5C3E\u53F7 ${e.last4}`," \xB7 ",sA(e.items)]})]}),(0,ee.jsxs)(D,{variant:"caption",color:"text.secondary",display:"block",sx:{mt:1},children:["\u521B\u5EFA\u4E8E ",q1(e.created)," \xB7 \u66F4\u65B0\u4E8E ",q1(e.updated||e.created)]}),(0,ee.jsx)(D,{variant:"body2",color:"text.secondary",sx:{my:1},children:e.message}),e.items.length>0&&(0,ee.jsx)(iA,{items:e.items})]})}function Q$(e){let t={};for(let o of e)o.state==="pending"&&(t[o.currency]=(t[o.currency]||0)+o.amount);return Object.entries(t).map(([o,r])=>`${o} ${(r/100).toFixed(2)}`).join(" + ")||"0.00"}function iA({items:e}){return(0,ee.jsxs)(ee.Fragment,{children:[(0,ee.jsx)(ce,{spacing:1,sx:{display:{xs:"flex",sm:"none"},mb:1},children:e.map(t=>(0,ee.jsxs)(oe,{sx:{p:1.5,border:1,borderColor:"divider",borderRadius:1},children:[(0,ee.jsxs)(D,{variant:"body2",fontWeight:600,sx:{overflowWrap:"anywhere"},children:["@",t.username," \xB7 \u5151\u6362\u7801\u5C3E\u53F7 ",t.hint]}),t.payment_node&&(0,ee.jsxs)(D,{variant:"caption",children:["\u4ED8\u6B3E\u8282\u70B9 ",_d(t.payment_node)]}),(0,ee.jsxs)(D,{variant:"body2",children:[t.months," \u4E2A\u6708 \xB7 ",t.currency," ",(t.amount/100).toFixed(2)]}),(0,ee.jsx)(D,{variant:"body2",fontWeight:600,sx:{mt:1},children:F1[t.state]||t.state}),(0,ee.jsx)(D,{variant:"caption",color:"text.secondary",sx:{overflowWrap:"anywhere"},children:t.detail}),t.state==="link_ready"&&t.checkout_url&&(0,ee.jsx)(ue,{component:"a",href:t.checkout_url,target:"_blank",rel:"noopener noreferrer",size:"small",children:"\u6253\u5F00\u4ED8\u6B3E\u94FE\u63A5"})]},t.id))}),(0,ee.jsx)(oc,{tabIndex:0,role:"region","aria-label":"\u8865\u5355\u8BA2\u5355\u6E05\u5355\uFF0C\u53EF\u6EDA\u52A8\u67E5\u770B",sx:{maxHeight:380,display:{xs:"none",sm:"block"}},children:(0,ee.jsxs)(ec,{size:"small",stickyHeader:!0,"aria-label":"\u8865\u5355\u8BA2\u5355\u6E05\u5355",children:[(0,ee.jsx)(rc,{children:(0,ee.jsxs)(Xa,{children:[(0,ee.jsx)(io,{children:"\u5BA2\u6237 / \u5957\u9910"}),(0,ee.jsx)(io,{children:"\u8D26\u5355\u91D1\u989D"}),(0,ee.jsx)(io,{children:"\u5904\u7406\u7ED3\u679C"})]})}),(0,ee.jsx)(tc,{children:e.map(t=>(0,ee.jsxs)(Xa,{children:[(0,ee.jsxs)(io,{sx:{verticalAlign:"top",minWidth:140},children:[(0,ee.jsxs)(D,{variant:"body2",children:["@",t.username]}),(0,ee.jsxs)(D,{variant:"caption",display:"block",children:["\u5151\u6362\u7801\u5C3E\u53F7 ",t.hint,t.payment_node&&` \xB7 \u4ED8\u6B3E\u8282\u70B9 ${_d(t.payment_node)}`]}),(0,ee.jsxs)(D,{variant:"caption",color:"text.secondary",children:[t.months," \u4E2A\u6708"]})]}),(0,ee.jsxs)(io,{sx:{whiteSpace:"nowrap",verticalAlign:"top"},children:[t.currency," ",(t.amount/100).toFixed(2)]}),(0,ee.jsxs)(io,{sx:{minWidth:180},children:[(0,ee.jsx)(D,{variant:"body2",fontWeight:600,children:F1[t.state]||t.state}),(0,ee.jsx)(D,{variant:"caption",color:"text.secondary",sx:{overflowWrap:"anywhere"},children:t.detail}),t.state==="link_ready"&&t.checkout_url&&(0,ee.jsx)(ue,{component:"a",href:t.checkout_url,target:"_blank",rel:"noopener noreferrer",size:"small",children:"\u6253\u5F00\u4ED8\u6B3E\u94FE\u63A5"})]})]},t.id))})]})})]})}function lA({selection:e}){let[t,o]=(0,ro.useState)(null),[r,n]=(0,ro.useState)(null),[a,s]=(0,ro.useState)([]),[i,l]=(0,ro.useState)(null),[p,c]=(0,ro.useState)(!1),[d,f]=(0,ro.useState)(null),[u,g]=(0,ro.useState)(""),[b,x]=(0,ro.useState)(!1),[m,y]=(0,ro.useState)(""),[h,T]=(0,ro.useState)(!1),[S,C]=(0,ro.useState)(!1),[E,R]=(0,ro.useState)(!1),[O,w]=(0,ro.useState)(!1),A=t?.mode==="links",v=(0,ro.useRef)(!1),N=(0,ro.useRef)(0),k=(0,ro.useRef)(null),z=t?.state==="running"||t?.state==="stopping",j=t?.items.filter(Z=>Z.state==="pending").length||0;(0,ro.useEffect)(()=>{let Z=!1,X;async function de(){let me=N.current;try{let fe=await vo("/api/admin/recovery");!Z&&!v.current&&me===N.current&&(o(fe.batch),n(fe.network||null),s(fe.cards||[]),l(fe.rotation||null),c(!!fe.paused),f(fe.summary||null),g(""))}catch(fe){!Z&&!v.current&&me===N.current&&(g(fe.message),f(null))}finally{Z||(X=setTimeout(de,5e3))}}return de(),()=>{Z=!0,clearTimeout(X)}},[]),(0,ro.useEffect)(()=>{e&&(v.current?k.current=e:W("preview",e))},[e]);async function W(Z,X){if(!v.current){v.current=!0,N.current++,x(!0),y("");try{let de=await vo(`/api/admin/recovery/${Z}`,Z==="preview"?{id:X?.id||"",mode:X?.mode||"pay"}:Z==="start"?{id:t?.id,confirm:S,reset_pause:E,verified_unpaid:O}:{id:t?.id});o(de.batch),Z==="preview"&&(C(!1),R(!1),w(!1),T(!0)),Z==="start"&&T(!1)}catch(de){y(de.message)}finally{v.current=!1,N.current++,x(!1);let de=k.current;de&&(k.current=null,W("preview",de))}}}return(0,ee.jsxs)(ee.Fragment,{children:[u&&(0,ee.jsxs)(ze,{severity:"error",role:"alert",sx:{mb:3},children:["\u5F53\u524D\u72B6\u6001\u8BFB\u53D6\u5931\u8D25\uFF1A",u]}),(0,ee.jsx)(nA,{network:r,cards:a,rotation:i,failed:!!u}),(0,ee.jsxs)(tt,{component:"section","aria-labelledby":"recovery-panel-title",variant:"outlined",sx:{p:{xs:2,sm:3},mb:3},children:[(0,ee.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:2,children:[(0,ee.jsxs)(oe,{children:[(0,ee.jsx)(D,{id:"recovery-panel-title",variant:"h2",sx:{fontSize:21},children:"\u7BA1\u7406\u5458\u624B\u52A8\u8865\u5355"}),(0,ee.jsx)(D,{color:"text.secondary",variant:"body2",sx:{mt:1},children:"\u652F\u6301\u53EA\u751F\u6210\u8865\u5355\u94FE\u63A5\uFF0C\u6216\u786E\u8BA4\u540E\u4F7F\u7528\u5DF2\u4FDD\u5B58\u7684\u4ED8\u6B3E\u5361\u4ED8\u6B3E\u3002\u670D\u52A1\u5668\u9010\u7B14\u5904\u7406\uFF0C\u95F4\u9694\u81F3\u5C11 30 \u79D2\u3002"})]}),(0,ee.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{flexWrap:"wrap",rowGap:1},children:[(0,ee.jsx)(ue,{variant:"outlined",disabled:b||z,onClick:()=>{W("preview",{mode:"links"})},children:"\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5"}),(0,ee.jsx)(ue,{variant:"contained",disabled:b||z,onClick:()=>{W("preview")},children:"\u9884\u89C8\u5E76\u8865\u5355"}),z&&(0,ee.jsx)(ue,{variant:"outlined",color:"error",disabled:b||t?.state==="stopping",onClick:()=>{W("stop")},children:"\u505C\u6B62\u540E\u7EED\u8BA2\u5355"})]})]}),p&&(0,ee.jsx)(ze,{severity:"warning",sx:{mt:2},children:"\u4ED8\u6B3E\u4FDD\u62A4\u5DF2\u89E6\u53D1\uFF1A\u7528\u6237\u5145\u503C\u4E0E\u4ED8\u6B3E\u5361\u4ED8\u6B3E\u5747\u5DF2\u6682\u505C\u3002\u542F\u52A8\u8865\u5355\u65F6\uFF0C\u9700\u5728\u786E\u8BA4\u6846\u4E2D\u52FE\u9009\u89E3\u9664\u6682\u505C\u3002"}),m&&!h&&(0,ee.jsx)(ze,{severity:"error",role:"alert",sx:{mt:2},children:m}),(0,ee.jsxs)(oe,{sx:{mt:2},children:[(0,ee.jsx)(D,{variant:"body2",fontWeight:600,"aria-live":"polite",children:u?"\u5F53\u524D\u72B6\u6001\u6682\u4E0D\u53EF\u7528\uFF0C\u6B63\u5728\u81EA\u52A8\u91CD\u8BD5":z?"\u5F53\u524D\u6709\u8865\u5355\u4EFB\u52A1\u8FD0\u884C\u4E2D":d?"\u5F53\u524D\u6CA1\u6709\u8FD0\u884C\u4E2D\u7684\u8865\u5355\u4EFB\u52A1":"\u6B63\u5728\u8BFB\u53D6\u5F53\u524D\u72B6\u6001\u2026"}),d&&(0,ee.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:["\u5F53\u524D\u8BA2\u5355\uFF1A\u5F85\u6838\u5B9E ",d.review," \u7B14 \xB7 \u5145\u503C\u5904\u7406\u4E2D ",d.processing," \u7B14"]})]}),t&&z&&!u&&(0,ee.jsx)(oe,{sx:{mt:2},children:(0,ee.jsx)(aA,{batch:t})}),t&&!z&&(0,ee.jsxs)(oy,{disableGutters:!0,elevation:0,sx:{mt:2,border:1,borderColor:"divider","&::before":{display:"none"}},children:[(0,ee.jsx)(cy,{expandIcon:(0,ee.jsx)(tT,{}),"aria-controls":"recovery-history-content",id:"recovery-history-heading",children:(0,ee.jsxs)(oe,{children:[(0,ee.jsx)(D,{variant:"body2",fontWeight:600,children:t.state==="preview"?"\u4E0A\u6B21\u9884\u89C8\uFF08\u672A\u542F\u52A8\uFF09":"\u4E0A\u6B21\u8865\u5355\u8BB0\u5F55\uFF08\u5386\u53F2\uFF09"}),(0,ee.jsxs)(D,{variant:"caption",color:"text.secondary",children:[q1(t.updated||t.created)," \xB7 ",sA(t.items)]})]})}),(0,ee.jsxs)(ry,{id:"recovery-history-content",children:[(0,ee.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:1.5},children:"\u4EE5\u4E0B\u4E3A\u8FD9\u6B21\u4EFB\u52A1\u4FDD\u5B58\u7684\u5904\u7406\u7ED3\u679C\u3002\u5F53\u524D\u8BA2\u5355\u6570\u91CF\u663E\u793A\u5728\u4E0A\u65B9\uFF1B\u5237\u65B0\u9875\u9762\u4E0D\u4F1A\u91CD\u65B0\u6267\u884C\u6B64\u4EFB\u52A1\u3002"}),(0,ee.jsx)(aA,{batch:t})]})]},`${t.id}-${t.state}`),(0,ee.jsxs)(lr,{open:h,onClose:()=>{b||T(!1)},fullWidth:!0,maxWidth:"md",slotProps:{paper:{sx:{m:{xs:2,sm:4},width:{xs:"calc(100% - 32px)",sm:"calc(100% - 64px)"}}}},"aria-labelledby":"recovery-title","aria-describedby":"recovery-dialog-description",children:[(0,ee.jsx)(ur,{id:"recovery-title",children:A?"\u786E\u8BA4\u751F\u6210\u8865\u5355\u94FE\u63A5\uFF08\u4E0D\u4ED8\u6B3E\uFF09":"\u786E\u8BA4\u624B\u52A8\u8865\u5355"}),(0,ee.jsxs)(cr,{id:"recovery-dialog-description",children:[m&&(0,ee.jsx)(ze,{severity:"error",role:"alert",sx:{mb:2},children:m}),(0,ee.jsxs)(D,{sx:{mb:1},children:[A?"\u53EA\u751F\u6210\u6216\u66F4\u65B0\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u4E0D\u4F7F\u7528\u4ED8\u6B3E\u5361\u4ED8\u6B3E\uFF1B\u6838\u9A8C\u5E76\u5904\u7406":(0,ee.jsxs)(ee.Fragment,{children:[t?.cards&&t.cards>1?(0,ee.jsxs)(ee.Fragment,{children:["\u4F7F\u7528 ",(0,ee.jsx)("strong",{children:t.cards})," \u5F20\u4ED8\u6B3E\u5361\u968F\u673A\u8F6E\u6362\uFF08\u5F53\u524D\u5C3E\u53F7 ",(0,ee.jsx)("strong",{children:t?.last4}),"\uFF09"]}):(0,ee.jsxs)(ee.Fragment,{children:["\u4F7F\u7528\u4ED8\u6B3E\u5361\u5C3E\u53F7 ",(0,ee.jsx)("strong",{children:t?.last4})]}),"\uFF0C\u6838\u9A8C\u5E76\u5904\u7406"]})," ",(0,ee.jsx)("strong",{children:j})," \u7B14\u8BA2\u5355\uFF0C\u8D26\u5355\u603B\u989D"," ",(0,ee.jsx)("strong",{children:Q$(t?.items||[])}),"\u3002"]}),(0,ee.jsx)(ze,{severity:"warning",sx:{mb:2},children:A?"\u8FD9\u4E00\u6B65\u53EA\u51C6\u5907\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u4E0D\u4ED8\u6B3E\u3002\u6709\u6548\u94FE\u63A5\u4F1A\u590D\u7528\uFF1B\u65E7\u94FE\u63A5\u5931\u6548\u65F6\uFF0C\u6838\u9A8C\u5E76\u4FDD\u7559\u65E7\u8BB0\u5F55\u540E\u751F\u6210\u65B0\u94FE\u63A5\u3002":"\u786E\u8BA4\u540E\u4F1A\u5C1D\u8BD5\u771F\u5B9E\u4ED8\u6B3E\u3002\u65E7\u94FE\u63A5\u5931\u6548\u65F6\u53EF\u5148\u751F\u6210\u65B0\u94FE\u63A5\uFF1B\u5DF2\u4ED8\u6B3E\u53EA\u540C\u6B65\u7ED3\u679C\uFF0C\u4E0D\u7B26\u5408\u6761\u4EF6\u7684\u8BA2\u5355\u8DF3\u8FC7\u3002\u666E\u901A\u62D2\u4ED8\u53EA\u6807\u8BB0\u8BE5\u5355\u5931\u8D25\uFF1B\u7ED3\u679C\u4E0D\u660E\u3001\u9700\u94F6\u884C\u9A8C\u8BC1\u6216\u652F\u4ED8\u65B9\u660E\u786E\u7981\u6B62\u91CD\u8BD5\u65F6\u505C\u6B62\u4EFB\u52A1\u3002"}),t&&(0,ee.jsx)(iA,{items:t.items}),t?.paused&&!A&&(0,ee.jsx)(Ms,{control:(0,ee.jsx)(Bn,{checked:E,disabled:b,onChange:Z=>R(Z.target.checked)}),label:"\u6211\u5DF2\u68C0\u67E5\u4ED8\u6B3E\u65B9\u5F0F\uFF0C\u786E\u8BA4\u89E3\u9664\u672C\u8F6E\u6682\u505C\u5E76\u91CD\u65B0\u5C1D\u8BD5\uFF1B\u62D2\u4ED8\u4FDD\u62A4\u7EE7\u7EED\u751F\u6548\u3002"}),t?.items.some(Z=>Z.needs_unpaid_verification)&&(0,ee.jsx)(Ms,{control:(0,ee.jsx)(Bn,{checked:O,disabled:b,onChange:Z=>w(Z.target.checked)}),label:"\u6211\u5DF2\u6838\u5BF9\u539F\u8BA2\u5355\u672A\u6263\u6B3E\uFF1B\u82E5\u65E7\u94FE\u63A5\u5931\u6548\uFF0C\u5141\u8BB8\u4FDD\u7559\u65E7\u8BB0\u5F55\u5E76\u751F\u6210\u65B0\u94FE\u63A5\u3002\u672A\u52FE\u9009\u5219\u4E0D\u4F1A\u66FF\u6362\u65E0\u6CD5\u5728\u7EBF\u786E\u8BA4\u7684\u8D26\u5355\u3002"}),(0,ee.jsx)(Ms,{control:(0,ee.jsx)(Bn,{checked:S,disabled:b,onChange:Z=>C(Z.target.checked)}),label:A?"\u6211\u5DF2\u6838\u5BF9\u5BA2\u6237\u548C\u5957\u9910\uFF0C\u786E\u8BA4\u4EC5\u751F\u6210\u8865\u5355\u94FE\u63A5\uFF0C\u4E0D\u4ED8\u6B3E\u3002":"\u6211\u5DF2\u6838\u5BF9\u5BA2\u6237\u3001\u5957\u9910\u3001\u8D26\u5355\u91D1\u989D\u548C\u4ED8\u6B3E\u5361\uFF0C\u786E\u8BA4\u542F\u52A8\u672C\u6279\u6B21\u4ED8\u6B3E\u3002"})]}),(0,ee.jsxs)(pr,{children:[(0,ee.jsx)(ue,{disabled:b,onClick:()=>T(!1),children:"\u53D6\u6D88"}),(0,ee.jsx)(ue,{variant:"contained",disabled:b||!S||!j||!A&&t?.paused&&!E||t?.state!=="preview",onClick:()=>{W("start")},children:b?"\u6B63\u5728\u63D0\u4EA4\u2026":A?"\u786E\u8BA4\u751F\u6210\u94FE\u63A5\uFF08\u4E0D\u4ED8\u6B3E\uFF09":"\u786E\u8BA4\u4ED8\u6B3E\u5E76\u542F\u52A8\u8865\u5355"})]})]})]})]})}var Xn=P(L(),1);var pA=P(_(),1),cA=ae((0,pA.jsx)("path",{d:"M19.88 18.47c.48-.77.75-1.67.69-2.66-.13-2.15-1.84-3.97-3.97-4.2-2.72-.3-5.02 1.81-5.02 4.47 0 2.49 2.01 4.5 4.49 4.5.88 0 1.7-.26 2.39-.7l2.41 2.41c.39.39 1.03.39 1.42 0s.39-1.03 0-1.42zm-3.8.11c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5m-.36-8.5c-.74.02-1.45.18-2.1.45l-.55-.83-3.08 5.01c-.36.58-1.17.64-1.61.13l-2.12-2.47-3.06 4.9c-.31.49-.97.62-1.44.28-.42-.31-.54-.89-.26-1.34l3.78-6.05c.36-.57 1.17-.63 1.61-.12L9 12.5l3.18-5.17c.38-.62 1.28-.64 1.68-.03zm2.59.5c-.64-.28-1.33-.45-2.05-.49L20.8 2.9c.31-.49.97-.61 1.43-.27.43.31.54.9.26 1.34z"}),"QueryStatsRounded");var se=P(_(),1),uA={position:"absolute",width:"1px",height:"1px",p:0,m:"-1px",overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};function ou({label:e,value:t,hint:o}){return(0,se.jsxs)(oe,{sx:{border:1,borderColor:"divider",borderRadius:2,p:2,minWidth:0},children:[(0,se.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",children:e}),(0,se.jsx)(D,{variant:"h3",component:"p",sx:{mt:.25},children:t}),o&&(0,se.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",children:o})]})}var Z$=[{key:"created",label:"\u751F\u6210"},{key:"redeemed",label:"\u5151\u6362"},{key:"succeeded",label:"\u6210\u529F"}];function J$({daily:e}){let t=qt(),o={created:t.vars.palette.primary.main,redeemed:t.vars.palette.secondary.main,succeeded:t.vars.palette.success.main},r=t.vars.palette.divider,n=e.reduce((f,u)=>({created:f.created+u.created,redeemed:f.redeemed+u.redeemed,succeeded:f.succeeded+u.succeeded}),{created:0,redeemed:0,succeeded:0}),a=720,s=40,i=a/e.length,l=e[0],p=e[Math.floor((e.length-1)/2)],c=e[e.length-1],d=f=>f.slice(5).replace("-","/");return(0,se.jsxs)(oe,{children:[(0,se.jsxs)(oe,{role:"img","aria-label":`\u6700\u8FD1 30 \u5929\u5171\u751F\u6210 ${n.created} \u679A\uFF0C\u5151\u6362 ${n.redeemed} \u679A\uFF0C\u6210\u529F ${n.succeeded} \u679A\u3002`,children:[(0,se.jsx)(ce,{spacing:1.5,children:Z$.map(f=>{let u=e.map(b=>b[f.key]),g=Math.max(1,...u);return(0,se.jsxs)(oe,{children:[(0,se.jsxs)(ce,{direction:"row",alignItems:"baseline",spacing:1,sx:{mb:.5},children:[(0,se.jsx)(D,{variant:"body2",fontWeight:600,children:f.label}),(0,se.jsxs)(D,{variant:"caption",color:"text.secondary",children:["\u5171 ",n[f.key]]})]}),(0,se.jsxs)(oe,{component:"svg","aria-hidden":!0,viewBox:`0 0 ${a} ${s}`,preserveAspectRatio:"none",sx:{display:"block",width:"100%",height:{xs:36,sm:44}},children:[(0,se.jsx)(oe,{component:"line",x1:0,x2:a,y1:s-.5,y2:s-.5,stroke:r,strokeWidth:1}),u.map((b,x)=>{if(b===0)return null;let m=Math.max(2,b/g*(s-4));return(0,se.jsx)(oe,{component:"rect",x:x*i+i*.22,y:s-m,width:i*.56,height:m,rx:2,fill:o[f.key]},e[x].date)})]})]},f.key)})}),(0,se.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:"1fr auto 1fr",mt:.75},children:[(0,se.jsx)(D,{variant:"caption",color:"text.secondary",children:d(l.date)}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",textAlign:"center",children:d(p.date)}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",textAlign:"right",children:d(c.date)})]})]}),(0,se.jsxs)(oe,{component:"table",sx:uA,children:[(0,se.jsx)("caption",{children:"\u6700\u8FD1 30 \u5929\u6BCF\u65E5\u751F\u6210\u3001\u5151\u6362\u548C\u6210\u529F\u7684\u5151\u6362\u7801\u6570\u91CF"}),(0,se.jsx)("thead",{children:(0,se.jsxs)("tr",{children:[(0,se.jsx)("th",{scope:"col",children:"\u65E5\u671F"}),(0,se.jsx)("th",{scope:"col",children:"\u751F\u6210"}),(0,se.jsx)("th",{scope:"col",children:"\u5151\u6362"}),(0,se.jsx)("th",{scope:"col",children:"\u6210\u529F"})]})}),(0,se.jsx)("tbody",{children:e.map(f=>(0,se.jsxs)("tr",{children:[(0,se.jsx)("th",{scope:"row",children:f.date}),(0,se.jsx)("td",{children:f.created}),(0,se.jsx)("td",{children:f.redeemed}),(0,se.jsx)("td",{children:f.succeeded})]},f.date))})]})]})}function fA({refreshSignal:e}){let[t,o]=(0,Xn.useState)(!0),[r,n]=(0,Xn.useState)(null),[a,s]=(0,Xn.useState)(!0),[i,l]=(0,Xn.useState)(""),p=(0,Xn.useRef)(0),c=qt(),d=Lv("(prefers-reduced-motion: reduce)"),f=(0,Xn.useCallback)(async()=>{let y=++p.current;s(!0),l("");try{let h=await RM();y===p.current&&n(h)}catch(h){y===p.current&&l(h.message)}finally{y===p.current&&s(!1)}},[]);(0,Xn.useEffect)(()=>{f()},[f,e]);let u=r&&r.codes.redeemed>0?`${Math.round(r.rates.redeemed*100)}%`:"\u2014",g=r&&r.codes.redeemed>0?`${Math.round(r.rates.success*100)}%`:"\u2014",b=Math.max(1,r?.codes.total??1),x=Math.max(1,...(r?.review_stages??[]).map(y=>y.count)),m=c.vars.palette.divider;return(0,se.jsxs)(tt,{variant:"outlined",sx:{mb:3,overflow:"hidden"},children:[(0,se.jsxs)(ue,{fullWidth:!0,"aria-expanded":t,"aria-controls":"stats-panel-content",onClick:()=>o(y=>!y),sx:{justifyContent:"flex-start",gap:1,px:{xs:2.5,sm:3},py:1.5,borderRadius:0,color:"text.primary"},children:[(0,se.jsx)(cA,{color:"primary"}),(0,se.jsx)(D,{variant:"h2",component:"span",sx:{flexGrow:1,textAlign:"left"},children:"\u7EDF\u8BA1\u6982\u89C8"}),r&&(0,se.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5171 ",r.codes.total," \u679A"]}),(0,se.jsx)(tT,{sx:y=>({transform:t?"rotate(180deg)":"none",transition:y.transitions.create("transform"),"@media (prefers-reduced-motion: reduce)":{transition:"none"}})})]}),(0,se.jsx)(Cp,{in:t,timeout:d?0:void 0,children:(0,se.jsxs)(oe,{id:"stats-panel-content",role:"region","aria-label":"\u7EDF\u8BA1\u6982\u89C8",sx:{px:{xs:2.5,sm:3},pb:3,pt:1},children:[(0,se.jsx)(D,{variant:"h2",sx:uA,children:"\u7EDF\u8BA1\u6982\u89C8"}),a&&(0,se.jsxs)(ce,{spacing:2,role:"status","aria-label":"\u6B63\u5728\u52A0\u8F7D\u7EDF\u8BA1\u6570\u636E",children:[(0,se.jsx)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)"},gap:1.5},children:Array.from({length:6},(y,h)=>(0,se.jsx)(Ya,{variant:"rounded",height:92},h))}),(0,se.jsx)(Ya,{variant:"rounded",height:160})]}),!a&&i&&(0,se.jsxs)(ze,{severity:"error",role:"alert",children:[i,r&&" \u4EE5\u4E0B\u4FDD\u7559\u4E0A\u6B21\u52A0\u8F7D\u7684\u6570\u636E\u3002",(0,se.jsx)(ue,{onClick:()=>{f()},children:"\u91CD\u65B0\u52A0\u8F7D"})]}),!a&&!i&&r&&r.codes.total===0&&(0,se.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u8FD8\u6CA1\u6709\u5151\u6362\u7801\u3002\u751F\u6210\u7B2C\u4E00\u6279\u540E\uFF0C\u8FD9\u91CC\u4F1A\u663E\u793A\u5151\u6362\u7EDF\u8BA1\u3002"}),r&&r.codes.total>0&&(0,se.jsxs)(ce,{spacing:3,children:[(0,se.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)"},gap:1.5},children:[(0,se.jsx)(ou,{label:"\u5151\u6362\u7801\u603B\u6570",value:String(r.codes.total)}),(0,se.jsx)(ou,{label:"\u5DF2\u5151\u6362",value:String(r.codes.redeemed),hint:`\u5151\u6362\u7387 ${u}`}),(0,se.jsx)(ou,{label:"\u5151\u6362\u6210\u529F",value:String(r.codes.succeeded),hint:`\u6210\u529F\u7387 ${g}`}),(0,se.jsx)(ou,{label:"\u5904\u7406\u4E2D",value:String(r.codes.processing)}),(0,se.jsx)(ou,{label:"\u5F85\u6838\u5B9E",value:String(r.codes.review)}),(0,se.jsx)(ou,{label:"\u5DF2\u505C\u7528",value:String(r.codes.revoked)})]}),r.daily.length>0&&(0,se.jsxs)(oe,{component:"section","aria-labelledby":"stats-daily-title",children:[(0,se.jsx)(D,{id:"stats-daily-title",variant:"h3",sx:{mb:1.5},children:"\u6700\u8FD1 30 \u5929\u6D3B\u52A8"}),(0,se.jsx)(J$,{daily:r.daily})]}),r.months.length>0&&(0,se.jsxs)(oe,{component:"section","aria-labelledby":"stats-months-title",children:[(0,se.jsx)(D,{id:"stats-months-title",variant:"h3",sx:{mb:1.5},children:"\u5957\u9910\u5206\u5E03"}),(0,se.jsxs)(ce,{component:"ul",direction:"row",useFlexGap:!0,flexWrap:"wrap",gap:2,sx:{listStyle:"none",m:0,p:0,mb:1.5},children:[(0,se.jsxs)(ce,{component:"li",direction:"row",alignItems:"center",spacing:.75,children:[(0,se.jsx)(oe,{"aria-hidden":!0,sx:{width:10,height:10,borderRadius:"50%",bgcolor:"success.main"}}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",children:"\u6210\u529F"})]}),(0,se.jsxs)(ce,{component:"li",direction:"row",alignItems:"center",spacing:.75,children:[(0,se.jsx)(oe,{"aria-hidden":!0,sx:{width:10,height:10,borderRadius:"50%",bgcolor:m}}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",children:"\u672A\u5B8C\u6210"})]})]}),(0,se.jsx)(ce,{spacing:1.5,children:r.months.map(y=>(0,se.jsxs)(oe,{children:[(0,se.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"baseline",spacing:1,sx:{mb:.75},children:[(0,se.jsxs)(D,{variant:"body2",fontWeight:600,children:[y.months," \u4E2A\u6708"]}),(0,se.jsxs)(D,{variant:"body2",color:"text.secondary",children:["\u5171 ",y.total," \xB7 \u6210\u529F ",y.succeeded,"\uFF08",Math.round(y.succeeded/y.total*100),"%\uFF09"]})]}),(0,se.jsxs)(oe,{"aria-hidden":!0,sx:{display:"flex",width:`${y.total/b*100}%`,height:22,borderRadius:1,overflow:"hidden"},children:[(0,se.jsx)(oe,{sx:{width:`${y.succeeded/y.total*100}%`,bgcolor:"success.main"}}),(0,se.jsx)(oe,{sx:{flex:1,bgcolor:m}})]})]},y.months))})]}),r.review_stages.length>0&&(0,se.jsxs)(oe,{component:"section","aria-labelledby":"stats-stages-title",children:[(0,se.jsx)(D,{id:"stats-stages-title",variant:"h3",sx:{mb:1.5},children:"\u5F85\u6838\u5B9E\u9636\u6BB5\u5206\u5E03"}),(0,se.jsx)(ce,{spacing:1.5,children:[...r.review_stages].sort((y,h)=>y.progress-h.progress).map(y=>(0,se.jsxs)(ce,{direction:"row",alignItems:"center",spacing:1.5,children:[(0,se.jsxs)(D,{variant:"body2",sx:{minWidth:72},children:["\u9636\u6BB5 ",y.progress,"%"]}),(0,se.jsx)(oe,{sx:{flex:1},children:(0,se.jsx)(oe,{"aria-hidden":!0,sx:{width:`${y.count/x*100}%`,height:22,borderRadius:1,bgcolor:"warning.main"}})}),(0,se.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{minWidth:40,textAlign:"right"},children:[y.count," \u679A"]})]},y.progress))}),(0,se.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1},children:"\u9636\u6BB5\u767E\u5206\u6BD4\u5BF9\u5E94\u5151\u6362\u6D41\u7A0B\u7684\u8FDB\u5EA6\u4F4D\u7F6E\u3002"})]})]})]})})]})}var Ke=P(L(),1);var dA=P(_(),1),G1=ae((0,dA.jsx)("path",{d:"M17 7h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c1.65 0 3 1.35 3 3s-1.35 3-3 3h-3c-.55 0-1 .45-1 1s.45 1 1 1h3c2.76 0 5-2.24 5-5s-2.24-5-5-5m-9 5c0 .55.45 1 1 1h6c.55 0 1-.45 1-1s-.45-1-1-1H9c-.55 0-1 .45-1 1m2 3H7c-1.65 0-3-1.35-3-3s1.35-3 3-3h3c.55 0 1-.45 1-1s-.45-1-1-1H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h3c.55 0 1-.45 1-1s-.45-1-1-1"}),"LinkRounded");var mA=P(_(),1),yA=ae((0,mA.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m3.88-11.71L10 14.17l-1.88-1.88a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l2.59 2.59c.39.39 1.02.39 1.41 0L17.3 9.7c.39-.39.39-1.02 0-1.41s-1.03-.39-1.42 0"}),"CheckCircleOutlineRounded");var oT=P(L(),1);var hA=P(_(),1),gA=ae((0,hA.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2M12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8m-.22-13h-.06c-.4 0-.72.32-.72.72v4.72c0 .35.18.68.49.86l4.15 2.49c.34.2.78.1.98-.24.21-.34.1-.79-.25-.99l-3.87-2.3V7.72c0-.4-.32-.72-.72-.72"}),"ScheduleRounded");var TA=P(_(),1),bA=ae((0,TA.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2M9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9zm9 14H6V10h12zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2"}),"LockOutlined");var Ue=P(_(),1);function vA({progress:e,username:t,months:o,price:r,onCancel:n,cancelling:a,reconnecting:s,onNotify:i,notifyReady:l}){let p=(0,oT.useRef)(null);(0,oT.useEffect)(()=>{p.current?.focus({preventScroll:!0})},[]);let c=e.status==="submitting",d=e.status==="processing",f=e.estimated_wait_seconds,u=typeof f=="number"&&Number.isFinite(f)&&f>0,g=u&&f>=3600?"\u5C0F\u65F6":u&&f>=60?"\u5206\u949F":"\u79D2",b=u?Math.ceil(f/(f>=3600?3600:f>=60?60:1)):null;return(0,Ue.jsx)(jp,{ref:p,tabIndex:-1,role:"region",variant:"outlined","aria-labelledby":"payment-queue-title",sx:{borderRadius:2,bgcolor:"background.paper",outlineOffset:4},children:(0,Ue.jsxs)(Bp,{sx:{p:{xs:2.5,sm:3},"&:last-child":{pb:{xs:2.5,sm:3}}},children:[(0,Ue.jsxs)(ce,{direction:"row",spacing:1.5,alignItems:"center",sx:{mb:3},children:[(0,Ue.jsx)(oe,{sx:{display:"grid",placeItems:"center",width:48,height:48,flexShrink:0,borderRadius:"50%",bgcolor:"action.selected",color:"primary.main"},children:(0,Ue.jsx)(gA,{"aria-hidden":"true"})}),(0,Ue.jsxs)(oe,{role:"status","aria-live":"polite","aria-atomic":"true",children:[(0,Ue.jsx)(D,{id:"payment-queue-title",variant:"h3",children:s?"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u6B63\u5728\u91CD\u8FDE":c?"\u6B63\u5728\u63D0\u4EA4\u8BF7\u6C42":d?"\u6B63\u5728\u4E3A\u4F60\u751F\u6210\u94FE\u63A5":"\u5DF2\u52A0\u5165\u961F\u5217"}),(0,Ue.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:.25},children:s?"\u6B63\u5728\u6062\u590D\u539F\u6392\u961F\uFF0C\u8BF7\u52FF\u91CD\u590D\u63D0\u4EA4":c?"\u8BF7\u7A0D\u5019\uFF0C\u6B63\u5728\u786E\u8BA4\u4F60\u7684\u8BF7\u6C42":d?"\u5B8C\u6210\u540E\u5C06\u5728\u8FD9\u91CC\u663E\u793A\u4ED8\u6B3E\u5165\u53E3":"\u4F60\u7684\u8BF7\u6C42\u5C06\u6309\u987A\u5E8F\u5904\u7406"})]})]}),(0,Ue.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:"minmax(0, 1.35fr) minmax(0, 1fr)",gap:2,mb:3},children:[(0,Ue.jsxs)(oe,{children:[(0,Ue.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u9884\u8BA1\u8FD8\u9700"}),(0,Ue.jsx)(ce,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:.5},children:b===null?(0,Ue.jsx)(D,{sx:{fontSize:28,lineHeight:1.5,fontWeight:600},children:"\u4F30\u7B97\u4E2D"}):(0,Ue.jsxs)(Ue.Fragment,{children:[(0,Ue.jsx)(D,{component:"span",sx:{fontSize:{xs:44,sm:52},lineHeight:1.15,fontWeight:600,letterSpacing:"-0.03em",fontVariantNumeric:"tabular-nums",color:"primary.main"},children:b}),(0,Ue.jsx)(D,{component:"span",color:"text.secondary",children:g})]})}),(0,Ue.jsx)(D,{variant:"caption",color:"text.secondary",sx:{display:"block",mt:1},children:"\u524D\u65B9\u8BA2\u5355\u5B8C\u6210\u540E\uFF0C\u7B49\u5F85\u65F6\u95F4\u4F1A\u7F29\u77ED"})]}),(0,Ue.jsxs)(oe,{sx:{borderLeft:1,borderColor:"divider",pl:{xs:2,sm:3}},children:[(0,Ue.jsx)(D,{variant:"body2",color:"text.secondary",children:d?"\u5F53\u524D\u8FDB\u5EA6":"\u524D\u65B9\u7B49\u5F85"}),d?(0,Ue.jsx)(D,{sx:{mt:1,fontSize:24,fontWeight:600},children:"\u5DF2\u8F6E\u5230\u4F60"}):(0,Ue.jsxs)(ce,{direction:"row",spacing:.75,alignItems:"baseline",sx:{mt:1},children:[(0,Ue.jsx)(D,{component:"span",sx:{fontSize:32,lineHeight:1.25,fontWeight:600,fontVariantNumeric:"tabular-nums"},children:e.ahead??"\u2014"}),(0,Ue.jsx)(D,{component:"span",color:"text.secondary",children:"\u4EBA"})]})]})]}),(0,Ue.jsx)(ks,{"aria-label":d?"\u6B63\u5728\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5":"\u6B63\u5728\u7B49\u5F85\u5904\u7406",sx:{height:4,borderRadius:2,mb:3}}),(0,Ue.jsx)(ph,{alternativeLabel:!0,activeStep:c?0:d?2:1,sx:{mx:-1,mb:3,"& .MuiStepLabel-label":{fontSize:12,mt:1},"& .MuiStepIcon-root":{fontSize:22}},children:["\u63D0\u4EA4\u8BF7\u6C42","\u6392\u961F\u7B49\u5F85","\u751F\u6210\u94FE\u63A5"].map(m=>(0,Ue.jsx)(ah,{children:(0,Ue.jsx)(ih,{children:m})},m))}),i&&(0,Ue.jsx)(ue,{variant:"outlined",fullWidth:!0,onClick:i,disabled:l,sx:{mb:2,minHeight:44},children:l?"\u5DF2\u5F00\u542F\u5C31\u7EEA\u901A\u77E5":"\u94FE\u63A5\u5C31\u7EEA\u65F6\u901A\u77E5\u6211"}),(0,Ue.jsxs)(ze,{severity:"warning",icon:!1,sx:{mb:3},children:[(0,Ue.jsx)(D,{variant:"body2",fontWeight:600,children:"\u8F6E\u5230\u4F60\u540E\uFF0C\u4ED8\u6B3E\u94FE\u63A5\u53EA\u4FDD\u7559 3 \u5206\u949F"}),(0,Ue.jsx)(D,{variant:"body2",sx:{mt:.5},children:"\u8BF7\u63D0\u524D\u51C6\u5907\u597D\u94F6\u884C\u5361\uFF0C\u8D85\u65F6\u672A\u4ED8\u6B3E\u94FE\u63A5\u4F1A\u4F5C\u5E9F\uFF0C\u9700\u8981\u91CD\u65B0\u6392\u961F\u3002\u7B49\u5F85\u65F6\u8BF7\u8BA9\u672C\u9875\u4FDD\u6301\u6253\u5F00\uFF1A\u624B\u673A\u5207\u5230\u5176\u4ED6\u5E94\u7528\u8D85\u8FC7\u7EA6 1.5 \u5206\u949F\u4F1A\u6682\u505C\u4F60\u7684\u6392\u961F\uFF0C\u8D85\u8FC7 5 \u5206\u949F\u4F1A\u88AB\u79FB\u51FA\u961F\u5217\u3002\u9875\u9762\u6807\u9898\u4F1A\u663E\u793A\u6392\u961F\u8FDB\u5EA6\u548C\u4ED8\u6B3E\u5012\u8BA1\u65F6\u3002"})]}),(0,Ue.jsx)(Vp,{sx:{mb:2}}),(0,Ue.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:.5,children:[(0,Ue.jsxs)(D,{variant:"body2",fontWeight:600,sx:{overflowWrap:"anywhere"},children:["@",t]}),(0,Ue.jsxs)(D,{variant:"body2",color:"text.secondary",children:[o," \u4E2A\u6708 Premium \xB7 ",r]})]}),(0,Ue.jsxs)(ce,{direction:"row",spacing:.75,alignItems:"flex-start",sx:{mt:2},children:[(0,Ue.jsx)(bA,{sx:{fontSize:16,color:"text.secondary",mt:"3px"},"aria-hidden":"true"}),(0,Ue.jsx)(D,{variant:"caption",color:"text.secondary",children:"\u5237\u65B0\u9875\u9762\u4E0D\u4F1A\u9000\u51FA\u6392\u961F\uFF1B\u5173\u95ED\u6216\u79BB\u5F00\u7F51\u7AD9\u540E\u4F1A\u81EA\u52A8\u9000\u51FA\u3002\u751F\u6210\u94FE\u63A5\u4E0D\u4F1A\u6263\u6B3E\u3002"})]}),n&&(0,Ue.jsx)(ue,{variant:"outlined",fullWidth:!0,onClick:n,disabled:a,sx:{mt:2,minHeight:44},children:a?"\u6B63\u5728\u9000\u51FA\u2026":"\u653E\u5F03\u6392\u961F"})]})})}var xA=P(_(),1),rT=ae((0,xA.jsx)("path",{d:"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1M14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41s1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V4c0-.55-.45-1-1-1h-5c-.55 0-1 .45-1 1"}),"OpenInNewRounded");function eH(e){return e===429||e===502||e===503||e===504}async function PA(e,t,o=()=>new Promise(a=>setTimeout(a,3e3)),r=Date.now,n={}){let a=r()+(n.maxWaitMs??Number.POSITIVE_INFINITY);for(;;){t.throwIfAborted();try{let s=await e();if(!eH(s.status)||r()>=a)return s}catch(s){if(t.throwIfAborted(),r()>=a)throw s}n.onRetry?.(),await o()}}function SA(e,t,o){if(!e||typeof e!="object")return!1;let r=e;if(r.username!==t||!Number.isSafeInteger(r.months)||r.months<1||r.months>24||!Number.isSafeInteger(r.amount)||r.amount<=0||typeof r.currency!="string"||!/^[A-Z]{3}$/.test(r.currency))return!1;if(r.status==="succeeded")return!0;if(r.status!=="created"&&r.status!=="requires_action"||r.months!==o.months||r.amount!==o.amount||r.currency!==o.currency||typeof r.checkout_url!="string")return!1;try{let n=new URL(r.checkout_url);return n.protocol==="https:"&&n.hostname==="checkout.stripe.com"&&!n.port&&!n.username&&!n.password&&/^\/(?:c\/)?pay\/cs_(?:live|test)_[A-Za-z0-9]+$/.test(n.pathname)}catch{return!1}}var Dd=P(L(),1);var Y1=P(_(),1),CA=ae([(0,Y1.jsx)("path",{d:"M19.5 3.5 18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2v14H3v3c0 1.66 1.34 3 3 3h12c1.66 0 3-1.34 3-3V2zM15 20H6c-.55 0-1-.45-1-1v-1h10zm4-1c0 .55-.45 1-1 1s-1-.45-1-1v-3H8V5h11z"},"0"),(0,Y1.jsx)("path",{d:"M9 7h6v2H9zm7 0h2v2h-2zm-7 3h6v2H9zm7 0h2v2h-2z"},"1")],"ReceiptLongOutlined");var Dl=P(_(),1);function tH(e){return new Date(e*1e3).toLocaleString("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function W1({username:e}){let[t,o]=(0,Dd.useState)(!1),[r,n]=(0,Dd.useState)(null);(0,Dd.useEffect)(()=>n(null),[e]);let a=/^[a-z0-9_]{1,15}$/.test(e);async function s(){o(!0);try{let{ok:i,data:l}=await Sa(`/api/manual-link/order?username=${encodeURIComponent(e)}`);if(!i){n({severity:"info",text:l.message||"\u6682\u65F6\u65E0\u6CD5\u67E5\u8BE2\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"});return}let p=`@${l.username} \xB7 ${l.months} \u4E2A\u6708 Premium\uFF08${tH(l.created)} \u751F\u6210\u94FE\u63A5\uFF09`;n({paid:{severity:"success",text:`${p}\uFF1A\u5DF2\u786E\u8BA4\u4ED8\u6B3E\u3002Premium \u76F4\u63A5\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\uFF0C\u6CA1\u6709\u5151\u6362\u7801\uFF0C\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u67E5\u770B\u3002`},open:{severity:"info",text:`${p}\uFF1A\u4ED8\u6B3E\u94FE\u63A5\u4ECD\u5728 3 \u5206\u949F\u6709\u6548\u671F\u5185\uFF0C\u8BF7\u56DE\u5230\u672C\u9875\u7684\u4ED8\u6B3E\u5165\u53E3\u5B8C\u6210\u4ED8\u6B3E\u3002`},ended:{severity:"warning",text:`${p}\uFF1A\u94FE\u63A5\u5DF2\u8FC7\u671F\uFF0C\u672C\u7AD9\u6682\u672A\u8BB0\u5F55\u5230\u4ED8\u6B3E\u786E\u8BA4\u3002\u8FD9\u4E0D\u4E00\u5B9A\u8868\u793A\u672A\u4ED8\u6B3E\u2014\u2014\u5982\u5DF2\u6263\u6B3E\uFF0C\u8BF7\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\uFF0C\u5207\u52FF\u91CD\u590D\u4ED8\u6B3E\uFF1B\u786E\u8BA4\u672A\u4ED8\u6B3E\u65F6\u53EF\u91CD\u65B0\u6392\u961F\u3002`},not_created:{severity:"info",text:`${p}\uFF1A\u672A\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5\uFF0C\u6CA1\u6709\u4EA7\u751F\u4ED8\u6B3E\u3002`}}[l.state]??{severity:"info",text:"\u6682\u65F6\u65E0\u6CD5\u786E\u8BA4\u8BA2\u5355\u72B6\u6001\u3002"})}catch{n({severity:"error",text:"\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002"})}finally{o(!1)}}return(0,Dl.jsxs)(oe,{sx:{mt:2},children:[(0,Dl.jsx)(ue,{size:"small",startIcon:(0,Dl.jsx)(CA,{}),disabled:!a||t,onClick:()=>{s()},sx:{ml:-1},children:t?"\u6B63\u5728\u67E5\u8BE2\u2026":a?`\u67E5\u8BE2 @${e} \u7684\u4ED8\u6B3E\u72B6\u6001`:"\u586B\u5199\u7528\u6237\u540D\u540E\u53EF\u67E5\u8BE2\u4ED8\u6B3E\u72B6\u6001"}),r?(0,Dl.jsx)(ze,{severity:r.severity,sx:{mt:1},role:"status",children:r.text}):(0,Dl.jsx)(oe,{component:"p",sx:{m:0,mt:.5,color:"text.secondary",fontSize:12},children:"\u53EA\u67E5\u8BE2\u672C\u6D4F\u89C8\u5668\u751F\u6210\u8FC7\u7684\u8BA2\u5355\uFF0C\u4E0D\u4F1A\u6392\u961F\u6216\u5EFA\u5355\u3002"})]})}var re=P(_(),1),K1="xgift-public-queue";function gi(e){try{e?sessionStorage.setItem(K1,JSON.stringify(e)):sessionStorage.removeItem(K1)}catch{}}function oH(){try{let e=JSON.parse(sessionStorage.getItem(K1)||"null");return!e||typeof e.ticket!="string"||!/^[a-z0-9_]{1,15}$/.test(e.username)||!Number.isInteger(e.months)||e.months<1||e.months>24?null:typeof e.expires_at=="number"&&e.expires_at*1e3<=Date.now()?(gi(null),null):e}catch{return null}}function X1(e){if(e<60)return"1 \u5206\u949F\u5185";let t=Math.ceil(e/60);if(t<60)return`\u7EA6 ${t} \u5206\u949F`;let o=t%60;return`\u7EA6 ${Math.floor(t/60)} \u5C0F\u65F6${o?` ${o} \u5206\u949F`:""}`}function nT(e){return`${e.currency} ${(e.amount/100).toFixed(2)}`}function EA({publicMode:e=!1,onShow:t}){let o=e?"/api/manual-link":"/api/admin/manual-link",[r,n]=(0,Ke.useState)([]),[a,s]=(0,Ke.useState)(6),[i,l]=(0,Ke.useState)(""),[p,c]=(0,Ke.useState)(!1),[d,f]=(0,Ke.useState)(""),[u,g]=(0,Ke.useState)(""),[b,x]=(0,Ke.useState)(null),[m,y]=(0,Ke.useState)(!1),[h,T]=(0,Ke.useState)(!1),[S,C]=(0,Ke.useState)(""),[E,R]=(0,Ke.useState)({status:"submitting"}),O=(0,Ke.useRef)(null),w=(0,Ke.useRef)(null),A=(0,Ke.useRef)(null),v=(0,Ke.useRef)(!1),N=(0,Ke.useRef)(null),[k,z]=(0,Ke.useState)(!1),[j,W]=(0,Ke.useState)(!1),[Z,X]=(0,Ke.useState)(!1),de=typeof Notification<"u"&&Notification.permission!=="denied",[me,fe]=(0,Ke.useState)(()=>typeof Notification<"u"&&Notification.permission==="granted"),ie=(0,Ke.useRef)(null),we=(0,Ke.useRef)(document.title),Te=(0,Ke.useRef)(null),le=(0,Ke.useRef)(!0),[,Pe]=(0,Ke.useState)(0),[ye,Oe]=(0,Ke.useState)(null),he=e&&!p&&!b;(0,Ke.useEffect)(()=>{if(!he)return;let ne=()=>{document.visibilityState==="visible"&&Sa(o+"/queue").then(({ok:Me,data:je})=>Oe(Me&&Number.isInteger(je.waiting)?je:null)).catch(()=>Oe(null))};ne();let te=setInterval(ne,3e4);return()=>clearInterval(te)},[he]),(0,Ke.useEffect)(()=>{if(!b?.expires_at||!b.checkout_url)return;let ne=setInterval(()=>Pe(te=>te+1),1e3);return()=>clearInterval(ne)},[b]);let ge=b?.expires_at?Math.max(0,Math.floor(b.expires_at-Date.now()/1e3)):null,be=ge===0;(0,Ke.useEffect)(()=>{e&&be&&gi(null)},[e,be]),(0,Ke.useEffect)(()=>{if(!e)return;let ne=we.current;b?.checkout_url&&ge!==null?ne=ge>0?`${Math.floor(ge/60)}:${String(ge%60).padStart(2,"0")} \u5185\u8BF7\u4ED8\u6B3E \xB7 XGift`:"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u8FC7\u671F \xB7 XGift":b?.status==="succeeded"?ne="\u8BA2\u5355\u5DF2\u4ED8\u6B3E \xB7 XGift":p&&E.status==="processing"?ne="\u5373\u5C06\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5 \xB7 XGift":p&&E.status==="queued"&&(ne=`\u6392\u961F\u4E2D \xB7 \u524D\u65B9 ${E.ahead??"\u2014"} \u4EBA \xB7 XGift`),document.title=ne}),(0,Ke.useEffect)(()=>()=>{document.title=we.current},[]);let H=i.trim().replace(/^@/,"").toLowerCase(),U=/^[a-z0-9_]{1,15}$/.test(H);async function Se(ne=!1){g("");try{let te=await vo(o+"/plans");if(n(te.plans),s(te.plans.some(Me=>Me.months===6)?6:te.plans[0]?.months??0),te.plans.length||g("\u6682\u65E0\u53EF\u7528\u5957\u9910\u3002"),ne&&e&&te.plans.length&&le.current&&!v.current){let Me=oH();if(!Me){let je=await Sa(o+"/queue/current");je.ok&&je.data?.ticket&&(Me=je.data)}if(Me&&le.current&&!v.current){let je=te.plans.find(Mt=>Mt.months===Me.months);je&&(t?.(),l(Me.username),s(Me.months),He(Me,je))}}}catch(te){g(te.message)}}(0,Ke.useEffect)(()=>(le.current=!0,Se(!0),()=>{le.current=!1}),[]),(0,Ke.useEffect)(()=>{let ne=()=>{let Me=N.current;if(Me){let je=`/api/manual-link/queue/${encodeURIComponent(Me)}/leave`;navigator.sendBeacon(je,"")||fetch(je,{method:"POST",keepalive:!0,credentials:"same-origin"}).catch(()=>{}),A.current?.abort()}},te=Me=>{Me.persisted&&(v.current=!1,Se(!0))};return window.addEventListener("pagehide",ne),window.addEventListener("pageshow",te),()=>{A.current?.abort(),window.removeEventListener("pagehide",ne),window.removeEventListener("pageshow",te)}},[]);async function De(){let ne=N.current;if(!(!ne||k)){z(!0);try{let te=await Sa(`${o}/queue/${encodeURIComponent(ne)}/cancel`,{});if(!te.ok){f(te.data.message||"\u6682\u65F6\u65E0\u6CD5\u9000\u51FA\u6392\u961F\uFF0C\u8BF7\u91CD\u8BD5\u3002");return}te.data.cancelled&&(N.current=null,gi(null),A.current?.abort(),C("\u5DF2\u9000\u51FA\u6392\u961F\u3002"),f(""))}catch{f("\u6682\u65F6\u65E0\u6CD5\u9000\u51FA\u6392\u961F\uFF0C\u8BF7\u91CD\u8BD5\u3002")}finally{z(!1)}}}(0,Ke.useEffect)(()=>{b&&e&&O.current?.focus({preventScroll:!0})},[b,e]),(0,Ke.useEffect)(()=>{p||!d||(w.current?.focus({preventScroll:!0}),e&&ie.current?.scrollIntoView({block:"nearest"}))},[p,d]);function Ce(){e&&gi(null),x(null),f(""),C(""),y(!1),T(!1)}async function _e(){if(!("Notification"in window)){C("\u6B64\u6D4F\u89C8\u5668\u4E0D\u652F\u6301\u7CFB\u7EDF\u901A\u77E5\uFF0C\u8BF7\u4FDD\u6301\u9875\u9762\u6253\u5F00\uFF0C\u94FE\u63A5\u751F\u6210\u540E\u9875\u9762\u6807\u9898\u4E5F\u4F1A\u63D0\u9192\u3002");return}try{let ne=await Notification.requestPermission();ne==="granted"&&"serviceWorker"in navigator&&await navigator.serviceWorker.register("/payment-notifications.js"),fe(ne==="granted"),C(ne==="granted"?"\u5DF2\u5F00\u542F\u94FE\u63A5\u5C31\u7EEA\u901A\u77E5\uFF0C\u8BF7\u4FDD\u6301\u7F51\u9875\u6253\u5F00\u3002":"\u672A\u5F00\u542F\u7CFB\u7EDF\u901A\u77E5\uFF0C\u8BF7\u7559\u610F\u6B64\u9875\u9762\u7684\u6392\u961F\u8FDB\u5EA6\u3002")}catch{C("\u6682\u65F6\u65E0\u6CD5\u5F00\u542F\u7CFB\u7EDF\u901A\u77E5\uFF0C\u8BF7\u7559\u610F\u6B64\u9875\u9762\u3002")}}async function He(ne,te){let Me=te??r.find(Fe=>Fe.months===a),je=ne?.username??H;if(v.current||!/^[a-z0-9_]{1,15}$/.test(je)||!Me)return;v.current=!0,c(!0),f(""),C(""),x(null),R({status:"submitting"});let Mt=new AbortController;A.current=Mt,ne?N.current=ne.ticket:gi(null);try{let Fe=Re=>PA(()=>Sa(Re,void 0,AbortSignal.any([Mt.signal,AbortSignal.timeout(2e4)])),Mt.signal,void 0,void 0,{onRetry:()=>X(!0)}),{ok:Ne,data:Ae,status:rt}=ne?await Fe(`${o}/queue/${encodeURIComponent(ne.ticket)}`):await Sa(o,{username:je,months:Me.months,verified_unpaid:m&&h,queue_protocol:e?1:void 0},AbortSignal.any([Mt.signal,AbortSignal.timeout(12e4)]));for(ne&&(N.current=ne.ticket);Ne&&typeof Ae?.ticket=="string"&&Ae.ticket&&(Ae.status==="queued"||Ae.status==="processing");){N.current=Ae.ticket,gi({ticket:Ae.ticket,username:je,months:Me.months}),X(!1),R({status:Ae.status,ahead:Ae.ahead??Math.max(0,(Ae.position??1)-1),estimated_wait_seconds:Ae.estimated_wait_seconds}),await new Promise(Ft=>setTimeout(Ft,3e3)),Mt.signal.throwIfAborted();let Re=`${o}/queue/${encodeURIComponent(Ae.ticket)}`;({ok:Ne,data:Ae,status:rt}=await Fe(Re))}let Ot=N.current;if(N.current=null,X(!1),Ne||gi(null),!Ne&&rt===410)return;if(!Ne){y(!!Ae?.needs_unpaid_verification),f(Ae?.message||"\u751F\u6210\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002");return}if(!SA(Ae,je,Me)){f("\u5C1A\u672A\u53D6\u5F97\u5B8C\u6574\u7684\u4ED8\u6B3E\u8BA2\u5355\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u540E\u91CD\u8BD5\u3002\u7CFB\u7EDF\u4F1A\u5148\u68C0\u67E5\u5DF2\u6709\u94FE\u63A5\u3002");return}y(!1),T(!1),x(Ae),t?.(),e&&gi(Ot&&Ae.checkout_url&&Ae.expires_at?{ticket:Ot,username:je,months:Me.months,expires_at:Ae.expires_at}:null),e&&Ot&&Te.current!==Ot&&(Te.current=Ot,navigator.vibrate?.([200,100,200]),"Notification"in window&&Notification.permission==="granted"&&(async()=>{try{let Re=Ae.status==="succeeded"?"\u8BA2\u5355\u5DF2\u4ED8\u6B3E":"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u5C31\u7EEA",Ft={body:"\u8BF7\u8FD4\u56DE\u7F51\u9875\u67E5\u770B\u8BA2\u5355\u53CA\u4ED8\u6B3E\u72B6\u6001\u3002",tag:"xgift-payment-ready"};if("serviceWorker"in navigator)await navigator.serviceWorker.register("/payment-notifications.js"),await(await navigator.serviceWorker.ready).showNotification(Re,Ft);else{let Nt=new Notification(Re,Ft);Nt.onclick=()=>{window.focus(),Nt.close()}}}catch{C("\u7CFB\u7EDF\u901A\u77E5\u672A\u80FD\u663E\u793A\uFF0C\u8BF7\u7559\u610F\u6B64\u9875\u9762\u7684\u8BA2\u5355\u72B6\u6001\u3002")}})())}catch(Fe){Mt.signal.aborted||f(Fe.name==="TimeoutError"?"\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u4F7F\u7528\u540C\u4E00\u7528\u6237\u540D\u548C\u5957\u9910\u91CD\u8BD5\uFF0C\u7CFB\u7EDF\u4F1A\u68C0\u67E5\u5DF2\u6709\u8BA2\u5355\u3002":"\u8FDE\u63A5\u6682\u65F6\u4E2D\u65AD\uFF0C\u8BF7\u5237\u65B0\u9875\u9762\u6062\u590D\u539F\u6392\u961F\uFF1B\u65E0\u9700\u91CD\u65B0\u751F\u6210\u8BA2\u5355\u3002")}finally{A.current===Mt&&(v.current=!1,c(!1),R({status:"submitting"}),A.current=null,N.current=null)}}async function ot(){if(b?.checkout_url)try{await navigator.clipboard.writeText(b.checkout_url),C("\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u590D\u5236\u3002")}catch{C("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u9009\u4E2D\u4E0B\u65B9\u94FE\u63A5\u624B\u52A8\u590D\u5236\u3002")}}return(0,re.jsxs)(tt,{variant:"outlined",component:"section","aria-labelledby":"manual-payment-title",sx:{p:e?0:{xs:2,sm:3},mb:e?0:3,...e?{border:0,bgcolor:"transparent"}:{}},children:[(0,re.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:1},children:[(0,re.jsx)(G1,{color:"primary","aria-hidden":"true"}),(0,re.jsx)(D,{id:"manual-payment-title",variant:"h2",sx:{fontSize:21},children:"\u624B\u52A8\u4ED8\u6B3E\u94FE\u63A5"})]}),!(e&&(p||b))&&(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:e?"\u4E3A\u6307\u5B9A\u7684 X \u8D26\u53F7\u751F\u6210 Stripe \u4ED8\u6B3E\u94FE\u63A5\uFF0C\u4ED8\u6B3E\u6210\u529F\u540E Premium \u76F4\u63A5\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\u3002":"\u586B\u5199 X \u7528\u6237\u540D\u548C\u5957\u9910\u65F6\u957F\uFF0C\u751F\u6210 Stripe \u94FE\u63A5\u540E\u624B\u52A8\u4ED8\u6B3E\uFF0C\u65E0\u9700\u5151\u6362\u7801\u3002"}),e&&!(p||b)&&(0,re.jsx)(oe,{component:"ol",sx:{m:0,mb:3,p:0,listStyle:"none",display:"grid",gap:1},children:["\u586B\u5199 X \u7528\u6237\u540D\u3001\u9009\u62E9\u5957\u9910\u540E\u63D0\u4EA4\uFF0C\u6309\u987A\u5E8F\u6392\u961F\uFF1B\u9AD8\u5CF0\u671F\u53EF\u80FD\u9700\u8981\u7B49\u5F85\u8F83\u4E45\uFF0C\u8BF7\u4FDD\u6301\u672C\u9875\u6253\u5F00","\u8F6E\u5230\u4F60\u65F6\u751F\u6210 Stripe \u4ED8\u6B3E\u94FE\u63A5\uFF0C\u94FE\u63A5\u53EA\u4FDD\u7559 3 \u5206\u949F\uFF0C\u8BF7\u63D0\u524D\u51C6\u5907\u597D\u94F6\u884C\u5361\uFF0C\u770B\u5230\u94FE\u63A5\u7ACB\u5373\u4ED8\u6B3E","\u4ED8\u6B3E\u6210\u529F\u540E Premium \u76F4\u63A5\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\uFF0C\u6CA1\u6709\u5151\u6362\u7801\uFF1B\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26"].map((ne,te)=>(0,re.jsxs)(oe,{component:"li",sx:{display:"flex",gap:1.25,alignItems:"flex-start"},children:[(0,re.jsx)(oe,{"aria-hidden":"true",sx:{flexShrink:0,width:22,height:22,mt:"1px",borderRadius:"50%",bgcolor:"action.selected",color:"text.secondary",display:"grid",placeItems:"center",fontSize:13,fontWeight:600},children:te+1}),(0,re.jsx)(D,{variant:"body2",color:"text.secondary",children:ne})]},ne))}),he&&ye&&(0,re.jsxs)(ze,{severity:ye.waiting>=10?"warning":"info",icon:!1,sx:{mb:2},role:"status",children:[ye.waiting>0?(0,re.jsxs)(re.Fragment,{children:["\u5F53\u524D\u6392\u961F ",(0,re.jsx)("strong",{children:ye.waiting})," \u4EBA\uFF0C\u73B0\u5728\u63D0\u4EA4\u9884\u8BA1",X1(ye.estimated_wait_seconds),"\u540E\u8F6E\u5230\u4F60\u3002"]}):(0,re.jsxs)(re.Fragment,{children:["\u5F53\u524D\u65E0\u4EBA\u6392\u961F\uFF0C\u63D0\u4EA4\u540E\u9884\u8BA1",X1(ye.estimated_wait_seconds),"\u751F\u6210\u94FE\u63A5\u3002"]}),ye.waiting>=10&&" \u7B49\u5F85\u671F\u95F4\u9700\u4FDD\u6301\u672C\u9875\u6253\u5F00\uFF0C\u8BF7\u786E\u8BA4\u6709\u7A7A\u518D\u63D0\u4EA4\u3002"]}),(0,re.jsxs)(lr,{open:j,onClose:()=>W(!1),"aria-labelledby":"confirm-payment-title","aria-describedby":"confirm-payment-description",fullWidth:!0,maxWidth:"xs",children:[(0,re.jsx)(ur,{id:"confirm-payment-title",children:"\u786E\u8BA4\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5\uFF1F"}),(0,re.jsxs)(cr,{children:[(0,re.jsx)(Ns,{id:"confirm-payment-description",color:"text.primary",children:"\u5982\u679C\u4E0D\u60F3\u8981\u4ED8\u6B3E\uFF0C\u8BF7\u4E0D\u8981\u70B9\u51FB\u751F\u6210\u94FE\u63A5\u3002"}),(0,re.jsxs)(Ns,{sx:{mt:2},children:["\u63D0\u4EA4\u540E\u9700\u8981\u6392\u961F",ye?.waiting?`\uFF08\u5F53\u524D ${ye.waiting} \u4EBA\uFF0C\u9884\u8BA1${X1(ye.estimated_wait_seconds)}\uFF09`:"","\u3002\u8F6E\u5230\u4F60\u65F6\u4ED8\u6B3E\u94FE\u63A5\u53EA\u4FDD\u7559 3 \u5206\u949F\uFF0C\u8D85\u65F6\u4F5C\u5E9F\u5E76\u9700\u91CD\u65B0\u6392\u961F\uFF0C\u8BF7\u63D0\u524D\u51C6\u5907\u597D\u94F6\u884C\u5361\u3002\u4ED8\u6B3E\u6210\u529F\u540E Premium \u4F1A\u76F4\u63A5\u8D60\u9001\u5230 @",H||"\u586B\u5199\u7684\u8D26\u53F7","\uFF0C\u4E0D\u4F1A\u751F\u6210\u5151\u6362\u7801\u3002\u5237\u65B0\u9875\u9762\u4F1A\u4FDD\u7559\u6392\u961F\uFF1B\u5173\u95ED\u6216\u79BB\u5F00\u7F51\u7AD9\u540E\u4F1A\u81EA\u52A8\u9000\u51FA\u6392\u961F\u3002"]})]}),(0,re.jsxs)(pr,{sx:{px:3,pb:2.5,gap:1},children:[(0,re.jsx)(ue,{onClick:()=>W(!1),children:"\u6682\u4E0D\u751F\u6210"}),(0,re.jsx)(ue,{variant:"contained",onClick:()=>{W(!1),He()},children:"\u786E\u8BA4\u751F\u6210"})]})]}),u&&(0,re.jsx)(ze,{severity:"error",sx:{mb:2},action:(0,re.jsx)(ue,{color:"inherit",onClick:()=>{Se(!0)},children:"\u91CD\u65B0\u52A0\u8F7D"}),children:u}),!(e&&(p||b))&&(0,re.jsxs)(oe,{component:"form",onSubmit:ne=>{ne.preventDefault(),e?W(!0):He()},"aria-busy":p,children:[(0,re.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"minmax(0, 1fr)",sm:"minmax(0, 1fr) minmax(0, 1fr)",md:e?"minmax(0, 1fr) minmax(0, 1fr)":"minmax(260px, 1fr) minmax(235px, 320px) auto"},gap:2,alignItems:"start"},children:[(0,re.jsx)(Ht,{inputRef:w,label:"X \u7528\u6237\u540D",placeholder:"\u4F8B\u5982 username \u6216 @username",value:i,disabled:p,required:!0,onChange:ne=>{l(ne.target.value),Ce()},error:i.trim().length>0&&!U,helperText:i.trim()&&!U?"\u7528\u6237\u540D\u987B\u4E3A 1\u201315 \u4F4D\u5B57\u6BCD\u3001\u6570\u5B57\u6216\u4E0B\u5212\u7EBF":"\u586B\u5199\u7528\u6237\u540D\uFF0C\u4E0D\u662F\u663E\u793A\u540D\u79F0",autoComplete:"off",sx:{minWidth:0},slotProps:{htmlInput:{maxLength:32,autoCapitalize:"none",spellCheck:!1}}}),(0,re.jsx)(Ht,{select:!0,label:"\u5957\u9910\u65F6\u957F",value:r.length?a:"",disabled:p||!r.length,onChange:ne=>{s(Number(ne.target.value)),Ce()},sx:{minWidth:0},children:r.map(ne=>(0,re.jsxs)(In,{value:ne.months,children:[ne.months," \u4E2A\u6708 \xB7 ",nT(ne)]},ne.months))}),(0,re.jsx)(ue,{type:"submit",variant:"contained",startIcon:(0,re.jsx)(G1,{}),disabled:p||!U||!r.length||m&&!h,sx:{minHeight:56,px:3,whiteSpace:"nowrap",gridColumn:{sm:"1 / -1",md:e?"1 / -1":"auto"},justifySelf:{xs:"stretch",sm:"end",md:e?"end":"stretch"}},children:p?"\u6B63\u5728\u751F\u6210\u2026":"\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5"})]}),e&&(0,re.jsx)(W1,{username:H}),m&&(0,re.jsx)(Ms,{control:(0,re.jsx)(Bn,{checked:h,disabled:p,onChange:ne=>T(ne.target.checked)}),label:"\u6211\u5DF2\u6838\u5B9E\u539F\u8BA2\u5355\u672A\u4ED8\u6B3E\uFF0C\u4E5F\u6CA1\u6709\u6B63\u5728\u5904\u7406\u7684\u6263\u6B3E\u6216\u94F6\u884C\u9A8C\u8BC1\uFF0C\u5141\u8BB8\u751F\u6210\u65B0\u94FE\u63A5"})]}),e&&p&&(0,re.jsx)(vA,{reconnecting:Z,onNotify:de?()=>{_e()}:void 0,notifyReady:me,onCancel:E.status==="submitting"?void 0:()=>{De()},cancelling:k,progress:E,username:H,months:a,price:r.find(ne=>ne.months===a)?nT(r.find(ne=>ne.months===a)):""}),!e&&p&&(0,re.jsx)(ks,{"aria-label":"\u6B63\u5728\u6838\u5BF9\u8D26\u53F7\u5E76\u751F\u6210\u4ED8\u6B3E\u94FE\u63A5",sx:{mt:1}}),d&&(0,re.jsx)(ze,{ref:ie,severity:"error",sx:{mt:2,scrollMarginTop:24},children:d}),e&&b&&(0,re.jsx)(jp,{variant:"outlined",sx:{borderRadius:2,bgcolor:"background.paper"},children:(0,re.jsxs)(Bp,{sx:{p:{xs:2.5,sm:3},"&:last-child":{pb:{xs:2.5,sm:3}}},children:[(0,re.jsxs)(ce,{direction:"row",spacing:1.5,alignItems:"center",sx:{mb:3},children:[(0,re.jsx)(oe,{sx:{display:"grid",placeItems:"center",width:48,height:48,flexShrink:0,borderRadius:"50%",bgcolor:"action.selected",color:"success.main"},children:(0,re.jsx)(yA,{"aria-hidden":"true"})}),(0,re.jsxs)(oe,{children:[(0,re.jsx)(D,{ref:O,tabIndex:-1,variant:"h3",children:b.status==="succeeded"?"\u8BA2\u5355\u5DF2\u4ED8\u6B3E":"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u5C31\u7EEA"}),(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:.5},children:b.status==="succeeded"?"\u65E0\u9700\u518D\u6B21\u4ED8\u6B3E":"\u751F\u6210\u94FE\u63A5\u4E0D\u4EE3\u8868\u4ED8\u6B3E\u6210\u529F\uFF0C\u8BF7\u524D\u5F80 Stripe \u4ED8\u6B3E"})]})]}),(0,re.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",spacing:.5,sx:{mb:2},children:[(0,re.jsxs)(D,{fontWeight:600,children:["@",b.username]}),(0,re.jsxs)(D,{color:"text.secondary",children:[b.months," \u4E2A\u6708 Premium \xB7 ",nT(b)]})]}),(0,re.jsx)(Vp,{sx:{mb:3}}),b.checkout_url&&be&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(ze,{severity:"warning",children:"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u8D85\u8FC7 3 \u5206\u949F\u6709\u6548\u671F\u5E76\u4F5C\u5E9F\u3002\u5982\u679C\u5C1A\u672A\u4ED8\u6B3E\uFF0C\u8BF7\u91CD\u65B0\u6392\u961F\u83B7\u53D6\u65B0\u94FE\u63A5\uFF1B\u5982\u679C\u5DF2\u7ECF\u4ED8\u6B3E\uFF0C\u8BF7\u52FF\u91CD\u590D\u652F\u4ED8\uFF0C\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\u3002"}),(0,re.jsx)(ue,{variant:"contained",onClick:()=>{Ce(),He()},sx:{mt:2,minHeight:48},children:"\u91CD\u65B0\u6392\u961F\u83B7\u53D6\u94FE\u63A5"})]}),b.checkout_url&&!be&&(0,re.jsxs)(re.Fragment,{children:[ge!==null&&(0,re.jsxs)(ze,{severity:ge<=60?"warning":"info",sx:{mb:2},role:"timer",children:["\u94FE\u63A5\u5269\u4F59 ",(0,re.jsxs)(oe,{component:"strong",sx:{fontVariantNumeric:"tabular-nums"},children:[Math.floor(ge/60),":",String(ge%60).padStart(2,"0")]}),"\uFF0C\u8BF7\u7ACB\u5373\u524D\u5F80 Stripe \u4ED8\u6B3E\uFF0C\u8D85\u65F6\u540E\u9700\u91CD\u65B0\u6392\u961F\u3002"]}),(0,re.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[(0,re.jsx)(ue,{component:"a",href:b.checkout_url,target:"_blank",rel:"noopener noreferrer",variant:"contained",endIcon:(0,re.jsx)(rT,{}),sx:{minHeight:48},children:"\u524D\u5F80 Stripe \u4ED8\u6B3E"}),(0,re.jsx)(ue,{variant:"outlined",onClick:()=>{ot()},startIcon:(0,re.jsx)(wf,{}),children:"\u590D\u5236\u94FE\u63A5"})]}),(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:2},children:"\u82E5 Stripe \u63D0\u793A\u4ED8\u6B3E\u88AB\u62D2\u7EDD\uFF0C\u5219\u5C1A\u672A\u652F\u4ED8\u6210\u529F\u3002\u5DF2\u6263\u6B3E\u6216\u6B63\u5728\u94F6\u884C\u9A8C\u8BC1\u65F6\uFF0C\u8BF7\u52FF\u91CD\u590D\u652F\u4ED8\u3002"}),(0,re.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{mt:1},children:["\u4ED8\u6B3E\u6210\u529F\u540E Premium \u4F1A\u76F4\u63A5\u8D60\u9001\u5230 @",b.username,"\uFF0C\u6CA1\u6709\u5151\u6362\u7801\uFF0C\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\u3002"]}),(0,re.jsxs)(oe,{component:"details",sx:{mt:1},children:[(0,re.jsx)(oe,{component:"summary",sx:{cursor:"pointer",color:"text.secondary",fontSize:13,py:1.5,minHeight:44},children:"\u67E5\u770B\u5B8C\u6574\u94FE\u63A5"}),(0,re.jsx)(Ht,{label:"Stripe \u4ED8\u6B3E\u94FE\u63A5",value:b.checkout_url,slotProps:{input:{readOnly:!0}},onFocus:ne=>ne.target.select()})]}),(0,re.jsx)(W1,{username:b.username})]}),b.status==="succeeded"&&(0,re.jsxs)(oe,{sx:{mb:2},children:[(0,re.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:2},children:"\u4ED8\u6B3E\u5DF2\u6838\u5B9E\uFF0CPremium \u4F1A\u8D60\u9001\u5230\u8BE5\u8D26\u53F7\uFF0C\u6CA1\u6709\u5151\u6362\u7801\u3002\u53EF\u767B\u5F55\u8BE5\u8D26\u53F7\u5728 X \u7684 Premium \u9875\u9762\u786E\u8BA4\u5230\u8D26\u3002"}),(0,re.jsx)(ue,{component:"a",href:"https://x.com/i/premium",target:"_blank",rel:"noopener noreferrer",variant:"contained",endIcon:(0,re.jsx)(rT,{}),sx:{minHeight:48},children:"\u6253\u5F00 X \u67E5\u770B Premium"})]}),(0,re.jsxs)(ce,{direction:"row",spacing:1,sx:{mt:2,ml:-2},children:[b.checkout_url&&(0,re.jsx)(ue,{onClick:()=>{Ce(),requestAnimationFrame(()=>w.current?.focus())},children:"\u66F4\u6362\u5957\u9910"}),(0,re.jsx)(ue,{onClick:()=>{Ce(),l(""),requestAnimationFrame(()=>w.current?.focus())},children:"\u4E3A\u5176\u4ED6\u8D26\u53F7\u751F\u6210\u94FE\u63A5"})]})]})}),!e&&b&&(0,re.jsxs)(oe,{sx:{mt:2},"aria-live":"polite",children:[(0,re.jsx)(ze,{severity:b.status==="requires_action"?"info":"success",sx:{mb:2},children:b.status==="succeeded"?b.message:b.status==="requires_action"?"\u5DF2\u6709\u4ED8\u6B3E\u7B49\u5F85\u9A8C\u8BC1\uFF0C\u8BF7\u6253\u5F00\u539F\u4ED8\u6B3E\u9875\u9762\u5B8C\u6210\u9A8C\u8BC1\u3002":e?"\u65B0\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u751F\u6210\uFF0C\u5DF2\u6838\u5BF9\u8D26\u53F7\u3001\u5957\u9910\u3001\u91D1\u989D\u53CA\u53EF\u652F\u4ED8\u72B6\u6001\u3002\u8BF7\u5C3D\u5FEB\u6253\u5F00\u4ED8\u6B3E\u3002":"\u4ED8\u6B3E\u94FE\u63A5\u5DF2\u5C31\u7EEA\uFF0C\u5C1A\u672A\u81EA\u52A8\u6263\u6B3E\u3002"}),(0,re.jsxs)(D,{sx:{mb:1,fontWeight:600},children:["@",b.username," \xB7 ",b.months," \u4E2A\u6708 \xB7 ",nT(b)]}),b.checkout_url&&(0,re.jsxs)(re.Fragment,{children:[(0,re.jsx)(Ht,{fullWidth:!0,label:"Stripe \u4ED8\u6B3E\u94FE\u63A5",value:b.checkout_url,slotProps:{input:{readOnly:!0}},onFocus:ne=>ne.target.select()}),(0,re.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1,sx:{mt:2},children:[(0,re.jsx)(ue,{component:"a",href:b.checkout_url,target:"_blank",rel:"noopener noreferrer",variant:"contained",startIcon:(0,re.jsx)(rT,{}),children:"\u6253\u5F00\u4ED8\u6B3E\u9875\u9762"}),(0,re.jsx)(ue,{variant:"outlined",onClick:()=>{ot()},startIcon:(0,re.jsx)(wf,{}),children:"\u590D\u5236\u94FE\u63A5"})]})]})]}),S&&(0,re.jsx)(ze,{severity:"info",sx:{mt:2},onClose:()=>C(""),children:S})]})}var $=P(_(),1);function rH(){let[e,t]=(0,Ie.useState)(null),[o,r]=(0,Ie.useState)(null),[n,a]=(0,Ie.useState)(null),[s,i]=(0,Ie.useState)(!0),[l,p]=(0,Ie.useState)(""),[c,d]=(0,Ie.useState)(!1),[f,u]=(0,Ie.useState)(6),[g,b]=(0,Ie.useState)("10"),[x,m]=(0,Ie.useState)(""),[y,h]=(0,Ie.useState)(""),[T,S]=(0,Ie.useState)(0),C=(0,Ie.useRef)(!1),[E,R]=(0,Ie.useState)([]),[O,w]=(0,Ie.useState)(!1),[A,v]=(0,Ie.useState)(""),N=(0,Ie.useRef)(""),[k,z]=(0,Ie.useState)(""),[j,W]=(0,Ie.useState)(""),[Z,X]=(0,Ie.useState)(null),[de,me]=(0,Ie.useState)(null),[fe,ie]=(0,Ie.useState)(0),[we,Te]=(0,Ie.useState)(0),[le,Pe]=(0,Ie.useState)({seq:0,text:""}),[ye,Oe]=(0,Ie.useState)(null),[he,ge]=(0,Ie.useState)(null),[be,H]=(0,Ie.useState)(null),[U,Se]=(0,Ie.useState)(!1),[De,Ce]=(0,Ie.useState)(!1),[_e,He]=(0,Ie.useState)(null),[ot,ne]=(0,Ie.useState)(0),te=(0,Ie.useRef)(0),Me=(0,Ie.useRef)(!1),je=(0,Ie.useRef)(null),Mt=(0,Ie.useRef)(null),Fe=(0,Ie.useRef)(null),Ne=(0,Ie.useCallback)(async(Q,Ge=N.current)=>{let Lt=++te.current,Ea=Ge!==N.current;i(!0),p("");try{let Ee=await vo(`/api/admin/codes?page=${Q}&folder=${encodeURIComponent(Ge)}`);Lt===te.current&&(a(Ee),N.current=Ee.folder,Ea&&R([]),Lt>1&&ne(uo=>uo+1))}catch(Ee){Lt===te.current&&p(Ee.message)}finally{Lt===te.current&&i(!1)}},[]);(0,Ie.useEffect)(()=>{Ne(0)},[Ne]);let Ae=(0,Ie.useCallback)(async(Q,Ge=!1)=>{let Lt;try{Lt=HM(Q)}catch(Ee){W(Ee.message);return}W("");let Ea=++te.current;i(!0),p("");try{let Ee=[],uo=0;for(;;){let fs=await vo(`/api/admin/codes?page=${uo}`);if(Ea!==te.current)return;if(Ee.push(...fs.codes),!fs.has_more)break;uo++}me(Ee),X({source:Q,match:Lt}),Te(fs=>fs+1),Ge||ie(0),R([])}catch(Ee){Ea===te.current&&p(Ee.message)}finally{Ea===te.current&&i(!1)}},[]);function rt(Q=!0){X(null),me(null),z(""),W(""),ie(0),R([]),Q&&Ne(0,"")}function Ot(){Z?(Ae(Z.source,!0),ne(Q=>Q+1)):Ne(n?.page??0)}(0,Ie.useEffect)(()=>{if(!_e||be||c||s)return;let Q=setTimeout(()=>{_e==="list"&&Fe.current?.focus(),He(null)},250);return()=>clearTimeout(Q)},[_e,be,c,s]);async function Re(Q){if(!Q.copyable){h("\u5386\u53F2\u5151\u6362\u7801\u672A\u4FDD\u5B58\u5B8C\u6574\u5185\u5BB9\uFF0C\u8BF7\u4F7F\u7528\u539F\u5148\u4E0B\u8F7D\u7684 TXT\u3002"),S(Ge=>Ge+1);return}if(!C.current){C.current=!0;try{let Ge=vo("/api/admin/codes/copy",{id:Q.id});typeof ClipboardItem<"u"&&navigator.clipboard?.write?await navigator.clipboard.write([new ClipboardItem({"text/plain":Ge.then(Lt=>new Blob([Lt.code],{type:"text/plain"}))})]):await navigator.clipboard.writeText((await Ge).code),h(`\u5DF2\u590D\u5236\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801\u3002`)}catch{h("\u590D\u5236\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u526A\u8D34\u677F\u6743\u9650\u6216\u7A0D\u540E\u91CD\u8BD5\u3002")}finally{S(Ge=>Ge+1),C.current=!1}}}async function Ft(){if(!Me.current){Me.current=!0,d(!0),H(null),ge(null);try{let Q=await vo("/api/admin/codes",{months:f,count:Number(g),batch:x.trim()});Oe(Q),ge({text:`\u5DF2\u751F\u6210 ${Q.codes.length} \u679A\u5151\u6362\u7801\uFF0C\u5DF2\u5F52\u5165\u6279\u6B21\u300C${Q.batch}\u300D\u3002\u70B9\u51FB\u5217\u8868\u6761\u76EE\u5373\u53EF\u590D\u5236\u3002`,error:!1}),requestAnimationFrame(()=>Mt.current?.scrollIntoView({block:"nearest"})),Z?Ot():await Ne(0,Q.folder||"unfiled")}catch(Q){ge({text:`${Q.message} \u82E5\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u5148\u5237\u65B0\u5217\u8868\u6838\u5B9E\u6279\u6B21\uFF0C\u4E0D\u8981\u7ACB\u5373\u91CD\u590D\u751F\u6210\u3002`,error:!0})}finally{Me.current=!1,d(!1)}}}async function Nt(){if(!(be?.kind!=="revoke"||Me.current)){Me.current=!0,d(!0);try{await vo("/api/admin/revoke",{id:be.code.id}),ge({text:"\u5151\u6362\u7801\u5DF2\u505C\u7528\u3002",error:!1}),R([]),He("list"),H(null),Ot()}catch(Q){ge({text:Q.message,error:!0}),H(null)}finally{Me.current=!1,d(!1)}}}async function Qr(){if(!(Me.current||!E.length)){Me.current=!0,d(!0),ge(null);try{await vo("/api/admin/codes/move",{ids:E,folder:A}),ge({text:`\u5DF2\u79FB\u52A8 ${E.length} \u679A\u5151\u6362\u7801\u3002`,error:!1}),R([]),w(!1),He("list"),Ot()}catch(Q){w(!1),ge({text:`${Q.message} \u82E5\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u8BF7\u5237\u65B0\u5217\u8868\u6838\u5B9E\u3002`,error:!0})}finally{Me.current=!1,d(!1)}}}function Kn(){if(!ye)return;let Q=URL.createObjectURL(new Blob([ye.codes.join(` `)+` -`],{type:"text/plain;charset=utf-8"})),Ge=document.createElement("a");Ge.href=Q,Ge.download=`xgift-${ye.months}mo-${Date.now()}.txt`,Ge.click(),setTimeout(()=>URL.revokeObjectURL(Q),1e3)}let gr=Z&&de?de.filter(Z.match):null,Ca=gr?.length??0,Qn=Math.max(1,Math.ceil(Ca/100)),Zr=Math.min(fe,Qn-1),ve=gr?gr.slice(Zr*100,Zr*100+100):n?.codes??[],qe=ve.map(Q=>Q.id),Bt=qe.filter(Q=>E.includes(Q));return(0,$.jsxs)(mM,{admin:!0,children:[(0,$.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"start",sm:"center"},spacing:2,sx:{mb:4},children:[(0,$.jsxs)(oe,{children:[(0,$.jsx)(D,{variant:"h1",sx:{fontSize:{xs:30,sm:36},mt:.5},children:"\u5151\u6362\u7801\u7BA1\u7406"}),(0,$.jsx)(D,{color:"text.secondary",sx:{mt:1},children:"\u751F\u6210\u5151\u6362\u7801\u3001\u67E5\u770B\u5151\u6362\u72B6\u6001\u548C\u7BA1\u7406\u6279\u6B21\u3002"})]}),(0,$.jsxs)(ce,{direction:"row",alignItems:"center",spacing:1,children:[(0,$.jsx)(jo,{variant:"outlined",color:n?.payments_enabled?"success":"default",label:n?n.payments_enabled?"\u5145\u503C\u5DF2\u5F00\u653E":"\u7528\u6237\u5145\u503C\u5165\u53E3\u5DF2\u6682\u505C":"\u6B63\u5728\u83B7\u53D6\u670D\u52A1\u72B6\u6001"}),(0,$.jsx)(xM,{})]})]}),(0,$.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"minmax(0, 1fr) minmax(0, 1fr)"},gap:3,mb:3,alignItems:"stretch"},children:[(0,$.jsx)(YM,{selected:e,onPrepare:(Q,Ge)=>r({id:Q,mode:Ge,seq:Date.now()})}),(0,$.jsx)(KM,{disabled:c||s,refreshSignal:ot,onCopy:Q=>{Re(Q)},onViewCustomer:Q=>t({id:Q,seq:Date.now()}),onRevoke:Q=>H({kind:"revoke",code:Q})})]}),(0,$.jsx)(EA,{}),(0,$.jsx)(lA,{selection:o}),(0,$.jsx)(fA,{refreshSignal:ot}),(0,$.jsx)(AM,{folders:n?.folders??[],stats:n?.stats,filter:n?.folder??"",disabled:c||s,onSelect:Q=>{if(Z){rt(!1);let Ge=Q==="unfiled"?"\u672A\u5206\u7C7B":Q?n?.folders.find(Lt=>Lt.id===Q)?.name??"":"";Ge&&Pe(Lt=>({seq:Lt.seq+1,text:`\u7B5B\u9009\u5DF2\u6E05\u9664\uFF0C\u5DF2\u663E\u793A\u6279\u6B21\uFF1A${Ge}`}))}Ne(0,Q)},onBusyChange:Q=>{Me.current=Q,d(Q)},onChanged:async()=>{Z?Ot():await Ne(0)}}),Z&&(0,$.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:-1.5,mb:3},children:"\u8868\u8FBE\u5F0F\u7B5B\u9009\u751F\u6548\u4E2D\uFF0C\u70B9\u51FB\u6279\u6B21\u6587\u4EF6\u5939\u53EF\u6E05\u9664\u7B5B\u9009\u5E76\u67E5\u770B\u8BE5\u6279\u6B21\u3002"}),(0,$.jsx)(qM,{value:k,onChange:Q=>{z(Q),j&&W("")},onApply:()=>{k.trim()&&Ae(k.trim())},onClear:()=>rt(),applied:!!Z,error:j,disabled:c||s,folders:n?.folders??[],appliedSource:Z?.source??"",resultCount:Z?Ca:void 0,applySeq:we,clearNotice:le}),(0,$.jsxs)(tt,{variant:"outlined",sx:{p:{xs:2.5,sm:3},mb:3},children:[(0,$.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:1},children:[(0,$.jsx)(Uv,{color:"primary"}),(0,$.jsx)(D,{variant:"h2",children:"\u751F\u6210\u5151\u6362\u7801"})]}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"\u6BCF\u6279\u6700\u591A 500 \u679A\u3002\u540C\u540D\u6279\u6B21\u81EA\u52A8\u5F52\u5165\u540C\u4E00\u4E2A\u6587\u4EF6\u5939\u3002"}),(0,$.jsx)(oe,{component:"form",ref:je,noValidate:!0,onSubmit:Q=>{Q.preventDefault();let Ge=new TextEncoder().encode(x.trim()).length>120,Lt=!Number.isInteger(Number(g))||Number(g)<1||Number(g)>500;Se(Ge),Ce(Lt),!(Ge||Lt||!je.current.reportValidity()||c)&&Ft()},children:(0,$.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr",md:"1fr 1fr 2fr"},gap:2,alignItems:"start"},children:[(0,$.jsxs)(Ht,{select:!0,label:"\u5957\u9910\u65F6\u957F",value:f,onChange:Q=>u(Number(Q.target.value)),disabled:c,helperText:"\u7ED1\u5B9A\u540E\u4E0D\u53EF\u66F4\u6539",children:[(0,$.jsx)(In,{value:3,children:"3 \u4E2A\u6708 Premium"}),(0,$.jsx)(In,{value:6,children:"6 \u4E2A\u6708 Premium"})]}),(0,$.jsx)(Ht,{label:"\u751F\u6210\u6570\u91CF",type:"number",required:!0,value:g,onChange:Q=>{b(Q.target.value),De&&Ce(!1)},disabled:c,error:De,helperText:De?"\u8BF7\u8F93\u5165 1\u2013500 \u4E4B\u95F4\u7684\u6574\u6570":"\u6BCF\u6279 1\u2013500 \u679A",slotProps:{htmlInput:{min:1,max:500,step:1}}}),(0,$.jsx)(Ht,{label:"\u6279\u6B21\u540D\u79F0\uFF08\u53EF\u9009\uFF09",placeholder:"\u4F8B\u5982\uFF1A\u5341\u6708\u8D60\u793C",value:x,onChange:Q=>{m(Q.target.value),U&&Se(!1)},disabled:c,error:U,helperText:U?"\u6279\u6B21\u540D\u79F0\u4E0D\u80FD\u8D85\u8FC7 120 \u5B57\u8282\uFF08\u7EA6 40 \u4E2A\u6C49\u5B57\uFF09":"\u6279\u6B21\u540D\u79F0\u5C31\u662F\u6587\u4EF6\u5939\u540D\u79F0\uFF0C\u7559\u7A7A\u81EA\u52A8\u547D\u540D"}),(0,$.jsx)(ue,{type:"submit",variant:"contained",startIcon:(0,$.jsx)(Zw,{}),disabled:c||s||!!l,sx:{gridColumn:{sm:"1 / -1"},justifySelf:{sm:"end"}},children:c?"\u6B63\u5728\u5904\u7406\u2026":"\u751F\u6210\u5151\u6362\u7801"})]})})]}),he&&(0,$.jsx)(ze,{severity:he.error?"error":"success",role:"status",closeText:"\u5173\u95ED",onClose:he.error?void 0:()=>ge(null),sx:{mb:3},children:he.text}),ye&&(0,$.jsxs)(tt,{ref:Mt,variant:"outlined",sx:{p:3,mb:3,borderColor:"primary.main"},children:[(0,$.jsx)(D,{variant:"h2",children:"\u672C\u6279\u5151\u6362\u7801"}),(0,$.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{my:1,overflowWrap:"anywhere"},children:[ye.batch," \xB7 ",ye.codes.length," \u679A \xB7 ",ye.months," ","\u4E2A\u6708"]}),(0,$.jsx)(EM,{codes:ye.codes},ye.codes[0]),(0,$.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[(0,$.jsx)(ue,{variant:"contained",startIcon:(0,$.jsx)(eO,{}),onClick:Kn,children:"\u4E0B\u8F7D TXT"}),(0,$.jsx)(ue,{variant:"outlined",disabled:c,onClick:()=>Oe(null),children:"\u6536\u8D77\u672C\u6279\u5151\u6362\u7801"})]})]}),(0,$.jsxs)(tt,{variant:"outlined",sx:{overflow:"hidden"},children:[(0,$.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{px:{xs:2,sm:3},py:2},children:[(0,$.jsxs)(oe,{children:[(0,$.jsx)(D,{variant:"h2",children:gr?"\u8868\u8FBE\u5F0F\u7B5B\u9009\u7ED3\u679C":n?.folder==="unfiled"?"\u672A\u5206\u7C7B":n?.folders.find(Q=>Q.id===n.folder)?.name??"\u5168\u90E8\u5151\u6362\u7801"}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u70B9\u51FB\u6761\u76EE\u590D\u5236\u5151\u6362\u7801 \xB7 \u6BCF\u9875\u6700\u591A 100 \u6761"})]}),(0,$.jsx)($n,{describeChild:!0,title:"\u5237\u65B0\u5217\u8868",children:(0,$.jsx)("span",{children:(0,$.jsx)(sn,{ref:Fe,"aria-label":"\u5237\u65B0\u5217\u8868",disabled:s||c,onClick:()=>Ot(),sx:{border:1,borderColor:"divider",width:44,height:44},children:(0,$.jsx)(oO,{})})})})]}),s&&(0,$.jsx)(ks,{"aria-label":"\u6B63\u5728\u52A0\u8F7D\u5151\u6362\u7801"}),l&&(0,$.jsxs)(ze,{severity:"error",role:"alert",sx:{m:2},children:[l,(n||de)&&" \u4EE5\u4E0B\u4FDD\u7559\u4E0A\u6B21\u52A0\u8F7D\u7684\u6570\u636E\u3002",(0,$.jsx)(ue,{onClick:()=>Ot(),children:"\u91CD\u65B0\u52A0\u8F7D"})]}),(0,$.jsx)(D,{variant:"caption",color:"text.secondary",sx:{display:{xs:"block",md:"none"},px:2,pb:1},children:"\u5DE6\u53F3\u6ED1\u52A8\u8868\u683C\uFF0C\u53EF\u67E5\u770B\u8D26\u53F7\u548C\u64CD\u4F5C\u3002"}),E.length>0&&(0,$.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,sx:{px:2,py:1,bgcolor:"action.selected"},children:[(0,$.jsxs)(D,{variant:"body2",children:["\u5DF2\u9009\u62E9 ",E.length," \u679A"]}),(0,$.jsx)(ue,{color:"secondary",variant:"outlined",startIcon:(0,$.jsx)(Kw,{}),disabled:c||s||!!l,onClick:()=>{v(""),w(!0)},children:"\u79FB\u52A8\u5230\u6279\u6B21"})]}),(0,$.jsx)(oc,{tabIndex:0,role:"region","aria-label":"\u5151\u6362\u7801\u5217\u8868\uFF0C\u53EF\u6A2A\u5411\u6EDA\u52A8",sx:{"&:focus-visible":{outlineOffset:-3}},children:(0,$.jsxs)(ec,{sx:{minWidth:750},"aria-label":"\u5151\u6362\u7801\u5217\u8868",children:[(0,$.jsx)(rc,{sx:{bgcolor:"background.default"},children:(0,$.jsxs)(Xa,{children:[(0,$.jsx)(io,{padding:"checkbox",children:(0,$.jsx)(Bn,{slotProps:{input:{"aria-label":"\u9009\u62E9\u672C\u9875\u5168\u90E8\u5151\u6362\u7801"}},disabled:c||s||!!l||!ve.length,checked:!!qe.length&&Bt.length===qe.length,indeterminate:Bt.length>0&&Bt.lengthR(Ge=>Q.target.checked?[...new Set([...Ge,...qe])]:Ge.filter(Lt=>!qe.includes(Lt)))})}),["\u5151\u6362\u7801 / \u6279\u6B21","\u5957\u9910","\u72B6\u6001","\u63A5\u6536\u8D26\u53F7","\u751F\u6210\u65F6\u95F4","\u64CD\u4F5C"].map(Q=>(0,$.jsx)(io,{sx:{fontWeight:600,whiteSpace:"nowrap"},children:Q},Q))]})}),(0,$.jsxs)(tc,{children:[ve.map(Q=>(0,$.jsxs)(Xa,{hover:!0,selected:E.includes(Q.id),onClick:()=>{!c&&!s&&!l&&Re(Q)},sx:{cursor:Q.copyable?"pointer":"default"},children:[(0,$.jsx)(io,{padding:"checkbox",onClick:Ge=>Ge.stopPropagation(),children:(0,$.jsx)(Bn,{slotProps:{input:{"aria-label":`\u9009\u62E9\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801`}},checked:E.includes(Q.id),disabled:c||s||!!l,onChange:Ge=>R(Lt=>Ge.target.checked?[...Lt,Q.id]:Lt.filter(Ea=>Ea!==Q.id))})}),(0,$.jsxs)(io,{sx:{maxWidth:260},children:[(0,$.jsxs)(D,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:600},children:["\u2026",Q.hint]}),(0,$.jsx)(D,{variant:"caption",color:"text.secondary",sx:{overflowWrap:"anywhere"},children:Q.batch}),(0,$.jsx)(D,{variant:"caption",component:"p",color:"text.secondary",children:Q.copyable?"\u70B9\u51FB\u590D\u5236":"\u5386\u53F2\u7801\u672A\u4FDD\u5B58"})]}),(0,$.jsxs)(io,{sx:{whiteSpace:"nowrap"},children:[Q.months," \u4E2A\u6708"]}),(0,$.jsxs)(io,{sx:{minWidth:100,maxWidth:240},children:[(0,$.jsx)(jo,{size:"small",variant:"outlined",color:hi[Q.status]?.color??"default",label:hi[Q.status]?.label??Q.status}),Q.message&&(0,$.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1,overflowWrap:"anywhere"},children:Q.message})]}),(0,$.jsx)(io,{children:Q.username?`@${Q.username}`:"\u2014"}),(0,$.jsxs)(io,{children:[(0,$.jsx)(D,{variant:"body2",sx:{whiteSpace:"nowrap"},children:_l(Q.created).slice(0,10)}),(0,$.jsx)(D,{variant:"caption",color:"text.secondary",children:_l(Q.created).slice(11)})]}),(0,$.jsx)(io,{onClick:Ge=>Ge.stopPropagation(),children:(0,$.jsxs)(ce,{direction:"row",spacing:1,children:[(0,$.jsx)(ue,{size:"small",variant:"outlined",disabled:c||s,onClick:()=>t({id:Q.id,seq:Date.now()}),sx:{whiteSpace:"nowrap",flexShrink:0},children:"\u67E5\u770B\u5151\u6362\u7801 / \u8865\u5355"}),(0,$.jsx)($n,{describeChild:!0,title:Q.copyable?"\u590D\u5236\u5B8C\u6574\u5151\u6362\u7801":"\u5386\u53F2\u7801\u672A\u4FDD\u5B58\u5B8C\u6574\u5185\u5BB9\uFF0C\u8BF7\u4F7F\u7528\u539F TXT",children:(0,$.jsx)("span",{children:(0,$.jsx)(sn,{"aria-label":`\u590D\u5236\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801`,disabled:!Q.copyable||c||s||!!l,onClick:()=>{Re(Q)},sx:{border:1,borderColor:"divider",width:44,height:44},children:(0,$.jsx)(wf,{fontSize:"small"})})})}),Q.status==="active"&&(0,$.jsx)($n,{describeChild:!0,title:"\u505C\u7528\u5151\u6362\u7801",children:(0,$.jsx)("span",{children:(0,$.jsx)(sn,{color:"error",disabled:c||s||!!l,"aria-label":`\u505C\u7528\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801`,onClick:()=>H({kind:"revoke",code:Q}),sx:{border:1,borderColor:"divider",width:44,height:44},children:(0,$.jsx)(Yw,{fontSize:"small"})})})})]})})]},Q.id)),!s&&!l&&!ve.length&&(0,$.jsx)(Xa,{children:(0,$.jsxs)(io,{colSpan:7,align:"center",sx:{py:7},children:[(0,$.jsx)(Uv,{sx:{fontSize:40,color:"text.secondary",mb:1}}),gr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{fontWeight:600,children:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u5151\u6362\u7801"}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u8BF7\u8C03\u6574\u7B5B\u9009\u8868\u8FBE\u5F0F\uFF0C\u6216\u6E05\u9664\u7B5B\u9009\u67E5\u770B\u5168\u90E8\u5151\u6362\u7801\u3002"})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{fontWeight:600,children:"\u5F53\u524D\u5206\u7C7B\u6CA1\u6709\u5151\u6362\u7801"}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u53EF\u5728\u4E0A\u65B9\u751F\u6210\u5151\u6362\u7801\uFF0C\u6216\u4ECE\u5176\u4ED6\u5206\u7C7B\u79FB\u52A8\u5230\u8FD9\u91CC\u3002"})]})]})})]})]})}),(0,$.jsx)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"start",sm:"center"},spacing:1,sx:{p:2,borderTop:1,borderColor:"divider"},children:gr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ce,{direction:"row",spacing:1.5,alignItems:"center",children:[(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:`\u7B5B\u9009 ${Ca} / \u5171 ${de?.length??0} \u6761 \xB7 \u7B2C ${Zr+1} / ${Qn} \u9875`}),(0,$.jsx)(ue,{variant:"outlined",disabled:s||c,onClick:()=>rt(),sx:{px:1.5,minHeight:36},children:"\u6E05\u9664\u7B5B\u9009"})]}),(0,$.jsxs)(ce,{direction:"row",spacing:1,children:[(0,$.jsx)(ue,{disabled:s||c||Zr===0,onClick:()=>ie(Zr-1),sx:{px:1.5},children:"\u4E0A\u4E00\u9875"}),(0,$.jsx)(ue,{disabled:s||c||Zr>=Qn-1,onClick:()=>ie(Zr+1),sx:{px:1.5},children:"\u4E0B\u4E00\u9875"})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:(()=>{let Q=n?.folder?n.folder==="unfiled"?n?.stats.unfiled??0:n?.folders.find(Ge=>Ge.id===n.folder)?.count??0:n?.stats.total??0;return`\u5171 ${Q} \u6761 \xB7 \u7B2C ${(n?.page??0)+1} / ${Math.max(1,Math.ceil(Q/100))} \u9875`})()}),(0,$.jsxs)(ce,{direction:"row",spacing:1,children:[(0,$.jsx)(ue,{disabled:s||c||!n?.page,onClick:()=>{Ne((n?.page??0)-1)},sx:{px:1.5},children:"\u4E0A\u4E00\u9875"}),(0,$.jsx)(ue,{disabled:s||c||!n?.has_more,onClick:()=>{Ne((n?.page??0)+1)},sx:{px:1.5},children:"\u4E0B\u4E00\u9875"})]})]})})]}),(0,$.jsxs)(lr,{open:O,disableRestoreFocus:_e!==null,onClose:()=>{c||w(!1)},fullWidth:!0,maxWidth:"xs","aria-labelledby":"move-dialog-title","aria-describedby":"move-dialog-description",children:[(0,$.jsxs)(ur,{id:"move-dialog-title",children:["\u79FB\u52A8 ",E.length," \u679A\u5151\u6362\u7801"]}),(0,$.jsxs)(cr,{children:[(0,$.jsxs)(Ht,{select:!0,label:"\u76EE\u6807\u6279\u6B21",value:A,disabled:c,onChange:Q=>v(Q.target.value),slotProps:{select:{displayEmpty:!0},inputLabel:{shrink:!0}},sx:{mt:1},children:[(0,$.jsx)(In,{value:"",children:"\u672A\u5206\u7C7B"}),(n?.folders??[]).map(Q=>(0,$.jsx)(In,{value:Q.id,sx:{whiteSpace:"normal"},children:Q.name},Q.id))]}),(0,$.jsx)(Ns,{id:"move-dialog-description",sx:{mt:2},children:"\u53EA\u4FEE\u6539\u5F52\u5C5E\u5206\u7C7B\uFF0C\u4E0D\u6539\u53D8\u5151\u6362\u7801\u3001\u8D26\u53F7\u548C\u8BA2\u5355\u72B6\u6001\u3002"})]}),(0,$.jsxs)(pr,{sx:{p:2},children:[(0,$.jsx)(ue,{autoFocus:!0,disabled:c,onClick:()=>w(!1),children:"\u53D6\u6D88"}),(0,$.jsx)(ue,{variant:"contained",disabled:c||!E.length,onClick:()=>{Qr()},children:c?"\u6B63\u5728\u79FB\u52A8\u2026":"\u786E\u8BA4\u79FB\u52A8"})]})]}),(0,$.jsxs)(lr,{disableRestoreFocus:_e!==null,open:!!be,onClose:()=>{c||H(null)},role:"alertdialog","aria-labelledby":"admin-dialog-title","aria-describedby":"admin-dialog-description",maxWidth:"xs",fullWidth:!0,children:[(0,$.jsx)(ur,{id:"admin-dialog-title",children:"\u505C\u7528\u8FD9\u679A\u5151\u6362\u7801\uFF1F"}),(0,$.jsx)(cr,{children:(0,$.jsx)(Ns,{id:"admin-dialog-description",children:`\u5C3E\u53F7 ${be?.code.hint??""} \u7684\u5151\u6362\u7801\u5C06\u65E0\u6CD5\u4F7F\u7528\u3002\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002`})}),(0,$.jsxs)(pr,{sx:{p:2},children:[(0,$.jsx)(ue,{onClick:()=>H(null),disabled:c,autoFocus:!0,children:"\u53D6\u6D88"}),(0,$.jsx)(ue,{variant:"contained",color:"error",disabled:c,onClick:()=>{Nt()},children:c?"\u6B63\u5728\u5904\u7406\u2026":"\u786E\u8BA4\u505C\u7528"})]})]}),(0,$.jsx)(oh,{open:!!y,autoHideDuration:4e3,onClose:()=>h(""),message:y,slotProps:{content:{role:"status"}}},T)]})}dM((0,$.jsx)(rH,{})); +`],{type:"text/plain;charset=utf-8"})),Ge=document.createElement("a");Ge.href=Q,Ge.download=`xgift-${ye.months}mo-${Date.now()}.txt`,Ge.click(),setTimeout(()=>URL.revokeObjectURL(Q),1e3)}let gr=Z&&de?de.filter(Z.match):null,Ca=gr?.length??0,Qn=Math.max(1,Math.ceil(Ca/100)),Zr=Math.min(fe,Qn-1),ve=gr?gr.slice(Zr*100,Zr*100+100):n?.codes??[],qe=ve.map(Q=>Q.id),Bt=qe.filter(Q=>E.includes(Q));return(0,$.jsxs)(mM,{admin:!0,children:[(0,$.jsxs)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"start",sm:"center"},spacing:2,sx:{mb:4},children:[(0,$.jsxs)(oe,{children:[(0,$.jsx)(D,{variant:"h1",sx:{fontSize:{xs:30,sm:36},mt:.5},children:"\u5151\u6362\u7801\u7BA1\u7406"}),(0,$.jsx)(D,{color:"text.secondary",sx:{mt:1},children:"\u751F\u6210\u5151\u6362\u7801\u3001\u67E5\u770B\u5151\u6362\u72B6\u6001\u548C\u7BA1\u7406\u6279\u6B21\u3002"})]}),(0,$.jsxs)(ce,{direction:"row",alignItems:"center",spacing:1,children:[(0,$.jsx)(jo,{variant:"outlined",color:n?.payments_enabled?"success":"default",label:n?n.payments_enabled?"\u5145\u503C\u5DF2\u5F00\u653E":"\u7528\u6237\u5145\u503C\u5165\u53E3\u5DF2\u6682\u505C":"\u6B63\u5728\u83B7\u53D6\u670D\u52A1\u72B6\u6001"}),(0,$.jsx)(xM,{})]})]}),(0,$.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",md:"minmax(0, 1fr) minmax(0, 1fr)"},gap:3,mb:3,alignItems:"stretch"},children:[(0,$.jsx)(YM,{selected:e,onPrepare:(Q,Ge)=>r({id:Q,mode:Ge,seq:Date.now()})}),(0,$.jsx)(KM,{disabled:c||s,refreshSignal:ot,onCopy:Q=>{Re(Q)},onViewCustomer:Q=>t({id:Q,seq:Date.now()}),onRevoke:Q=>H({kind:"revoke",code:Q})})]}),(0,$.jsx)(EA,{}),(0,$.jsx)(lA,{selection:o}),(0,$.jsx)(fA,{refreshSignal:ot}),(0,$.jsx)(AM,{folders:n?.folders??[],stats:n?.stats,filter:n?.folder??"",disabled:c||s,onSelect:Q=>{if(Z){rt(!1);let Ge=Q==="unfiled"?"\u672A\u5206\u7C7B":Q?n?.folders.find(Lt=>Lt.id===Q)?.name??"":"";Ge&&Pe(Lt=>({seq:Lt.seq+1,text:`\u7B5B\u9009\u5DF2\u6E05\u9664\uFF0C\u5DF2\u663E\u793A\u6279\u6B21\uFF1A${Ge}`}))}Ne(0,Q)},onBusyChange:Q=>{Me.current=Q,d(Q)},onChanged:async()=>{Z?Ot():await Ne(0)}}),Z&&(0,$.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mt:-1.5,mb:3},children:"\u8868\u8FBE\u5F0F\u7B5B\u9009\u751F\u6548\u4E2D\uFF0C\u70B9\u51FB\u6279\u6B21\u6587\u4EF6\u5939\u53EF\u6E05\u9664\u7B5B\u9009\u5E76\u67E5\u770B\u8BE5\u6279\u6B21\u3002"}),(0,$.jsx)(qM,{value:k,onChange:Q=>{z(Q),j&&W("")},onApply:()=>{k.trim()&&Ae(k.trim())},onClear:()=>rt(),applied:!!Z,error:j,disabled:c||s,folders:n?.folders??[],appliedSource:Z?.source??"",resultCount:Z?Ca:void 0,applySeq:we,clearNotice:le}),(0,$.jsxs)(tt,{variant:"outlined",sx:{p:{xs:2.5,sm:3},mb:3},children:[(0,$.jsxs)(ce,{direction:"row",spacing:1,alignItems:"center",sx:{mb:1},children:[(0,$.jsx)(Uv,{color:"primary"}),(0,$.jsx)(D,{variant:"h2",children:"\u751F\u6210\u5151\u6362\u7801"})]}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",sx:{mb:3},children:"\u6BCF\u6279\u6700\u591A 2000 \u679A\u3002\u540C\u540D\u6279\u6B21\u81EA\u52A8\u5F52\u5165\u540C\u4E00\u4E2A\u6587\u4EF6\u5939\u3002"}),(0,$.jsx)(oe,{component:"form",ref:je,noValidate:!0,onSubmit:Q=>{Q.preventDefault();let Ge=new TextEncoder().encode(x.trim()).length>120,Lt=!Number.isInteger(Number(g))||Number(g)<1||Number(g)>2e3;Se(Ge),Ce(Lt),!(Ge||Lt||!je.current.reportValidity()||c)&&Ft()},children:(0,$.jsxs)(oe,{sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:"1fr 1fr",md:"1fr 1fr 2fr"},gap:2,alignItems:"start"},children:[(0,$.jsxs)(Ht,{select:!0,label:"\u5957\u9910\u65F6\u957F",value:f,onChange:Q=>u(Number(Q.target.value)),disabled:c,helperText:"\u7ED1\u5B9A\u540E\u4E0D\u53EF\u66F4\u6539",children:[(0,$.jsx)(In,{value:3,children:"3 \u4E2A\u6708 Premium"}),(0,$.jsx)(In,{value:6,children:"6 \u4E2A\u6708 Premium"})]}),(0,$.jsx)(Ht,{label:"\u751F\u6210\u6570\u91CF",type:"number",required:!0,value:g,onChange:Q=>{b(Q.target.value),De&&Ce(!1)},disabled:c,error:De,helperText:De?"\u8BF7\u8F93\u5165 1\u20132000 \u4E4B\u95F4\u7684\u6574\u6570":"\u6BCF\u6279 1\u20132000 \u679A",slotProps:{htmlInput:{min:1,max:2e3,step:1}}}),(0,$.jsx)(Ht,{label:"\u6279\u6B21\u540D\u79F0\uFF08\u53EF\u9009\uFF09",placeholder:"\u4F8B\u5982\uFF1A\u5341\u6708\u8D60\u793C",value:x,onChange:Q=>{m(Q.target.value),U&&Se(!1)},disabled:c,error:U,helperText:U?"\u6279\u6B21\u540D\u79F0\u4E0D\u80FD\u8D85\u8FC7 120 \u5B57\u8282\uFF08\u7EA6 40 \u4E2A\u6C49\u5B57\uFF09":"\u6279\u6B21\u540D\u79F0\u5C31\u662F\u6587\u4EF6\u5939\u540D\u79F0\uFF0C\u7559\u7A7A\u81EA\u52A8\u547D\u540D"}),(0,$.jsx)(ue,{type:"submit",variant:"contained",startIcon:(0,$.jsx)(Zw,{}),disabled:c||s||!!l,sx:{gridColumn:{sm:"1 / -1"},justifySelf:{sm:"end"}},children:c?"\u6B63\u5728\u5904\u7406\u2026":"\u751F\u6210\u5151\u6362\u7801"})]})})]}),he&&(0,$.jsx)(ze,{severity:he.error?"error":"success",role:"status",closeText:"\u5173\u95ED",onClose:he.error?void 0:()=>ge(null),sx:{mb:3},children:he.text}),ye&&(0,$.jsxs)(tt,{ref:Mt,variant:"outlined",sx:{p:3,mb:3,borderColor:"primary.main"},children:[(0,$.jsx)(D,{variant:"h2",children:"\u672C\u6279\u5151\u6362\u7801"}),(0,$.jsxs)(D,{variant:"body2",color:"text.secondary",sx:{my:1,overflowWrap:"anywhere"},children:[ye.batch," \xB7 ",ye.codes.length," \u679A \xB7 ",ye.months," ","\u4E2A\u6708"]}),(0,$.jsx)(EM,{codes:ye.codes},ye.codes[0]),(0,$.jsxs)(ce,{direction:{xs:"column",sm:"row"},spacing:1.5,children:[(0,$.jsx)(ue,{variant:"contained",startIcon:(0,$.jsx)(eO,{}),onClick:Kn,children:"\u4E0B\u8F7D TXT"}),(0,$.jsx)(ue,{variant:"outlined",disabled:c,onClick:()=>Oe(null),children:"\u6536\u8D77\u672C\u6279\u5151\u6362\u7801"})]})]}),(0,$.jsxs)(tt,{variant:"outlined",sx:{overflow:"hidden"},children:[(0,$.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"center",sx:{px:{xs:2,sm:3},py:2},children:[(0,$.jsxs)(oe,{children:[(0,$.jsx)(D,{variant:"h2",children:gr?"\u8868\u8FBE\u5F0F\u7B5B\u9009\u7ED3\u679C":n?.folder==="unfiled"?"\u672A\u5206\u7C7B":n?.folders.find(Q=>Q.id===n.folder)?.name??"\u5168\u90E8\u5151\u6362\u7801"}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u70B9\u51FB\u6761\u76EE\u590D\u5236\u5151\u6362\u7801 \xB7 \u6BCF\u9875\u6700\u591A 100 \u6761"})]}),(0,$.jsx)($n,{describeChild:!0,title:"\u5237\u65B0\u5217\u8868",children:(0,$.jsx)("span",{children:(0,$.jsx)(sn,{ref:Fe,"aria-label":"\u5237\u65B0\u5217\u8868",disabled:s||c,onClick:()=>Ot(),sx:{border:1,borderColor:"divider",width:44,height:44},children:(0,$.jsx)(oO,{})})})})]}),s&&(0,$.jsx)(ks,{"aria-label":"\u6B63\u5728\u52A0\u8F7D\u5151\u6362\u7801"}),l&&(0,$.jsxs)(ze,{severity:"error",role:"alert",sx:{m:2},children:[l,(n||de)&&" \u4EE5\u4E0B\u4FDD\u7559\u4E0A\u6B21\u52A0\u8F7D\u7684\u6570\u636E\u3002",(0,$.jsx)(ue,{onClick:()=>Ot(),children:"\u91CD\u65B0\u52A0\u8F7D"})]}),(0,$.jsx)(D,{variant:"caption",color:"text.secondary",sx:{display:{xs:"block",md:"none"},px:2,pb:1},children:"\u5DE6\u53F3\u6ED1\u52A8\u8868\u683C\uFF0C\u53EF\u67E5\u770B\u8D26\u53F7\u548C\u64CD\u4F5C\u3002"}),E.length>0&&(0,$.jsxs)(ce,{direction:"row",justifyContent:"space-between",alignItems:"center",spacing:1,sx:{px:2,py:1,bgcolor:"action.selected"},children:[(0,$.jsxs)(D,{variant:"body2",children:["\u5DF2\u9009\u62E9 ",E.length," \u679A"]}),(0,$.jsx)(ue,{color:"secondary",variant:"outlined",startIcon:(0,$.jsx)(Kw,{}),disabled:c||s||!!l,onClick:()=>{v(""),w(!0)},children:"\u79FB\u52A8\u5230\u6279\u6B21"})]}),(0,$.jsx)(oc,{tabIndex:0,role:"region","aria-label":"\u5151\u6362\u7801\u5217\u8868\uFF0C\u53EF\u6A2A\u5411\u6EDA\u52A8",sx:{"&:focus-visible":{outlineOffset:-3}},children:(0,$.jsxs)(ec,{sx:{minWidth:750},"aria-label":"\u5151\u6362\u7801\u5217\u8868",children:[(0,$.jsx)(rc,{sx:{bgcolor:"background.default"},children:(0,$.jsxs)(Xa,{children:[(0,$.jsx)(io,{padding:"checkbox",children:(0,$.jsx)(Bn,{slotProps:{input:{"aria-label":"\u9009\u62E9\u672C\u9875\u5168\u90E8\u5151\u6362\u7801"}},disabled:c||s||!!l||!ve.length,checked:!!qe.length&&Bt.length===qe.length,indeterminate:Bt.length>0&&Bt.lengthR(Ge=>Q.target.checked?[...new Set([...Ge,...qe])]:Ge.filter(Lt=>!qe.includes(Lt)))})}),["\u5151\u6362\u7801 / \u6279\u6B21","\u5957\u9910","\u72B6\u6001","\u63A5\u6536\u8D26\u53F7","\u751F\u6210\u65F6\u95F4","\u64CD\u4F5C"].map(Q=>(0,$.jsx)(io,{sx:{fontWeight:600,whiteSpace:"nowrap"},children:Q},Q))]})}),(0,$.jsxs)(tc,{children:[ve.map(Q=>(0,$.jsxs)(Xa,{hover:!0,selected:E.includes(Q.id),onClick:()=>{!c&&!s&&!l&&Re(Q)},sx:{cursor:Q.copyable?"pointer":"default"},children:[(0,$.jsx)(io,{padding:"checkbox",onClick:Ge=>Ge.stopPropagation(),children:(0,$.jsx)(Bn,{slotProps:{input:{"aria-label":`\u9009\u62E9\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801`}},checked:E.includes(Q.id),disabled:c||s||!!l,onChange:Ge=>R(Lt=>Ge.target.checked?[...Lt,Q.id]:Lt.filter(Ea=>Ea!==Q.id))})}),(0,$.jsxs)(io,{sx:{maxWidth:260},children:[(0,$.jsxs)(D,{variant:"body2",sx:{fontFamily:"monospace",fontWeight:600},children:["\u2026",Q.hint]}),(0,$.jsx)(D,{variant:"caption",color:"text.secondary",sx:{overflowWrap:"anywhere"},children:Q.batch}),(0,$.jsx)(D,{variant:"caption",component:"p",color:"text.secondary",children:Q.copyable?"\u70B9\u51FB\u590D\u5236":"\u5386\u53F2\u7801\u672A\u4FDD\u5B58"})]}),(0,$.jsxs)(io,{sx:{whiteSpace:"nowrap"},children:[Q.months," \u4E2A\u6708"]}),(0,$.jsxs)(io,{sx:{minWidth:100,maxWidth:240},children:[(0,$.jsx)(jo,{size:"small",variant:"outlined",color:hi[Q.status]?.color??"default",label:hi[Q.status]?.label??Q.status}),Q.message&&(0,$.jsx)(D,{variant:"caption",color:"text.secondary",component:"p",sx:{mt:1,overflowWrap:"anywhere"},children:Q.message})]}),(0,$.jsx)(io,{children:Q.username?`@${Q.username}`:"\u2014"}),(0,$.jsxs)(io,{children:[(0,$.jsx)(D,{variant:"body2",sx:{whiteSpace:"nowrap"},children:_l(Q.created).slice(0,10)}),(0,$.jsx)(D,{variant:"caption",color:"text.secondary",children:_l(Q.created).slice(11)})]}),(0,$.jsx)(io,{onClick:Ge=>Ge.stopPropagation(),children:(0,$.jsxs)(ce,{direction:"row",spacing:1,children:[(0,$.jsx)(ue,{size:"small",variant:"outlined",disabled:c||s,onClick:()=>t({id:Q.id,seq:Date.now()}),sx:{whiteSpace:"nowrap",flexShrink:0},children:"\u67E5\u770B\u5151\u6362\u7801 / \u8865\u5355"}),(0,$.jsx)($n,{describeChild:!0,title:Q.copyable?"\u590D\u5236\u5B8C\u6574\u5151\u6362\u7801":"\u5386\u53F2\u7801\u672A\u4FDD\u5B58\u5B8C\u6574\u5185\u5BB9\uFF0C\u8BF7\u4F7F\u7528\u539F TXT",children:(0,$.jsx)("span",{children:(0,$.jsx)(sn,{"aria-label":`\u590D\u5236\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801`,disabled:!Q.copyable||c||s||!!l,onClick:()=>{Re(Q)},sx:{border:1,borderColor:"divider",width:44,height:44},children:(0,$.jsx)(wf,{fontSize:"small"})})})}),Q.status==="active"&&(0,$.jsx)($n,{describeChild:!0,title:"\u505C\u7528\u5151\u6362\u7801",children:(0,$.jsx)("span",{children:(0,$.jsx)(sn,{color:"error",disabled:c||s||!!l,"aria-label":`\u505C\u7528\u5C3E\u53F7 ${Q.hint} \u7684\u5151\u6362\u7801`,onClick:()=>H({kind:"revoke",code:Q}),sx:{border:1,borderColor:"divider",width:44,height:44},children:(0,$.jsx)(Yw,{fontSize:"small"})})})})]})})]},Q.id)),!s&&!l&&!ve.length&&(0,$.jsx)(Xa,{children:(0,$.jsxs)(io,{colSpan:7,align:"center",sx:{py:7},children:[(0,$.jsx)(Uv,{sx:{fontSize:40,color:"text.secondary",mb:1}}),gr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{fontWeight:600,children:"\u6CA1\u6709\u7B26\u5408\u7B5B\u9009\u6761\u4EF6\u7684\u5151\u6362\u7801"}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u8BF7\u8C03\u6574\u7B5B\u9009\u8868\u8FBE\u5F0F\uFF0C\u6216\u6E05\u9664\u7B5B\u9009\u67E5\u770B\u5168\u90E8\u5151\u6362\u7801\u3002"})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{fontWeight:600,children:"\u5F53\u524D\u5206\u7C7B\u6CA1\u6709\u5151\u6362\u7801"}),(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:"\u53EF\u5728\u4E0A\u65B9\u751F\u6210\u5151\u6362\u7801\uFF0C\u6216\u4ECE\u5176\u4ED6\u5206\u7C7B\u79FB\u52A8\u5230\u8FD9\u91CC\u3002"})]})]})})]})]})}),(0,$.jsx)(ce,{direction:{xs:"column",sm:"row"},justifyContent:"space-between",alignItems:{xs:"start",sm:"center"},spacing:1,sx:{p:2,borderTop:1,borderColor:"divider"},children:gr?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(ce,{direction:"row",spacing:1.5,alignItems:"center",children:[(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:`\u7B5B\u9009 ${Ca} / \u5171 ${de?.length??0} \u6761 \xB7 \u7B2C ${Zr+1} / ${Qn} \u9875`}),(0,$.jsx)(ue,{variant:"outlined",disabled:s||c,onClick:()=>rt(),sx:{px:1.5,minHeight:36},children:"\u6E05\u9664\u7B5B\u9009"})]}),(0,$.jsxs)(ce,{direction:"row",spacing:1,children:[(0,$.jsx)(ue,{disabled:s||c||Zr===0,onClick:()=>ie(Zr-1),sx:{px:1.5},children:"\u4E0A\u4E00\u9875"}),(0,$.jsx)(ue,{disabled:s||c||Zr>=Qn-1,onClick:()=>ie(Zr+1),sx:{px:1.5},children:"\u4E0B\u4E00\u9875"})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{variant:"body2",color:"text.secondary",children:(()=>{let Q=n?.folder?n.folder==="unfiled"?n?.stats.unfiled??0:n?.folders.find(Ge=>Ge.id===n.folder)?.count??0:n?.stats.total??0;return`\u5171 ${Q} \u6761 \xB7 \u7B2C ${(n?.page??0)+1} / ${Math.max(1,Math.ceil(Q/100))} \u9875`})()}),(0,$.jsxs)(ce,{direction:"row",spacing:1,children:[(0,$.jsx)(ue,{disabled:s||c||!n?.page,onClick:()=>{Ne((n?.page??0)-1)},sx:{px:1.5},children:"\u4E0A\u4E00\u9875"}),(0,$.jsx)(ue,{disabled:s||c||!n?.has_more,onClick:()=>{Ne((n?.page??0)+1)},sx:{px:1.5},children:"\u4E0B\u4E00\u9875"})]})]})})]}),(0,$.jsxs)(lr,{open:O,disableRestoreFocus:_e!==null,onClose:()=>{c||w(!1)},fullWidth:!0,maxWidth:"xs","aria-labelledby":"move-dialog-title","aria-describedby":"move-dialog-description",children:[(0,$.jsxs)(ur,{id:"move-dialog-title",children:["\u79FB\u52A8 ",E.length," \u679A\u5151\u6362\u7801"]}),(0,$.jsxs)(cr,{children:[(0,$.jsxs)(Ht,{select:!0,label:"\u76EE\u6807\u6279\u6B21",value:A,disabled:c,onChange:Q=>v(Q.target.value),slotProps:{select:{displayEmpty:!0},inputLabel:{shrink:!0}},sx:{mt:1},children:[(0,$.jsx)(In,{value:"",children:"\u672A\u5206\u7C7B"}),(n?.folders??[]).map(Q=>(0,$.jsx)(In,{value:Q.id,sx:{whiteSpace:"normal"},children:Q.name},Q.id))]}),(0,$.jsx)(Ns,{id:"move-dialog-description",sx:{mt:2},children:"\u53EA\u4FEE\u6539\u5F52\u5C5E\u5206\u7C7B\uFF0C\u4E0D\u6539\u53D8\u5151\u6362\u7801\u3001\u8D26\u53F7\u548C\u8BA2\u5355\u72B6\u6001\u3002"})]}),(0,$.jsxs)(pr,{sx:{p:2},children:[(0,$.jsx)(ue,{autoFocus:!0,disabled:c,onClick:()=>w(!1),children:"\u53D6\u6D88"}),(0,$.jsx)(ue,{variant:"contained",disabled:c||!E.length,onClick:()=>{Qr()},children:c?"\u6B63\u5728\u79FB\u52A8\u2026":"\u786E\u8BA4\u79FB\u52A8"})]})]}),(0,$.jsxs)(lr,{disableRestoreFocus:_e!==null,open:!!be,onClose:()=>{c||H(null)},role:"alertdialog","aria-labelledby":"admin-dialog-title","aria-describedby":"admin-dialog-description",maxWidth:"xs",fullWidth:!0,children:[(0,$.jsx)(ur,{id:"admin-dialog-title",children:"\u505C\u7528\u8FD9\u679A\u5151\u6362\u7801\uFF1F"}),(0,$.jsx)(cr,{children:(0,$.jsx)(Ns,{id:"admin-dialog-description",children:`\u5C3E\u53F7 ${be?.code.hint??""} \u7684\u5151\u6362\u7801\u5C06\u65E0\u6CD5\u4F7F\u7528\u3002\u6B64\u64CD\u4F5C\u4E0D\u53EF\u64A4\u9500\u3002`})}),(0,$.jsxs)(pr,{sx:{p:2},children:[(0,$.jsx)(ue,{onClick:()=>H(null),disabled:c,autoFocus:!0,children:"\u53D6\u6D88"}),(0,$.jsx)(ue,{variant:"contained",color:"error",disabled:c,onClick:()=>{Nt()},children:c?"\u6B63\u5728\u5904\u7406\u2026":"\u786E\u8BA4\u505C\u7528"})]})]}),(0,$.jsx)(oh,{open:!!y,autoHideDuration:4e3,onClose:()=>h(""),message:y,slotProps:{content:{role:"status"}}},T)]})}dM((0,$.jsx)(rH,{})); /*! Bundled license information: react/cjs/react.production.js: diff --git a/internal/site/assets/admin.js.gz b/internal/site/assets/admin.js.gz index f344531..79ed329 100644 Binary files a/internal/site/assets/admin.js.gz and b/internal/site/assets/admin.js.gz differ diff --git a/internal/site/folders.go b/internal/site/folders.go index 12c554e..8cb6f24 100644 --- a/internal/site/folders.go +++ b/internal/site/folders.go @@ -160,8 +160,8 @@ func (s *server) moveCodes(w http.ResponseWriter, r *http.Request) { if !decode(w, r, &q) { return } - if len(q.IDs) < 1 || len(q.IDs) > 100 || (q.Folder != "" && !folderIDPattern.MatchString(q.Folder)) { - message(w, 400, "请选择 1–100 枚兑换码和有效的目标文件夹。") + if len(q.IDs) < 1 || len(q.IDs) > 1000 || (q.Folder != "" && !folderIDPattern.MatchString(q.Folder)) { + message(w, 400, "请选择 1–1000 枚兑换码和有效的目标文件夹。") return } seen := map[string]bool{} diff --git a/internal/site/reconcile.go b/internal/site/reconcile.go index 9cb4ab0..6da1387 100644 --- a/internal/site/reconcile.go +++ b/internal/site/reconcile.go @@ -80,7 +80,7 @@ func (s *server) reconcileLoop() { case <-ticker.C: } var c codeRow - err := s.db.QueryRow("SELECT id,recipient_id,username,months,status,progress,updated FROM codes WHERE status='review' AND recipient_id IS NOT NULL AND id>? AND updated>? ORDER BY id LIMIT 1", cursor, time.Now().Add(-24*time.Hour).Unix()).Scan(&c.ID, &c.RecipientID, &c.Username, &c.Months, &c.Status, &c.Progress, &c.Updated) + err := s.db.QueryRow("SELECT id,recipient_id,username,months,status,progress,updated FROM codes WHERE status='review' AND recipient_id IS NOT NULL AND id>? AND updated>? ORDER BY id LIMIT 1", cursor, time.Now().Add(-7*24*time.Hour).Unix()).Scan(&c.ID, &c.RecipientID, &c.Username, &c.Months, &c.Status, &c.Progress, &c.Updated) if err != nil { cursor = "" continue @@ -98,7 +98,7 @@ func (s *server) reconcileLoop() { } func (s *server) autoChecking(c *codeRow) bool { - if c.Status != "review" || c.RecipientID == "" || c.Updated < time.Now().Add(-24*time.Hour).Unix() { + if c.Status != "review" || c.RecipientID == "" || c.Updated < time.Now().Add(-7*24*time.Hour).Unix() { return false } raw, err := s.vault.Get("checkout:" + c.RecipientID) diff --git a/internal/site/recovery.go b/internal/site/recovery.go index ce5cf58..fe00a45 100644 --- a/internal/site/recovery.go +++ b/internal/site/recovery.go @@ -305,7 +305,7 @@ func (s *server) recoveryStart(w http.ResponseWriter, r *http.Request) { reply(w, 200, map[string]any{"batch": recoveryView(q)}) return } - if time.Now().Unix()-q.Created > 600 { + if time.Now().Unix()-q.Created > 3600 { message(w, 409, "预览已过期,请重新生成。") return } diff --git a/internal/site/site.go b/internal/site/site.go index 0f665b0..b866587 100644 --- a/internal/site/site.go +++ b/internal/site/site.go @@ -777,8 +777,8 @@ func (s *server) generate(w http.ResponseWriter, r *http.Request) { return } q.Batch = strings.TrimSpace(q.Batch) - if (q.Months != 3 && q.Months != 6) || q.Count < 1 || q.Count > 500 || len(q.Batch) > 120 || (q.Folder != "" && !folderIDPattern.MatchString(q.Folder)) { - message(w, 400, "请选择 3 或 6 个月,数量 1–500,批次名称不超过 120 字节。") + if (q.Months != 3 && q.Months != 6) || q.Count < 1 || q.Count > 2000 || len(q.Batch) > 120 || (q.Folder != "" && !folderIDPattern.MatchString(q.Folder)) { + message(w, 400, "请选择 3 或 6 个月,数量 1–2000,批次名称不超过 120 字节。") return } if q.Batch == "" {