(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[814],{38862:(e,s,t)=>{"use strict";t.r(s),t.d(s,{default:()=>U});var a=t(95155),r=t(12115),l=t(35695),o=t(88482),n=t(97168),i=t(89852),d=t(88145),c=t(41397),m=t(9685),x=t(83540),u=t(99445),h=t(96025),p=t(16238),f=t(94517),g=t(62341);let b=[{date:"Jan 1",value:1e5,gain:0},{date:"Jan 5",value:102500,gain:2500},{date:"Jan 10",value:98e3,gain:-2e3},{date:"Jan 15",value:11e4,gain:1e4},{date:"Jan 20",value:115e3,gain:15e3},{date:"Jan 25",value:12e4,gain:2e4},{date:"Jan 30",value:125420,gain:25420}];function j(){return(0,a.jsx)("div",{className:"h-[300px] w-full",children:(0,a.jsx)(x.u,{width:"100%",height:"100%",children:(0,a.jsxs)(u.Q,{data:b,children:[(0,a.jsx)("defs",{children:(0,a.jsxs)("linearGradient",{id:"colorGradient",x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,a.jsx)("stop",{offset:"5%",stopColor:"#8B5CF6",stopOpacity:.3}),(0,a.jsx)("stop",{offset:"95%",stopColor:"#8B5CF6",stopOpacity:0})]})}),(0,a.jsx)(h.W,{dataKey:"date",axisLine:!1,tickLine:!1,tick:{fill:"#9CA3AF",fontSize:12}}),(0,a.jsx)(p.h,{axisLine:!1,tickLine:!1,tick:{fill:"#9CA3AF",fontSize:12},tickFormatter:e=>"$".concat((e/1e3).toFixed(0),"k")}),(0,a.jsx)(f.m,{contentStyle:{backgroundColor:"#1E293B",border:"1px solid #475569",borderRadius:"8px",color:"#F1F5F9"},formatter:(e,s)=>"value"===s?["$".concat(e.toLocaleString()),"Portfolio Value"]:["$".concat(e.toLocaleString()),"Gain/Loss"]}),(0,a.jsx)(g.G,{type:"monotone",dataKey:"value",stroke:"#8B5CF6",strokeWidth:2,fill:"url(#colorGradient)"})]})})})}var N=t(84616),v=t(44020),y=t(13717),w=t(24357),k=t(62525),C=t(33109),R=t(68500),P=t(47924),S=t(1482),A=t(25673),E=t(13052),F=t(5196),L=t(9428),T=t(53999);let J=A.bL,z=A.l9;A.YJ,A.ZL,A.Pb,A.z6,r.forwardRef((e,s)=>{let{className:t,inset:r,children:l,...o}=e;return(0,a.jsxs)(A.ZP,{ref:s,className:(0,T.cn)("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...o,children:[l,(0,a.jsx)(E.A,{className:"ml-auto"})]})}).displayName=A.ZP.displayName,r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(A.G5,{ref:s,className:(0,T.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg 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",t),...r})}).displayName=A.G5.displayName;let O=r.forwardRef((e,s)=>{let{className:t,sideOffset:r=4,...l}=e;return(0,a.jsx)(A.ZL,{children:(0,a.jsx)(A.UC,{ref:s,sideOffset:r,className:(0,T.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 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",t),...l})})});O.displayName=A.UC.displayName;let B=r.forwardRef((e,s)=>{let{className:t,inset:r,...l}=e;return(0,a.jsx)(A.q7,{ref:s,className:(0,T.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",r&&"pl-8",t),...l})});B.displayName=A.q7.displayName,r.forwardRef((e,s)=>{let{className:t,children:r,checked:l,...o}=e;return(0,a.jsxs)(A.H_,{ref:s,className:(0,T.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:l,...o,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(A.VF,{children:(0,a.jsx)(F.A,{className:"h-4 w-4"})})}),r]})}).displayName=A.H_.displayName,r.forwardRef((e,s)=>{let{className:t,children:r,...l}=e;return(0,a.jsxs)(A.hN,{ref:s,className:(0,T.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...l,children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,a.jsx)(A.VF,{children:(0,a.jsx)(L.A,{className:"h-2 w-2 fill-current"})})}),r]})}).displayName=A.hN.displayName,r.forwardRef((e,s)=>{let{className:t,inset:r,...l}=e;return(0,a.jsx)(A.JU,{ref:s,className:(0,T.cn)("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",t),...l})}).displayName=A.JU.displayName,r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(A.wv,{ref:s,className:(0,T.cn)("-mx-1 my-1 h-px bg-muted",t),...r})}).displayName=A.wv.displayName;var Z=t(99840),$=t(82714),_=t(38543),q=t(92844);function G(e){let{isOpen:s,onOpenChange:t,onPortfolioCreated:l}=e,[o,d]=(0,r.useState)(""),[c,m]=(0,r.useState)(""),[x,u]=(0,r.useState)("1000"),[h,p]=(0,r.useState)(!1),f=async()=>{if(!o.trim()){_.oR.error("Portfolio name is required");return}let e=parseFloat(x);if(isNaN(e)||e<1e3){_.oR.error("Initial cash must be at least $1,000");return}p(!0);try{await q.u.createPortfolio({name:o.trim(),description:c.trim(),initialCash:e}),d(""),m(""),u("1000"),t(!1),l(),_.oR.success("Portfolio created successfully")}catch(e){console.error("Error creating portfolio:",e),_.oR.error("Failed to create portfolio")}finally{p(!1)}};return(0,a.jsx)(Z.lG,{open:s,onOpenChange:t,children:(0,a.jsxs)(Z.Cf,{className:"bg-slate-800 border-slate-700",children:[(0,a.jsxs)(Z.c7,{children:[(0,a.jsx)(Z.L3,{className:"text-purple-300",children:"Create New Portfolio"}),(0,a.jsx)(Z.rr,{className:"text-gray-400",children:"Create a new portfolio to start tracking your investments."})]}),(0,a.jsxs)("div",{className:"grid gap-4 py-4",children:[(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)($.J,{htmlFor:"name",className:"text-gray-300",children:"Portfolio Name"}),(0,a.jsx)(i.p,{id:"name",value:o,onChange:e=>d(e.target.value),placeholder:"Enter portfolio name",className:"bg-slate-700 border-slate-600 text-white"})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)($.J,{htmlFor:"description",className:"text-gray-300",children:"Description (Optional)"}),(0,a.jsx)(i.p,{id:"description",value:c,onChange:e=>m(e.target.value),placeholder:"Enter portfolio description",className:"bg-slate-700 border-slate-600 text-white"})]}),(0,a.jsxs)("div",{className:"grid gap-2",children:[(0,a.jsx)($.J,{htmlFor:"initialCash",className:"text-gray-300",children:"Initial Cash (Optional)"}),(0,a.jsx)(i.p,{id:"initialCash",type:"number",value:x,onChange:e=>u(e.target.value),placeholder:"Enter initial cash (min. $1,000)",className:"bg-slate-700 border-slate-600 text-white"})]})]}),(0,a.jsxs)(Z.Es,{children:[(0,a.jsx)(n.$,{variant:"outline",onClick:()=>t(!1),className:"border-slate-600 text-gray-300",disabled:h,children:"Cancel"}),(0,a.jsx)(n.$,{onClick:f,className:"bg-gradient-to-r from-purple-500 to-blue-500",disabled:h,children:h?"Creating...":"Create"})]})]})})}function U(){let e=(0,l.useRouter)(),[s]=(0,r.useState)([{id:"1",name:"Tech Giants",description:"Large cap technology stocks",value:125420,initialValue:1e5,change:8.5,dayChange:2.3,stocks:[{symbol:"AAPL",name:"Apple Inc.",shares:50,price:175.2,change:1.2},{symbol:"MSFT",name:"Microsoft",shares:30,price:285.5,change:-.8},{symbol:"GOOGL",name:"Alphabet",shares:20,price:142.3,change:2.1},{symbol:"AMZN",name:"Amazon",shares:15,price:145.8,change:.5},{symbol:"META",name:"Meta Platforms",shares:25,price:298.4,change:3.2}],performance:"excellent"},{id:"2",name:"Dividend Kings",description:"High dividend yield stocks",value:98750,initialValue:1e5,change:-1.25,dayChange:-.5,stocks:[{symbol:"JNJ",name:"Johnson & Johnson",shares:40,price:162.3,change:-.3},{symbol:"PG",name:"Procter & Gamble",shares:35,price:155.8,change:.2},{symbol:"KO",name:"Coca-Cola",shares:60,price:58.9,change:-.1},{symbol:"PEP",name:"PepsiCo",shares:30,price:168.2,change:.4}],performance:"good"}]),[t,x]=(0,r.useState)(s[0]),[u,h]=(0,r.useState)([]),[p,f]=(0,r.useState)(!1),[g,b]=(0,r.useState)(!0),[A,E]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{try{let e=await q.u.getPortfolios();h(e),e.length}catch(e){console.error("Failed to fetch portfolios:",e)}finally{b(!1)}})()},[]);let F=async()=>{try{let e=await q.u.getPortfolios();h(e),e.length}catch(e){console.error("Failed to refresh portfolios:",e)}};return g?(0,a.jsxs)("div",{className:"flex min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900",children:[(0,a.jsx)(m.Bx,{}),(0,a.jsx)("main",{className:"flex-1 p-3 sm:p-6 lg:ml-64",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto space-y-6",children:(0,a.jsx)("div",{className:"flex justify-center items-center h-[calc(100vh-200px)]",children:(0,a.jsx)("div",{className:"animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-purple-500"})})})})]}):(0,a.jsxs)("div",{className:"flex min-h-screen bg-gradient-to-br from-slate-900 via-purple-900 to-slate-900 relative",children:[A&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 z-40 lg:hidden",onClick:()=>E(!1)}),(0,a.jsx)(m.Bx,{}),(0,a.jsx)("main",{className:"flex-1 p-3 sm:p-4 lg:p-6 lg:ml-64 w-full min-w-0",children:(0,a.jsxs)("div",{className:"max-w-7xl mx-auto space-y-4 sm:space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4 pt-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("h1",{className:"text-2xl sm:text-3xl font-bold bg-gradient-to-r from-purple-400 to-blue-400 bg-clip-text text-transparent",children:"Portfolio Management"}),(0,a.jsx)("p",{className:"text-gray-400 mt-1 text-sm sm:text-base",children:"Manage your investment portfolios and track performance"})]}),(0,a.jsxs)(n.$,{className:"bg-gradient-to-r from-purple-500 to-blue-500 hover:from-purple-600 hover:to-blue-600 transition-all duration-300 shadow-lg hover:shadow-purple-500/25 w-full sm:w-auto",onClick:()=>f(!0),children:[(0,a.jsx)(N.A,{className:"h-4 w-4 mr-2"}),"Create Portfolio"]})]}),(0,a.jsx)(G,{isOpen:p,onOpenChange:f,onPortfolioCreated:F}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-4 sm:gap-6",children:[null==u?void 0:u.map(s=>{var r,l;return(0,a.jsxs)(o.Zp,{className:"bg-slate-800/60 backdrop-blur-sm border-slate-700 cursor-pointer transition-all duration-300 hover:border-purple-500/50 hover:shadow-lg hover:shadow-purple-500/10 hover:-translate-y-1 ".concat((null==t?void 0:t.id)===s.id?"border-purple-500 ring-1 ring-purple-500/20 shadow-lg shadow-purple-500/20":""),onClick:()=>e.push("/portfolios/".concat(s.id)),children:[(0,a.jsx)(o.aR,{className:"pb-3",children:(0,a.jsxs)("div",{className:"flex justify-between items-start",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 pr-2",children:[(0,a.jsx)(o.ZB,{className:"text-lg truncate",children:s.name}),(0,a.jsx)(o.BT,{className:"text-sm line-clamp-2",children:s.description})]}),(0,a.jsxs)(J,{children:[(0,a.jsx)(z,{asChild:!0,children:(0,a.jsx)(n.$,{variant:"ghost",size:"sm",className:"hover:bg-slate-700/50 shrink-0",children:(0,a.jsx)(v.A,{className:"h-4 w-4"})})}),(0,a.jsxs)(O,{className:"bg-slate-800 border-slate-700",children:[(0,a.jsxs)(B,{className:"text-gray-300 hover:text-white hover:bg-slate-700",children:[(0,a.jsx)(y.A,{className:"h-4 w-4 mr-2"}),"Edit"]}),(0,a.jsxs)(B,{className:"text-gray-300 hover:text-white hover:bg-slate-700",children:[(0,a.jsx)(w.A,{className:"h-4 w-4 mr-2"}),"Clone"]}),(0,a.jsxs)(B,{className:"text-red-400 hover:text-red-300 hover:bg-red-500/10",children:[(0,a.jsx)(k.A,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Current Value"}),(0,a.jsxs)("span",{className:"font-bold text-lg text-right",children:["$",s.currentValue.toLocaleString()]})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Total Return"}),(0,a.jsxs)("div",{className:"flex items-center space-x-1",children:[s.totalReturn>0?(0,a.jsx)(C.A,{className:"h-4 w-4 text-green-400"}):(0,a.jsx)(R.A,{className:"h-4 w-4 text-red-400"}),(0,a.jsxs)("span",{className:"font-medium ".concat(s.totalReturn>0?"text-green-400":"text-red-400"),children:[s.totalReturn>0?"+":"",s.totalReturn.toFixed(2),"%"]})]})]}),(0,a.jsxs)("div",{className:"flex justify-between items-center",children:[(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Today"}),(0,a.jsxs)("span",{className:"font-medium ".concat(s.dailyChange>0?"text-green-400":"text-red-400"),children:[s.dailyChange>0?"+":"",s.dailyChange.toFixed(2),"%"]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,a.jsx)("span",{className:"text-gray-400",children:"Stocks"}),(0,a.jsxs)("span",{className:"font-medium",children:[null==s?void 0:null===(r=s.holdings)||void 0===r?void 0:r.length,"/20"]})]}),(0,a.jsx)(c.k,{value:(null==s?void 0:null===(l=s.holdings)||void 0===l?void 0:l.length)/20*100,className:"h-2 bg-slate-700"})]})]})})]},s.id)}),(0,a.jsx)(o.Zp,{className:"bg-slate-800/30 backdrop-blur-sm border-dashed border-slate-600 border-2 hover:border-purple-500/50 transition-all duration-300 hover:bg-slate-800/50",children:(0,a.jsxs)(o.Wu,{className:"flex flex-col items-center justify-center h-full min-h-[280px] sm:min-h-[300px] space-y-4",children:[(0,a.jsx)("div",{className:"p-4 bg-slate-700/50 rounded-full",children:(0,a.jsx)(N.A,{className:"h-8 w-8 text-gray-400"})}),(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("h3",{className:"font-medium text-gray-300",children:"Create New Portfolio"}),(0,a.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Start building your next investment strategy"})]}),(0,a.jsx)(n.$,{variant:"outline",className:"border-purple-500/50 text-purple-300 hover:bg-purple-500/20 hover:border-purple-400 transition-all duration-300",onClick:()=>f(!0),children:"Get Started"})]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 sm:gap-6",children:[(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsxs)(o.Zp,{className:"bg-slate-800/60 backdrop-blur-sm border-slate-700 hover:border-slate-600 transition-all duration-300",children:[(0,a.jsxs)(o.aR,{children:[(0,a.jsxs)(o.ZB,{className:"text-purple-300",children:[t.name," Performance"]}),(0,a.jsx)(o.BT,{children:"30-day performance overview"})]}),(0,a.jsx)(o.Wu,{children:(0,a.jsx)(j,{})})]})}),(0,a.jsxs)(o.Zp,{className:"bg-slate-800/60 backdrop-blur-sm border-slate-700 hover:border-slate-600 transition-all duration-300",children:[(0,a.jsxs)(o.aR,{children:[(0,a.jsx)(o.ZB,{className:"text-blue-300",children:"Holdings"}),(0,a.jsx)(o.BT,{children:"Current stock positions"})]}),(0,a.jsx)(o.Wu,{children:(0,a.jsx)("div",{className:"space-y-3 max-h-96 overflow-y-auto",children:t.stocks.map((e,s)=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-3 bg-slate-700/50 rounded-lg hover:bg-slate-700/70 transition-all duration-200",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"font-medium text-white truncate",children:e.symbol}),(0,a.jsxs)("p",{className:"text-sm text-gray-400",children:[e.shares," shares"]})]}),(0,a.jsxs)("div",{className:"text-right shrink-0 ml-2",children:[(0,a.jsxs)("p",{className:"font-medium text-white",children:["$",e.price]}),(0,a.jsxs)("p",{className:"text-sm font-medium ".concat(e.change>0?"text-green-400":"text-red-400"),children:[e.change>0?"+":"",e.change,"%"]})]})]},s))})})]})]}),(0,a.jsxs)(o.Zp,{className:"bg-slate-800/60 backdrop-blur-sm border-slate-700 hover:border-slate-600 transition-all duration-300",children:[(0,a.jsx)(o.aR,{children:(0,a.jsxs)("div",{className:"flex flex-col lg:flex-row justify-between items-start lg:items-center gap-4",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)(o.ZB,{className:"text-purple-300",children:"Manage Stocks"}),(0,a.jsxs)(o.BT,{children:["Add or remove stocks from ",t.name]})]}),(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-2 w-full lg:w-auto",children:[(0,a.jsxs)("div",{className:"relative flex-1 sm:flex-none",children:[(0,a.jsx)(P.A,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-gray-400"}),(0,a.jsx)(i.p,{placeholder:"Search stocks...",className:"pl-10 bg-slate-700 border-slate-600 hover:border-slate-500 focus:border-purple-500 transition-all duration-200 sm:w-64"})]}),(0,a.jsxs)(n.$,{variant:"outline",size:"sm",className:"border-slate-600 hover:bg-slate-700 hover:border-slate-500",children:[(0,a.jsx)(S.A,{className:"h-4 w-4 mr-2"}),"Filter"]})]})]})}),(0,a.jsx)(o.Wu,{children:(0,a.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:t.stocks.map((e,s)=>(0,a.jsx)(o.Zp,{className:"bg-slate-700/50 border-slate-600 hover:bg-slate-700/70 hover:border-slate-500 transition-all duration-200",children:(0,a.jsxs)(o.Wu,{className:"p-4",children:[(0,a.jsxs)("div",{className:"flex justify-between items-start mb-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1 pr-2",children:[(0,a.jsx)("h4",{className:"font-bold text-white truncate",children:e.symbol}),(0,a.jsx)("p",{className:"text-sm text-gray-400 line-clamp-2",children:e.name})]}),(0,a.jsxs)(d.E,{variant:"outline",className:"shrink-0 ".concat(e.change>0?"border-green-500 text-green-400 bg-green-500/10":"border-red-500 text-red-400 bg-red-500/10"),children:[e.change>0?"+":"",e.change,"%"]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Price"}),(0,a.jsxs)("span",{className:"font-medium text-white",children:["$",e.price]})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Shares"}),(0,a.jsx)("span",{className:"font-medium text-white",children:e.shares})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("span",{className:"text-sm text-gray-400",children:"Value"}),(0,a.jsxs)("span",{className:"font-medium text-white",children:["$",(e.price*e.shares).toLocaleString()]})]})]}),(0,a.jsxs)("div",{className:"flex gap-2 mt-4",children:[(0,a.jsx)(n.$,{size:"sm",variant:"outline",className:"flex-1 border-blue-500/50 text-blue-300 hover:bg-blue-500/20 hover:border-blue-400 transition-all duration-200",children:"Edit"}),(0,a.jsx)(n.$,{size:"sm",variant:"outline",className:"flex-1 border-red-500/50 text-red-300 hover:bg-red-500/20 hover:border-red-400 transition-all duration-200",children:"Remove"})]})]})},s))})})]})]})})]})}},41397:(e,s,t)=>{"use strict";t.d(s,{k:()=>n});var a=t(95155),r=t(12115),l=t(55863),o=t(53999);let n=r.forwardRef((e,s)=>{let{className:t,value:r,...n}=e;return(0,a.jsx)(l.bL,{ref:s,className:(0,o.cn)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:(0,a.jsx)(l.C1,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(r||0),"%)")}})})});n.displayName=l.bL.displayName},82714:(e,s,t)=>{"use strict";t.d(s,{J:()=>d});var a=t(95155),r=t(12115),l=t(40968),o=t(74466),n=t(53999);let i=(0,o.F)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.b,{ref:s,className:(0,n.cn)(i(),t),...r})});d.displayName=l.b.displayName},88145:(e,s,t)=>{"use strict";t.d(s,{E:()=>n});var a=t(95155);t(12115);var r=t(74466),l=t(53999);let o=(0,r.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"}});function n(e){let{className:s,variant:t,...r}=e;return(0,a.jsx)("div",{className:(0,l.cn)(o({variant:t}),s),...r})}},88482:(e,s,t)=>{"use strict";t.d(s,{BT:()=>d,Wu:()=>c,ZB:()=>i,Zp:()=>o,aR:()=>n});var a=t(95155),r=t(12115),l=t(53999);let o=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("rounded-lg border bg-card text-card-foreground shadow-sm",t),...r})});o.displayName="Card";let n=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("flex flex-col space-y-1.5 p-6",t),...r})});n.displayName="CardHeader";let i=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("text-2xl font-semibold leading-none tracking-tight",t),...r})});i.displayName="CardTitle";let d=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("text-sm text-muted-foreground",t),...r})});d.displayName="CardDescription";let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("p-6 pt-0",t),...r})});c.displayName="CardContent",r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)("div",{ref:s,className:(0,l.cn)("flex items-center p-6 pt-0",t),...r})}).displayName="CardFooter"},89852:(e,s,t)=>{"use strict";t.d(s,{p:()=>o});var a=t(95155),r=t(12115),l=t(53999);let o=r.forwardRef((e,s)=>{let{className:t,type:r,...o}=e;return(0,a.jsx)("input",{type:r,className:(0,l.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground 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",t),ref:s,...o})});o.displayName="Input"},90077:(e,s,t)=>{Promise.resolve().then(t.bind(t,38862))},92844:(e,s,t)=>{"use strict";t.d(s,{u:()=>l});var a=t(88783);class r{getHeaders(){let e={"Content-Type":"application/json"};if(this.token){let s=this.token.trim();e.Authorization="Bearer ".concat(s)}return e}async request(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t={...this.getHeaders(),...s.headers};console.log("Request URL:","".concat(this.baseUrl).concat(e)),console.log("Request Headers:",t);let a=await fetch("".concat(this.baseUrl).concat(e),{...s,headers:t});if(!a.ok){let e=await a.json().catch(()=>({}));if(console.error("API Error:",{status:a.status,statusText:a.statusText,error:e}),401===a.status)throw this.clearToken(),window.location.href="/",Error("Your session has expired. Please log in again.");throw Error(e.message||"An error occurred")}let r=await a.json();return console.log("Response Data:",r),r}async createPortfolio(e){return this.request("/api/v1/portfolios",{method:"POST",body:JSON.stringify(e)})}async getPortfolios(){return this.request("/api/v1/portfolios")}async getPortfolio(e){return this.request("/api/v1/portfolios/".concat(e))}async updatePortfolio(e,s){return this.request("/api/v1/portfolios/".concat(e),{method:"PUT",body:JSON.stringify(s)})}async deletePortfolio(e){return this.request("/api/v1/portfolios/".concat(e),{method:"DELETE"})}async searchStocks(e){return this.request("/api/v1/market/search?q=".concat(encodeURIComponent(e)))}async getStock(e){return this.request("/api/v1/stocks/".concat(e))}async addStockToPortfolio(e,s,t){return this.request("/api/v1/portfolios/".concat(e,"/stocks"),{method:"POST",body:JSON.stringify({symbol:s,shares:t})})}async updateStockInPortfolio(e,s,t){return this.request("/api/v1/portfolios/".concat(e,"/stocks/").concat(s),{method:"PUT",body:JSON.stringify({shares:t})})}async removeStockFromPortfolio(e,s){return this.request("/api/v1/portfolios/".concat(e,"/stocks/").concat(s),{method:"DELETE"})}setToken(e){this.token=e,localStorage.setItem("token",e)}clearToken(){this.token=null,localStorage.removeItem("token")}constructor(){this.baseUrl=(0,a.$_)("production","NEXT_PUBLIC_API_URL"),this.token=localStorage.getItem("token")}}let l=new r},99840:(e,s,t)=>{"use strict";t.d(s,{Cf:()=>m,Es:()=>u,L3:()=>h,c7:()=>x,lG:()=>i,rr:()=>p});var a=t(95155),r=t(12115),l=t(15452),o=t(54416),n=t(53999);let i=l.bL;l.l9;let d=l.ZL;l.bm;let c=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.hJ,{ref:s,className:(0,n.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...r})});c.displayName=l.hJ.displayName;let m=r.forwardRef((e,s)=>{let{className:t,children:r,...i}=e;return(0,a.jsxs)(d,{children:[(0,a.jsx)(c,{}),(0,a.jsxs)(l.UC,{ref:s,className:(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:rounded-lg",t),...i,children:[r,(0,a.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,a.jsx)(o.A,{className:"h-4 w-4"}),(0,a.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});m.displayName=l.UC.displayName;let x=e=>{let{className:s,...t}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex flex-col space-y-1.5 text-center sm:text-left",s),...t})};x.displayName="DialogHeader";let u=e=>{let{className:s,...t}=e;return(0,a.jsx)("div",{className:(0,n.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",s),...t})};u.displayName="DialogFooter";let h=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.hE,{ref:s,className:(0,n.cn)("text-lg font-semibold leading-none tracking-tight",t),...r})});h.displayName=l.hE.displayName;let p=r.forwardRef((e,s)=>{let{className:t,...r}=e;return(0,a.jsx)(l.VY,{ref:s,className:(0,n.cn)("text-sm text-muted-foreground",t),...r})});p.displayName=l.VY.displayName}},e=>{var s=s=>e(e.s=s);e.O(0,[49,478,52,290,452,128,265,685,441,684,358],()=>s(90077)),_N_E=e.O()}]);