PageSourceSearch

https://xynergy.ai/_next/static/chunks/app/advisor/page-662fd1781ce5eaa1.js

js xynergy.ai collected 2026-10-05 16:01:30 UTC 90,262 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1641,7465],{2134:(e,t,r)=>{"use strict";function s(e){let t=e.getFullYear(),r=e.getMonth();return{start:new Date(t,r,1,0,0,0,0),end:new Date(t,r+1,0,23,59,59,999)}}function a(e){if(!e)return null;try{let{Timestamp:t}=r(20752);if(e instanceof t)return e.toDate()}catch{}if(e instanceof Date)return isNaN(e.getTime())?null:new Date(e.getTime());if("string"==typeof e){let t=new Date(e);return isNaN(t.getTime())?null:t}if("object"==typeof e){if("toDate"in e&&"function"==typeof e.toDate)try{let t=e.toDate();if(t instanceof Date&&!isNaN(t.getTime()))return t}catch{}if("seconds"in e&&"number"==typeof e.seconds&&"nanoseconds"in e&&"number"==typeof e.nanoseconds)try{let{Timestamp:t}=r(20752),s=new t(e.seconds,e.nanoseconds).toDate();if(s instanceof Date&&!isNaN(s.getTime()))return s}catch{}}return null}function l(){let e=new Date,t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${s}`}function i(e=30){let t=new Date;return new Date(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate()+e)).toISOString().split("T")[0]}function n(e=30){let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+e),s=r.getFullYear(),a=String(r.getMonth()+1).padStart(2,"0"),l=String(r.getDate()).padStart(2,"0");return`${s}-${a}-${l}`}function o(e){let[t,r,s]=e.split("-").map(Number);return new Date(Date.UTC(t,r-1,s))}function d(e,t,r,s){return e&&t&&r&&s?e.filter(e=>{let a=s(e);return!(!a||!(a instanceof Date)||isNaN(a.getTime()))&&a>=t&&a<=r}):[]}function c(e){let t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())),r=t.getUTCDay()||7;t.setUTCDate(t.getUTCDate()+4-r);let s=new Date(Date.UTC(t.getUTCFullYear(),0,1));return Math.ceil(((t.getTime()-s.getTime())/864e5+1)/7)}r.d(t,{$L:()=>d,OG:()=>a,QW:()=>c,Qv:()=>s,SD:()=>o,ll:()=>n,o0:()=>i,ri:()=>l})},3953:(e,t,r)=>{"use strict";r.d(t,{AM:()=>n,Wv:()=>o,dT:()=>d,hl:()=>c});var s=r(85047),a=r(31615),l=r(79068),i=r(34961);let n=l.bL,o=l.l9,d=l.Mz,c=a.forwardRef(({className:e,align:t="center",sideOffset:r=4,...a},n)=>(0,s.jsx)(l.ZL,{children:(0,s.jsx)(l.UC,{ref:n,align:t,sideOffset:r,className:(0,i.cn)("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",e),...a})}));c.displayName=l.UC.displayName},10892:(e,t,r)=>{"use strict";r.d(t,{T:()=>i});var s=r(85047),a=r(31615),l=r(34961);let i=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("textarea",{className:(0,l.cn)("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:r,...t}));i.displayName="Textarea"},14022:(e,t,r)=>{"use strict";r.d(t,{getTierConfig:()=>a,nU:()=>l});let s={rookie:{id:"rookie",name:"新手",color:"#94A3B8",minUniqueClients:0,minRating:0,maxFee:null,order:0},normal:{id:"normal",name:"普通",color:"#8B7355",minUniqueClients:10,minRating:4.5,maxFee:3e3,order:1},elite:{id:"elite",name:"菁英",color:"#C0C0C0",minUniqueClients:100,minRating:4.5,maxFee:12e3,order:2},epic:{id:"epic",name:"史詩",color:"#FFD700",minUniqueClients:1e3,minRating:4.5,maxFee:24e3,order:3},legendary:{id:"legendary",name:"傳說",color:"#9B59B6",minUniqueClients:1e4,minRating:4.5,maxFee:null,order:4},special:{id:"special",name:"特殊",color:"#E74C3C",minUniqueClients:0,minRating:0,maxFee:null,order:5},gm:{id:"gm",name:"GM",color:"#991B1B",minUniqueClients:0,minRating:0,maxFee:null,order:6}};function a(e){return s[e]}function l(){return Object.values(s).sort((e,t)=>e.order-t.order)}},18534:(e,t,r)=>{"use strict";r.d(t,{Cf:()=>x,Es:()=>f,HM:()=>m,L3:()=>g,c7:()=>h,lG:()=>o,rr:()=>p,zM:()=>d});var s=r(85047),a=r(31615),l=r(49083),i=r(42165),n=r(34961);let o=l.bL,d=l.l9,c=l.ZL,m=l.bm,u=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.hJ,{ref:r,className:(0,n.cn)("fixed inset-0 z-50 bg-black/80 transition-opacity duration-200 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:opacity-0 data-[state=closed]:pointer-events-none",e),...t}));u.displayName=l.hJ.displayName;let x=a.forwardRef(({className:e,children:t,asChild:r,overlayClassName:a,...o},d)=>{let m=(0,n.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rou
1nded-lg",e);return r?(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{className:a}),(0,s.jsx)(l.UC,{ref:d,className:m,asChild:!0,...o,children:t})]}):(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{className:a}),(0,s.jsxs)(l.UC,{ref:d,className:m,...o,children:[t,(0,s.jsxs)(l.bm,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[(0,s.jsx)(i.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});x.displayName=l.UC.displayName;let h=({className:e,...t})=>(0,s.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});h.displayName="DialogHeader";let f=({className:e,...t})=>(0,s.jsx)("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});f.displayName="DialogFooter";let g=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.hE,{ref:r,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));g.displayName=l.hE.displayName;let p=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.VY,{ref:r,className:(0,n.cn)("text-sm text-muted-foreground",e),...t}));p.displayName=l.VY.displayName},21016:(e,t,r)=>{"use strict";r.d(t,{Fc:()=>o,TN:()=>c,XL:()=>d});var s=r(85047),a=r(31615),l=r(63610),i=r(34961);let n=(0,l.F)("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),o=a.forwardRef(({className:e,variant:t,...r},a)=>(0,s.jsx)("div",{ref:a,role:"alert",className:(0,i.cn)(n({variant:t}),e),...r}));o.displayName="Alert";let d=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("h5",{ref:r,className:(0,i.cn)("mb-1 font-medium leading-none tracking-tight",e),...t}));d.displayName="AlertTitle";let c=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("div",{ref:r,className:(0,i.cn)("text-sm [&_p]:leading-relaxed",e),...t}));c.displayName="AlertDescription"},21582:(e,t,r)=>{"use strict";r.d(t,{bq:()=>u,eb:()=>g,gC:()=>f,l6:()=>c,yv:()=>m});var s=r(85047),a=r(31615),l=r(63824),i=r(26345),n=r(92788),o=r(68341),d=r(34961);let c=l.bL;l.YJ;let m=l.WT,u=a.forwardRef(({className:e,children:t,...r},a)=>(0,s.jsxs)(l.l9,{ref:a,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,(0,s.jsx)(l.In,{asChild:!0,children:(0,s.jsx)(i.A,{className:"h-4 w-4 opacity-50"})})]}));u.displayName=l.l9.displayName;let x=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.PP,{ref:r,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",e),...t,children:(0,s.jsx)(n.A,{className:"h-4 w-4"})}));x.displayName=l.PP.displayName;let h=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.wn,{ref:r,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",e),...t,children:(0,s.jsx)(i.A,{className:"h-4 w-4"})}));h.displayName=l.wn.displayName;let f=a.forwardRef(({className:e,children:t,position:r="popper",...a},i)=>(0,s.jsx)(l.ZL,{children:(0,s.jsxs)(l.UC,{ref:i,className:(0,d.cn)("relative z-[70] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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","popper"===r&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a,children:[(0,s.jsx)(x,{}),(0,s.jsx)(l.LM,{className:(0,d.cn)("p-1","popper"===r&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,s.jsx)(h,{})]})}));f.displayName=l.UC.displayName,a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.JU,{ref:r,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t})).displayName=l.JU.displayName;let g=a.forwardRef(({className:e,children:t,...r},a)=>(0,s.jsxs)(l.q7,{ref:a,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(l.VF,{children:(0,s.jsx)(o.A,{className:"h-4 w-4"})})}),(0,s.jsx)(l.p4,{children:t})]}));g.displayName=l.q7.displayName,a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.wv,{ref:r,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",e),...t})).displayName=l.wv.displayName},30834:e=>{e.exports={svg:"LogoLoader_svg__K_m18",bgCircle:"LogoLoader_bgCircle__I9a0P",ringOuter:"LogoLoader_ringOuter__MOHXw",ringInner:"LogoLoader_ringInner__f3O_A",triTop:"LogoLoader_triTop__GNYgx",triBl:"LogoLoader_triBl__rI1Ka",triBr:"LogoLoader_triBr__uR9KW",orbit1:"LogoLoader_orbit1__fs26i",orbit2:"LogoLoader_orbit2__XhKZ2",orbit3:"LogoLoader_orbit3__e4hO3",orbitCounter:"LogoLoader_orbitCounter__vpKzS",triOutlineTop:"LogoLoader_triOutlineTop__mDP5N",triOutlineBl:"LogoLoader_triOutlineBl__iVjAO",triOutlineBr:"LogoLoader_triOutlineBr__v3z0a",comet:"LogoLoader_comet__mL9zX",cometThin:"LogoLoader_cometThin__WPzgT",orbit:"LogoLoader_orbit__NJhb0",bgShift:"LogoLoader_bgShift__b2JcU",rotCw:"LogoLoader_rotCw__eCgi_",rotCcw:"LogoLoader_rotCcw__G86Ks",triFlyTop:"LogoLoader_triFlyTop__dt_UM",triFlyBl:"LogoLoader_triFlyBl__BHPtH",triFlyBr:"LogoLoader_triFlyBr__6mkHr",orbitCw:"LogoLoader_orbitCw__SzhUp",orbitCcw:"LogoLoader_orbitCcw__EK7PG",outline:"LogoLoader_outline__9LjpJ",olBgIn:"LogoLoader_olBgIn__z4VpU",olRingOuter:"LogoLoader_olRingOuter__GGZ7h",olRingInner:"LogoLoader_olRingInner__xanAk",olTriStrokeTop:"LogoLoader_olTriStrokeTop__Rw8NR",olTriStrokeBl:"LogoLoader_olTriStrokeBl__VjX5L",olTriStrokeBr:"LogoLoader_olTriStrokeBr___wAAB",triFillTop:"LogoLoader_triFillTop__5VxIo",olTriFillTop:"LogoLoader_olTriFillTop__GD8CV",triFillBl:"LogoLoader_triFillBl__yQQYX",olTriFillBl:"LogoLoader_olTriFillBl__YAGZS",triFillBr:"LogoLoader_triFillBr__jIkwr",olTriFillBr:"LogoLoader_olTriFillBr__mpbgE",cometGroup:"LogoLoader_cometGroup__k9pBP",olCometIn:"LogoLoader_olCometIn__6KPhH",comet1:"LogoLoader_comet1__Uig7S",comet2:"LogoLoader_comet2__swgHT"}},38025:(e,t,r)=>{"use strict";r.d(t,{BE:()=>m,I6:()=>h,_s:()=>n,gk:()=>x,tb:()=>u,zj:()=>c});var s=r(85047),a=r(31615),l=r(80255),i=r(34961);
1let n=({shouldScaleBackground:e=!0,...t})=>(0,s.jsx)(l._s.Root,{shouldScaleBackground:e,...t});n.displayName="Drawer",l._s.Trigger;let o=l._s.Portal;l._s.Close;let d=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l._s.Overlay,{ref:r,className:(0,i.cn)("fixed inset-0 z-50 bg-black/80",e),...t}));d.displayName=l._s.Overlay.displayName;let c=a.forwardRef(({className:e,children:t,...r},a)=>(0,s.jsxs)(o,{children:[(0,s.jsx)(d,{}),(0,s.jsxs)(l._s.Content,{ref:a,className:(0,i.cn)("fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",e),...r,children:[(0,s.jsx)("div",{className:"mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted"}),t]})]}));c.displayName="DrawerContent";let m=({className:e,...t})=>(0,s.jsx)("div",{className:(0,i.cn)("grid gap-1.5 p-4 text-center sm:text-left",e),...t});m.displayName="DrawerHeader";let u=({className:e,...t})=>(0,s.jsx)("div",{className:(0,i.cn)("mt-auto flex flex-col gap-2 p-4",e),...t});u.displayName="DrawerFooter";let x=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l._s.Title,{ref:r,className:(0,i.cn)("text-lg font-semibold leading-none tracking-tight",e),...t}));x.displayName=l._s.Title.displayName;let h=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l._s.Description,{ref:r,className:(0,i.cn)("text-sm text-muted-foreground",e),...t}));h.displayName=l._s.Description.displayName},38187:(e,t,r)=>{"use strict";r.d(t,{E:()=>o});var s=r(85047),a=r(31615),l=r(63610),i=r(34961);let n=(0,l.F)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}}),o=a.forwardRef(({className:e,variant:t,...r},a)=>(0,s.jsx)("div",{ref:a,className:(0,i.cn)(n({variant:t}),e),...r}));o.displayName="Badge"},54306:(e,t,r)=>{"use strict";r.d(t,{default:()=>m});var s=r(85047),a=r(31615),l=r(34961),i=r(30834),n=r.n(i);let o="0,-90 -39,-22.5 39,-22.5",d="-78,45 0,45 -39,-22.5",c="0,45 78,45 39,-22.5";function m({variant:e="orbit",size:t=96,text:r="",fullScreen:i=!1,className:u}){let x=(0,a.useId)().replace(/:/g,""),h=`xll-bg-${x}`,f=`xll-gold-${x}`,g=(0,s.jsxs)("svg",{className:(0,l.cn)(n().svg,n()[e]),viewBox:"-160 -160 320 320",width:t,height:t,role:"img","aria-label":"鑫世紀理財載入中",children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:h,x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#3B82F6"}),(0,s.jsx)("stop",{offset:"50%",stopColor:"#7C3AED"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#8B5CF6"})]}),(0,s.jsxs)("linearGradient",{id:f,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#FBBF24"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#EAB308"})]})]}),(0,s.jsx)("circle",{className:n().bgCircle,cx:"0",cy:"0",r:"148",fill:`url(#${h})`}),"orbit"===e?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{className:n().ringOuter,cx:"0",cy:"0",r:"110",fill:"none",stroke:`url(#${f})`,strokeWidth:"5"}),(0,s.jsx)("circle",{className:n().ringInner,cx:"0",cy:"0",r:"100",fill:"none",stroke:`url(#${f})`,strokeWidth:"2.5",opacity:"0.7"}),(0,s.jsx)("circle",{className:(0,l.cn)(n().comet,n().orbit1),cx:"0",cy:"0",r:"110",transform:"rotate(-90)"}),(0,s.jsx)("circle",{className:(0,l.cn)(n().comet,n().cometThin,n().orbit2),cx:"0",cy:"0",r:"110",transform:"rotate(-90)"}),(0,s.jsx)("circle",{className:(0,l.cn)(n().comet,n().cometThin,n().orbit3),cx:"0",cy:"0",r:"110",transform:"rotate(-90)"}),(0,s.jsx)("circle",{className:(0,l.cn)(n().comet,n().cometThin,n().orbitCounter),cx:"0",cy:"0",r:"100",transform:"rotate(-90)"}),(0,s.jsx)("polygon",{className:n().triTop,points:o,fill:`url(#${f})`}),(0,s.jsx)("polygon",{className:n().triBl,points:d,fill:`url(#${f})`}),(0,s.jsx)("polygon",{className:n().triBr,points:c,fill:`url(#${f})`})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:"0",cy:"0",r:"148",fill:"none",stroke:"rgba(125,150,255,0.2)",strokeWidth:"1"}),(0,s.jsx)("circle",{className:n().ringOuter,cx:"0",cy:"0",r:"110",fill:"none",stroke:`url(#${f})`,strokeWidth:"5",strokeLinecap:"round"}),(0,s.jsx)("circle",{className:n().ringInner,cx:"0",cy:"0",r:"100",fill:"none",stroke:`url(#${f})`,strokeWidth:"2.5",strokeLinecap:"round",opacity:"0.7"}),(0,s.jsx)("polygon",{className:n().triOutlineTop,points:o,pathLength:100,fill:"none",stroke:"#FBBF24",strokeWidth:"2.5",strokeLinejoin:"round"}),(0,s.jsx)("polygon",{className:n().triOutlineBl,points:d,pathLength:100,fill:"none",stroke:"#FBBF24",strokeWidth:"2.5",strokeLinejoin:"round"}),(0,s.jsx)("polygon",{className:n().triOutlineBr,points:c,pathLength:100,fill:"none",stroke:"#FBBF24",strokeWidth:"2.5",strokeLinejoin:"round"}),(0,s.jsx)("polygon",{className:n().triFillTop,points:o,fill:`url(#${f})`}),(0,s.jsx)("polygon",{className:n().triFillBl,points:d,fill:`url(#${f})`}),(0,s.jsx)("polygon",{className:n().triFillBr,points:c,fill:`url(#${f})`}
1),(0,s.jsxs)("g",{className:n().cometGroup,children:[(0,s.jsx)("circle",{className:(0,l.cn)(n().comet,n().comet1),cx:"0",cy:"0",r:"110",transform:"rotate(-90)"}),(0,s.jsx)("circle",{className:(0,l.cn)(n().comet,n().cometThin,n().comet2),cx:"0",cy:"0",r:"100",transform:"rotate(-90)"})]})]})]}),p=(0,s.jsxs)("div",{className:(0,l.cn)("flex flex-col items-center justify-center gap-4 text-center",u),children:[(0,s.jsx)("div",{style:{width:t,height:t},children:g}),r?(0,s.jsx)("p",{className:"text-muted-foreground text-sm",children:r}):null]});return i?(0,s.jsx)("div",{className:"flex min-h-screen items-center justify-center bg-background",children:p}):p}},62557:(e,t,r)=>{"use strict";r.d(t,{S:()=>o});var s=r(85047),a=r(31615),l=r(2817),i=r(68341),n=r(34961);let o=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.bL,{ref:r,className:(0,n.cn)("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:(0,s.jsx)(l.C1,{className:(0,n.cn)("flex items-center justify-center text-current"),children:(0,s.jsx)(i.A,{className:"h-4 w-4"})})}));o.displayName=l.bL.displayName},68916:(e,t,r)=>{Promise.resolve().then(r.bind(r,90044))},79705:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});var s=r(85047),a=r(31615),l=r(94788),i=r(34961);let n=a.forwardRef(({className:e,...t},r)=>(0,s.jsxs)(l.bL,{ref:r,className:(0,i.cn)("relative flex w-full touch-none select-none items-center",e),...t,children:[(0,s.jsx)(l.CC,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:(0,s.jsx)(l.Q6,{className:"absolute h-full bg-primary"})}),(0,s.jsx)(l.zi,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));n.displayName=l.bL.displayName},80712:(e,t,r)=>{"use strict";r.d(t,{k:()=>U,v:()=>P});var s=r(85047),a=r(31615),l=r(24571),i=r(18534),n=r(11787),o=r(84569),d=r(73521),c=r(41178),m=r(34961),u=r(35347),x=r(93806),h=r(77405),f=r(18654),g=r(44832),p=r(8058),b=r(85084),v=r(60373),j=r(38187),N=r(79579);function y({rooms:e,selectedRoomId:t,onSelectRoom:r,currentUserId:a,isLoading:l,isAdvisor:i,selectedRoom:o,isMobile:d=!1}){let c=o&&!e.some(e=>e.id===o.id)?[o,...e]:e;return(0,s.jsx)("div",{className:(0,m.cn)("flex flex-col",d?"w-full":"w-80 border-r"),children:(0,s.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[(0,s.jsx)("div",{className:"p-4 border-b",children:(0,s.jsx)("h3",{className:"font-semibold",children:"對話"})}),(0,s.jsxs)("div",{className:"p-2",children:[c.map(e=>{let l=e.userId===a,n=l?e.advisorName||"顧問":e.userDisplayName||"用戶",o=l?e.advisorAvatar:null,d=i?e.unreadCountAdvisor:e.unreadCountUser;return(0,s.jsx)("button",{onClick:()=>r(e),className:(0,m.cn)("w-full p-3 rounded-lg transition-colors text-left",t===e.id?"bg-accent":"hover:bg-accent/50"),children:(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[l?(0,s.jsx)(v.eu,{className:"h-10 w-10",children:o?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v.BK,{src:o,alt:n}),(0,s.jsx)(v.q5,{children:n.substring(0,2)})]}):(0,s.jsx)(v.q5,{children:n.substring(0,2)})}):(0,s.jsx)(N.H,{userId:e.userId,size:"medium",className:"h-10 w-10"}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"font-medium truncate",children:n}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground truncate",children:e.lastMessage||"尚未有訊息"})]}),d>0&&(0,s.jsx)(j.E,{variant:"destructive",className:"ml-auto",children:d>99?"99+":d})]})},e.id)}),l&&0===e.length&&(0,s.jsx)("div",{className:"flex items-center justify-center py-8",children:(0,s.jsx)(n.A,{className:"h-6 w-6 animate-spin text-muted-foreground"})}),!l&&0===e.length&&!o&&(0,s.jsx)("div",{className:"text-center text-muted-foreground py-8",children:(0,s.jsx)("p",{children:i?"目前沒有聊天對象":"目前沒有聊天室"})})]})]})})}var w=r(21410),C=r(866),_=r(56560);let k=a.forwardRef(({className:e,children:t,...r},a)=>(0,s.jsxs)(_.bL,{ref:a,className:(0,m.cn)("relative overflow-hidden",e),...r,children:[(0,s.jsx)(_.LM,{className:"h-full w-full rounded-[inherit]",children:t}),(0,s.jsx)(A,{}),(0,s.jsx)(_.OK,{})]}));k.displayName=_.bL.displayName;let A=a.forwardRef(({className:e,orientation:t="vertical",...r},a)=>(0,s.jsx)(_.VM,{ref:a,orientation:t,className:(0,m.cn)("flex touch-none select-none transition-colors","vertical"===t&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===t&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:(0,s.jsx)(_.lr,{className:"relative flex-1 rounded-full bg-border"})}));A.displayName=_.VM.displayName;var L=r(48113),S=r(97839),T=r(62937),R=r(54296),D=r(52226),I=r(81154),F=r(9789);function E({room:e,selectedAdvisor:t,messages:r,currentUserId:l,isAdvisor:i,inputValue:o,onInputChange:u,onSendMessage:x,isSending:h,onKeyPress:f,isLoadingMessages:g=!1,onRoomDeleted:p,isMobile:b=!1,onBack:j,onRetry:y}){let _=(0,a.useRef)(null),{user:A}=(0,d.A)(),{toast:B}=(0,c.dj)(),[M,$]=(0,a.useState)(!1),[z,O]=(0,a.useState)(!1);(0,a.useEffect)(()=>{_.current?.scrollIntoView({behavior:"smooth"})},[r]);
1let G=e.userId===l,U=G?e.advisorName||t?.name||"顧問":e.userDisplayName||"用戶",P=G?"財務顧問":e.userEmail||"用戶",V=async()=>{if(A){O(!0);try{let t=await A.getIdToken(),r=await fetch(`/api/chat/rooms/${encodeURIComponent(e.id)}`,{method:"DELETE",headers:{Authorization:`Bearer ${t}`}});if(!r.ok){let e=await r.json().catch(()=>({})),t=e?.error||r.statusText||"刪除失敗";B({title:"刪除失敗",description:t,variant:"destructive"});return}$(!1),p?.(e.id)}catch{B({title:"刪除失敗",description:"請稍後再試。",variant:"destructive"})}finally{O(!1)}}},H=G?(0,s.jsxs)(v.eu,{children:[(0,s.jsx)(v.BK,{src:e.advisorAvatar||t?.avatar,alt:U}),(0,s.jsx)(v.q5,{children:(U||"顧").substring(0,2)})]}):(0,s.jsx)(N.H,{userId:e.userId,size:"medium"}),q=(0,s.jsxs)(S.rI,{children:[(0,s.jsx)(S.ty,{asChild:!0,children:(0,s.jsx)(w.$,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0",children:(0,s.jsx)(T.A,{className:"h-4 w-4"})})}),(0,s.jsx)(S.SQ,{align:"end",children:(0,s.jsxs)(S._2,{className:"text-destructive focus:text-destructive",onClick:()=>$(!0),children:[(0,s.jsx)(R.A,{className:"h-4 w-4"}),"刪除聊天室"]})})]});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"p-4 border-b border-border flex items-center gap-3",children:b?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w.$,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0 -ml-2",onClick:j,"aria-label":"返回",children:(0,s.jsx)(D.A,{className:"h-5 w-5"})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0 text-center",children:[(0,s.jsx)("div",{className:"font-semibold truncate text-foreground",children:U}),(0,s.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:P})]}),H,q]}):(0,s.jsxs)(s.Fragment,{children:[H,(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"font-semibold text-foreground",children:U}),(0,s.jsx)("div",{className:"text-sm text-muted-foreground",children:P})]}),q]})}),(0,s.jsx)(L.Lt,{open:M,onOpenChange:$,children:(0,s.jsxs)(L.EO,{children:[(0,s.jsxs)(L.wd,{children:[(0,s.jsx)(L.r7,{children:"刪除聊天室"}),(0,s.jsx)(L.$v,{children:"確定要刪除此聊天室嗎?此操作將永久刪除所有訊息且無法復原。"})]}),(0,s.jsxs)(L.ck,{children:[(0,s.jsx)(L.Zr,{disabled:z,children:"取消"}),(0,s.jsx)(L.Rx,{onClick:e=>{e.preventDefault(),V()},disabled:z,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:z?(0,s.jsx)(n.A,{className:"h-4 w-4 animate-spin"}):"刪除"})]})]})}),(0,s.jsx)(k,{className:"flex-1 p-4",children:(0,s.jsxs)("div",{className:"space-y-4",children:[g&&0===r.length?(0,s.jsx)("div",{className:"space-y-4",children:[1,2,3].map(e=>(0,s.jsxs)("div",{className:(0,m.cn)("flex gap-3",e%2==0?"flex-row-reverse":"flex-row"),children:[(0,s.jsx)("div",{className:"h-8 w-8 rounded-full bg-muted animate-pulse flex-shrink-0"}),(0,s.jsxs)("div",{className:"flex flex-col gap-1 max-w-[70%]",children:[(0,s.jsx)("div",{className:"rounded-lg px-4 py-2 bg-muted animate-pulse h-10 w-32"}),(0,s.jsx)("div",{className:"h-3 w-12 bg-muted animate-pulse rounded"})]})]},e))}):0===r.length?(0,s.jsx)("div",{className:"flex flex-col items-center justify-center py-12 text-center text-muted-foreground",children:(0,s.jsx)("p",{children:"尚無訊息,開始對話吧"})}):r.map(r=>{let a=r.senderId===l,i=function(e){if(!e)return"";try{let t=e.toDate(),r=new Date,s=new Date(r.getFullYear(),r.getMonth(),r.getDate());if(new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()===s.getTime())return t.toLocaleTimeString("zh-TW",{hour:"2-digit",minute:"2-digit"});return t.toLocaleString("zh-TW",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}(r.createdAt)||"--",n=null!=r.readAt?"已讀":null,o="sending"===r.status,d="failed"===r.status;return(0,s.jsxs)("div",{className:(0,m.cn)("flex gap-3",a?"flex-row-reverse":"flex-row"),children:[(()=>{if(a)return(0,s.jsx)(N.H,{userId:l,size:"small",className:"h-8 w-8 flex-shrink-0"});if("user"===r.senderType)return(0,s.jsx)(N.H,{userId:e.userId,size:"small",className:"h-8 w-8 flex-shrink-0"});
1let i=e.advisorAvatar||t?.avatar,n=e.advisorName||t?.name||"顧問";return(0,s.jsxs)(v.eu,{className:"h-8 w-8 flex-shrink-0",children:[(0,s.jsx)(v.BK,{src:i||void 0,alt:n}),(0,s.jsx)(v.q5,{children:(n||"顧").substring(0,2)})]})})(),(0,s.jsxs)("div",{className:(0,m.cn)("flex flex-col gap-1 max-w-[70%]",a?"items-end":"items-start"),children:[(0,s.jsx)("div",{className:(0,m.cn)("rounded-2xl px-4 py-2",a?"bg-primary text-primary-foreground":"bg-muted",o&&"opacity-70"),children:(0,s.jsx)("p",{className:"text-sm whitespace-pre-wrap break-words",children:r.content||""})}),!d&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:i}),a&&o&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:"傳送中…"}),a&&d&&(0,s.jsxs)("button",{type:"button",onClick:()=>y?.(r),className:"flex items-center gap-1 text-xs text-destructive hover:underline",children:[(0,s.jsx)(I.A,{className:"h-3 w-3"}),"傳送失敗,點擊重試"]}),a&&!o&&!d&&(0,s.jsx)("span",{className:"text-xs text-muted-foreground",children:n??"已送達"})]})]},r.id)}),(0,s.jsx)("div",{ref:_})]})}),(0,s.jsx)("div",{className:"p-4 border-t border-border",children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(C.p,{value:o,onChange:e=>{let t=e.target.value;t.length<=500&&u(t)},onKeyPress:f,placeholder:"輸入訊息...",disabled:h,maxLength:500,className:"rounded-full border-border/60 bg-muted/40 px-4 focus-visible:ring-1 focus-visible:ring-accent"}),(0,s.jsx)(w.$,{onClick:x,disabled:!o.trim()||h,size:"icon",className:"rounded-full flex-shrink-0 bg-gradient-to-br from-blue-500 to-purple-500 text-white hover:opacity-90 disabled:opacity-40",children:h?(0,s.jsx)(n.A,{className:"h-4 w-4 animate-spin"}):(0,s.jsx)(F.A,{className:"h-4 w-4"})})]})})]})}var B=r(54611),M=r(31862);function $({open:e,onOpenChange:t,preselectedAdvisorId:r}){let{user:v}=(0,d.A)(),{toast:j}=(0,c.dj)(),{isAdvisor:N}=(0,u.b)(),{advisor:w,loading:C}=(0,x.s)(),_=(0,h.a)(),{displayName:k}=(0,M.M)(v?.uid),[A,L]=(0,a.useState)(null),[S,T]=(0,a.useState)(null),[R,D]=(0,a.useState)(""),[I,F]=(0,a.useState)(!1),[z,O]=(0,a.useState)([]),G=(0,a.useRef)(0),{chatRooms:U,isLoading:P}=function({userId:e,isAdvisor:t,advisorId:r,enabled:s=!0}){let[l,i]=(0,a.useState)([]),[n,o]=(0,a.useState)(!0),[d,c]=(0,a.useState)(null),m=r??null;return(0,a.useEffect)(()=>{if(!s||!e){i([]),o(!0),c(null);return}i([]),o(!0),c(null);let r=e=>{i(e),o(!1),c(null)},a=t?g.M.getAdvisorChatRooms(m,e,r):g.M.getUserChatRooms(e,r);return()=>{a()}},[s,e,t,m]),{chatRooms:l,isLoading:n,error:d}}({userId:v?.uid??null,isAdvisor:N,advisorId:w?.id,enabled:e&&!!v&&(!N||!C)}),{messages:V,isLoading:H}=function({chatRoomId:e,enabled:t=!0}){let[r,s]=(0,a.useState)([]),[l,i]=(0,a.useState)(!0),[n,o]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(!t||!e){s([]),i(!1),o(null);return}s([]),i(!0),o(null);let r=p.s.getMessages(e,e=>{s(e),i(!1),o(null)});return()=>{r(),i(!1)}},[t,e]),{messages:r,isLoading:l,error:n}}({chatRoomId:S?.id??null,enabled:!!S});(0,a.useEffect)(()=>{if(!e||!v||!r)return;let t=!1;return F(!0),b.advisorOperations.getAllAdvisors().then(async e=>{if(t)return;let s=e.find(e=>e.id===r);if(s){L(s);let e=await (0,B.L)(v.uid)||v.displayName||void 0;return g.M.createChatRoom(v.uid,s.id,s.name,s.avatar,e,v.email||void 0)}}).then(e=>{!t&&e&&T(e)}).catch(e=>{t||((0,f.vV)("載入顧問或建立聊天室失敗",e),j({title:"錯誤",description:"無法開啟聊天,請稍後再試。",variant:"destructive"}))}).finally(()=>{t||F(!1)}),()=>{t=!0}},[e,v,r,j]),(0,a.useEffect)(()=>{A&&v&&(async()=>{try{let e=await (0,B.L)(v.uid)||v.displayName||void 0,t=await g.M.createChatRoom(v.uid,A.id,A.name,A.avatar,e,v.email||void 0);T(t)}catch(e){(0,f.vV)("建立聊天室失敗:",e),j({title:"錯誤",description:"無法建立聊天室,請稍後再試。",variant:"destructive"})}})()},[A,v,j]),(0,a.useEffect)(()=>{S&&v&&(async()=>{try{await p.s.markMessagesAsRead(S.id,v.uid)}catch(e){(0,f.vV)("標記已讀失敗:",e)}})()},[S,v]),(0,a.useEffect)(()=>{let e=S?.id;e?O(t=>t.filter(t=>t.roomId===e)):O([])},[S?.id]);let q=(0,a.useCallback)(async e=>{O(t=>t.map(t=>t.tempId===e.tempId?{...t,status:"sending"}:t));try{await p.s.sendMessage(e.roomId,e.senderId,e.senderType,e.senderName,e.content),G.current=Date.now(),O(t=>t.filter(t=>t.tempId!==e.tempId))}
1catch(t){(0,f.vV)("發送訊息失敗:",t),O(t=>t.map(t=>t.tempId===e.tempId?{...t,status:"failed"}:t)),j({title:"發送失敗",description:t instanceof Error?t.message:"無法發送訊息,請稍後再試。",variant:"destructive"})}},[j]),W=(0,a.useCallback)(async()=>{if(!R.trim()||!S||!v||Date.now()-G.current<1e3)return;let e=S.userId===v.uid,t=null!=w&&S.advisorId===w.id;if(!e&&!t)return void j({title:"無權限發送",description:"您不是此聊天室的參與者。",variant:"destructive"});let r=R.trim();if(r.length>500)return void j({title:"訊息過長",description:"訊息內容最多 500 字。",variant:"destructive"});let s=e?k||v.displayName||v.email?.split("@")[0]||"用戶":S.advisorName||w?.name||"顧問",a=`local-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,i={id:a,tempId:a,roomId:S.id,senderId:v.uid,senderType:e?"user":"advisor",senderName:s,content:r,createdAt:l.Timestamp.now(),readAt:null,status:"sending"};D(""),G.current=Date.now(),O(e=>[...e,i]),await q(i)},[R,S,v,j,w,q,k]),K=(0,a.useCallback)(e=>{if(!e.tempId)return;let t=z.find(t=>t.tempId===e.tempId);t&&q(t)},[z,q]),Y=(0,a.useMemo)(()=>{let e=S?.id;if(!e)return V;let t=z.filter(t=>t.roomId===e);return 0===t.length?V:[...V,...t]},[V,z,S?.id]),J=!!A&&!S,Z=I||J,Q=!!S||Z,X=!_||!Q,ee=!_||Q;return(0,s.jsx)(i.lG,{open:e,onOpenChange:t,children:(0,s.jsxs)(i.Cf,{className:(0,m.cn)("max-w-4xl h-[80vh] flex flex-col p-0",_&&"h-screen w-screen max-w-full max-h-full rounded-none"),children:[(0,s.jsx)(i.c7,{className:(0,m.cn)("px-6 py-4 border-b border-border",_&&"sr-only"),children:(0,s.jsx)(i.L3,{children:"聊天室"})}),(0,s.jsxs)("div",{className:"flex flex-1 overflow-hidden",children:[X&&(0,s.jsx)(y,{rooms:U,selectedRoomId:S?.id??null,onSelectRoom:T,currentUserId:v?.uid,isLoading:P,isAdvisor:N,selectedRoom:S,isMobile:_}),ee&&(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-w-0",children:[Z&&(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-3 text-muted-foreground",children:[(0,s.jsx)(n.A,{className:"h-8 w-8 animate-spin"}),(0,s.jsx)("p",{children:"建立聊天室中…"})]})}),!Z&&S&&(0,s.jsx)(E,{room:S,selectedAdvisor:A,messages:Y,currentUserId:v?.uid,isAdvisor:N,inputValue:R,onInputChange:D,onSendMessage:W,isSending:!1,onKeyPress:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),W())},isLoadingMessages:H,onRoomDeleted:()=>T(null),isMobile:_,onBack:()=>T(null),onRetry:K}),!Z&&!S&&(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center",children:(0,s.jsxs)("div",{className:"text-center text-muted-foreground",children:[(0,s.jsx)(o.A,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),(0,s.jsx)("p",{children:"開始聊天"})]})})]})]})]})})}class z extends a.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){(0,f.vV)("[ErrorBoundary]",{error:e,componentStack:t?.componentStack}),this.props.onError?.(e,t)}render(){return this.state.hasError&&void 0!==this.props.fallback?this.props.fallback:this.state.hasError?null:this.props.children}}let O={openChat:()=>{},closeChat:()=>{},isOpen:!1},G=(0,a.createContext)(O);function U({children:e}){let[t,r]=(0,a.useState)(!1),[l,i]=(0,a.useState)(void 0),n=(0,a.useCallback)(e=>{i(e),r(!0)},[]),o=(0,a.useCallback)(()=>{r(!1),i(void 0)},[]),d=(0,a.useCallback)(e=>{r(e),e||i(void 0)},[]);return(0,s.jsxs)(G.Provider,{value:{openChat:n,closeChat:o,isOpen:t},children:[e,(0,s.jsx)(z,{fallback:null,children:(0,s.jsx)($,{open:t,onOpenChange:d,preselectedAdvisorId:l})})]})}function P(){return(0,a.useContext)(G)??O}},82520:(e,t,r)=>{"use strict";r.d(t,{BT:()=>d,Wu:()=>c,ZB:()=>o,Zp:()=>i,aR:()=>n,wL:()=>m});var s=r(85047),a=r(31615),l=r(34961);let i=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("div",{ref:r,className:(0,l.cn)("rounded-xl border bg-card text-card-foreground shadow",e),...t}));i.displayName="Card";let n=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("div",{ref:r,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",e),...t}));
1n.displayName="CardHeader";let o=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("h3",{ref:r,className:(0,l.cn)("font-semibold leading-none tracking-tight",e),...t}));o.displayName="CardTitle";let d=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("p",{ref:r,className:(0,l.cn)("text-sm text-muted-foreground",e),...t}));d.displayName="CardDescription";let c=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("div",{ref:r,className:(0,l.cn)("p-6 pt-0",e),...t}));c.displayName="CardContent";let m=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)("div",{ref:r,className:(0,l.cn)("flex items-center p-6 pt-0",e),...t}));m.displayName="CardFooter"},90044:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>eg});var s=r(85047),a=r(31615),l=r(26052),i=r.n(l),n=r(46377),o=r(21410),d=r(82520),c=r(63972),m=r(15139),u=r(49187),x=r(41178),h=r(73521),f=r(57381),g=r(90930),p=r(44251),b=r(56785),v=r(15659),j=r(95902),N=r(80712),y=r(18534),w=r(67050),C=r(29414),_=r(33700),k=r(60373),A=r(78308);function L({avatarUrl:e,name:t,className:r,fallbackClassName:l,fallbackMode:i="initials"}){let[n,o]=(0,a.useState)(e),[d,c]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{o(e),c(!1)},[e]),(0,s.jsxs)(k.eu,{className:r,children:[!d&&n&&(0,s.jsx)(k.BK,{src:n,alt:t,onError:()=>{d||c(!0)},onLoad:()=>{c(!1)}}),(0,s.jsx)(k.q5,{className:l,children:"icon"===i?(0,s.jsx)(A.A,{className:"h-5 w-5 text-muted-foreground"}):t.substring(0,2)})]})}var S=r(34619),T=r(57481),R=r(34961),D=r(14022);function I({advisor:e,onClick:t,onCalendarClick:r}){var l;let[i,n]=(0,a.useState)(!1),o=(l=e.rating)>=4.5?{barGradient:"from-sky-300 via-blue-400 to-indigo-400",badgeTone:"bg-sky-500/15 border-sky-400/30 text-sky-50",glow:"shadow-[0_18px_45px_rgba(56,189,248,0.32)]"}:l>=4?{barGradient:"from-sky-300 via-blue-400 to-blue-500",badgeTone:"bg-blue-500/12 border-blue-400/25 text-slate-50",glow:"shadow-[0_16px_38px_rgba(59,130,246,0.28)]"}:l>=3.5?{barGradient:"from-blue-300 via-blue-400 to-cyan-400",badgeTone:"bg-cyan-500/12 border-cyan-400/20 text-slate-50",glow:"shadow-[0_14px_32px_rgba(14,165,233,0.22)]"}:{barGradient:"from-slate-200 via-slate-300 to-slate-400",badgeTone:"bg-white/6 border-white/15 text-slate-100",glow:"shadow-[0_12px_28px_rgba(148,163,184,0.18)]"},d=e.rating/5*100,c=e.yearsOfExperience||0,m=c/30*100,u=e.tier||"rookie";(0,D.getTierConfig)(u);let x={rookie:{border:"border-white/10",bgGradient:"from-slate-950/95 via-slate-900/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(148,163,184,0.08),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(148,163,184,0.08),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.04),rgba(15,23,42,0.75))",glow:"shadow-[0_12px_28px_rgba(148,163,184,0.15)]"},normal:{border:"border-gray-400/60",bgGradient:"from-slate-950/95 via-gray-900/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(156,163,175,0.12),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(156,163,175,0.12),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.05),rgba(15,23,42,0.75))",glow:"shadow-[0_14px_32px_rgba(156,163,175,0.25)]"},elite:{border:"border-blue-500/70",bgGradient:"from-slate-950/95 via-blue-950/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(59,130,246,0.15),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(59,130,246,0.15),transparent_28%),linear-gradient(180deg,rgba(59,130,246,0.08),rgba(15,23,42,0.75))",glow:"shadow-[0_16px_38px_rgba(59,130,246,0.35)]"},epic:{border:"border-purple-500/70",bgGradient:"from-slate-950/95 via-purple-950/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(168,85,247,0.15),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(168,85,247,0.15),transparent_28%),linear-gradient(180deg,rgba(168,85,247,0.08),rgba(15,23,42,0.75))",glow:"shadow-[0_18px_42px_rgba(168,85,247,0.35)]"},legendary:{border:"border-amber-800/70",bgGradient:"from-slate-950/95 via-amber-950/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(146,64,14,0.15),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(146,64,14,0.15),transparent_28%),linear-gradient(180deg,rgba(146,64,14,0.08),rgba(15,23,42,0.75))",glow:"shadow-[0_20px_45px_rgba(146,64,14,0.35)]"},special:{border:"border-cyan-500/70",bgGradient:"from-slate-950/95 via-cyan-950/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(6,182,212,0.15),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(6,182,212,0.15),transparent_28%),linear-gradient(180deg,rgba(6,182,212,0.08),rgba(15,23,42,0.75))",glow:"shadow-[0_18px_42px_rgba(6,182,212,0.35)]"},gm:{border:"border-red-900/70",bgGradient:"from-slate-950/95 via-red-950/95 to-slate-950/95",overlayGradient:"radial-gradient(circle_at_20%_20%,rgba(153,27,27,0.15),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(153,27,27,0.15),transparent_28%),linear-gradient(180deg,rgba(153,27,27,0.08),rgba(15,23,42,0.75))",glow:"shadow-[0_20px_45px_rgba(153,27,27,0.35)]"}},h=x[u]||x.rookie;return(0,s.jsx)(_.P.div,{initial:{opacity:0,y:20}
1,animate:{opacity:1,y:0},transition:{duration:.4},whileHover:{scale:1.05},onHoverStart:()=>n(!0),onHoverEnd:()=>n(!1),className:"relative w-full min-w-0 sm:min-w-[280px] max-w-[320px] aspect-[5/7] cursor-pointer mx-auto",onClick:t,children:(0,s.jsxs)(_.P.div,{className:(0,R.cn)("relative w-full h-full rounded-3xl overflow-hidden border-2 transition-all duration-300 backdrop-blur-xl bg-gradient-to-br",h.bgGradient,h.border,i&&"border-opacity-80",h.glow),children:[(0,s.jsx)("div",{className:"absolute inset-0 pointer-events-none",style:{background:h.overlayGradient}}),(0,s.jsxs)("div",{className:"relative h-full flex flex-col pt-3 pb-2 px-3 sm:pt-4 sm:pb-3 sm:px-4 md:pt-5 md:pb-4 md:px-5 lg:pt-6 lg:pb-5 lg:px-6 text-white min-w-0 overflow-hidden",children:[(0,s.jsx)("div",{className:"text-center mb-1.5 sm:mb-2 md:mb-2.5 min-w-0",children:(0,s.jsx)("p",{className:"text-xs sm:text-sm md:text-base text-white/80 font-semibold truncate px-1",children:e.company||" "})}),(0,s.jsx)("div",{className:"relative mb-2 sm:mb-2.5 md:mb-3 flex items-center justify-center",children:(0,s.jsx)("div",{className:"p-[2px] rounded-full bg-gradient-to-br from-white/15 via-accent/40 to-transparent",children:(0,s.jsx)(_.P.div,{animate:{scale:i?1.05:1},transition:{duration:.3},className:"rounded-full bg-slate-900/80",children:(0,s.jsx)(L,{avatarUrl:e.avatar,name:e.name,className:"h-20 w-20 sm:h-24 sm:w-24 md:h-28 md:w-28 border-4 border-white/20 shadow-lg",fallbackClassName:"text-xl sm:text-2xl bg-slate-800 text-white flex items-center justify-center"})})})}),(0,s.jsx)("div",{className:"text-center mb-1.5 sm:mb-2 md:mb-2.5 min-w-0",children:(0,s.jsx)("h3",{className:"text-sm sm:text-base md:text-lg font-bold drop-shadow-lg truncate px-1",children:e.name})}),(0,s.jsxs)("div",{className:"space-y-1 sm:space-y-1.5 md:space-y-2 mb-1.5 sm:mb-2 md:mb-2.5 min-w-0 flex-shrink-0",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-[9px] sm:text-[10px] md:text-xs mb-0.5 sm:mb-1 md:mb-1.5 min-w-0 gap-1",children:[(0,s.jsxs)("span",{className:"flex items-center gap-0.5 sm:gap-1 flex-shrink-0 min-w-0",children:[(0,s.jsx)(S.A,{className:"h-2 w-2 sm:h-2.5 sm:w-2.5 md:h-3 md:w-3 fill-yellow-400 text-yellow-300 drop-shadow flex-shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:"評分"})]}),(0,s.jsx)("span",{className:"font-bold flex-shrink-0 ml-1",children:e.rating})]}),(0,s.jsx)("div",{className:"h-1.5 sm:h-2 bg-white/10 rounded-full overflow-hidden",children:(0,s.jsx)(_.P.div,{className:(0,R.cn)("h-full bg-gradient-to-r rounded-full",o.barGradient),initial:{width:0},animate:{width:`${d}%`},transition:{duration:.8,delay:.2}})})]}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-[9px] sm:text-[10px] md:text-xs mb-0.5 sm:mb-1 md:mb-1.5 min-w-0 gap-1",children:[(0,s.jsxs)("span",{className:"flex items-center gap-0.5 sm:gap-1 flex-shrink-0 min-w-0",children:[(0,s.jsx)(T.A,{className:"h-2 w-2 sm:h-2.5 sm:w-2.5 md:h-3 md:w-3 flex-shrink-0"}),(0,s.jsx)("span",{className:"truncate",children:"年資"})]}),(0,s.jsxs)("span",{className:"font-bold flex-shrink-0 ml-1 whitespace-nowrap",children:[c," 年"]})]}),(0,s.jsx)("div",{className:"h-1.5 sm:h-2 bg-white/10 rounded-full overflow-hidden",children:(0,s.jsx)(_.P.div,{className:(0,R.cn)("h-full bg-gradient-to-r rounded-full",o.barGradient),initial:{width:0},animate:{width:`${m}%`},transition:{duration:.8,delay:.4}})})]})]}),(0,s.jsx)("div",{className:"mt-auto pt-1.5 sm:pt-2 md:pt-2.5 border-t border-white/20 min-w-0 flex-shrink-0",children:(0,s.jsx)("div",{className:"flex items-center justify-center min-w-0 py-0.5 sm:py-1",children:(0,s.jsxs)("span",{className:"text-xs sm:text-sm md:text-base lg:text-lg font-bold truncate px-1",children:["NT$ ",Number(e.fee||0).toLocaleString()]})})}),(0,s.jsx)("div",{className:"pt-1 sm:pt-1.5 md:pt-2 border-t border-white/10 min-w-0 flex-shrink-0",children:(0,s.jsx)("p",{className:"text-[9px] sm:text-[10px] md:text-xs text-white/60 text-center truncate px-1 whitespace-nowrap py-0.5 sm:py-1",children:"點擊查看詳情"})}),(0,s.jsxs)(_.P.div,{initial:{opacity:0,height:0}
1,animate:{opacity:+!!i,height:i?"auto":0},transition:{duration:.3},className:"overflow-hidden",children:[e.description&&(0,s.jsx)("div",{className:"mt-3 pt-3 border-t border-white/20",children:(0,s.jsx)("p",{className:"text-xs text-white/90 line-clamp-2",children:e.description})}),e.experience&&(0,s.jsxs)("div",{className:"mt-2 text-xs text-white/80",children:[(0,s.jsx)("span",{className:"font-semibold",children:"經驗:"}),e.experience]})]})]})]})})}function F(){return(0,s.jsx)("div",{className:"relative w-full max-w-[280px] h-[420px] mx-auto",children:(0,s.jsxs)(_.P.div,{className:"relative w-full h-full rounded-3xl overflow-hidden border border-white/10 bg-slate-950/80 backdrop-blur-xl",initial:{opacity:0},animate:{opacity:1},children:[(0,s.jsx)("div",{className:"absolute inset-0 pointer-events-none bg-[radial-gradient(circle_at_20%_20%,rgba(59,130,246,0.08),transparent_30%),radial-gradient(circle_at_80%_0%,rgba(99,102,241,0.08),transparent_28%),linear-gradient(180deg,rgba(255,255,255,0.03),rgba(15,23,42,0.8))]"}),(0,s.jsxs)("div",{className:"relative h-full flex flex-col p-4",children:[(0,s.jsx)("div",{className:"relative mb-3 flex items-center justify-center",children:(0,s.jsx)("div",{className:"h-32 w-32 rounded-full bg-slate-800 animate-pulse"})}),(0,s.jsxs)("div",{className:"text-center mb-3",children:[(0,s.jsx)("div",{className:"h-6 w-32 mx-auto bg-slate-800 rounded mb-2 animate-pulse"}),(0,s.jsxs)("div",{className:"flex justify-center gap-2 flex-wrap",children:[(0,s.jsx)("div",{className:"h-5 w-16 bg-slate-800 rounded animate-pulse"}),(0,s.jsx)("div",{className:"h-5 w-16 bg-slate-800 rounded animate-pulse"})]})]}),(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsx)("div",{className:"h-3 w-20 bg-slate-800 rounded mb-1 animate-pulse"}),(0,s.jsx)("div",{className:"h-2 w-full bg-slate-800 rounded-full overflow-hidden",children:(0,s.jsx)(_.P.div,{className:"h-full bg-slate-700 rounded-full",animate:{x:["-100%","100%"]},transition:{duration:1.5,repeat:1/0,ease:"linear"},style:{width:"50%"}})})]}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-1.5 justify-center mb-3",children:[(0,s.jsx)("div",{className:"h-6 w-20 bg-slate-800 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"h-6 w-20 bg-slate-800 rounded-full animate-pulse"}),(0,s.jsx)("div",{className:"h-6 w-20 bg-slate-800 rounded-full animate-pulse"})]}),(0,s.jsx)("div",{className:"mt-auto pt-3 border-t border-white/10",children:(0,s.jsx)("div",{className:"h-8 w-32 mx-auto bg-slate-800 rounded animate-pulse"})})]})]})})}var E=r(5779);function B({onResetFilters:e}){return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 px-4",children:[(0,s.jsxs)("div",{className:"relative mb-6",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-gradient-to-r from-blue-500/20 to-purple-500/20 rounded-full blur-2xl"}),(0,s.jsx)("div",{className:"relative bg-muted/50 rounded-full p-6",children:(0,s.jsx)(E.A,{className:"h-12 w-12 text-muted-foreground"})})]}),(0,s.jsx)("h3",{className:"text-xl font-semibold mb-2",children:"找不到符合條件的顧問"}),(0,s.jsx)("p",{className:"text-muted-foreground text-center max-w-md mb-6",children:"請嘗試調整篩選條件,或使用不同的搜尋關鍵字來尋找您需要的顧問。"}),e&&(0,s.jsxs)(o.$,{variant:"outline",onClick:e,className:"flex items-center gap-2",children:[(0,s.jsx)(m.A,{className:"h-4 w-4"}),"清除所有篩選"]})]})}var M=r(58730),$=r(52226),z=r(54387);let O=a.createContext(null);function G(){let e=a.useContext(O);if(!e)throw Error("useCarousel must be used within a <Carousel />");return e}let U=a.forwardRef(({orientation:e="horizontal",opts:t,setApi:r,plugins:l,className:i,children:n,...o},d)=>{let[c,m]=(0,M.A)({...t,axis:"horizontal"===e?"x":"y"},l),[u,x]=a.useState(!1),[h,f]=a.useState(!1),g=a.useCallback(e=>{e&&(x(e.canScrollPrev()),f(e.canScrollNext()))},[]),p=a.useCallback(()=>{m?.scrollPrev()},[m]),b=a.useCallback(()=>{m?.scrollNext()},[m]),v=a.useCallback(e=>{"ArrowLeft"===e.key?(e.preventDefault(),p()):"ArrowRight"===e.key&&(e.preventDefault(),b())},[p,b]);return a.useEffect(()=>{m&&r&&r(m)},[m,r]),a.useEffect(()=>{if(m)return g(m),m.on("reInit",g),m.on("select",g),()=>{m?.off("select",g)}},[m,g]),(0,s.jsx)(O.Provider,{value:{carouselRef:c,api:m,opts:t,orientation:e||(t?.axis==="y"?"vertical":"horizontal"),scrollPrev:p,scrollNext:b,canScrollPrev:u,canScrollNext:h},children:(0,s.jsx)("div",{ref:d,onKeyDownCapture:v,className:(0,R.cn)("relative",i),role:"region","aria-roledescription":"carousel",...o,children:n})})});
1U.displayName="Carousel";let P=a.forwardRef(({className:e,...t},r)=>{let{carouselRef:a,orientation:l}=G(),i=e?.includes("overflow-visible");return(0,s.jsx)("div",{ref:a,className:i?"overflow-visible":"overflow-hidden",children:(0,s.jsx)("div",{ref:r,className:(0,R.cn)("flex","horizontal"===l?"-ml-4":"-mt-4 flex-col",e),...t})})});P.displayName="CarouselContent";let V=a.forwardRef(({className:e,...t},r)=>{let{orientation:a}=G();return(0,s.jsx)("div",{ref:r,role:"group","aria-roledescription":"slide",className:(0,R.cn)("min-w-0 shrink-0 grow-0 basis-full","horizontal"===a?"pl-4":"pt-4",e),...t})});V.displayName="CarouselItem";let H=a.forwardRef(({className:e,variant:t="outline",size:r="icon",...a},l)=>{let{orientation:i,scrollPrev:n,canScrollPrev:d}=G();return(0,s.jsxs)(o.$,{ref:l,variant:t,size:r,className:(0,R.cn)("absolute  h-8 w-8 rounded-full","horizontal"===i?"-left-12 top-1/2 -translate-y-1/2":"-top-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!d,onClick:n,...a,children:[(0,s.jsx)($.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Previous slide"})]})});H.displayName="CarouselPrevious";let q=a.forwardRef(({className:e,variant:t="outline",size:r="icon",...a},l)=>{let{orientation:i,scrollNext:n,canScrollNext:d}=G();return(0,s.jsxs)(o.$,{ref:l,variant:t,size:r,className:(0,R.cn)("absolute h-8 w-8 rounded-full","horizontal"===i?"-right-12 top-1/2 -translate-y-1/2":"-bottom-12 left-1/2 -translate-x-1/2 rotate-90",e),disabled:!d,onClick:n,...a,children:[(0,s.jsx)(z.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Next slide"})]})});q.displayName="CarouselNext";var W=r(39102),K=r(2134);async function Y(e,t,r){if(!Array.isArray(e)||0===e.length)return[];if(!Number.isFinite(t)||t<=0)throw Error("concurrency 必須為正數");let s=Array(e.length),a=0,l=Array.from({length:Math.min(t,e.length)},async()=>{for(;;){let t=a;if(a+=1,t>=e.length)return;s[t]=await r(e[t],t)}});return await Promise.all(l),s}var J=r(77405),Z=r(21582),Q=r(42165),X=r(866);let ee=(0,a.memo)(function({value:e,onChange:t,placeholder:r="搜尋顧問名稱、描述或專長...",debounceMs:l=300,className:i}){let[n,o]=(0,a.useState)(e);(0,a.useEffect)(()=>{o(e)},[e]),(0,a.useEffect)(()=>{if(n===e)return;let r=setTimeout(()=>{t(n)},l);return()=>clearTimeout(r)},[n,l,t,e]);let d=(0,a.useCallback)(e=>{o(e.target.value)},[]);return(0,s.jsxs)("div",{className:(0,R.cn)("relative",i),children:[(0,s.jsx)(E.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),(0,s.jsx)(X.p,{placeholder:r,value:n,onChange:d,className:"pl-10 h-9 text-sm"})]})});var et=r(79705);let er=(0,a.memo)(function({value:e,onChange:t,maxPrice:r,debounceMs:l=200,className:i}){let[n,o]=(0,a.useState)(e);(0,a.useEffect)(()=>{o(e)},[e]),(0,a.useEffect)(()=>{if(n[0]===e[0]&&n[1]===e[1])return;let r=setTimeout(()=>{t(n)},l);return()=>clearTimeout(r)},[n,l,t,e]);let d=(0,a.useCallback)(e=>{o([e[0],e[1]])},[]);return(0,s.jsxs)("div",{className:(0,R.cn)("space-y-2",i),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between text-sm",children:[(0,s.jsx)("span",{className:"text-muted-foreground",children:"價格區間"}),(0,s.jsxs)("span",{className:"font-medium text-foreground",children:["NT$ ",n[0].toLocaleString()," - NT$ ",n[1].toLocaleString()]})]}),(0,s.jsx)(et.A,{value:[n[0],n[1]],onValueChange:d,min:0,max:r,step:1e3,className:"w-full"})]})}),es=(0,a.memo)(function({selectedSpecialty:e,selectedRating:t,selectedArea:r,specialtyOptions:a,areaOptions:l,onSpecialtyChange:i,onRatingChange:n,onAreaChange:o,className:d}){return(0,s.jsxs)("div",{className:(0,R.cn)("grid grid-cols-1 md:grid-cols-3 gap-4",d),children:[(0,s.jsxs)(Z.l6,{value:e||"all",onValueChange:e=>i("all"===e?"":e),children:[(0,s.jsx)(Z.bq,{className:"h-9 text-sm",children:(0,s.jsx)(Z.yv,{placeholder:"所有專長"})}),(0,s.jsxs)(Z.gC,{children:[(0,s.jsx)(Z.eb,{value:"all",children:"所有專長"}),a.map(e=>(0,s.jsx)(Z.eb,{value:e,children:e},e))]})]}),(0,s.jsxs)(Z.l6,{value:String(t),onValueChange:e=>n(Number(e)),children:[(0,s.jsx)(Z.bq,{className:"h-9 text-sm",children:(0,s.jsx)(Z.yv,{placeholder:"所有評分"})}),(0,s.jsxs)(Z.gC,{children:[(0,s.jsx)(Z.eb,{value:"0",children:"所有評分"}),(0,s.jsx)(Z.eb,{value:"4",children:"4星以上"}),(0,s.jsx)(Z.eb,{value:"4.5",children:"4.5星以上"})]})]}),(0,s.jsxs)(Z.l6,{value:r||"all",onValueChange:e=>o("all"===e?"":e),children:[(0,s.jsx)(Z.bq,{className:"h-9 text-sm",children:(0,s.jsx)(Z.yv,{placeholder:"所有地區"})}),(0,s.jsxs)(Z.gC,{children:[(0,s.jsx)(Z.eb,{value:"all",children:"所有地區"}),l.map(e=>(0,s.jsx)(Z.eb,{value:e,children:e},e))]})]})]})});
1var ea=r(14311),el=r(24385),ei=r(80746),en=r(63533),eo=r(66592),ed=r(3953);function ec({value:e,onChange:t,minDate:r,id:l,placeholder:i="選擇日期",className:n}){let[d,c]=(0,a.useState)(!1),m=r??(0,K.ri)(),u=(0,a.useMemo)(()=>{if(e)try{return(0,ea.H)(e)}catch{return}},[e]),x=(0,a.useMemo)(()=>(0,ea.H)(m),[m]),h=e?(0,el.GP)((0,ea.H)(e),"yyyy/M/d",{locale:ei.G}):"";return(0,s.jsxs)(ed.AM,{open:d,onOpenChange:c,children:[(0,s.jsx)(ed.Wv,{asChild:!0,children:(0,s.jsxs)(o.$,{id:l,variant:"outline",className:(0,R.cn)("h-9 w-full justify-start text-left font-normal text-sm",!h&&"text-muted-foreground",n),children:[(0,s.jsx)(en.A,{className:"mr-2 h-4 w-4 shrink-0 opacity-70"}),h||i]})}),(0,s.jsxs)(ed.hl,{className:"w-auto p-0",align:"start",children:[(0,s.jsx)(eo.V,{mode:"single",selected:u,onSelect:e=>{if(!e)return;let r=(0,el.GP)(e,"yyyy-MM-dd");r<m||(t(r),c(!1))},disabled:e=>(0,el.GP)(e,"yyyy-MM-dd")<m,locale:ei.G,defaultMonth:u??x}),(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 border-t p-2",children:[(0,s.jsx)(o.$,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground h-8 text-xs",onClick:()=>{t(""),c(!1)},children:"清除"}),(0,s.jsx)(o.$,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground h-8 text-xs",onClick:()=>{t(m),c(!1)},children:"今天"})]})]})]})}function em({keyword:e,selectedSpecialty:t,selectedRating:r,selectedArea:a,selectedTiers:l=[],priceRange:i,availableDate:n,sortBy:d,specialtyOptions:c,areaOptions:m,maxPrice:u,resultCount:x,isLoading:h,onKeywordChange:f,onSpecialtyChange:g,onRatingChange:p,onAreaChange:b,onTiersChange:v,onPriceRangeChange:j,onAvailableDateChange:N,onSortByChange:y,onResetFilters:w}){return(0,s.jsxs)("div",{className:"space-y-6 pb-6 border-b",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-xl font-semibold text-foreground",children:"尋找適合的財務顧問"}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"尋找通過平台資格篩選的專業財務顧問。我們提供媒合服務,協助您找到合適的顧問夥伴。"})]}),(0,s.jsxs)(o.$,{variant:"ghost",size:"sm",onClick:w,className:"text-xs text-muted-foreground hover:text-foreground",children:[(0,s.jsx)(Q.A,{className:"h-3 w-3 mr-1"}),"清除篩選"]})]}),(0,s.jsx)(ee,{value:e,onChange:f}),(0,s.jsx)(er,{value:i,onChange:j,maxPrice:u}),(0,s.jsx)(es,{selectedSpecialty:t,selectedRating:r,selectedArea:a,specialtyOptions:c,areaOptions:m,onSpecialtyChange:g,onRatingChange:p,onAreaChange:b}),v&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm text-muted-foreground block",children:"等級"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,D.nU)().map(e=>{let t=l.includes(e.id);return(0,s.jsx)(o.$,{variant:t?"default":"outline",size:"sm",onClick:()=>{t?v(l.filter(t=>t!==e.id)):v([...l,e.id])},className:(0,R.cn)("text-xs",((e,t)=>{if(t)switch(e){case"rookie":return"bg-slate-500/20 border-slate-400/50 text-slate-300 hover:bg-slate-500/30";case"normal":return"bg-gray-500/20 border-gray-400/50 text-gray-300 hover:bg-gray-500/30";case"elite":return"bg-blue-500/20 border-blue-500/50 text-blue-300 hover:bg-blue-500/30";case"epic":return"bg-purple-500/20 border-purple-500/50 text-purple-300 hover:bg-purple-500/30";case"legendary":return"bg-amber-500/20 border-amber-600/50 text-amber-300 hover:bg-amber-500/30";case"special":return"bg-cyan-500/20 border-cyan-500/50 text-cyan-300 hover:bg-cyan-500/30";case"gm":return"bg-red-500/20 border-red-700/50 text-red-300 hover:bg-red-500/30";default:return""}switch(e){case"rookie":return"border-slate-400/30 text-slate-300/80 hover:bg-slate-500/10 hover:text-slate-300";case"normal":return"border-gray-400/30 text-gray-300/80 hover:bg-gray-500/10 hover:text-gray-300";case"elite":return"border-blue-500/30 text-blue-300/80 hover:bg-blue-500/10 hover:text-blue-300";case"epic":return"border-purple-500/30 text-purple-300/80 hover:bg-purple-500/10 hover:text-purple-300";case"legendary":return"border-amber-600/30 text-amber-300/80 hover:bg-amber-500/10 hover:text-amber-300";case"special":return"border-cyan-500/30 text-cyan-300/80 hover:bg-cyan-500/10 hover:text-cyan-300";
1case"gm":return"border-red-700/30 text-red-300/80 hover:bg-red-500/10 hover:text-red-300";default:return""}})(e.id,t)),children:e.name},e.id)})})]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"available-date",className:"text-sm text-muted-foreground mb-2 block",children:"可用時段"}),(0,s.jsx)(ec,{id:"available-date",value:n,onChange:N,minDate:(0,K.ri)(),placeholder:"選擇日期"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-muted-foreground mb-2 block",children:"排序方式"}),(0,s.jsxs)(Z.l6,{value:d,onValueChange:e=>y(e),children:[(0,s.jsx)(Z.bq,{className:"h-9 text-sm",children:(0,s.jsx)(Z.yv,{})}),(0,s.jsxs)(Z.gC,{children:[(0,s.jsx)(Z.eb,{value:"rating",children:"評分"}),(0,s.jsx)(Z.eb,{value:"fee",children:"費用"}),(0,s.jsx)(Z.eb,{value:"reviews",children:"評價數"}),(0,s.jsx)(Z.eb,{value:"name",children:"名稱"})]})]})]})]}),!h&&(0,s.jsxs)("div",{className:"text-sm text-muted-foreground",children:["找到 ",(0,s.jsx)("span",{className:"font-semibold text-foreground",children:x})," 位符合條件的顧問"]})]})}var eu=r(38025);function ex({open:e,onOpenChange:t,keyword:r,selectedSpecialty:a,selectedRating:l,selectedArea:i,selectedTiers:n=[],priceRange:d,availableDate:c,sortBy:m,specialtyOptions:u,areaOptions:x,maxPrice:h,resultCount:f,isLoading:g,onKeywordChange:p,onSpecialtyChange:b,onRatingChange:v,onAreaChange:j,onTiersChange:N,onPriceRangeChange:y,onAvailableDateChange:w,onSortByChange:C,onResetFilters:_}){return(0,s.jsx)(eu._s,{open:e,onOpenChange:t,children:(0,s.jsxs)(eu.zj,{className:"max-h-[90vh]",children:[(0,s.jsx)(eu.BE,{children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)(eu.gk,{children:"篩選條件"}),(0,s.jsxs)(o.$,{variant:"ghost",size:"sm",onClick:_,className:"text-xs text-muted-foreground hover:text-foreground",children:[(0,s.jsx)(Q.A,{className:"h-3 w-3 mr-1"}),"清除"]})]})}),(0,s.jsxs)("div",{className:"px-4 pb-4 space-y-6 overflow-y-auto",children:[(0,s.jsx)(ee,{value:r,onChange:p}),(0,s.jsx)(er,{value:d,onChange:y,maxPrice:h}),(0,s.jsx)(es,{selectedSpecialty:a,selectedRating:l,selectedArea:i,specialtyOptions:u,areaOptions:x,onSpecialtyChange:b,onRatingChange:v,onAreaChange:j}),N&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("label",{className:"text-sm text-muted-foreground block",children:"等級"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:(0,D.nU)().map(e=>{let t=n.includes(e.id);return(0,s.jsx)(o.$,{variant:t?"default":"outline",size:"sm",onClick:()=>{t?N(n.filter(t=>t!==e.id)):N([...n,e.id])},className:(0,R.cn)("text-xs",((e,t)=>{if(t)switch(e){case"rookie":return"bg-slate-500/20 border-slate-400/50 text-slate-300 hover:bg-slate-500/30";case"normal":return"bg-gray-500/20 border-gray-400/50 text-gray-300 hover:bg-gray-500/30";case"elite":return"bg-blue-500/20 border-blue-500/50 text-blue-300 hover:bg-blue-500/30";case"epic":return"bg-purple-500/20 border-purple-500/50 text-purple-300 hover:bg-purple-500/30";case"legendary":return"bg-amber-500/20 border-amber-600/50 text-amber-300 hover:bg-amber-500/30";case"special":return"bg-cyan-500/20 border-cyan-500/50 text-cyan-300 hover:bg-cyan-500/30";case"gm":return"bg-red-500/20 border-red-700/50 text-red-300 hover:bg-red-500/30";default:return""}switch(e){case"rookie":return"border-slate-400/30 text-slate-300/80 hover:bg-slate-500/10 hover:text-slate-300";case"normal":return"border-gray-400/30 text-gray-300/80 hover:bg-gray-500/10 hover:text-gray-300";case"elite":return"border-blue-500/30 text-blue-300/80 hover:bg-blue-500/10 hover:text-blue-300";case"epic":return"border-purple-500/30 text-purple-300/80 hover:bg-purple-500/10 hover:text-purple-300";case"legendary":return"border-amber-600/30 text-amber-300/80 hover:bg-amber-500/10 hover:text-amber-300";case"special":return"border-cyan-500/30 text-cyan-300/80 hover:bg-cyan-500/10 hover:text-cyan-300";case"gm":return"border-red-700/30 text-red-300/80 hover:bg-red-500/10 hover:text-red-300";default:return""}})(e.id,t)),children:e.name},e.id)})})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"drawer-available-date",className:"text-sm text-muted-foreground mb-2 block",children:"可用時段"}
1),(0,s.jsx)(ec,{id:"drawer-available-date",value:c,onChange:w,minDate:(0,K.ri)(),placeholder:"選擇日期"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-sm text-muted-foreground mb-2 block",children:"排序方式"}),(0,s.jsxs)(Z.l6,{value:m,onValueChange:e=>C(e),children:[(0,s.jsx)(Z.bq,{className:"h-9 text-sm",children:(0,s.jsx)(Z.yv,{})}),(0,s.jsxs)(Z.gC,{children:[(0,s.jsx)(Z.eb,{value:"rating",children:"評分"}),(0,s.jsx)(Z.eb,{value:"fee",children:"費用"}),(0,s.jsx)(Z.eb,{value:"reviews",children:"評價數"}),(0,s.jsx)(Z.eb,{value:"name",children:"名稱"})]})]})]})]}),!g&&(0,s.jsxs)("div",{className:"text-sm text-muted-foreground",children:["找到 ",(0,s.jsx)("span",{className:"font-semibold text-foreground",children:f})," 位符合條件的顧問"]})]}),(0,s.jsx)(eu.tb,{children:(0,s.jsx)(o.$,{onClick:()=>{t(!1)},className:"w-full",children:"套用篩選"})})]})})}var eh=r(95800),ef=r(19548);let eg=function(){let{toast:e}=(0,x.dj)(),t=(0,n.useRouter)(),r=(0,n.useSearchParams)(),{user:l}=(0,h.A)(),k=(0,J.a)(),{advisors:A,isLoading:L,error:S}=(0,f.n)({enabled:!0}),T=(0,eh.b)(),{savedAdvisorIds:R}=T,[D,E]=(0,a.useState)(""),[M,$]=(0,a.useState)(0),[z,O]=(0,a.useState)(""),[G,Z]=(0,a.useState)([]),[Q,X]=(0,a.useState)(""),[ee,et]=(0,a.useState)("rating"),[er,es]=(0,a.useState)([0,5e4]),[ea,el]=(0,a.useState)(""),[ei,en]=(0,a.useState)(null),[eo,ed]=(0,a.useState)(!1),[ec,eu]=(0,a.useState)(void 0),[eg,ep]=(0,a.useState)(!1),[eb,ev]=(0,a.useState)(!1),[ej,eN]=(0,a.useState)(null),[ey,ew]=(0,a.useState)("detail"),eC=eb||eo,{openChat:e_}=(0,N.v)(),[ek,eA]=(0,a.useState)(!1),[eL,eS]=(0,a.useState)([]),[eT,eR]=(0,a.useState)(!1),[eD,eI]=(0,a.useState)([]),eF=(0,a.useRef)(new Map),eE=(0,a.useRef)(""),eB=(0,a.useRef)(""),eM=L||eT;(0,a.useEffect)(()=>{let t=!1;return(async()=>{if(L)return;if(0===A.length){t||(eS([]),eR(!1));return}t||eR(!0);let r=A.filter(e=>(e.fee??0)>0),s=0,a=await Y(r,5,async e=>{if(!e?.id)return!1;try{let t=eF.current.get(e.id),r=t??await (0,W.G)(e.id);return t||eF.current.set(e.id,r),r.some(e=>Array.isArray(e.times)&&e.times.length>0)}catch(r){s+=1;let t=r instanceof Error?r:Error(String(r));return ef.Cp(t,{level:"error",extra:{message:"顧問可預約時段載入失敗(公開搜尋資格檢查)",advisorId:e.id},tags:{source:"advisor/page.searchEligibility.fetchAvailability"}}),!0}});if(!t&&(eS(r.filter((e,t)=>a[t])),eR(!1),s>0)){let t=`eligibility-scan:${r.length}:${s}`;eB.current!==t&&(eB.current=t,e({title:"可用時段載入部分失敗",description:"部分顧問時段暫時無法確認,公開列表可能不完整。請稍後再試或重新整理。",variant:"destructive"}))}})(),()=>{t=!0}},[A,L,e]),(0,a.useEffect)(()=>{r?.get("bookingId")&&!eo&&ed(!0)},[r,eo]);let e$=(0,a.useMemo)(()=>Array.from(new Set(eL.flatMap(e=>e.specialties))),[eL]),ez=(0,a.useMemo)(()=>Array.from(new Set(eL.flatMap(e=>e.serviceAreas))),[eL]),eO=(0,a.useMemo)(()=>{if(0===eL.length)return 5e4;let e=Math.max(...eL.map(e=>e.fee||0));return e>0?e:5e4},[eL]);(0,a.useEffect)(()=>{eO>0&&5e4===er[1]&&eL.length>0&&es([0,eO])},[eO,eL.length,er]),(0,a.useEffect)(()=>{S&&e({variant:"destructive",title:"載入失敗",description:"無法載入顧問資料,請稍後再試。"})},[S,e]);let eG=(r,s)=>{if(!l){e({variant:"destructive",title:"請先登入",description:"預約顧問服務需要登入帳號,請先登入後再試。"}),t.push("/auth");return}if(en(r),s){let e=s.getFullYear(),t=String(s.getMonth()+1).padStart(2,"0"),r=String(s.getDate()).padStart(2,"0");eu(`${e}-${t}-${r}`)}else eu(void 0);eb?(ew("booking"),ed(!0)):(ed(!0),ew("booking"))},eU=e=>{eN(e),ev(!0),ew("detail")},eP=e=>{e||("detail"===ey?(ev(!1),eN(null)):(ed(!1),setTimeout(()=>{en(null),eu(void 0),ew("detail")},300)))},eV=(0,a.useMemo)(()=>eL.filter(e=>{if(Q){let t=Q.toLowerCase(),r=e.name.toLowerCase().includes(t),s=e.description?.toLowerCase().includes(t)||!1,a=e.specialties.some(e=>e.toLowerCase().includes(t));if(!r&&!s&&!a)return!1}if(D&&!e.specialties.includes(D)||M&&e.rating<M||z&&!e.serviceAreas.includes(z))return!1;if(G.length>0){let t=e.tier||"rookie";if(!G.includes(t))return!1}let t=e.fee||0;return!(t<er[0])&&!(t>er[1])}),[eL,Q,D,M,z,G,er]);(0,a.useEffect)(()=>{let t=!1;return(async()=>{let r=[...eV];if(ea){let s=(0,K.ri)(),a=new Date,l=60*a.getHours()+a.getMinutes(),i=0,n=await Y(r,5,async e=>
1{if(!e?.id)return!1;try{let t=eF.current.get(e.id),r=t??await (0,W.G)(e.id);t||eF.current.set(e.id,r);let a=r.find(e=>e?.date===ea);if(!a||!Array.isArray(a.times)||0===a.times.length)return!1;if(ea!==s)return!0;return a.times.some(e=>(e=>{let[t,r]=e.split(":").map(Number);return Number.isFinite(t)&&Number.isFinite(r)?60*t+r:-1/0})(e)>l)}catch(r){i+=1;let t=r instanceof Error?r:Error(String(r));return ef.Cp(t,{level:"error",extra:{message:"顧問可預約時段載入失敗(依日期篩選)",advisorId:e.id,availableDate:ea},tags:{source:"advisor/page.filterByAvailability.fetchAvailability"}}),!0}});if(r=r.filter((e,t)=>n[t]),i>0){let r=`${ea}:${eV.length}:${i}`;eE.current!==r&&(eE.current=r,t||e({title:"可用時段載入部分失敗",description:"部分顧問時段暫時無法確認,結果可能不完整。請稍後再試或重新整理。",variant:"destructive"}))}}t||eI(r)})(),()=>{t=!0}},[eV,ea,e]);let eH=(0,a.useMemo)(()=>A.filter(e=>R.has(e.id)),[A,R]),eq=(0,a.useMemo)(()=>{let e=[...eD];return e.sort((e,t)=>{switch(ee){case"rating":return t.rating-e.rating;case"fee":return(e.fee||0)-(t.fee||0);case"reviews":return t.reviews-e.reviews;case"name":return e.name.localeCompare(t.name,"zh-TW");default:return 0}}),e},[eD,ee]),eW=()=>{X(""),E(""),$(0),O(""),Z([]),es([0,eO]),el(""),et("rating")};return(0,s.jsxs)("div",{className:"flex flex-col min-h-screen",children:[(0,s.jsx)(g.R,{}),(0,s.jsx)("main",{className:"flex-1",children:(0,s.jsx)("div",{className:"container mx-auto py-16",children:(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[(0,s.jsx)("h1",{className:"text-3xl font-bold bg-gradient-to-r from-blue-500 to-purple-500 bg-clip-text text-transparent",children:"顧問列表"}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)(o.$,{asChild:!0,variant:"outline",size:"sm",children:(0,s.jsx)(i(),{href:"/become-advisor",children:"成為平台顧問"})}),(0,s.jsxs)(o.$,{onClick:()=>ep(!0),variant:"default",className:"flex gap-2",children:[(0,s.jsx)(c.A,{className:"h-4 w-4"}),"AI 媒合顧問"]})]})]}),k&&(0,s.jsx)("div",{className:"flex justify-end",children:(0,s.jsxs)(o.$,{variant:"outline",onClick:()=>eA(!0),className:"flex items-center gap-2",children:[(0,s.jsx)(m.A,{className:"h-4 w-4"}),"篩選"]})}),!k&&(0,s.jsx)(d.Zp,{children:(0,s.jsx)(d.Wu,{className:"pt-6",children:(0,s.jsx)(em,{keyword:Q,selectedSpecialty:D,selectedRating:M,selectedArea:z,selectedTiers:G,priceRange:er,availableDate:ea,sortBy:ee,specialtyOptions:e$,areaOptions:ez,maxPrice:eO,resultCount:eq.length,isLoading:eM,onKeywordChange:X,onSpecialtyChange:E,onRatingChange:$,onAreaChange:O,onTiersChange:Z,onPriceRangeChange:es,onAvailableDateChange:el,onSortByChange:et,onResetFilters:eW})})}),k&&(0,s.jsx)(ex,{open:ek,onOpenChange:eA,keyword:Q,selectedSpecialty:D,selectedRating:M,selectedArea:z,selectedTiers:G,priceRange:er,availableDate:ea,sortBy:ee,specialtyOptions:e$,areaOptions:ez,maxPrice:eO,resultCount:eq.length,isLoading:eM,onKeywordChange:X,onSpecialtyChange:E,onRatingChange:$,onAreaChange:O,onTiersChange:Z,onPriceRangeChange:es,onAvailableDateChange:el,onSortByChange:et,onResetFilters:eW}),(0,s.jsx)(d.Zp,{children:(0,s.jsxs)(d.Wu,{className:"py-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,s.jsx)(u.A,{className:"h-5 w-5 text-primary shrink-0","aria-hidden":!0}),(0,s.jsx)("h2",{className:"text-lg font-semibold tracking-tight",children:"我收藏的顧問"})]}),L&&R.size>0?(0,s.jsx)("div",{className:"flex justify-center gap-4 py-4",children:Array.from({length:2}).map((e,t)=>(0,s.jsx)(F,{},`saved-${t}`))}):0===eH.length?(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:R.size>0?"您收藏的顧問目前不在列表中(可能已停用、未定價或未開放可預約時段)。":"尚無收藏。開啟任一顧問卡片後,點右上角 ⁝ → 儲存。"}):(0,s.jsx)("div",{className:"w-full overflow-visible",children:(0,s.jsxs)(U,{opts:{align:"start",loop:!1,slidesToScroll:1},className:"w-full",children:[(0,s.jsx)(P,{className:"-ml-2 md:-ml-4 overflow-visible",children:eH.map(e=>(0,s.jsx)(V,{className:"pl-2 md:pl-4 basis-full sm:basis-1/2 lg:basis-1/3 xl:basis-1/4 overflow-visible min-w-0",children:(0,s.jsx)("div",{className:"flex justify-center p-1 sm:p-2 md:p-3 lg:p-4 min-w-0",children:(0,s.jsx)(I,{advisor:e,onClick:()=>eU(e),onCalendarClick:t=>eG(e,t)})})},`saved-${e.id}`))}),eH.length>1&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(H,{className:"hidden md:flex"}),(0,s.jsx)(q,{className:"hidden md:flex"})]})]})})]})}),(0,s.jsx)(d.Zp,{children:(0,s.jsx)(d.Wu,{className:"min-h-[500px] py-6",children:eM?(0,s.jsx)("div",{className:"flex justify-center gap-4 py-8",children:Array.from({length:3}).map((e,t)=>(0,s.jsx)(F,{},t))}):0===eq.length?(0,s.jsx)(B,{onResetFilters:eW}):(0,s.jsx)("div",{className:"w-full overflow-visible",children:(0,s.jsxs)(U,{opts:{align:"start",loop:!1,slidesToScroll:1},className:"w-full",children:[(0,s.jsx)(P,{className:"-ml-2 md:-ml-4 overflow-visible",children:eq.map(e=>(0,s.jsx)(V,{className:"pl-2 md:pl-4 basis-full sm:basis-1/2 lg:basis-1/3 xl:basis-1/4 overflow-visible min-w-0",children:(0,s.jsx)("div",{className:"flex justify-center p-1 sm:p-2 md:p-3 lg:p-4 min-w-0",children:(0,s.jsx)(I,{advisor:e,onClick:()=>eU(e),onCalendarClick:t=>eG(e,t)})})},e.id))}),eq.length>1&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(H,{className:"hidden md:flex"}),(0,s.jsx)(q,{className:"hidden md:flex"})]})]})})})}),(0,s.jsx)(y.lG,{open:eC,onOpenChange:eP,children:(0,s.jsx)(y.Cf,{className:"sm:max-w-[640px] max-h-[90vh] overflow-y-auto overflow-x-hidden p-4 sm:p-6 [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none]",asChild:!0,children:(0,s.jsxs)("div",{children:[(0,s.jsx)(w.bL,{asChild:!0,children:(0,s.jsx)(y.L3,{children:"booking"===ey?"預約顧問諮詢":"顧問詳細資料"})}),(0,s.jsxs)(C.N,{mode:"wait",children:["detail"===ey&&ej&&(0,s.jsx)(_.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:(0,s.jsx)(j.AdvisorDetailContent,{advisor:ej,savedAdvisorsControl:T,onClose:()=>eP(!1),onBookingClick:eG,onChatClick:r=>{if(!l){e({title:"請先登入",description:"登入後即可與顧問開始聊天。",variant:"destructive"}),t.push("/auth");return}e_(r.id),eP(!1)}})},"detail"),"booking"===ey&&ei&&(0,s.jsx)(_.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:(0,s.jsx)(b.AdvisorBookingDialog,{advisor:ei,open:!0,onOpenChange:eP,presetDate:ec,embedded:!0,showCloseButton:!0})},"booking")]})]})})}),(0,s.jsx)(v.AdvisorMatchingDialog,{open:eg,onOpenChange:ep,advisors:eL,onSelectAdvisor:e=>{eG(e)}})]})})}),(0,s.jsx)(p.r,{})]})}},95800:(e,t,r)=>{"use strict";r.d(t,{b:()=>p});var s=r(31615),a=r(73521),l=r(19548),i=r(24571),n=r(76458),o=r(15418);let d=o.Ik({savedAt:o.bz()}),c="saved_advisors",m="xynergy.savedAdvisorIds";function u(){try{let e=localStorage.getItem(m);if(!e)return[];let t=JSON.parse(e);if(!Array.isArray(t))return[];return t.filter(e=>"string"==typeof e)}catch{return[]}}function x(e){localStorage.setItem(m,JSON.stringify(e))}function h(){localStorage.removeItem(m)}async function f(e,t){if(!n.db)throw Error("Firestore 尚未初始化");let r=(0,i.doc)(n.db,n.USERS,e,c,t),s=d.parse({savedAt:(0,i.serverTimestamp)()});await (0,i.setDoc)(r,s)}async function g(e,t){if(!n.db)throw Error("Firestore 尚未初始化");await (0,i.kd)((0,i.doc)(n.db,n.USERS,e,c,t))}function p(){let{user:e}=(0,a.A)(),[t,r]=(0,s.useState)([]),o=(0,s.useRef)(null);(0,s.useEffect)(()=>{e?.uid||(o.current=null,r(u()))},[e?.uid]),(0,s.useEffect)(()=>{if(!e?.uid)return;let t=e.uid,s=function(e,t){if(!n.db)return t([]),()=>{};let r=(0,i.rJ)(n.db,n.USERS,e,c);return(0,i.aQ)(r,e=>{t(e.docs.map(e=>e.id))},r=>{l.Cp(r instanceof Error?r:Error(String(r)),{level:"error",extra:{message:"訂閱顧問收藏失敗",operation:"subscribeUserSavedAdvisorIds",context:{userId:e}},tags:{source:"userSavedAdvisors.subscribeUserSavedAdvisorIds"}}),t([])})}(t,e=>{if(o.current!==t){o.current=t;let r=new Set(e),s=u(),a=s.filter(e=>!r.has(e));a.length>0?(async()=>{try{for(let e of a)await f(t,e);h()}catch(r){let e=r instanceof Error?r:Error(String(r));l.Cp(e,{level:"error",extra:{message:"顧問收藏合併至雲端失敗",operation:"useUserSavedAdvisors.mergeLocal",userId:t},tags:{source:"useUserSavedAdvisors.mergeLocal"}})}})():s.length>0&&h()}r(e)});return()=>s()},[e?.uid]);let d=(0,s.useMemo)(()=>new Set(t),[t]),m=(0,s.useCallback)(e=>d.has(e),[d]),p=(0,s.useCallback)(async t=>{if(!e?.uid){let e,s,a=(s=(e=u()).indexOf(t))>=0?(e.splice(s,1),x(e),{saved:!1}):(e.push(t),x(e),{saved:!0});return r(u()),a}return d.has(t)?(await g(e.uid,t),{saved:!1}):(await f(e.uid,t),{saved:!0})},[e?.uid,d]);return{savedAdvisorIds:d,savedIds:t,isAdvisorSaved:m,toggleSaveAdvisor:p,isCloudBacked:!!e?.uid}}},95902:(e,t,r)=>{"use strict";r.r(t),r.d(t,{AdvisorDetailContent:()=>P,AdvisorDetailDialog:()=>H});var s=r(85047),a=r(31615),l=r(46377),i=r(18534),n=r(97839),o=r(60373),d=r(38187),c=r(96968),m=r(10892),u=r(21410),x=r(71899),h=r(12129),f=r(31283),g=r(70522),p=r(22034),b=r(6149),v=r(42165),j=r(34619),N=r(98896),y=r(57321),w=r(88660),C=r(18569),_=r(78308),k=r(95802),A=r(63533),L=r(33700),S=r(73521),T=r(41178),R=r(19548),D=r(24571),I=r(27703),F=r(15418);let E=F.Ik({userId:F.Yj().min(1,"userId 不能為空"),advisorId:F.Yj().min(1,"advisorId 不能為空"),advisorName:F.Yj().min(1,"顧問名稱不能為空").max(200),description:F.Yj().min(10,"請至少填寫 10 字").max(2e3,"內容請勿超過 2000 字"),createdAt:F.bz().optional()});var B=r(76458);async function M(e,t){if(!B.db)throw Error("Firestore 尚未初始化");let r={userId:e,advisorId:t.advisorId,advisorName:t.advisorName,description:t.description.trim()},s=Object.fromEntries(Object.entries(E.parse(r)).filter(([,e])=>void 0!==e));return(await (0,D.gS)((0,D.rJ)(B.db,I.I.advisorReports),{...s,createdAt:(0,D.serverTimestamp)()})).id}var $=r(93674),z=r(46711),O=r(95800);let G=({className:e})=>
1(0,s.jsx)("svg",{className:e,viewBox:"0 0 192 192",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg","aria-label":"Threads",children:(0,s.jsx)("path",{d:"M141.537 88.9883C140.71 88.5919 139.87 88.2104 139.019 87.8451C137.537 60.5382 122.616 44.905 97.5619 44.745C97.4484 44.7443 97.3355 44.7443 97.222 44.7443C82.2364 44.7443 69.7731 51.1409 62.102 62.7807L75.881 72.2328C81.6116 63.5383 90.6052 61.6848 97.2286 61.6848C97.3051 61.6848 97.3819 61.6848 97.4576 61.6855C105.707 61.7381 111.932 64.1366 115.961 68.814C118.893 72.2193 120.854 76.925 121.825 82.8638C114.511 81.6207 106.601 81.2385 98.145 81.7233C74.3247 83.0954 59.0111 96.9879 60.0396 116.292C60.5615 126.084 65.4397 134.508 73.775 140.011C80.8224 144.663 89.899 146.938 99.3323 146.423C111.79 145.74 121.563 140.987 128.381 132.296C133.559 125.696 136.834 117.143 138.28 106.366C144.217 109.949 148.617 114.664 151.047 120.332C155.179 129.967 155.42 145.8 142.501 158.708C131.182 170.016 117.576 174.908 97.0135 175.059C74.2042 174.89 56.9538 167.575 45.7381 153.317C35.2355 139.966 29.8077 120.682 29.6052 96C29.8077 71.3178 35.2355 52.0336 45.7381 38.6827C56.9538 24.4249 74.2039 17.11 97.0132 16.9405C119.988 17.1113 137.539 24.4614 149.184 38.788C154.894 45.8136 159.199 54.6488 162.037 64.9503L178.184 60.6422C174.744 47.9622 169.331 37.0357 161.965 27.974C147.036 9.60668 125.202 0.195148 97.0695 0H96.9569C68.8816 0.19447 47.2921 9.6418 32.7883 28.0793C19.8819 44.4864 13.2244 67.3157 13.0007 95.9325L13 96L13.0007 96.0675C13.2244 124.684 19.8819 147.514 32.7883 163.921C47.2921 182.358 68.8816 191.806 96.9569 192H97.0695C122.03 191.827 139.624 185.292 154.118 170.811C173.081 151.866 172.51 128.119 166.26 113.541C161.776 103.087 153.227 94.5962 141.537 88.9883ZM98.4405 129.507C88.0005 130.095 77.1544 125.409 76.6196 115.372C76.2232 107.93 81.9158 99.626 99.0812 98.6368C101.047 98.5234 102.976 98.468 104.871 98.468C111.106 98.468 116.939 99.0737 122.242 100.233C120.264 124.935 108.662 128.946 98.4405 129.507Z"})});function U({advisor:e,onClose:t,onBookingClick:r,onChatClick:L,showCloseButton:D=!0,savedAdvisors:I}){let F=(0,l.useRouter)(),{user:E}=(0,S.A)(),{toast:B}=(0,T.dj)(),{isAdvisorSaved:O,toggleSaveAdvisor:P,isCloudBacked:V}=I,[H,q]=(0,a.useState)(!1),[W,K]=(0,a.useState)(""),[Y,J]=(0,a.useState)(!1),Z=O(e.id),Q=(0,a.useCallback)(()=>{(async()=>{try{let{saved:t}=await P(e.id);if(t)return void B({title:"已加入收藏",description:V?"可於本頁上方「我收藏的顧問」快速找到。":"已儲存於此裝置;登入後會同步至帳號。"});B({title:"已取消收藏",description:"已從收藏清單移除。"})}catch(r){let t=r instanceof Error?r:Error(String(r));R.Cp(t,{level:"error",extra:{message:"顧問收藏更新失敗",operation:"AdvisorDetailContent.handleToggleSaveAdvisor",advisorId:e.id},tags:{source:"AdvisorDetailContent.handleToggleSaveAdvisor"}}),B({variant:"destructive",title:"無法更新收藏",description:t.message||"請稍後再試。"})}})()},[e.id,P,V,B]),X=(0,a.useCallback)(()=>{if(!E){B({title:"請先登入",description:"登入後即可檢舉,我們才能與您聯繫處理。",variant:"destructive"}),F.push("/auth");return}K(""),q(!0)},[E,B,F]),ee=(0,a.useCallback)(async()=>{let t=W.trim();if(E?.uid&&!(t.length<10)){J(!0);try{await M(E.uid,{advisorId:e.id,advisorName:e.name,description:t}),q(!1),K(""),B({title:"已送出",description:"感謝您的回報,我們會審核處理。"})}catch(r){let t=r instanceof Error?r:Error(String(r));R.Cp(t,{level:"error",extra:{message:"顧問檢舉送出失敗",operation:"AdvisorDetailContent.submitAdvisorReport",advisorId:e.id},tags:{source:"AdvisorDetailContent.submitAdvisorReport"}}),B({variant:"destructive",title:"送出失敗",description:t.message||"請稍後再試。"})}finally{J(!1)}}},[E?.uid,W,e.id,e.name,B]);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,s.jsxs)(i.c7,{className:"flex-1 space-y-1.5 text-left sm:text-left",children:[(0,s.jsx)(i.L3,{children:"顧問詳細資料"}),(0,s.jsx)(i.rr,{children:"查看顧問的完整資訊"})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5",children:[(0,s.jsxs)(n.rI,{children:[(0,s.jsx)(n.ty,{asChild:!0,children:(0,s.jsx)(u.$,{type:"button",variant:"ghost",size:"icon",className:"h-9 w-9 text-muted-foreground hover:text-foreground","aria-label":"更多選項",children:(0,s.jsx)("span",{className:"select-none text-xl leading-none","aria-hidden":!0,
1children:"⁝"})})}),(0,s.jsxs)(n.SQ,{align:"end",className:"z-[200] min-w-[10rem]",children:[(0,s.jsxs)(n._2,{onSelect:Q,children:[Z?(0,s.jsx)(g.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}):(0,s.jsx)(p.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),Z?"取消收藏":"儲存"]}),(0,s.jsxs)(n._2,{onSelect:X,className:"text-destructive focus:bg-destructive/10 focus:text-destructive",children:[(0,s.jsx)(b.A,{className:"h-4 w-4 shrink-0","aria-hidden":!0}),"檢舉"]})]})]}),D&&(0,s.jsxs)(i.HM,{className:"rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground h-9 w-9 inline-flex items-center justify-center",children:[(0,s.jsx)(v.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}),(0,s.jsx)(i.lG,{open:H,onOpenChange:q,children:(0,s.jsxs)(i.Cf,{overlayClassName:"z-[100]",className:"z-[101] sm:max-w-md",children:[(0,s.jsxs)(i.c7,{children:[(0,s.jsx)(i.L3,{children:"檢舉顧問"}),(0,s.jsx)(i.rr,{children:"請說明原因(至少 10 字)。送出後管理團隊會審核,必要時與您聯繫。"})]}),(0,s.jsxs)("div",{className:"grid gap-2 py-2",children:[(0,s.jsx)(c.J,{htmlFor:"advisor-report-desc",children:"說明"}),(0,s.jsx)(m.T,{id:"advisor-report-desc",value:W,onChange:e=>K(e.target.value),placeholder:"例如:公開資料與事實不符、不當聯絡方式…",rows:5,className:"resize-y min-h-[120px]",disabled:Y})]}),(0,s.jsxs)(i.Es,{children:[(0,s.jsx)(u.$,{type:"button",variant:"outline",onClick:()=>q(!1),disabled:Y,children:"取消"}),(0,s.jsx)(u.$,{type:"button",onClick:()=>void ee(),disabled:Y||W.trim().length<10,children:Y?"送出中…":"送出"})]})]})}),(0,s.jsxs)("div",{className:"space-y-6 py-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsxs)(o.eu,{className:"h-20 w-20 flex-shrink-0",children:[(0,s.jsx)(o.BK,{src:e.avatar,alt:e.name}),(0,s.jsx)(o.q5,{className:"text-lg",children:e.name.substring(0,2)})]}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsx)("h2",{className:"text-2xl font-bold",children:e.name}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)(j.A,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"}),(0,s.jsx)("span",{className:"font-medium",children:e.rating}),(0,s.jsxs)("span",{className:"text-sm text-muted-foreground",children:["(",e.reviews," 則評價)"]})]}),e.certifications&&e.certifications.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.certifications.map(e=>{let t=(0,$.Bu)(e);return t?(0,s.jsx)(d.E,{variant:"outline",className:"text-sm",children:t.abbreviation},e):null})})]}),e.description&&(0,s.jsx)("p",{className:"text-muted-foreground",children:e.description}),e.experience&&(0,s.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,s.jsx)(N.A,{className:"h-4 w-4"}),(0,s.jsx)("span",{children:e.experience})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(y.A,{className:"h-4 w-4 text-muted-foreground"}),(0,s.jsxs)("span",{className:"font-semibold text-lg",children:["NT$ ",Number(e.fee||0).toLocaleString()]})]})]})]}),(e.website||e.socialMedia&&e.socialMedia.length>0)&&(0,s.jsxs)("div",{className:"flex items-center gap-3",children:[e.website&&(0,s.jsx)("a",{href:e.website,target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-full hover:bg-accent transition-colors",title:e.website,children:(0,s.jsx)(w.A,{className:"h-5 w-5 text-primary"})}),e.socialMedia&&e.socialMedia.length>0&&(0,s.jsx)(s.Fragment,{children:e.socialMedia.map((e,t)=>{let r,a=(r=e.platform.toLowerCase()).includes("facebook")?x.A:r.includes("instagram")?h.A:r.includes("threads")?G:f.A;return(0,s.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:"p-2 rounded-full hover:bg-accent transition-colors",title:e.platform,children:(0,s.jsx)(a,{className:"h-5 w-5 text-primary"})},t)})})]}),(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-sm font-medium text-muted-foreground",children:[(0,s.jsx)(C.A,{className:"h-4 w-4"}),"服務地區"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.serviceAreas.map((e,t)=>(0,s.jsx)(d.E,{variant:"outline",className:"text-sm",children:e},t))})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2 text-sm font-medium text-muted-foreground",children:[(0,s.jsx)(_.A,{className:"h-4 w-4"}),"專長領域"]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:e.specialties.map((e,t)=>(0,s.jsx)(d.E,{variant:"secondary",className:"text-sm",children:e},t))})]})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[L&&(0,s.jsxs)(u.$,{variant:"outline",onClick:()=>{L(e),t()},className:"flex-1",children:[(0,s.jsx)(k.A,{className:"h-4 w-4 mr-2"}),"開始聊天"]}),r&&(0,s.jsxs)(u.$,{onClick:()=>{(0,z.jh)("detail",e.id),r(e)},className:"flex-1",children:[(0,s.jsx)(A.A,{className:"h-4 w-4 mr-2"}),"預約諮詢"]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3 text-sm font-medium text-muted-foreground",children:[(0,s.jsx)(k.A,{className:"h-4 w-4"}),"用戶評價 ",e.customerReviews&&e.customerReviews.length>0&&`(${e.customerReviews.length})`]}),e.customerReviews&&e.customerReviews.length>0?(0,s.jsx)("div",{className:"space-y-4",children:e.customerReviews.slice(0,5).map((e,t)=>(0,s.jsxs)("div",{className:"border-b last:border-0 pb-4 last:pb-0",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,s.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,s.jsx)("div",{className:"flex items-center gap-1",children:Array.from({length:5}).map((t,r)=>(0,s.jsx)(j.A,{className:`h-3 w-3 ${r<e.rating?"fill-yellow-400 text-yellow-400":"text-muted-foreground"}`},r))})]}),(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:e.comment})]},t))}):(0,s.jsx)("p",{className:"text-sm text-muted-foreground",children:"目前尚無用戶評價"})]}),(0,s.jsxs)("div",{className:"bg-yellow-50 border border-yellow-200 rounded-lg p-3 text-xs text-yellow-800",children:[(0,s.jsx)("p",{className:"font-medium mb-1",children:"ℹ️ 服務說明"}),(0,s.jsx)("p",{children:"本平台已對顧問進行初步資格篩選,但不對個別顧問的服務品質、專業建議或服務結果承擔保證責任。建議您在選擇顧問前,詳細了解顧問的專業背景、服務經驗,並根據自身需求進行評估。"})]})]})]})}function P(e){let{savedAdvisorsControl:t,...r}=e;return t?(0,s.jsx)(U,{...r,savedAdvisors:t}):(0,s.jsx)(V,{...r})}function V(e){let t=(0,O.b)();return(0,s.jsx)(U,{...e,savedAdvisors:t})}function H({advisor:e,open:t,onOpenChange:r,onBookingClick:l,onChatClick:n}){let[o,d]=(0,a.useState)(!1),c=(0,a.useRef)(null);return((0,a.useEffect)(()=>{t||d(!1)},[t]),e)?(0,s.jsx)(i.lG,{open:t||o,onOpenChange:e=>{o||r(e)},children:(0,s.jsx)(i.Cf,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto [&::-webkit-scrollbar]:hidden [-ms-overflow-style:none] [scrollbar-width:none] data-[state=open]:!animate-none",asChild:!0,children:(0,s.jsx)("div",{children:(0,s.jsx)(L.P.div,{initial:{opacity:1,x:0},animate:o?{opacity:0,x:-100}:{opacity:1,x:0},transition:{duration:.3,ease:"easeInOut"},onAnimationComplete:()=>{if(!o)return;
1let e=c.current;c.current=null,d(!1),r(!1),e&&l&&l(e)},children:(0,s.jsx)(P,{advisor:e,onClose:()=>r(!1),onBookingClick:()=>{l&&(c.current=e,d(!0))},onChatClick:n})})})})}):null}},96968:(e,t,r)=>{"use strict";r.d(t,{J:()=>d});var s=r(85047),a=r(31615),l=r(97688),i=r(63610),n=r(34961);let o=(0,i.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=a.forwardRef(({className:e,...t},r)=>(0,s.jsx)(l.b,{ref:r,className:(0,n.cn)(o(),e),...t}));d.displayName=l.b.displayName}},e=>{e.O(0,[5338,6062,8721,2811,1336,6277,274,9291,6052,7629,5418,7355,8133,8594,6821,6620,2931,5120,908,5360,752,3700,8928,2850,3257,5160,6162,4498,972,5084,6323,4387,5035,3118,1936,7358],()=>e(e.s=68916)),_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.