PageSourceSearch

https://20251200-manbai-member-app.vercel.app/_next/static/chunks/…/mailing-list/page-107c8c72be874fda.js

js 20251200-manbai-member-app.vercel.app collected 2026-10-03 06:05:47 UTC 28,516 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5291],{17414:(e,t,s)=>{"use strict";s.d(t,{AM:()=>i,Wv:()=>l,dT:()=>c,hl:()=>d});var a=s(95155);s(12115);var r=s(63925),n=s(40980);function i(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"popover",...t})}function l(e){let{...t}=e;return(0,a.jsx)(r.l9,{"data-slot":"popover-trigger",...t})}function d(e){let{className:t,align:s="center",sideOffset:i=4,...l}=e;return(0,a.jsx)(r.ZL,{children:(0,a.jsx)(r.UC,{"data-slot":"popover-content",align:s,sideOffset:i,className:(0,n.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",t),...l})})}function c(e){let{...t}=e;return(0,a.jsx)(r.Mz,{"data-slot":"popover-anchor",...t})}},18349:(e,t,s)=>{"use strict";s.d(t,{T:()=>n});var a=s(95155);s(12115);var r=s(40980);function n(e){let{className:t,...s}=e;return(0,a.jsx)("textarea",{"data-slot":"textarea",className:(0,r.cn)("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),...s})}},29991:(e,t,s)=>{"use strict";s.d(t,{bq:()=>m,eb:()=>x,gC:()=>u,l6:()=>c,yv:()=>o});var a=s(95155);s(12115);var r=s(29144),n=s(66088),i=s(94514),l=s(9921),d=s(40980);function c(e){let{...t}=e;return(0,a.jsx)(r.bL,{"data-slot":"select",...t})}function o(e){let{...t}=e;return(0,a.jsx)(r.WT,{"data-slot":"select-value",...t})}function m(e){let{className:t,size:s="default",children:i,...l}=e;return(0,a.jsxs)(r.l9,{"data-slot":"select-trigger","data-size":s,className:(0,d.cn)("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...l,children:[i,(0,a.jsx)(r.In,{asChild:!0,children:(0,a.jsx)(n.A,{className:"size-4 opacity-50"})})]})}function u(e){let{className:t,children:s,position:n="popper",align:i="center",...l}=e;return(0,a.jsx)(r.ZL,{children:(0,a.jsxs)(r.UC,{"data-slot":"select-content",className:(0,d.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,align:i,...l,children:[(0,a.jsx)(p,{}),(0,a.jsx)(r.LM,{className:(0,d.cn)("p-1","popper"===n&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:s}),(0,a.jsx)(h,{})]})})}function x(e){let{className:t,children:s,...n}=e;return(0,a.jsxs)(r.q7,{"data-slot":"select-item",className:(0,d.cn)("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",t),...n,children:[(0,a.jsx)("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:(0,a.jsx)(r.VF,{children:(0,a.jsx)(i.A,{className:"size-4"})})}),(0,a.jsx)(r.p4,{children:s})]})}function p(e){let{className:t,...s}=e;return(0,a.jsx)(r.PP,{"data-slot":"select-scroll-up-button",className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,a.jsx)(l.A,{className:"size-4"})})}function h(e){let{className:t,...s}=e;return(0,a.jsx)(r.wn,{"data-slot":"select-scroll-down-button",className:(0,d.cn)("flex cursor-default items-center justify-center py-1",t),...s,children:(0,a.jsx)(n.A,{className:"size-4"})})}},48884:(e,t,s)=>{"use strict";s.d(t,{AG:()=>a,BP:()=>i,Bb:()=>m,Bc:()=>f,NN:()=>l,SB:()=>x,Vy:()=>d,Yw:()=>b,ZM:()=>o,ZU:()=>r,a6:()=>p,hH:()=>c,hl:()=>h,ir:()=>n,q:()=>g});let a=8,r=!1,n={ROUTINE:"常態活動",SPECIAL:"特別活動"},i="https://lin.ee/eIzC4KCf",l="https://lin.ee/XCv9Vgm";function d(e){return(e?.membershipTier?.level??0)>0}let c=["18-24","25-34","35-44","45-54","55-64","65+"],o=["男","女","其他"],m=["工程師","教師","學生","業務","公務員","設計師","行銷企劃","金融/保險","醫療人員","餐飲/服務業","自由接案","家管","待業中","其他"],u=["業務","其他"];function x(e){return!!e&&u.includes(e)}function p(e,t){let s=t?.trim();return x(e)&&s?`${e}|${s}`:e}function h(e){let t=e||"";
1if(!t.includes("|"))return{occupation:t,detail:""};let[s,...a]=t.split("|");return{occupation:s,detail:a.join("|")}}let g=["平日早上","平日下午","平日晚上","假日早上","假日下午","假日晚上"],f=["朋友介紹","IG","Facebook","Google 搜尋","活動現場","其他"],b={CREDIT:!0,ATM:!1,CVS:!0,APPLE_PAY:!0,GOOGLE_PAY:!0}},57058:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>B});var a=s(95155),r=s(12115),n=s(81477),i=s(89239),l=s(45160),d=s(9192),c=s(60529),o=s(18349),m=s(66829),u=s(17028),x=s(56563),p=s(94514),h=s(33210),g=s(17414),f=s(40980);function b(e){let{options:t,value:s,onChange:n,placeholder:l="請選擇…",searchPlaceholder:d="搜尋…",emptyMessage:o="沒有符合的項目",className:m,maxTagsShown:u=2}=e,[b,v]=(0,r.useState)(!1),[j,N]=(0,r.useState)(""),y=(0,r.useMemo)(()=>{let e=j.trim().toLowerCase();return e?t.filter(t=>t.label.toLowerCase().includes(e)||t.description?.toLowerCase().includes(e)):t},[t,j]),w=(0,r.useMemo)(()=>s.map(e=>t.find(t=>t.value===e)?.label).filter(e=>!!e),[s,t]);return(0,a.jsxs)(g.AM,{open:b,onOpenChange:v,children:[(0,a.jsx)(g.Wv,{asChild:!0,children:(0,a.jsxs)(i.$,{type:"button",variant:"outline",role:"combobox","aria-expanded":b,className:(0,f.cn)("w-full justify-between font-normal h-9 min-w-0",0===s.length&&"text-muted-foreground",m),children:[(0,a.jsx)("span",{className:"truncate text-left",children:0===s.length?l:w.length<=u?w.join("、"):`已選 ${s.length} 項:${w.slice(0,u).join("、")}…`}),(0,a.jsx)(x.A,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,a.jsxs)(g.hl,{className:"w-[min(28rem,calc(100vw-2rem))] p-0",align:"start",children:[(0,a.jsx)("div",{className:"p-2 border-b",children:(0,a.jsx)(c.p,{value:j,onChange:e=>N(e.target.value),placeholder:d,className:"h-8"})}),(0,a.jsx)("div",{className:"max-h-72 overflow-y-auto py-1",children:0===y.length?(0,a.jsx)("p",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:o}):y.map(e=>{let t=s.includes(e.value);return(0,a.jsxs)("button",{type:"button",onClick:()=>{var t;return t=e.value,void n(s.includes(t)?s.filter(e=>e!==t):[...s,t])},className:(0,f.cn)("w-full flex items-start gap-2 px-3 py-2 text-left text-sm hover:bg-accent transition-colors",t&&"bg-accent/50"),children:[(0,a.jsx)("span",{className:(0,f.cn)("mt-0.5 size-4 shrink-0 rounded-[4px] border grid place-content-center",t?"bg-primary border-primary text-primary-foreground":"border-input"),children:t&&(0,a.jsx)(p.A,{className:"size-3"})}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("span",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"truncate",children:e.label}),e.hint&&(0,a.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:e.hint})]}),e.description&&(0,a.jsx)("span",{className:"block text-xs text-muted-foreground truncate",children:e.description})]})]},e.value)})}),s.length>0&&(0,a.jsxs)("div",{className:"border-t p-2 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-xs text-muted-foreground",children:["已選 ",s.length," 項"]}),(0,a.jsxs)(i.$,{type:"button",variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>n([]),children:[(0,a.jsx)(h.A,{className:"size-3 mr-1"}),"清除"]})]})]})]})}var v=s(29991),j=s(20280),N=s(51914),y=s(68459),w=s(92289),k=s(7810),z=s(91958),C=s(41641),E=s(21362),$=s(67635),A=s(6962);s(48884);let S="NONE",T={excludeAdmins:!0,requireEmailVerified:!1,excludeNudgeOptOut:!1},O={all:"全部註冊使用者",tier:"會員等級",membership:"會籍狀態",status:"帳號狀態",application:"入會申請狀態",occupation:"職業",event:"活動報名者"},_={registered:"有效報名",checkedIn:"實際到場",noShow:"報名未到",cancelled:"已取消報名"},L={ACTIVE:"會籍有效中",EXPIRED:"會籍已到期",TRIAL:"試用期中",NEVER:"從未有過會籍"},R={PENDING:"待審核",APPROVED:"已通過",REJECTED:"已拒絕"},I={NONE:"未申請",PENDING:"審核中",APPROVED:"已通過",REJECTED:"已拒絕"},M={include:{title:"加入名單(聯集)",hint:"符合任一條件的人都會進入名單。若完å
1…¨ä¸è¨­å®šï¼Œé è¨­ç‚ºã€Œå…¨éƒ¨è¨»å†Šä½¿ç”¨è€…」。",card:"border-emerald-200 bg-emerald-50/40",badge:"bg-emerald-100 text-emerald-700 border-emerald-200",button:"border-emerald-300 text-emerald-700 hover:bg-emerald-100"},intersect:{title:"且必須符合(交集)",hint:"在上方名單中,只保留同時符合這些條件的人。",card:"border-sky-200 bg-sky-50/40",badge:"bg-sky-100 text-sky-700 border-sky-200",button:"border-sky-300 text-sky-700 hover:bg-sky-100"},exclude:{title:"排除(差集)",hint:"最後把符合這些條件的人從名單中扣掉。",card:"border-rose-200 bg-rose-50/40",badge:"bg-rose-100 text-rose-700 border-rose-200",button:"border-rose-300 text-rose-700 hover:bg-rose-100"}},D=["all","tier","membership","status","application","occupation","event"],P={comma:{label:"逗號 ,",join:", "},semicolon:{label:"分號 ;",join:"; "},newline:{label:"換行",join:"\n"}};function V(){return`r_${Math.random().toString(36).slice(2,10)}`}function B(){let{toast:e}=(0,j.dj)(),[t,s]=(0,r.useState)(null),[x,p]=(0,r.useState)(!0),[h,g]=(0,r.useState)([]),[f,B]=(0,r.useState)(T),[Z,W]=(0,r.useState)(null),[q,F]=(0,r.useState)(!1),[U,G]=(0,r.useState)("comma"),[Y,H]=(0,r.useState)(String(300)),[J,X]=(0,r.useState)(0),[K,Q]=(0,r.useState)([]),ee=(0,r.useRef)(0);(0,r.useEffect)(()=>{(async()=>{try{let e=await fetch("/api/admin/mailing-list/options");if(!e.ok)throw Error("載入選項失敗");s(await e.json())}catch{e({title:"載入失敗",description:"無法取得會員等級與活動清單",variant:"destructive"})}finally{p(!1)}})()},[e]);let et=(0,r.useCallback)(async()=>{let t=++ee.current;F(!0);try{let e=await fetch("/api/admin/mailing-list",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({rules:h,options:f})});if(!e.ok)throw Error("查詢失敗");let s=await e.json();t===ee.current&&W(s)}catch{t===ee.current&&e({title:"查詢失敗",description:"產生名單時發生錯誤,請稍後再試",variant:"destructive"})}finally{t===ee.current&&F(!1)}},[h,f,e]);(0,r.useEffect)(()=>{let e=setTimeout(et,400);return()=>clearTimeout(e)},[et]);let es=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"tier";g(s=>[...s,{id:V(),mode:e,type:t,values:[],eventScope:"registered"}])},ea=(e,t)=>{g(s=>s.map(s=>s.id===e?{...s,...t}:s))},er=e=>{if(!t)return;let s=t.tiers.filter(e=>0===e.level).map(e=>e.id);"guests"===e?g([{id:V(),mode:"include",type:"tier",values:[S,...s]}]):"activeMembers"===e?g([{id:V(),mode:"include",type:"membership",values:["ACTIVE"]}]):g([{id:V(),mode:"include",type:"all",values:[]},{id:V(),mode:"exclude",type:"event",values:["ANY"],eventScope:"registered"}])},en=(0,r.useCallback)(e=>{if(!t)return[];switch(e){case"tier":return[{value:S,label:"未指派等級(純訪客)",hint:`${t.noTierCount} 人`},...t.tiers.map(e=>({value:e.id,label:e.displayName,hint:`${e.userCount} 人`,description:`Level ${e.level}`}))];case"membership":return Object.entries(L).map(e=>{let[t,s]=e;return{value:t,label:s}});case"status":return Object.entries(R).map(e=>{let[s,a]=e;return{value:s,label:a,hint:`${t.statusCounts[s]||0} 人`}});case"application":return Object.entries(I).map(e=>{let[s,a]=e;return{value:s,label:a,hint:`${t.applicationCounts[s]||0} 人`}});case"occupation":return(t.occupations??[]).map(e=>({value:e.value,label:"__NONE__"===e.value?"未填寫":e.value,hint:`${e.count} 人`,description:e.builtIn?void 0:"自行填寫"}));case"event":return[{value:"ANY",label:"任一活動(曾報名過)"},...t.events.map(e=>({value:e.id,label:e.title,hint:`${e.registrationCount} 人`,description:new Date(e.date).toLocaleDateString("zh-TW")}))];default:return[]}},[t]),ei=Math.max(1,parseInt(Y,10)||300),el=(0,r.useMemo)(()=>{let e=Z?.members.map(e=>e.email)??[],t=[];for(let s=0;s<e.length;s+=ei)t.push(e.slice(s,s+ei));return t},[Z,ei]);(0,r.useEffect)(()=>{X(0),Q([])},[Z,ei]);let ed=(0,r.useMemo)(()=>el[J]??[],[el,J]),ec=J*ei,eo=(0,r.useMemo)(()=>ed.join(P[U].join),[ed,U]),em=async t=>{try{return await navigator.clipboard.writeText(t),!0}catch{return e({title:"複製失敗",description:"請手動選取下方文字框內容複製",variant:"destructive"}),!1}},eu=async()=>
1{if(0===ed.length||!await em(eo))return;let t=K.includes(J)?K:[...K,J];Q(t);let s=el.findIndex((e,s)=>s>J&&!t.includes(s)),a=el.length-t.length;-1!==s&&X(s),e({title:`已複製第 ${J+1} 組`,description:a>0?`${ed.length} 個 Email;還有 ${a} 組未複製`:`${ed.length} 個 Email;全部 ${el.length} 組都已複製完成`})},ex=async()=>{if(!Z||0===Z.total)return;let t=Z.members.map(e=>e.email).join(P[U].join);await em(t)&&(Q(el.map((e,t)=>t)),e({title:"已複製全部",description:`${Z.total} 個 Email 已複製到剪貼簿`}))},ep=[{key:"memberId",header:"會員編號",sortable:!0,render:e=>e.memberId||"—",className:"whitespace-nowrap"},{key:"name",header:"姓名",sortable:!0,render:e=>e.name||"—"},{key:"email",header:"Email",sortable:!0,render:e=>(0,a.jsx)("span",{className:"font-mono text-xs break-all",children:e.email})},{key:"tierName",header:"會員等級",sortable:!0,render:e=>(0,a.jsx)(l.E,{variant:e.tierName?"default":"secondary",children:e.tierName||"訪客"})},{key:"status",header:"帳號狀態",sortable:!0,render:e=>R[e.status]||e.status},{key:"emailVerified",header:"已驗證",sortable:!0,render:e=>e.emailVerified?(0,a.jsx)("span",{className:"text-emerald-600",children:"是"}):(0,a.jsx)("span",{className:"text-muted-foreground",children:"否"})},{key:"createdAt",header:"註冊時間",sortable:!0,render:e=>new Date(e.createdAt).toLocaleDateString("zh-TW"),className:"whitespace-nowrap"}];if(x)return(0,a.jsx)(m.R,{});let eh=e=>{let t=M[e],s=h.filter(t=>t.mode===e);return(0,a.jsxs)("div",{className:`rounded-lg border p-4 space-y-3 ${t.card}`,children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h3",{className:"font-semibold text-sm",children:t.title}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.hint})]}),(0,a.jsxs)(i.$,{type:"button",variant:"outline",size:"sm",className:`shrink-0 bg-white ${t.button}`,onClick:()=>es(e),children:[(0,a.jsx)(N.A,{className:"size-3.5 mr-1"}),"新增條件"]})]}),0===s.length?(0,a.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:"尚未設定條件"}):(0,a.jsx)("div",{className:"space-y-2",children:s.map(e=>(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center gap-2 rounded-md bg-white border p-2",children:[(0,a.jsxs)(v.l6,{value:e.type,onValueChange:t=>ea(e.id,{type:t,values:[]}),children:[(0,a.jsx)(v.bq,{className:"h-9 w-full sm:w-44 shrink-0",children:(0,a.jsx)(v.yv,{})}),(0,a.jsx)(v.gC,{children:D.map(e=>(0,a.jsx)(v.eb,{value:e,children:O[e]},e))})]}),"all"===e.type?(0,a.jsx)("div",{className:"flex-1 text-sm text-muted-foreground px-1",children:"不限條件,涵蓋所有註冊使用者"}):(0,a.jsx)("div",{className:"flex-1 min-w-0",children:(0,a.jsx)(b,{options:en(e.type),value:e.values,onChange:t=>ea(e.id,{values:t}),placeholder:`選擇${O[e.type]}…`})}),"event"===e.type&&(0,a.jsxs)(v.l6,{value:e.eventScope||"registered",onValueChange:t=>ea(e.id,{eventScope:t}),children:[(0,a.jsx)(v.bq,{className:"h-9 w-full sm:w-32 shrink-0",children:(0,a.jsx)(v.yv,{})}),(0,a.jsx)(v.gC,{children:Object.entries(_).map(e=>{let[t,s]=e;return(0,a.jsx)(v.eb,{value:t,children:s},t)})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[Z?.ruleHits[e.id]!==void 0&&(0,a.jsxs)(l.E,{variant:"outline",className:t.badge,children:[Z.ruleHits[e.id]," 人"]}),(0,a.jsx)(i.$,{type:"button",variant:"ghost",size:"icon",className:"size-8 text-muted-foreground hover:text-destructive",onClick:()=>{var t;return t=e.id,void g(e=>e.filter(e=>e.id!==t))},children:(0,a.jsx)(y.A,{className:"size-4"})})]})]},e.id))})]})};return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[(0,a.jsx)(w.A,{className:"size-6"}),"寄信名單"]}),(0,a.jsx)("p",{className:"text-muted-foreground mt-1",children:"用聯集/交集/排除三種運算組合條件,快速產生要寄信的 Email 名單"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:"快捷組合:"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>er("guests"),children:"所有註冊訪客"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>er("activeMembers"),children:"會籍有效會員"}),(0,a.jsx)(i.$,{variant:"outline",size:"sm",onClick:()=>er("dormant"),children:"從未報名過活動"}),h.length>0&&(0,a.jsx)(i.$,{variant:"ghost",size:"sm",className:"text-muted-foreground",onClick:()=>g([]),children:"清空條件"})]}),(0,a.jsxs)("div",{className:"grid gap-6 xl:grid-cols-[minmax(0,1fr)_360px]",children:[(0,a.jsxs)("div",{className:"space-y-4",children:[eh("include"),eh("intersect"),eh("exclude"),(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)(n.aR,{className:"pb-3",children:[(0,a.jsx)(n.ZB,{className:"text-sm",children:"全域選項"}),(0,a.jsx)(n.BT,{className:"text-xs",children:"套用在候選池上,所有條件計算前先生效"})]}),(0,a.jsx)(n.Wu,{className:"space-y-3",children:[["excludeAdmins","排除管理員帳號"],["requireEmailVerified","只包含已完成 Email 驗證者"],["excludeNudgeOptOut","排除已退訂升級提醒者"]].map(e=>{let[t,s]=e;return(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,a.jsx)(d.S,{checked:f[t],onCheckedChange:e=>B(s=>({...s,[t]:!0===e}))}),(0,a.jsx)("span",{children:s})]},t)})})]})]}),(0,a.jsx)("div",{className:"space-y-4",children:(0,a.jsxs)(n.Zp,{children:[(0,a.jsx)(n.aR,{className:"pb-3",children:(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)(n.ZB,{className:"text-sm flex items-center gap-2",children:[(0,a.jsx)(k.A,{className:"size-4"}),"名單結果"]}
1),(0,a.jsx)(i.$,{variant:"ghost",size:"icon",className:"size-8",onClick:et,disabled:q,children:(0,a.jsx)(z.A,{className:`size-4 ${q?"animate-spin":""}`})})]})}),(0,a.jsxs)(n.Wu,{className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-3xl font-bold",children:Z?.total??0}),(0,a.jsxs)("p",{className:"text-xs text-muted-foreground mt-1",children:["自 ",Z?.candidatePoolSize??0," 位候選使用者中篩選"]})]}),Z&&Z.total>0&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"名單組成"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:Object.entries(Z.breakdown.byTier).sort((e,t)=>t[1]-e[1]).map(e=>{let[t,s]=e;return(0,a.jsxs)(l.E,{variant:"secondary",className:"text-xs",children:[t===S?"訪客":t," ",s]},t)})})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Email 清單"}),(0,a.jsxs)(v.l6,{value:U,onValueChange:e=>G(e),children:[(0,a.jsx)(v.bq,{className:"h-7 w-28 text-xs",children:(0,a.jsx)(v.yv,{})}),(0,a.jsx)(v.gC,{children:Object.entries(P).map(e=>{let[t,s]=e;return(0,a.jsx)(v.eb,{value:t,children:s.label},t)})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"group-size",className:"text-xs text-muted-foreground shrink-0",children:"每組"}),(0,a.jsx)(c.p,{id:"group-size",type:"number",min:1,value:Y,onChange:e=>H(e.target.value),onBlur:()=>{Y.trim()&&ei===Number(Y)||H(String(ei))},className:"h-7 w-20 text-xs"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground shrink-0",children:"筆"}),(0,a.jsxs)("div",{className:"flex items-center gap-1 ml-auto",children:[(0,a.jsx)(i.$,{variant:"outline",size:"icon",className:"size-7",onClick:()=>X(e=>Math.max(0,e-1)),disabled:0===J,children:(0,a.jsx)(C.A,{className:"size-3.5"})}),(0,a.jsx)("span",{className:"text-xs tabular-nums whitespace-nowrap px-1",children:0===el.length?"0 / 0":`${J+1} / ${el.length}`}),(0,a.jsx)(i.$,{variant:"outline",size:"icon",className:"size-7",onClick:()=>X(e=>Math.min(el.length-1,e+1)),disabled:J>=el.length-1,children:(0,a.jsx)(E.A,{className:"size-3.5"})})]})]}),(0,a.jsx)(o.T,{readOnly:!0,value:eo,placeholder:"尚無符合條件的名單",className:"h-40 font-mono text-xs resize-none",onFocus:e=>e.currentTarget.select()}),el.length>0&&(0,a.jsxs)("p",{className:"text-xs text-muted-foreground",children:["第 ",J+1," 組:第 ",ec+1,"–",ec+ed.length," 筆,共 ",ed.length," 個 Email",K.length>0&&(0,a.jsxs)("span",{className:"text-emerald-600",children:[" 已複製 ",K.length," / ",el.length," 組"]})]})]}),el.length>1&&(0,a.jsx)("div",{className:"flex flex-wrap gap-1 max-h-24 overflow-y-auto",children:el.map((e,t)=>{let s=K.includes(t);return(0,a.jsx)("button",{type:"button",onClick:()=>X(t),title:`第 ${t+1} 組(${e.length} 筆)`,className:`h-6 min-w-8 px-1.5 rounded border text-xs tabular-nums transition-colors ${t===J?"border-primary bg-primary text-primary-foreground":s?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-input hover:bg-accent"}`,children:s&&t!==J?`${t+1}✓`:t+1},t)})}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,a.jsxs)(i.$,{onClick:eu,disabled:0===ed.length,children:[(0,a.jsx)($.A,{className:"size-4 mr-1"}),el.length>1?`複製本組 ${ed.length}`:"複製 Email"]}),(0,a.jsxs)(i.$,{variant:"outline",onClick:()=>{if(!Z||0===Z.members.length)return;let t=new Blob(["\uFEFF"+[["會員編號","姓名","Email","會員等級","帳號狀態","Email已驗證","會籍到期日","註冊時間"],...Z.members.map(e=>[e.memberId||"",e.name||"",e.email,e.tierName||"訪客",R[e.status]||e.status,e.emailVerified?"是":"否",e.membershipExpiresAt?new Date(e.membershipExpiresAt).toLocaleDateString("zh-TW"):"",new Date(e.createdAt).toLocaleDateString("zh-TW")])].map(e=>e.map(e=>`"${String(e??"").replace(/"/g,'""')}"`).join(",")).join("\n")],{type:"text/csv;charset=utf-8;"}),s=URL.createObjectURL(t),a=document.createElement("a"),r=new Date,n=`${r.getFullYear()}${String(r.getMonth()+1).padStart(2,"0")}${String(r.getDate()).padStart(2,"0")}`;a.href=s,a.download=`寄信名單_${n}.csv`,a.click(),URL.revokeObjectURL(s),e({title:"匯出成功",description:`已匯出 ${Z.members.length} 筆名單`})},disabled:!Z||0===Z.total,children:[(0,a.jsx)(A.A,{className:"size-4 mr-1"}),"下載 CSV"]})]}),el.length>1&&(0,a.jsxs)(i.$,{variant:"ghost",size:"sm",className:"w-full text-xs text-muted-foreground",onClick:ex,children:["不分組,一次複製全部 ",Z?.total??0," 筆"]})]})]})]})})]}),(0,a.jsxs)(n.Zp,{children:[(0,a.jsxs)(n.aR,{children:[(0,a.jsx)(n.ZB,{children:"名單明細"}),(0,a.jsx)(n.BT,{children:Z?`共 ${Z.total} 位收件人`:"設定條件後即時產生"})]}),(0,a.jsx)(n.Wu,{children:(0,a.jsx)(u.b,{columns:ep,data:Z?.members??[],emptyMessage:"沒有符合條件的收件人",pagination:!0,pageSize:25})})]})]})}},60529:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var a=s(95155);s(12115);var r=s(40980);function n(e){let{className:t,type:s,...n}=e;return(0,a.jsx)("input",{type:s,"data-slot":"input",className:(0,r.cn)("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",t),...n})}},66829:(e,t,s)=>{"use strict";s.d(t,{R:()=>i});var a=s(95155),r=s(6296),n=s(40980);function i(e){let{className:t,variant:s="default",text:i}=e;return"full"===s?(0,a.jsxs)("div",{className:(0,n.cn)("min-h-[50vh] flex flex-col items-center justify-center space-y-4 w-full",t),children:[(0,a.jsx)(r.A,{className:"h-10 w-10 animate-spin text-primary"}),i&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground animate-pulse",children:i})]}):"inline"===s?(0,a.jsxs)("div",{className:(0,n.cn)("inline-flex items-center space-x-2",t),children:[(0,a.jsx)(r.A,{className:"h-4 w-4 animate-spin text-primary"}),i&&(0,a.jsx)("span",{className:"text-sm text-muted-foreground",children:i})]}):(0,a.jsxs)("div",{className:(0,n.cn)("flex flex-col items-center justify-center p-8 space-y-3 w-full",t),children:[(0,a.jsx)(r.A,{className:"h-8 w-8 animate-spin text-primary"}),i&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:i})]})}},81477:(e,t,s)=>{"use strict";s.d(t,{BT:()=>d,Wu:()=>c,ZB:()=>l,Zp:()=>n,aR:()=>i});var a=s(95155);s(12115);var r=s(40980);function n(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card",className:(0,r.cn)("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-2 shadow-sm",t),...s})}function i(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-header",className:(0,r.cn)("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-2 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",t),...s})}function l(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-title",className:(0,r.cn)("leading-none font-semibold",t),...s})}function d(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-description",className:(0,r.cn)("text-muted-foreground text-sm",t),...s})}function c(e){let{className:t,...s}=e;return(0,a.jsx)("div",{"data-slot":"card-content",className:(0,r.cn)("px-6",t),...s})}},89455:(e,t,s)=>{Promise.resolve().then(s.bind(s,57058))}},e=>{e.O(0,[8409,2439,9431,1038,7189,6223,1360,8441,3794,7358],()=>e(e.s=89455)),_N_E=e.O()}]);

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.