1import{j as e}from"./jsx-runtime-0DLF9kdB.js";import{G as g}from"./GlassCard-QGEypy6d.js";import{P as L}from"./PageTransition-d4Dnod-f.js";import{c}from"./cn-fNskMoFt.js";import{u as R,r as x}from"./index-DM-Ysix_.js";import"./i18n-context-DuXOzqEp.js";import{u as V}from"./hooks-ktRWiHiM.js";import{u as C,a as P,d as B,F as i,r as k}from"./components-C61DWoh4.js";import{m as A}from"./proxy-TcOPxGtH.js";import"./use-combine-values-xozz9E_C.js";function J(){const{members:h,agents:N,ledgers:j,q:M,tier:I,status:D,role:E}=C(),a=P(),p=R(),r=p.state==="submitting",l=V(),S=B(),[T,n]=x.useState(!1),[m,b]=x.useState(null),[f,_]=x.useState(!1);x.useEffect(()=>{_(!0)},[]);const u=(t,s)=>{const v=l(t);return v===t?s:v},d=t=>u(`member.tier.${t}`,t),w=t=>u(`member.status.${t}`,t),o=t=>u(`member.role.${t}`,t),y=(a==null?void 0:a.error)==="MISSING_MEMBER_ID"?l("admin.members.errors.missingMemberId"):(a==null?void 0:a.error)==="INVALID_DELTA"?l("admin.members.errors.invalidDelta"):(a==null?void 0:a.error)==="MEMBER_NOT_FOUND"?l("admin.members.errors.memberNotFound"):(a==null?void 0:a.error)==="UNKNOWN_INTENT"?l("admin.members.errors.unknownIntent"):a==null?void 0:a.error,O=e.jsx("div",{className:"fixed inset-0 z-[10000] overflow-y-auto bg-black/80 backdrop-blur-xl",children:e.jsxs("div",{className:"flex min-h-full items-start justify-center p-4 py-12 md:py-20",children:[e.jsx("div",{className:"fixed inset-0",onClick:()=>n(!1)}),e.jsx(A.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"relative w-full max-w-lg",children:e.jsxs(g,{className:"p-6 md:p-10 space-y-5 md:space-y-8 border-white/20 shadow-[0_0_50px_rgba(0,0,0,0.5)]",intensity:"high",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-white/10 pb-5",children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"æ°å¢æå¡å¸³è"}),e.jsx("button",{onClick:()=>n(!1),className:"p-2 -mr-2 text-gray-500 hover:text-white transition-colors",children:"â"})]}),e.jsxs(i,{method:"post",className:"space-y-5",onSubmit:()=>n(!1),children:[e.jsx("input",{type:"hidden",name:"intent",value:"create-member"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase text-gray-400 font-bold mb-1.5 ml-1 tracking-wider",children:"å§å"}),e.jsx("input",{name:"name",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-2xl px-5 py-3.5 text-sm outline-none focus:border-white/30 transition-all focus:bg-white/10",placeholder:"çå°æ"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase text-gray-400 font-bold mb-1.5 ml-1 tracking-wider",children:"é»åéµä»¶"}),e.jsx("input",{type:"email",name:"email",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-2xl px-5 py-3.5 text-sm outline-none focus:border-white/30 transition-all focus:bg-white/10",placeholder:"[email protected]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase text-gray-400 font-bold mb-1.5 ml-1 tracking-wider",children:"ææ©è碼 (å°ä½çºé è¨å¯ç¢¼)"}),e.jsx("input",{type:"tel",name:"phone",required:!0,className:"w-full bg-white/5 border border-white/10 rounded-2xl px-5 py-3.5 text-sm outline-none focus:border-white/30 transition-all focus:bg-white/10",placeholder:"0912345678"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase text-gray-400 font-bold mb-1.5 ml-1 tracking-wider",children:"åå§çç´"}),e.jsxs("select",{name:"tier",className:"w-full bg-white/5 border border-white/10 rounded-2xl px-4 py-3.5 text-xs outline-none focus:border-white/30 transition-all focus:bg-white/10",children:[e.jsx("option",{value:"GUEST",className:"bg-black",children:"訪客 (GUEST)"}),e.jsx("option",{value:"NANO",className:"bg-black",children:"å¥ç±³ (NANO)"}),e.jsx("option",{value:"QUARTZ",className:"bg-black",children:"ç³è± (QUARTZ)"}),e.jsx("option",{value:"DIAMOND",className:"bg-black",children:"é½ç³ (DIAMOND)"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[10px] uppercase text-gray-400 font-bold mb-1.5 ml-1 tracking-wider",children:"è§è²æ¬é"}),e.jsxs("select",{name:"role",className:"w-full bg-white/5 border border-white/10 rounded-2xl px-4 py-3.5 text-xs outline-none focus:border-white/30 transition-all focus:bg-white/10",children:[e.jsx("option",{value:"MEMBER",className:"bg-black text-white",children:"ä¸è¬æå¡ (MEMBER)"}),e.jsx("option",{value:"SALES",className:"bg-black text-white",children:"æ¥åäººå¡ (SALES)"}),e.jsx("option",{value:"ADMIN",className:"bg-black text-white",children:"管çå¡ (ADMIN)"})]})]})]})]}),e.jsxs("div",{className:"pt-4 flex gap-4",children:[e.jsx("button",{type:"button",onClick:()=>n(!1),className:"flex-1 px-6 py-4 rounded-2xl border border-white/10 font-bold text-sm hover:bg-white/5 transition-all",children:"åæ¶"}),e.jsx("button",{type:"submit",disabled:r,className:"flex-1 bg-white text-black px-6 py-4 rounded-2xl font-bold text-sm hover:bg-gray-200 transition-all disabled:opacity-50 shadow-2xl shadow-white/10",children:r?"建ç«ä¸...":"建ç«
1æå¡"})]}),e.jsx("p",{className:"text-[10px] text-gray-500 text-center leading-relaxed",children:"é è¨å¯ç¢¼çºææ©è碼ã建ç«å¾è«éç¥å®¢æ¶ç»å
¥ã"})]})]})})]})}),U=e.jsx("div",{className:"fixed inset-0 z-[10000] overflow-y-auto bg-black/80 backdrop-blur-xl",children:e.jsxs("div",{className:"flex min-h-full items-start justify-center p-4 py-12 md:py-20",children:[e.jsx("div",{className:"fixed inset-0",onClick:()=>b(null)}),e.jsx(A.div,{initial:{opacity:0,scale:.95,y:20},animate:{opacity:1,scale:1,y:0},className:"relative w-full max-w-2xl",children:e.jsxs(g,{className:"p-6 md:p-10 border-white/20 shadow-[0_0_50px_rgba(0,0,0,0.5)]",intensity:"high",children:[e.jsxs("div",{className:"flex justify-between items-center border-b border-white/10 pb-5 mb-6",children:[e.jsx("h2",{className:"text-xl font-bold tracking-tight",children:"黿¸ç°åç´é"}),e.jsx("button",{onClick:()=>b(null),className:"p-2 -mr-2 text-gray-500 hover:text-white transition-colors",children:"â"})]}),e.jsx("div",{className:"space-y-2 max-h-[60vh] overflow-y-auto pr-2 custom-scrollbar",children:j.filter(t=>t.memberId===m).length===0?e.jsx("div",{className:"text-center py-10 text-gray-500 italic",children:"å°ç¡é»æ¸ç´éã"}):j.filter(t=>t.memberId===m).map(t=>e.jsxs("div",{className:"flex justify-between items-center p-4 rounded-xl bg-white/5 border border-white/5",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-white",children:t.reason||"系統調æ´"}),e.jsxs("div",{className:"text-[10px] text-gray-500 font-mono",children:[new Date(t.createdAt).toLocaleString()," · ",t.type]})]}),e.jsxs("div",{className:c("text-lg font-mono font-bold",t.pointsDelta>0?"text-green-400":"text-red-400"),children:[t.pointsDelta>0?"+":"",t.pointsDelta]})]},t.id))})]})})]})});return e.jsxs(e.Fragment,{children:[f&&T&&k.createPortal(O,document.body),f&&m&&k.createPortal(U,document.body),e.jsxs(L,{children:[e.jsxs("div",{className:"mb-10 flex justify-between items-end",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-bold text-gray-500 uppercase tracking-widest",children:"管çå¾å°"}),e.jsx("h1",{className:"text-3xl font-black italic tracking-tighter",children:"æå¡"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("button",{onClick:()=>n(!0),className:"bg-white text-black px-6 py-3 rounded-xl font-bold text-sm hover:bg-gray-200 transition-all active:scale-95 shadow-xl shadow-white/10",children:"+ æ°å¢æå¡"}),e.jsxs("div",{className:"text-xs text-gray-500 bg-white/5 border border-white/10 px-4 py-3 rounded-xl",children:["總æ¸: ",e.jsx("span",{className:"text-white font-mono font-bold",children:h.length})]})]})]}),e.jsxs(i,{method:"get",className:"mb-6 flex flex-col md:flex-row md:items-center gap-2",onChange:t=>S(t.currentTarget,{replace:!0}),children:[e.jsx("input",{name:"q",defaultValue:M,placeholder:l("admin.members.searchPlaceholder"),className:"w-72 max-w-full px-4 py-3 rounded-xl bg-white/[0.02] border border-white/10 text-sm outline-none focus:border-white/30"}),e.jsxs("select",{name:"tier",defaultValue:I||"",className:"w-40 px-3 py-3 rounded-xl bg-white/[0.02] border border-white/10 text-sm outline-none focus:border-white/30",children:[e.jsx("option",{value:"",className:"bg-phantom-black text-white",children:l("admin.members.filter.allTiers")}),["GUEST","NANO","QUARTZ","DIAMOND"].map(t=>e.jsx("option",{value:t,className:"bg-phantom-black text-white",children:d(t)},t))]}),e.jsxs("select",{name:"status",defaultValue:D||"",className:"w-40 px-3 py-3 rounded-xl bg-white/[0.02] border border-white/10 text-sm outline-none focus:border-white/30",children:[e.jsx("option",{value:"",className:"bg-phantom-black text-white",children:l("admin.members.filter.allStatuses")}),["ACTIVE","SUSPENDED"].map(t=>e.jsx("option",{value:t,className:"bg-phantom-black text-white",children:w(t)},t))]}),e.jsxs("select",{name:"role",defaultValue:E||"",className:"w-40 px-3 py-3 rounded-xl bg-white/[0.02] border border-white/10 text-sm outline-none focus:border-white/30",children:[e.jsx("option",{value:"",className:"bg-phantom-black text-white",children:l("admin.members.filter.allRoles")}),["MEMBER","SALES","ADMIN"].map(t=>e.jsx("option",{value:t,className:"bg-phantom-black text-white",children:o(t)},t))]}),e.jsx("button",{type:"submit",className:c("text-[10px] font-bold uppercase tracking-widest border border-white/10 px-4 py-3 rounded-xl hover:bg-white/10 transition-colors",p.state!=="idle"?"opacity-60 pointer-events-none":""),children:p.state!=="idle"?"â¦":l("common.search")})]}),e.jsxs(g,{className:"overflow-hidden p-0",intensity:"low",children:[e.jsx("div",{className:"hidden md:block overflow-x-auto",children:e.jsxs("table",{className:"w-full text-left border-collapse",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-white/5 bg-white/[0.02]",children:[e.jsx("th",{className:"px-6 py-4 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:l("admin.members.table.member")}),e.jsx("th",{className:"px-6 py-4 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:l("admin.members.table.tier")}),e.jsx("th",{className:"px-6 py-4 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:l("admin.members.table.spent")}),e.jsx("th",{className:"px-6 py-4 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:l("admin.members.table.points")}),e.jsx("th",{className:"px-6 py-4 text-[10px] font-bold text-gray-500 uppercase tracking-widest",children:l("admin.common.agent")}),e.jsx("th",{className:"px-6 py-4 text-[10px] font-bold text-gray-500 uppercase tracking-widest text-right",children:l("admin.common.actions")})]})}),e.jsx("tbody",{className:"divide-y divide-white/5",children:h.map(t=>e.jsxs("tr",{className:"hover:bg-white/[0.02] transition-colors group",children:[e.jsx("td",{className:"px-6 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-full bg-white/5 flex items-center justify-center border border-white/10 group-hover:border-white/20 transition-colors",children:"ð¤"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-bold text-white",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]})}),e.jsx("td",{className:"px-6 py-4",children:t.role==="ADMIN"?e.jsx("span",{className:"text-[10px] font-bold px-2.5 py-1 rounded-lg bg-white/10 text-white border border-white/20 uppercase tracking-widest shadow-[0_0_15px_rgba(255,255,255,0.05)]",children:o("ADMIN")}):e.jsx("span",{className:c("text-[10px] font-bold px-2 py-0.5 rounded-full border",t.tier==="DIAMOND"?"bg-amber-500/10 text-amber-500 border-amber-500/20":t.tier==="QUARTZ"?"bg-purple-500/10 text-purple-500 border-purple-500/20":t.tier==="NANO"?"bg-blue-500/10 text-blue-500 border-blue-500/20":"bg-gray-500/10 text-gray-500 border-gray-500/20"),children:d(t.tier)})}),e.jsx("td",{className:"px-6 py-4 text-sm font-mono text-gray-300",children:t.role==="ADMIN"?e.jsx("span",{className:"text-gray-600",children:"â"}
1):`$${t.totalSpent.toLocaleString()}`}),e.jsx("td",{className:"px-6 py-4 text-sm font-mono text-titanium-silver",children:t.role==="ADMIN"?e.jsx("span",{className:"text-gray-600",children:"â"}):e.jsxs("div",{className:"flex items-center gap-2",children:[t.pointsBalance.toLocaleString(),e.jsx("button",{onClick:()=>b(t.id),className:"p-1.5 rounded-lg bg-white/5 hover:bg-white/10 text-gray-500 hover:text-white transition-colors text-[10px]",title:"æ¥ç黿¸æ·å²",children:"ð"})]})}),e.jsx("td",{className:"px-6 py-4 text-xs font-mono text-gray-400",children:t.role==="ADMIN"?"â":t.salesCode||"â"}),e.jsx("td",{className:"px-6 py-4 text-right",children:e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsxs(i,{method:"post",className:"flex items-center gap-2",children:[e.jsx("input",{type:"hidden",name:"intent",value:"update-profile"}),e.jsx("input",{type:"hidden",name:"memberId",value:t.id}),t.role!=="ADMIN"&&e.jsx("select",{name:"tier",defaultValue:t.tier,className:"px-3 py-2 rounded-xl bg-white/[0.02] border border-white/10 text-xs outline-none focus:border-white/30",children:["GUEST","NANO","QUARTZ","DIAMOND"].map(s=>e.jsx("option",{value:s,className:"bg-phantom-black text-white",children:d(s)},s))}),e.jsx("select",{name:"status",defaultValue:t.status,className:"px-3 py-2 rounded-xl bg-white/[0.02] border border-white/10 text-xs outline-none focus:border-white/30",children:["ACTIVE","SUSPENDED"].map(s=>e.jsx("option",{value:s,className:"bg-phantom-black text-white",children:w(s)},s))}),e.jsx("select",{name:"role",defaultValue:t.role,className:"px-3 py-2 rounded-xl bg-white/[0.02] border border-white/10 text-xs outline-none focus:border-white/30 font-bold text-amber-500",children:["MEMBER","SALES","ADMIN"].map(s=>e.jsx("option",{value:s,className:"bg-phantom-black text-white",children:o(s)},s))}),t.role!=="ADMIN"&&e.jsxs("select",{name:"salesAgentId",defaultValue:t.salesAgentId||"",className:"px-3 py-2 rounded-xl bg-white/[0.02] border border-white/10 text-xs outline-none focus:border-white/30",children:[e.jsx("option",{value:"",className:"bg-phantom-black text-white",children:l("admin.orders.noAgent")}),N.map(s=>e.jsxs("option",{value:s.id,className:"bg-phantom-black text-white",children:[s.name," (",s.code,")"]},s.id))]}),e.jsx("button",{type:"submit",disabled:r,className:"text-[10px] font-bold uppercase tracking-widest border border-white/10 px-3 py-2 rounded-xl hover:bg-white/10 transition-colors disabled:opacity-50 bg-white/5",children:l("common.save")})]}),t.role!=="ADMIN"&&e.jsxs(i,{method:"post",className:"flex items-center gap-2",children:[e.jsx("input",{type:"hidden",name:"intent",value:"adjust-points"}),e.jsx("input",{type:"hidden",name:"memberId",value:t.id}),e.jsx("input",{name:"delta",placeholder:l("admin.members.deltaPlaceholder"),className:"w-28 px-3 py-2 rounded-xl bg-white/[0.02] border border-white/10 text-xs outline-none focus:border-white/30 font-mono"}),e.jsx("input",{name:"reason",placeholder:l("admin.members.reasonPlaceholder"),className:"w-40 px-3 py-2 rounded-xl bg-white/[0.02] border border-white/10 text-xs outline-none focus:border-white/30"}),e.jsx("button",{type:"submit",disabled:r,className:"text-[10px] font-bold uppercase tracking-widest border border-white/10 px-3 py-2 rounded-xl hover:bg-white/10 transition-colors disabled:opacity-50",children:l("admin.members.adjust")})]})]})})]},t.id))})]})}),e.jsx("div",{className:"md:hidden divide-y divide-white/5",children:h.map(t=>e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12 rounded-full bg-white/5 flex items-center justify-center border border-white/10",children:"ð¤"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-base font-bold text-white",children:t.name}),e.jsx("div",{className:"text-xs text-gray-500",children:t.email})]})]}),t.role==="ADMIN"?e.jsx("span",{className:"text-[10px] font-bold px-2.5 py-1 rounded-lg bg-white/10 text-white border border-white/20 uppercase tracking-widest shadow-[0_0_15px_rgba(255,255,255,0.05)]",children:o("ADMIN")}):e.jsx("span",{className:c("text-[10px] font-bold px-2 py-0.5 rounded-full border",t.tier==="DIAMOND"?"bg-amber-500/10 text-amber-500 border-amber-500/20":t.tier==="QUARTZ"?"bg-purple-500/10 text-purple-500 border-purple-500/20":t.tier==="NANO"?"bg-blue-500/10 text-blue-500 border-blue-500/20":"bg-gray-500/10 text-gray-500 border-gray-500/20"),children:d(t.tier)})]}),t.role!=="ADMIN"&&e.jsxs("div",{className:"grid grid-cols-2 gap-4 bg-white/5 rounded-2xl p-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-widest mb-1",children:l("admin.members.table.spent")}),e.jsxs("div",{className:"text-sm font-mono text-white",children:["$",t.totalSpent.toLocaleStr
1ing()]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-gray-500 uppercase tracking-widest mb-1",children:l("admin.members.table.points")}),e.jsx("div",{className:"text-sm font-mono text-titanium-silver",children:t.pointsBalance.toLocaleString()})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs(i,{method:"post",className:"space-y-3",children:[e.jsx("input",{type:"hidden",name:"intent",value:"update-profile"}),e.jsx("input",{type:"hidden",name:"memberId",value:t.id}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.role!=="ADMIN"&&e.jsx("select",{name:"tier",defaultValue:t.tier,className:"w-full px-3 py-3 rounded-xl bg-white/5 border border-white/10 text-xs outline-none",children:["GUEST","NANO","QUARTZ","DIAMOND"].map(s=>e.jsx("option",{value:s,children:d(s)},s))}),e.jsx("select",{name:"status",defaultValue:t.status,className:c("px-3 py-3 rounded-xl bg-white/5 border border-white/10 text-xs outline-none",t.role==="ADMIN"?"w-full col-span-2":"w-full"),children:["ACTIVE","SUSPENDED"].map(s=>e.jsx("option",{value:s,children:w(s)},s))})]}),e.jsx("select",{name:"role",defaultValue:t.role,className:"w-full px-3 py-3 rounded-xl bg-white/5 border border-white/10 text-xs outline-none font-bold text-amber-500",children:["MEMBER","SALES","ADMIN"].map(s=>e.jsx("option",{value:s,children:o(s)},s))}),t.role!=="ADMIN"&&e.jsxs("select",{name:"salesAgentId",defaultValue:t.salesAgentId||"",className:"w-full px-3 py-3 rounded-xl bg-white/5 border border-white/10 text-xs outline-none",children:[e.jsx("option",{value:"",children:l("admin.orders.noAgent")}),N.map(s=>e.jsxs("option",{value:s.id,children:[s.name," (",s.code,")"]},s.id))]}),e.jsx("button",{type:"submit",disabled:r,className:"w-full text-xs font-bold uppercase tracking-widest bg-white text-black py-3 rounded-xl transition-colors disabled:opacity-50 shadow-lg shadow-white/5",children:l("common.save")})]}),t.role!=="ADMIN"&&e.jsxs(i,{method:"post",className:"space-y-3 pt-4 border-t border-white/5",children:[e.jsx("input",{type:"hidden",name:"intent",value:"adjust-points"}),e.jsx("input",{type:"hidden",name:"memberId",value:t.id}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{name:"delta",placeholder:l("admin.members.deltaPlaceholder"),className:"flex-1 px-3 py-3 rounded-xl bg-white/5 border border-white/10 text-xs outline-none font-mono"}),e.jsx("input",{name:"reason",placeholder:l("admin.members.reasonPlaceholder"),className:"flex-[2] px-3 py-3 rounded-xl bg-white/5 border border-white/10 text-xs outline-none"})]}),e.jsx("button",{type:"submit",disabled:r,className:"w-full text-xs font-bold uppercase tracking-widest border border-white/20 py-3 rounded-xl hover:bg-white/10 transition-colors disabled:opacity-50",children:l("admin.members.adjust")})]})]})]},t.id))})]}),y?e.jsx("div",{className:"mt-4 text-xs text-red-300 border border-red-500/20 bg-red-500/10 rounded-xl p-4",children:y}):null]})]})}export{J as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.