1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7099],{1006:(e,t,a)=>{"use strict";function o(e){if(!e)return new Date;let[t,a,o]=e.split("T")[0].split("-").map(Number);return new Date(t,a-1,o)}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{month:"short",day:"numeric",year:"numeric"};return o(e).toLocaleDateString("en-US",t)}a.d(t,{TJ:()=>r,Zj:()=>o})},31321:(e,t,a)=>{"use strict";a.d(t,{Z0:()=>G,j5:()=>ee,ly:()=>J,q1:()=>X,tS:()=>q,zq:()=>$});var o=a(43002),r=a(42753),n=a(66840),l=a(70415),s=a(62072),d=a(58997),c=a(91762),i=a(70419),u=a(97152),g=a(1367),m=a(19769),p=a(73774),b=a(48065),_=a(28239),y=a(74147),x=a(55300),h=a(7552),f=a(46244),w=a(12051),v=a(61290),j=a(81456),k=a(19753),C=a(21011),N=a(73102),A=a(65321),S=a(83170),B=a(89355),T=a(31622),I=a(19146),D=a(29038),F=a(889),L=a(40590),R=a(82455),M=a(75097),E=a(76113),P=a(60815),H=a(21654),z=a(18937),W=a(39880),K=a(25438),O=a(18988);let q={home:o.A,utensils:r.A,car:n.A,"shopping-cart":l.A,film:s.A,zap:d.A,heart:c.A,shield:i.A,"credit-card":u.A,"piggy-bank":g.A,user:m.A,shirt:p.A,smartphone:b.A,wifi:_.A,"graduation-cap":y.A,"paw-print":x.A,gift:h.A,plane:f.A,dumbbell:w.A,baby:v.A,"hand-coins":j.A,church:k.A,wrench:C.A,landmark:N.A,scissors:A.A,coffee:S.A,wine:B.A,cigarette:T.A,briefcase:I.A,"book-open":D.A,sparkles:F.A,tag:L.A,wallet:R.A,droplets:M.A,pill:E.A,stethoscope:P.A,gamepad:H.A,music:z.A,tv:W.A,package:K.A,banknote:O.A},G=Object.keys(q),U=[{keywords:["hous","rent","mortgage","apartment"],iconKey:"home"},{keywords:["food","grocer","dining","restaurant","meal","eat"],iconKey:"utensils"},{keywords:["coffee","cafe","starbucks"],iconKey:"coffee"},{keywords:["transport","car","gas","fuel","auto","parking","commut"],iconKey:"car"},{keywords:["shop","amazon","retail"],iconKey:"shopping-cart"},{keywords:["entertain","fun","stream","netflix","hobby"],iconKey:"film"},{keywords:["game","gaming","xbox","playstation","nintendo"],iconKey:"gamepad"},{keywords:["music","spotify","concert"],iconKey:"music"},{keywords:["tv","cable","television","hulu"],iconKey:"tv"},{keywords:["util","electric","energy","sewage","trash"],iconKey:"zap"},{keywords:["water"],iconKey:"droplets"},{keywords:["health","medical","doctor","dental","vision","therap","wellness"],iconKey:"heart"},{keywords:["prescri","pharmacy","medication"],iconKey:"pill"},{keywords:["insur"],iconKey:"shield"},{keywords:["subscri","membership"],iconKey:"credit-card"},{keywords:["saving","emergency","invest","retire","ira","401k"],iconKey:"piggy-bank"},{keywords:["personal","self-care","selfcare","grooming","hygiene"],iconKey:"user"},{keywords:["cloth","apparel","wear","fashion","shoe"],iconKey:"shirt"},{keywords:["phone","cell","mobile"],iconKey:"smartphone"},{keywords:["internet","wifi","broadband"],iconKey:"wifi"},{keywords:["educat","school","tuition","college","course","learn","student"],iconKey:"graduation-cap"},{keywords:["pet","dog","cat","vet"],iconKey:"paw-print"},{keywords:["gift","present","birthday","holiday","christmas"],iconKey:"gift"},{keywords:["travel","vacation","flight","hotel","trip"],iconKey:"plane"},{keywords:["fitness","gym","workout","exercise","sport","yoga"],iconKey:"dumbbell"},{keywords:["child","kid","baby","daycare","nursery","diaper"],iconKey:"baby"},{keywords:["debt","loan","payment","payoff"],iconKey:"hand-coins"},{keywords:["donat","charity","tithe","church","giving","offering"],iconKey:"church"},{keywords:["mainten","repair","fix","home improvement"],iconKey:"wrench"},{keywords:["tax","govern","fee","license"],iconKey:"landmark"},{keywords:["beauty","hair","salon","barber","nail","spa"],iconKey:"scissors"},{keywords:["alcohol","bar","beer","wine","drink","liquor"],iconKey:"wine"},{keywords:["smok","tobacco","vape","cigarette"],iconKey:"cigarette"},{keywords:["work","business","office","profession"],iconKey:"briefcase"},{keywords:["book","read","library","kindle","audible"],iconKey:"book-open"},{keywords:["misc","other","miscellaneous","general","extra"],iconKey:"sparkles"},{keywords:["wallet","cash","allowance","pocket money","spending"],iconKey:"wallet"}];function V(e){let t=e.toLowerCase();for(let e of U)if(e.keywords.some(e=>t.includes(e)))return e.iconKey;return"tag"}function X(e,t){return e&&q[e]?q[e]:t&&q[V(t)]||L.A}function J(e,t){return e&&q[e]?e:t?V(t):"tag"}let Z=/^#[0-9A-Fa-f]{6}$/,Y=["#10b981","#3b82f6","#f59e0b","#ef4444","#8b5cf6","#ec4899","#06b6d4","#84cc16","#f97316","#6366f1"],Q={red:"#EF4444",orange:"#F97316",amber:"#F59E0B",yellow:"#EAB308",green:"#10B981",emerald:"#10B981",teal:"#14B8A6",cyan:"#06B6D4",blue:"#3B82F6",indigo:"#6366F1",violet:"#8B5CF6",purple:"#A855F7",pink:"#EC4899",rose:"#F43F5E",lime:"#84CC16",gray:"#6B7280",grey:"#6B7280",white:"#FFFFFF",black:"#000000"};function $(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e){if(Z.test(e))return e;let t=Q[e.toLowerCase()];if(t)return t}return Y[t%Y.length]}function ee(e,t){let a=parseInt(e.slice(1,3),16),o=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return"rgba(".concat(a,", ").concat(o,", ").concat(r,", ").concat(t,")")}},45233:(e,t,a)=>{"use strict";a.d(t,{E:()=>l});var o=a(54568);a(7620);var r=a(31321);let n={sm:{circle:24,icon:14},md:{circle:28,icon:16},lg:{circle:32,icon:18}};function l(e){let{iconKey:t,categoryName:a,color:l,colorIndex:s=0,size:d="md",isDebt:c}=e,i=(0,r.q1)(t,a),u=c?"#EF4444":(0,r.zq)(l,s),{circle:g,icon:m}=n[d];return(0,o.jsx)("div",{style:{width:g,height:g,borderRadius:"50%",backgroundColor:(0,r.j5)(u,.15),display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:(0,o.jsx)(i,{size:m,color:u,strokeWidth:2})})}},68231:e=>{e.exports={panel:"budget-components_panel__b_z2c",panelPadding:"budget-components_panelPadding__K6ef2",label:"budget-components_label__MZniG",primaryText:"budget-components_primaryText__Y8o5T",secondaryText:"budget-components_secondaryText__PeUgN",mutedText:"budget-components_mutedText__BwbNS",largeAmount:"budget-components_largeAmount__2EIaj",progressTrack:"budget-components_progressTrack__8ukr0",progressFill:"budget-components_progressFill__SgpWv",progressFillOver:"budget-components_progressFillOver__EO3q_",progressText:"budget-components_progressText__NnV57",divider:"budget-components_divider__EgsZT",sectionTitle:"budget-components_sectionTitle__g3iWi",breakdownRow:"budget-components_breakdownRow__Cr297",breakdownLabel:"budget-components_breakdownLabel__rxGoT",breakdownValue:"budget-components_breakdownValue__LNqL7",categoryRow:"budget-components_categoryRow__AvjKf",categoryDot:"budget-components_categoryDot__2aWW4",categoryInfo:"budget-components_categoryInfo__O2uJv",categoryName:"budget-components_categoryName__x8c35",categoryAmount:"budget-components_categoryAmount__ZW__2",categoryProgress:"budget-components_categoryProgress__MGgwX",categoryProgressFill:"budget-components_categoryProgressFill__yxLMG",secondaryButton:"budget-components_secondaryButton__Dh3rh",calendarHeader:"budget-components_calendarHeader__MMBXz",calendarTitle:"budget-components_calendarTitle__HZgO8",calendarNav:"budget-components_calendarNav__9_uoI",navButton:"budget-components_navButton__y4h3Q",calendarGrid:"budget-components_calendarGrid__TRwVD",dayHeader:"budget-components_dayHeader__md97G",dayCell:"budget-components_dayCell__HtU51",dayNumber:"budget-components_dayNumber__2YzAV",dayAmount:"budget-components_dayAmount__9c1yy",legend:"budget-components_legend__UrBWJ",legendDot:"budget-components_legendDot__DcpC7",legendLabel:"budget-components_legendLabel__Bl3es",dayCellEmpty:"budget-components_dayCellEmpty__efiD7",dayCellToday:"budget-components_dayCellToday__lk7J_",dayCellHasSpending:"budget-components_dayCellHasSpending__OU4cM",dayCellUnder:"budget-components_dayCellUnder__EaS8s",dayCellOnPace:"budget-components_dayCellOnPace__33rDp",dayCellOver:"budget-components_dayCellOver__gCrLs",dayCellHigh:"budget-components_dayCellHigh__D_vT3",legendItem:"budget-components_legendItem__4y4ig",chartContainer:"budget-components_chartContainer__pQ3Dg",chartHeader:"budget-components_chartHeader__9h_T_",chartTitle:"budget-components_chartTitle__Ap4rs",overlay:"budget-components_overlay__A0kDD",fadeIn:"budget-components_fadeIn__bAikZ",slidePanel:"budget-components_slidePanel__OMTH_",slideIn:"budget-components_slideIn__9CnQd",slidePanelHeader:"budget-components_slidePanelHeader__j6Drq",slidePanelTitle:"budget-components_slidePanelTitle__SqndU",closeButton:"budget-components_closeButton__Nvuxc",slidePanelContent:"budget-components_slidePanelContent__mXdRM",emptyState:"budget-components_emptyState__Czki7",emptyStateIcon:"budget-components_emptyStateIcon__TXaUT",emptyStateText:"budget-components_emptyStateText__4p9g6",debtRow:"budget-components_debtRow__nnTFm",debtInfo:"budget-components_debtInfo__3rKbJ",debtName:"budget-components_debtName__WUuD4",debtAmount:"budget-components_debtAmount__cNJgU",debtStatus:"budget-components_debtStatus__MaC21",debtStatusPaid:"budget-components_debtStatusPaid__SjdpS",debtStatusPartial:"budget-components_debtStatusPartial__2rDBE",debtStatusDue:"budget-components_debtStatusDue__WJHdL"}},74166:e=>{e.exports={overlay:"budget-modal_overlay___rIR8",modal:"budget-modal_modal__19quz",modalL
1arge:"budget-modal_modalLarge__gwson",header:"budget-modal_header__E3Tn7",headerLeft:"budget-modal_headerLeft__0olo0",headerIcon:"budget-modal_headerIcon__ygn2h",headerIconWarning:"budget-modal_headerIconWarning__lWNmP",headerIconSuccess:"budget-modal_headerIconSuccess__NU6oS",headerIconDanger:"budget-modal_headerIconDanger__wme7p",headerTitle:"budget-modal_headerTitle__iVKei",closeButton:"budget-modal_closeButton__InfCz",content:"budget-modal_content__M3hl8",contentRebalancing:"budget-modal_contentRebalancing__x5YaL",footer:"budget-modal_footer__KpQZu",footerLeft:"budget-modal_footerLeft__BPNxA",footerRight:"budget-modal_footerRight__41fYV",fieldGroup:"budget-modal_fieldGroup__2Kv76",label:"budget-modal_label__hlNh0",input:"budget-modal_input__zbf40",inputWrapper:"budget-modal_inputWrapper__6DTML",inputPrefix:"budget-modal_inputPrefix__548NG",inputWithPrefix:"budget-modal_inputWithPrefix__ME5to",colorGrid:"budget-modal_colorGrid__JBIhZ",colorButton:"budget-modal_colorButton__mXoIE",colorButtonSelected:"budget-modal_colorButtonSelected__34HXE",iconGrid:"budget-modal_iconGrid__FQ_bO",iconButton:"budget-modal_iconButton__I_Fc7",iconButtonSelected:"budget-modal_iconButtonSelected___J2LO",budgetContext:"budget-modal_budgetContext__iINkn",budgetContextValue:"budget-modal_budgetContextValue__Fxlng",statusPositive:"budget-modal_statusPositive___awkZ",statusNegative:"budget-modal_statusNegative__vTRta",statusWarning:"budget-modal_statusWarning__y2qIc",infoBox:"budget-modal_infoBox__akd_X",infoRow:"budget-modal_infoRow__C84AI",infoLabel:"budget-modal_infoLabel__8al2Q",infoValue:"budget-modal_infoValue__XBpG8",infoText:"budget-modal_infoText__4rSEg",inputLabel:"budget-modal_inputLabel__wLeHO",inputField:"budget-modal_inputField__8PHnu",warningBox:"budget-modal_warningBox__DBVXZ",warningBoxIncrease:"budget-modal_warningBoxIncrease__XvxNA",warningBoxDecrease:"budget-modal_warningBoxDecrease__2gbsG",warningIcon:"budget-modal_warningIcon__kfJXE",warningTitle:"budget-modal_warningTitle__Qfrdi",warningText:"budget-modal_warningText__6jt6l",warningTextIncrease:"budget-modal_warningTextIncrease__O_Emk",warningTextDecrease:"budget-modal_warningTextDecrease__dw_j_",errorBox:"budget-modal_errorBox__7heFv",errorIcon:"budget-modal_errorIcon__24Hin",errorText:"budget-modal_errorText__qyOnB",successBox:"budget-modal_successBox__ws09O",successText:"budget-modal_successText__bidle",rebalanceHeader:"budget-modal_rebalanceHeader__dp8A_",rebalanceHeaderIncrease:"budget-modal_rebalanceHeaderIncrease__lxA4w",rebalanceHeaderDecrease:"budget-modal_rebalanceHeaderDecrease__GmLdY",rebalanceSummary:"budget-modal_rebalanceSummary__iAP7L",rebalanceSummaryCategory:"budget-modal_rebalanceSummaryCategory__uin2k",categoryColorDot:"budget-modal_categoryColorDot__nRnpS",categoryName:"budget-modal_categoryName__C185X",rebalanceSummaryAmount:"budget-modal_rebalanceSummaryAmount__m5Kyv",rebalanceSummaryAmountNew:"budget-modal_rebalanceSummaryAmountNew__tAw6E",rebalanceTitle:"budget-modal_rebalanceTitle__K5tD1",rebalanceTitleIncrease:"budget-modal_rebalanceTitleIncrease__oVcyM",rebalanceTitleDecrease:"budget-modal_rebalanceTitleDecrease__Qc1jT",rebalanceDescription:"budget-modal_rebalanceDescription__Cc5G7",rebalanceDescriptionIncrease:"budget-modal_rebalanceDescriptionIncrease__sMvP_",rebalanceDescriptionDecrease:"budget-modal_rebalanceDescriptionDecrease__F6qjt",progressContainer:"budget-modal_progressContainer__vjr3J",progressTrack:"budget-modal_progressTrack__NLm1v",progressFill:"budget-modal_progressFill__glTFs",progressFillIncrease:"budget-modal_progressFillIncrease__mBUGn",progressFillDecrease:"budget-modal_progressFillDecrease__rGea8",progressFillComplete:"budget-modal_progressFillComplete__wC0JD",progressLabel:"budget-modal_progressLabel__pTD4I",progressLabelPending:"budget-modal_progressLabelPending__TuQFD",progressLabelComplete:"budget-modal_progressLabelComplete__19rOz",categoryList:"budget-modal_categoryList__Xttkk",categoryRow:"budget-modal_categoryRow__90_nm",categoryRowHeader:"budget-modal_categoryRowHeader__znMnC",categoryRowInfo:"budget-modal_categoryRowInfo__U0Trf",categoryRowName:"budget-modal_categoryRowName__0n3gs",categoryRowMeta:"budget-modal_categoryRowMeta__a7jXI",categoryRowControls:"budget-modal_categoryRowControls__Tr7ti",categorySlider:"budget-modal_categorySlider__LG35m",categoryInputWrapper:"budget-modal_categoryInputWrapper__XkAZ8",categoryInputPrefix:"budget-modal_categoryInputPrefix__MN6Wu",categoryInput:"budget-modal_categoryInput__SWFRd",quickAmounts:"budget-modal_quickAmounts__vwlYI",quickAmountBtn:"budget-modal_quickAmountBtn__aujec",quickAmountBtnExact:"budget-modal_quickAmountBtnExact__UKOKN",quickAmountBtnNormal:"budget-modal_quickAmountBtnNormal__SJ04N",addCategoryButton:"budget-modal_addCategoryButton__KWMtl",typeToggleGroup:"budget-modal_typeToggleGroup__vVMEZ",typeToggleBtn:"budget-modal_typeToggleBtn__4TIgK",typeToggleBtnActive:"budget-modal_typeToggleBtnActive__5
1Hdzu",incomeTheme:"budget-modal_incomeTheme__kZyJq",primaryButton:"budget-modal_primaryButton__OgkrM",dangerButton:"budget-modal_dangerButton__SZtXr",warningButton:"budget-modal_warningButton__clq5I",secondaryButton:"budget-modal_secondaryButton__emhA_",backButton:"budget-modal_backButton__8esyc",spinner:"budget-modal_spinner__33TgC",spin:"budget-modal_spin__pG14Q",deleteCategoryInfo:"budget-modal_deleteCategoryInfo__9e_Rp",deleteCategoryHeader:"budget-modal_deleteCategoryHeader__FC9za",deleteCategoryName:"budget-modal_deleteCategoryName__2axf3",deleteCategoryStats:"budget-modal_deleteCategoryStats__bO4dB",deleteCategoryStat:"budget-modal_deleteCategoryStat__toFku",deleteStatLabel:"budget-modal_deleteStatLabel__82qmD",deleteStatValue:"budget-modal_deleteStatValue__9f8bN",blockedContainer:"budget-modal_blockedContainer__LF0Xv",blockedIcon:"budget-modal_blockedIcon__Z9Vxe",blockedTitle:"budget-modal_blockedTitle__llLyr",blockedDescription:"budget-modal_blockedDescription__eI87_"}},91214:(e,t,a)=>{"use strict";a.d(t,{A8:()=>y,Yj:()=>A,lX:()=>k,Tp:()=>i,do:()=>R});var o=a(54568),r=a(7620),n=a(85047),l=a(37286),s=a(78036),d=a(68231),c=a.n(d);function i(e){let{monthLabel:t,totalBudget:a,totalSpent:d,categoryCount:i,viewMonth:u,viewYear:g,onViewCategories:m,onViewHistory:p}=e,{currency:b,symbol:_}=(0,s.H)(),[y,x]=(0,r.useState)(!1);(0,r.useEffect)(()=>x(!0),[]);let h=e=>isNaN(e)||!isFinite(e)?"".concat(_,"0"):new Intl.NumberFormat("en-US",{style:"currency",currency:b,minimumFractionDigits:0,maximumFractionDigits:0}).format(e),f=a>0?Math.min(Math.round(d/a*100),100):0,w=d>a,v=a-d,j=(0,r.useMemo)(()=>{let e=new Date,t=new Date(g,u+1,0).getDate(),o=u===e.getMonth()&&g===e.getFullYear(),r=o?e.getDate():t,n=o?t-r:0,l=a/t,s=l*r,c=r>0?d/r:0,i=n>0?v/n:0,m=s>0?d/s*100:0,p="on";return m<90?p="under":m>110&&(p="over"),{dailyBudget:l,daysRemaining:n,avgDailySpending:c,projectedTotal:c*t,dailyRemaining:i,paceStatus:p,isCurrentMonth:o}},[a,d,v,u,g]);return y?(0,o.jsxs)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),children:[(0,o.jsxs)("div",{children:[(0,o.jsxs)("p",{className:c().label,children:[t," Spending"]}),(0,o.jsx)("p",{className:c().largeAmount,children:h(d)}),(0,o.jsx)("div",{className:c().progressTrack,children:(0,o.jsx)("div",{className:w?c().progressFillOver:c().progressFill,style:{width:"".concat(f,"%")}})}),(0,o.jsxs)("p",{className:c().progressText,children:[f,"% of ",h(a)," budget"]})]}),(0,o.jsx)("div",{className:c().divider}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:c().sectionTitle,children:"Summary"}),(0,o.jsxs)("div",{className:c().breakdownRow,children:[(0,o.jsx)("span",{className:c().breakdownLabel,children:"Remaining"}),(0,o.jsxs)("span",{className:c().breakdownValue,style:{color:v>=0?"var(--success)":"var(--error)"},children:[h(Math.abs(v)),v<0&&" over"]})]}),(0,o.jsxs)("div",{className:c().breakdownRow,children:[(0,o.jsx)("span",{className:c().breakdownLabel,children:"Categories"}),(0,o.jsx)("span",{className:c().breakdownValue,children:i})]})]}),(0,o.jsx)("div",{className:c().divider}),(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{className:c().sectionTitle,children:"Spending Pace"}),(0,o.jsxs)("div",{className:c().breakdownRow,children:[(0,o.jsx)("span",{className:c().breakdownLabel,children:"Daily Budget"}),(0,o.jsx)("span",{className:c().breakdownValue,children:h(j.dailyBudget)})]}),(0,o.jsxs)("div",{className:c().breakdownRow,children:[(0,o.jsx)("span",{className:c().breakdownLabel,children:"Avg. Daily Spending"}),(0,o.jsx)("span",{className:c().breakdownValue,style:{color:j.avgDailySpending>j.dailyBudget?"var(--error)":"var(--success)"},children:h(j.avgDailySpending)})]}),j.isCurrentMonth&&j.daysRemaining>0&&(0,o.jsxs)("div",{className:c().breakdownRow,children:[(0,o.jsx)("span",{className:c().breakdownLabel,children:"Days Remaining"}),(0,o.jsx)("span",{className:c().breakdownValue,children:j.daysRemaining})]})]}),(0,o.jsxs)("div",{style:{marginTop:"1.25rem",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,o.jsxs)("button",{onClick:m,className:c().secondaryButton,children:[(0,o.jsx)(n.A,{}),"View Categories"]}),(0,o.jsxs)("button",{onClick:p,className:c().secondaryButton,children:[(0,o.jsx)(l.A,{}),"View History"]})]})]}):(0,o.jsx)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),style:{minHeight:300}})}var u=a(24560),g=a(97509),m=a(48037),p=a(86336),b=a(5530),_=a(2255);function y(e){let{transactions:t,viewMonth:a,viewYear:n,dailyBudget:l,onDayClick:d,onMonthChange:i,selectedCategoryId:y}=e,{resolvedTheme:x}=(0,u.D)(),{symbol:h}=(0,s.H)(),[f,w]=(0,r.useState)(!1),[v,j]=(0,r.useState)(null),[k,C]=(0,r.useState)(!1),[N,A]=(0,r.useState)(!1),[S,B]=(0,r.useState)({width:0,height:0});(0,r.useEffect)(()=>{w(!0);let e=()=>{A(window.innerWidth<640),B({width:window.innerWidth,height:window.innerHeight})};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let T=f&&"light"===x;(0,r.useEffect)(()=>(k?(document.body.style.overflow="hidden",document.body.setAttribute("data-fullscreen-open","true")):(document.body.style.overflow="",document.body.removeAttribute("data-fullscreen-open")),()=>{document.body.style.overflow="",document.body.removeAttribute("data-fullscreen-open")}),[k]);let I=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],D=new Date(n,a+1,0).getDate(),F=new Date(n,a,1).getDay(),L=(e,t,a)=>"".concat(e,"-").concat(String(t+1).padStart(2,"0"),"-").concat(String(a).padStart(2,"0")),R=new Date,M=L(R.getFullYear(),R.getMonth(),R.getDate()),E=(0,r.useMemo)(()=>{let e={};
1return(y?t.filter(e=>e.category_id===y):t).forEach(t=>{let{year:a,month:o,day:r}=(e=>{let[t,a,o]=e.split("T")[0].split("-").map(Number);return{year:t,month:a-1,day:o}})(t.date),n=L(a,o,r);e[n]||(e[n]=[]),e[n].push(t)}),e},[t,y]),P=e=>E[e]||[],H=e=>P(e).filter(e=>"expense"===e.type).reduce((e,t)=>{let a="number"==typeof t.amount?t.amount:parseFloat(String(t.amount));return e+(isNaN(a)?0:Math.abs(a))},0),z=e=>e>=1e3?"".concat(h).concat((e/1e3).toFixed(1),"k"):"".concat(h).concat(Math.round(e)),W=["January","February","March","April","May","June","July","August","September","October","November","December"],K=()=>{0===a?i(11,n-1):i(a-1,n)},O=()=>{11===a?i(0,n+1):i(a+1,n)},q=e=>0===e?"var(--accent)":e<l?"#10B981":e<1.5*l?"#60a5fa":e<2*l?"#F59E0B":"#EF4444";if(!f)return(0,o.jsx)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),style:{minHeight:300}});let G=e=>{let{day:t,expanded:r=!1}=e,s=L(n,a,t),i=P(s),u=H(s),g=u>0,m=s===M,p=v===t,b=[c().dayCell,g?0===u?"":u<l?c().dayCellUnder:u<1.5*l?c().dayCellOnPace:u<2*l?c().dayCellOver:c().dayCellHigh:"",m?c().dayCellToday:""].filter(Boolean).join(" ");return(0,o.jsxs)("button",{onClick:()=>{d(new Date(n,a,t),i)},className:b,style:{minHeight:r?"60px":void 0,aspectRatio:r?"1":void 0,transform:p?"scale(1.02)":"scale(1)"},onMouseEnter:()=>j(t),onMouseLeave:()=>j(null),"aria-label":"".concat(W[a]," ").concat(t,", ").concat(n).concat(g?", ".concat(z(u)," spent"):""),children:[(0,o.jsx)("span",{className:c().dayNumber,style:{fontWeight:g?600:500,color:g?q(u):"var(--text)"},children:t}),g&&(0,o.jsx)("span",{className:c().dayAmount,style:{color:q(u)},children:z(u)})]})};if(k){let e=T?{bg:"#ffffff",border:"#e2e8f0",text:"#0f172a",textMuted:"#64748b",buttonBg:"#f1f5f9",cellBg:"#f8fafc",accent:"#10b981"}:{bg:"#111114",border:"#27272a",text:"#fafafa",textMuted:"#a1a1aa",buttonBg:"#18181b",cellBg:"#18181b",accent:"#10b981"},t=N?{position:"fixed",top:0,left:0,width:"".concat(S.height,"px"),height:"".concat(S.width,"px"),transform:"rotate(90deg)",transformOrigin:"top left",marginLeft:"".concat(S.width,"px"),zIndex:99999,backgroundColor:e.bg,display:"flex",flexDirection:"column",padding:0,overflow:"hidden"}:{position:"fixed",inset:0,zIndex:99999,backgroundColor:"rgba(0, 0, 0, 0.75)",backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},r=(0,o.jsx)("div",{style:t,onClick:e=>!N&&e.target===e.currentTarget&&C(!1),children:(0,o.jsxs)("div",{style:N?{display:"flex",flexDirection:"column",flex:1,overflow:"hidden",padding:"0.5rem 0.5rem 0.75rem 0.5rem"}:{maxWidth:"56rem",maxHeight:"90vh",width:"95%",padding:"1.5rem",display:"flex",flexDirection:"column",background:e.bg,border:"1px solid ".concat(e.border),borderRadius:"16px",boxShadow:"0 25px 50px -12px rgba(0, 0, 0, 0.5)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:N?"0.375rem":"1rem",paddingBottom:N?"0.375rem":0,borderBottom:N?"1px solid ".concat(e.border):"none",flexShrink:0},children:[(0,o.jsx)("button",{onClick:K,style:{width:N?"40px":"32px",height:N?"40px":"32px",display:"flex",alignItems:"center",justifyContent:"center",background:e.buttonBg,border:"1px solid ".concat(e.border),borderRadius:"8px",cursor:"pointer"},"aria-label":"Previous month",children:(0,o.jsx)(m.A,{style:{width:N?"18px":"16px",height:N?"18px":"16px",color:e.textMuted}})}),(0,o.jsxs)("h2",{style:{fontSize:N?"1rem":"1.25rem",fontWeight:600,color:e.text},children:[W[a]," ",n]}),(0,o.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,o.jsx)("button",{onClick:O,style:{width:N?"40px":"32px",height:N?"40px":"32px",display:"flex",alignItems:"center",justifyContent:"center",background:e.buttonBg,border:"1px solid ".concat(e.border),borderRadius:"8px",cursor:"pointer"},"aria-label":"Next month",children:(0,o.jsx)(p.A,{style:{width:N?"18px":"16px",height:N?"18px":"16px",color:e.textMuted}})}),(0,o.jsx)("button",{onClick:()=>C(!1),style:{width:N?"40px":"32px",height:N?"40px":"32px",display:"flex",alignItems:"center",justifyContent:"center",background:e.buttonBg,border:"1px solid ".concat(e.border),borderRadius:"8px",cursor:"pointer"},"aria-label":"Close fullscreen",children:(0,o.jsx)(b.A,{style:{width:N?"18px":"16px",height:N?"18px":"16px",color:e.textMuted}})})]})]}),(0,o.jsx)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",gap:N?"3px":"4px",marginBottom:N?"0.125rem":"0.5rem",flexShrink:0},children:I.map(t=>(0,o.jsx)("div",{style:{fontSize:N?"0.6875rem":"0.75rem",fontWeight:600,color:e.textMuted,textAlign:"center",padding:N?"0.125rem 0":"0.5rem 0"},children:t},t))}),(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(7, minmax(0, 1fr))",gridAutoRows:N?"1fr":void 0,gap:N?"3px":"8px",flex:1,overflow:"hidden"},children:[Array.from({length:F}).map((e,t)=>(0,o.jsx)("div",{},"empty-".concat(t))),Array.from({length:D}).map((t,r)=>{let s=r+1,c=L(n,a,s),i=P(c),u=H(c),g=u>0,m=c===M,p=q(u);return(0,o.jsxs)("button",{onClick:()=>{d(new Date(n,a,s),i),C(!1)},style:{aspectRatio:N?void 0:"1",minHeight:N?0:void 0,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",background:0===u?e.cellBg:u<l?T?"#f0fdf4":"rgba(16, 185, 129, 0.15)":u<1.5*l?T?"#eff6ff":"rgba(59, 130, 246, 0.15)":u<2*l?T?"#fffbeb":"rgba(245, 158, 11, 0.15)":T?"#fef2f2":"rgba(239, 68, 68, 0.15)",border:m?"2px solid ".concat(e.accent):"1px solid ".concat(e.border),borderRadius:N?"6px":"8px",cursor:"pointer",padding:N?"0.125rem":"0.25rem"},"aria-label":"".concat(W[a]," ").concat(s,", ").concat(n).concat(g?", ".concat(z(u)," spent"):""),children:[(0,o.jsx)("span",{style:{fontSize:N?"1rem":"0.875rem",fontWeight:g?600:500,color:g?p:e.text},children:s}),g&&(0,o.jsx)("span",{style:{fontSize:N?"0.6875rem":"0.625rem",fontWeight:600,color:p,marginTop:"2px"},children:z(u)})]},s)})]}),(0,o.jsx)("div",{style:{display:"flex",justifyContent:"center",gap:N?"0.5rem":"1rem",marginTop:N?"0.375rem":"1rem",padding:N?"0.375rem":"0.75rem",background:e.cellBg,borderRadius:"8px",flexShrink:0},children:[{label:N?"Under":"Under Pace",color:"#10B981"},{label:"On Pace",color:"#3b82f6"},{label:N?"Over":"Over Pace",color:"#F59E0B"},{label:"High",color:"#EF4444"}].map(t=>{let{label:a,color:r}=t;return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,o.jsx)("div",{style:{width:N?"6px":"8px",height:N?"6p
1x":"8px",borderRadius:"50%",backgroundColor:r}}),(0,o.jsx)("span",{style:{fontSize:N?"0.625rem":"0.75rem",fontWeight:500,color:e.textMuted},children:a})]},a)})})]})});return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),style:{minHeight:200,opacity:.5},children:(0,o.jsx)("p",{style:{textAlign:"center",padding:"2rem 0",color:"var(--text-muted)"},children:"Calendar expanded - tap X to close"})}),"undefined"!=typeof document&&(0,g.createPortal)(r,document.body)]})}return(0,o.jsxs)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),children:[(0,o.jsxs)("div",{className:c().calendarHeader,children:[(0,o.jsx)("button",{onClick:K,className:c().navButton,"aria-label":"Previous month",children:(0,o.jsx)(m.A,{})}),(0,o.jsxs)("h2",{className:c().calendarTitle,children:[W[a]," ",n]}),(0,o.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,o.jsx)("button",{onClick:O,className:c().navButton,"aria-label":"Next month",children:(0,o.jsx)(p.A,{})}),(0,o.jsx)("button",{onClick:()=>C(!0),className:c().navButton,"aria-label":"Expand calendar",children:(0,o.jsx)(_.A,{})})]})]}),(0,o.jsx)("div",{className:c().calendarGrid,style:{marginBottom:"0.5rem"},children:I.map(e=>(0,o.jsx)("div",{className:c().dayHeader,children:e},e))}),(0,o.jsxs)("div",{className:c().calendarGrid,children:[Array.from({length:F}).map((e,t)=>(0,o.jsx)("div",{className:c().dayCellEmpty},"empty-".concat(t))),Array.from({length:D}).map((e,t)=>(0,o.jsx)(G,{day:t+1},t+1))]}),(0,o.jsx)("div",{className:c().legend,children:[{label:"Under",color:"#10B981"},{label:"On Pace",color:"#3b82f6"},{label:"Over",color:"#F59E0B"},{label:"High",color:"#EF4444"}].map(e=>{let{label:t,color:a}=e;return(0,o.jsxs)("div",{className:c().legendItem,children:[(0,o.jsx)("div",{className:c().legendDot,style:{backgroundColor:a}}),(0,o.jsx)("span",{className:c().legendLabel,children:t})]},t)})})]})}var x=a(46966),h=a(51979),f=a(63598),w=a(20133),v=a(8526),j=a(46139);function k(e){let{isOpen:t,onClose:a,date:n,transactions:l,categories:d,onAddTransaction:c,onEditTransaction:i,onDeleteTransaction:g}=e,{resolvedTheme:m}=(0,u.D)(),{currency:p,symbol:_}=(0,s.H)(),[y,k]=(0,r.useState)(!1);(0,r.useEffect)(()=>k(!0),[]);let C=y&&"dark"===m,N="var(--foreground)",A="var(--text-secondary)",S="var(--muted-foreground)",B="var(--bg-elevated)",T="var(--border)",I=e=>isNaN(e)||!isFinite(e)?"".concat(_,"0.00"):new Intl.NumberFormat("en-US",{style:"currency",currency:p,minimumFractionDigits:2,maximumFractionDigits:2}).format(Math.abs(e)),D=l.filter(e=>"expense"===e.type).reduce((e,t)=>{let a="number"==typeof t.amount?t.amount:parseFloat(String(t.amount));return e+(isNaN(a)?0:Math.abs(a))},0);l.filter(e=>"income"===e.type).reduce((e,t)=>{let a="number"==typeof t.amount?t.amount:parseFloat(String(t.amount));return e+(isNaN(a)?0:Math.abs(a))},0);let F={};l.filter(e=>"expense"===e.type).forEach(e=>{let t=e.category_id||"uncategorized",a=d.find(e=>e.id===t);F[t]||(F[t]={name:(null==a?void 0:a.name)||e.category_name||"Uncategorized",total:0,color:(null==a?void 0:a.color)||"#10b981"});let o="number"==typeof e.amount?e.amount:parseFloat(String(e.amount));F[t].total+=isNaN(o)?0:Math.abs(o)});let L=Object.values(F).sort((e,t)=>t.total-e.total)[0];(0,r.useEffect)(()=>{let e=e=>{"Escape"===e.key&&t&&a()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,a]),(0,r.useEffect)(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[t]);let R={backgroundColor:B,borderRadius:"12px",padding:"16px",textAlign:"center",border:"1px solid ".concat(T)},M={fontSize:"0.625rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:S,marginBottom:"4px"},E={fontSize:"1.25rem",fontWeight:700,color:N},P={padding:"12px",backgroundColor:B,borderRadius:"12px",marginBottom:"8px",border:"1px solid ".concat(T)},H={padding:"6px",borderRadius:"6px",backgroundColor:"transparent",border:"none",cursor:"pointer",color:S,transition:"all 0.15s ease"};return y?(0,o.jsx)("div",{style:{position:"fixed",inset:0,backgroundColor:"rgba(0, 0, 0, 0.6)",backdropFilter:"blur(8px)",WebkitBackdropFilter:"blur(8px)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:50,padding:"16px",transition:"opacity 0.2s ease",opacity:+!!t,pointerEvents:t?"auto":"none"},onClick:a,children:(0,o.jsxs)("div",{style:{backgroundColor:"var(--bg-card)",borderRadius:"16px",border:"1px solid ".concat(T),boxShadow:"0 24px 48px rgba(0, 0, 0, 0.3)",maxWidth:"520px",width:"100%",maxHeight:"85vh",overflow:"auto",transform:t?"scale(1)":"scale(0.95)",transition:"transform 0.2s ease"},onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true","aria-labelledby":"budget-day-modal-title",children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"20px 24px",borderBottom:"1px solid ".concat(T)},children:[(0,o.jsx)("h2",{id:"budget-day-modal-title",style:{fontSize:"1.125rem",fontWeight:600,color:N},children:n?n.toLocaleDateString("en-US",{weekday:"long",month:"long",day:"numeric",year:"numeric"}):""}),(0,o.jsx)("button",{onClick:a,style:{padding:"8px",borderRadius:"8px",backgroundColor:"transparent",border:"none",cursor:"pointer",color:S,transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=B},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"},"aria-label":"Close modal",children:(0,o.jsx)(b.A,{style:{width:"20px",height:"20px"}})})]}),(0,o.jsxs)("div",{style:{padding:"24px"},children:[(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px"},children:[(0,o.jsxs)("div",{style:R,children:[(0,o.jsx)("p",{style:M,children:"SPENT"}),(0,o.jsx)("p",{style:{...E,color:"var(--error)"},children:I(D)})]}),(0,o.jsxs)("div",{style:R,children:[(0,o.jsx)("p",{style:M,children:"# TRANSACTIONS"}),(0,o.jsx)("p",{style:E,children:l.length})]}),(0,o.jsxs)("div",{style:R,children:[(0,o.jsx)("p",{style:M,children:"TOP CATEGORY"}),(0,o.jsx)("p",{style:{...E,fontSize:"0.875rem",color:(null==L?void 0:L.color)||S},children:(null==L?void 0:L.name)||"N/A"})]})]}),l.length>0?(0,o.jsxs)("div",{children:[(0,o.jsx)("h3",{style:{fontSize:"0.75rem",fontWeight:600,textTransform:"uppercase",letterSpacing:"0.05em",color:S,marginBottom:"12px",marginTop:"24px"},children:"TRANSACTIONS"}),l.map(e=>{let t=(e=>{switch(e){case"cash":return{bg:C?"rgba(16, 185, 129, 0.15)":"rgba(16, 185, 129, 0.1)",color:"#10B981",label:"Cash"};case"credit":return{bg:C?"rgba(139, 92, 246, 0.15)":"rgba(139, 92, 246, 0.1)",color:"#8B5CF6",label:"Credit"};case"debit":return{bg:C?"rgba(59, 130, 246, 0.15)":"rgba(59, 130, 246, 0.1)",color:"#3B82F6",label:"Debit"};default:return{bg:C?"rgba(255, 255, 255, 0.05)":"rgba(0, 0, 0, 0.05)",color:C?"rgba(255, 255, 255, 0.5)":"#78716C",label:e||"Other"}}})(e.payment_method),a=(e=>{if(!e)return"#10b981";let t=d.find(t=>
1t.id===e);return(null==t?void 0:t.color)||"#10b981"})(e.category_id),r="expense"===e.type;return(0,o.jsx)("div",{style:P,children:(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-start"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:"12px",flex:1},children:[r?(0,o.jsx)(x.A,{style:{width:"24px",height:"24px",color:"var(--destructive)",flexShrink:0}}):(0,o.jsx)(h.A,{style:{width:"24px",height:"24px",color:"var(--success)",flexShrink:0}}),(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"4px"},children:[(0,o.jsx)("span",{style:{fontSize:"0.875rem",fontWeight:500,color:N,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.description||"Transaction"}),(0,o.jsxs)("span",{style:{fontSize:"1rem",fontWeight:700,color:r?"var(--destructive)":"var(--success)",flexShrink:0,marginLeft:"8px"},children:[r?"-":"+",I(e.amount)]})]}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px",flexWrap:"wrap"},children:[r&&(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[(0,o.jsx)("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:a}}),(0,o.jsx)("span",{style:{fontSize:"0.75rem",color:A},children:e.category_name||"Uncategorized"})]}),(0,o.jsx)("span",{style:{fontSize:"0.625rem",fontWeight:600,padding:"2px 6px",borderRadius:"4px",backgroundColor:t.bg,color:t.color,textTransform:"uppercase",letterSpacing:"0.03em"},children:t.label})]})]})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:"4px",marginLeft:"8px"},children:[(0,o.jsx)("button",{onClick:()=>i(e),style:H,onMouseEnter:e=>{e.currentTarget.style.backgroundColor=B,e.currentTarget.style.color="var(--success)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.color=S},"aria-label":"Edit transaction",children:(0,o.jsx)(f.A,{style:{width:"16px",height:"16px"}})}),(0,o.jsx)("button",{onClick:()=>g(e.id),style:H,onMouseEnter:e=>{e.currentTarget.style.backgroundColor="var(--error-light)",e.currentTarget.style.color="var(--destructive)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.color=S},"aria-label":"Delete transaction",children:(0,o.jsx)(w.A,{style:{width:"16px",height:"16px"}})})]})]})},e.id)})]}):(0,o.jsxs)("div",{style:{textAlign:"center",padding:"32px 0",color:S},children:[(0,o.jsx)(v.A,{style:{width:"48px",height:"48px",margin:"0 auto 12px",color:S}}),(0,o.jsx)("p",{style:{fontSize:"1rem",marginBottom:"4px",color:A},children:"No transactions"}),(0,o.jsx)("p",{style:{fontSize:"0.875rem"},children:"Add a transaction for this day"})]})]}),(0,o.jsx)("div",{style:{padding:"16px 24px",borderTop:"1px solid ".concat(T)},children:(0,o.jsxs)("button",{onClick:()=>n&&c(n),style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px",background:"var(--progress-gradient-success)",color:"var(--primary-foreground)",padding:"12px 20px",borderRadius:"12px",fontWeight:500,fontSize:"0.875rem",border:"none",cursor:"pointer",boxShadow:"0 4px 12px -4px rgba(16, 185, 129, 0.4)",transition:"all 0.15s ease"},onMouseEnter:e=>{e.currentTarget.style.transform="scale(1.02)"},onMouseLeave:e=>{e.currentTarget.style.transform="scale(1)"},children:[(0,o.jsx)(j.A,{style:{width:"18px",height:"18px"}}),"Add Transaction for This Day"]})})]})}):null}var C=a(20511),N=a(54492);function A(e){let{categories:t}=e,{resolvedTheme:a}=(0,u.D)(),{symbol:n}=(0,s.H)(),[l,d]=(0,r.useState)(!1);(0,r.useEffect)(()=>d(!0),[]);let i=l&&"dark"===a,g=i?{text:"#fafafa",textMuted:"#a1a1aa",border:"#27272a",bgCard:"#18181b",gridLine:"rgba(255, 255, 255, 0.06)"}:{text:"#0f172a",textMuted:"#64748b",border:"#e2e8f0",bgCard:"#ffffff",gridLine:"rgba(0, 0, 0, 0.06)"},m=(0,r.useMemo)(()=>t.filter(e=>!e.is_debt&&"debt"!==e.item_type).filter(e=>Number(e.allocated)>0).sort((e,t)=>Number(t.spent)-Number(e.spent)).slice(0,8),[t]),p=(0,r.useMemo)(()=>{let e=m.map(e=>e.name),t=m.map(e=>Number(e.spent)||0),a=m.map(e=>Number(e.allocated)||0);return{labels:e,datasets:[{label:"Spent",data:t,backgroundColor:m.map(e=>((e,t)=>{if(t<=0)return"#6b7280";let a=e/t*100;return a>100?"#ef4444":a>=80?"#f59e0b":"#10b981"})(Number(e.spent)||0,Number(e.allocated)||0)),borderRadius:6,borderSkipped:!1,barPercentage:.7,categoryPercentage:.8},{label:"Budget",data:a,backgroundColor:i?"rgba(255, 255, 255, 0.1)":"rgba(0, 0, 0, 0.08)",borderRadius:6,borderSkipped:!1,barPercentage:.7,categoryPercentage:.8}]}},[m,i]),b={indexAxis:"y",responsive:!0,maintainAspectRatio:!1,plugins:{legend:{dis
1play:!0,position:"top",align:"end",labels:{color:g.textMuted,usePointStyle:!0,pointStyle:"rectRounded",padding:16,font:{size:12}}},tooltip:{backgroundColor:g.bgCard,titleColor:g.text,bodyColor:g.textMuted,borderColor:g.border,borderWidth:1,padding:12,cornerRadius:8,displayColors:!0,boxPadding:4,callbacks:{title:e=>e[0].label,label:e=>{var t;let a=null!=(t=e.parsed.x)?t:0;return"".concat(e.dataset.label,": ").concat(n).concat(a.toLocaleString("en-US",{minimumFractionDigits:0,maximumFractionDigits:0}))},afterBody:e=>{let t=m[e[0].dataIndex];if(!t)return[];let a=Number(t.spent)||0,o=Number(t.allocated)||0,r=o-a,l=o>0?Math.round(a/o*100):0;return r>=0?["".concat(l,"% used ⢠").concat(n).concat(r.toLocaleString()," left")]:["".concat(l,"% used ⢠").concat(n).concat(Math.abs(r).toLocaleString()," over")]}}}},scales:{x:{grid:{color:g.gridLine},border:{display:!1},ticks:{color:g.textMuted,font:{size:11},callback:e=>{if(e>=1e3){let t=e/1e3;return t%1==0?"".concat(n).concat(t,"k"):"".concat(n).concat(t.toFixed(1),"k")}return"".concat(n).concat(e)}}},y:{grid:{display:!1},border:{display:!1},ticks:{color:g.text,font:{size:12,weight:500},padding:8}}}};if(!l)return(0,o.jsx)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),style:{minHeight:300}});if(0===m.length)return(0,o.jsxs)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),children:[(0,o.jsx)("h3",{className:c().chartTitle,children:"Category Spending"}),(0,o.jsx)("div",{style:{padding:"2rem",textAlign:"center",color:g.textMuted},children:(0,o.jsx)("p",{children:"No categories with spending to display"})})]});let _=Math.max(200,50*m.length+60);return(0,o.jsxs)("div",{className:"".concat(c().panel," ").concat(c().panelPadding),children:[(0,o.jsxs)("div",{className:c().chartHeader,children:[(0,o.jsx)("h3",{className:c().chartTitle,children:"Category Spending"}),(0,o.jsxs)("div",{style:{display:"flex",gap:"0.75rem",fontSize:"0.75rem"},children:[(0,o.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#10b981"}}),(0,o.jsx)("span",{style:{color:g.textMuted},children:"Good"})]}),(0,o.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#f59e0b"}}),(0,o.jsx)("span",{style:{color:g.textMuted},children:"Warning"})]}),(0,o.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,backgroundColor:"#ef4444"}}),(0,o.jsx)("span",{style:{color:g.textMuted},children:"Over"})]})]})]}),(0,o.jsx)("div",{style:{height:"".concat(_,"px")},children:(0,o.jsx)(C.yP,{data:p,options:b})})]})}N.t1.register(N.PP,N.kc,N.E8,N.hE,N.m_,N.s$);var S=a(42030),B=a(61811),T=a(31321),I=a(74166),D=a.n(I);let F=e=>Math.round(e).toLocaleString(),L=["Savings","Emergency Fund","Investments","Retirement"];function R(e){let{isOpen:t,onClose:a,freedAmount:n,existingCategories:l,budgetId:d,onSave:c}=e,{symbol:i}=(0,s.H)(),[u,g]=(0,r.useState)(!1),[m,p]=(0,r.useState)(null),[_,y]=(0,r.useState)([]),x=(0,r.useMemo)(()=>l.filter(e=>"debt"!==e.type),[l]);(0,r.useEffect)(()=>{t&&(p(null),y([...x].sort((e,t)=>{let a=L.some(t=>e.name.toLowerCase().includes(t.toLowerCase())),o=L.some(e=>t.name.toLowerCase().includes(e.toLowerCase()));return a&&!o?-1:!a&&o?1:e.name.localeCompare(t.name)}).map(e=>({categoryId:e.id,name:e.name,currentAllocated:e.allocated,adjustAmount:0,color:e.color}))))},[t,x]);let h=(0,r.useMemo)(()=>_.reduce((e,t)=>e+t.adjustAmount,0),[_]),f=n-h,w=f<=.99&&f>=-.99,v=(e,t)=>{y(a=>a.map(a=>a.categoryId!==e?a:{...a,adjustAmount:Math.max(0,t)}))},j=async e=>{if(e.preventDefault(),p(null),!w)return void p("You still need to allocate $".concat(F(f)));g(!0);try{let e=_.filter(e=>e.adjustAmount>0);if(0===e.length){p("Please allocate the freed funds to at least one category"),g(!1);return}let t=Math.round(n),o=0,r=e.map((a,r)=>{if(r===e.length-1){let e=t-o;return{categoryId:a.categoryId,newAllocated:a.currentAllocated+e}}{let e=Math.round(a.adjustAmount);return o+=e,{categoryId:a.categoryId,newAllocated:a.currentAllocated+e}}});await c(r),a()}catch(t){let{message:e}=(0,B.P)(t);p(e)}finally{g(!1)}},k=()=>
1{if(!u){if(!w)return void p("Every dollar needs a job! Please allocate all freed funds before continuing.");a()}};return t?(0,o.jsx)("div",{className:D().overlay,onClick:e=>{e.target===e.currentTarget&&w&&k()},children:(0,o.jsxs)("div",{className:"".concat(D().modal," ").concat(D().modalLarge),role:"dialog","aria-modal":"true",children:[(0,o.jsxs)("div",{className:D().header,children:[(0,o.jsx)("div",{className:D().headerLeft,children:(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"12px"},children:[(0,o.jsx)("span",{style:{fontSize:"28px"},children:"\uD83D\uDCB0"}),(0,o.jsx)("h2",{className:D().headerTitle,children:"Allocate Freed Funds"})]})}),(0,o.jsx)("button",{onClick:k,disabled:u||!w,className:D().closeButton,title:w?"Close":"Allocate all funds before closing",children:(0,o.jsx)(b.A,{className:"h-6 w-6"})})]}),(0,o.jsxs)("form",{onSubmit:j,children:[(0,o.jsxs)("div",{className:D().contentRebalancing,children:[m&&(0,o.jsxs)("div",{className:D().errorBox,children:[(0,o.jsx)(S.A,{className:"h-5 w-5 ".concat(D().errorIcon)}),(0,o.jsx)("p",{className:D().errorText,children:m})]}),(0,o.jsxs)("div",{className:"".concat(D().rebalanceHeader," ").concat(D().rebalanceHeaderDecrease),children:[(0,o.jsx)("p",{className:D().rebalanceDescription,style:{marginBottom:"8px"},children:"Your debt payments freed up money in your budget. Every dollar needs a job!"}),(0,o.jsxs)("p",{className:D().rebalanceDescription,children:["Allocate ",(0,o.jsxs)("strong",{style:{fontSize:"1.1em"},children:[i,F(n)]})," to your other categories:"]}),(0,o.jsxs)("div",{className:D().progressContainer,style:{marginTop:"16px"},children:[(0,o.jsx)("div",{className:D().progressTrack,children:(0,o.jsx)("div",{className:"".concat(D().progressFill," ").concat(w?D().progressFillComplete:D().progressFillDecrease),style:{width:"".concat(n>0?Math.min(h/n*100,100):0,"%")}})}),(0,o.jsxs)("span",{className:"".concat(D().progressLabel," ").concat(w?D().progressLabelComplete:D().progressLabelPending),children:["$",F(h)," / $",F(n),w&&" â"]})]}),f>.99&&(0,o.jsxs)("p",{style:{marginTop:"8px",fontSize:"0.8125rem",color:"rgba(245, 158, 11, 0.9)"},children:["$",F(f)," still needs to be allocated"]})]}),_.length>0?(0,o.jsx)("div",{className:D().categoryList,children:_.map(e=>{let t=L.some(t=>e.name.toLowerCase().includes(t.toLowerCase()));return(0,o.jsxs)("div",{className:D().categoryRow,children:[(0,o.jsx)("div",{className:D().categoryRowHeader,children:(0,o.jsxs)("div",{className:D().categoryRowInfo,children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[(0,o.jsx)("div",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:(0,T.zq)(e.color)}}),(0,o.jsxs)("span",{className:D().categoryRowName,children:[e.name,t&&(0,o.jsx)("span",{style:{marginLeft:"8px",fontSize:"0.6875rem",padding:"2px 6px",backgroundColor:"var(--success-light)",color:"var(--success)",borderRadius:"4px",fontWeight:500},children:"Recommended"})]})]}),(0,o.jsxs)("span",{className:D().categoryRowMeta,children:["Current: ",i,F(e.currentAllocated)]})]})}),(0,o.jsxs)("div",{className:D().categoryRowControls,children:[(0,o.jsx)("input",{type:"range",min:"0",max:n,value:e.adjustAmount,onChange:t=>v(e.categoryId,parseFloat(t.target.value)),className:D().categorySlider}),(0,o.jsxs)("div",{className:D().categoryInputWrapper,children:[(0,o.jsxs)("span",{className:D().categoryInputPrefix,children:["+",i]}),(0,o.jsx)("input",{type:"number",min:"0",value:e.adjustAmount||"",onChange:t=>v(e.categoryId,parseFloat(t.target.value)||0),className:D().categoryInput})]})]}),(0,o.jsx)("div",{className:D().quickAmounts,children:(()=>{let t=Math.round(f);return[...new Set([t>
10&&t<=n?t:null,25,50,100,200].filter(e=>null!==e&&e>0))].slice(0,4).map((a,r)=>(0,o.jsx)("button",{type:"button",onClick:()=>v(e.categoryId,e.adjustAmount+a),className:"".concat(D().quickAmountBtn," ").concat(a===t?D().quickAmountBtnExact:D().quickAmountBtnNormal),children:a===t?"".concat(i).concat(a," (all)"):"+".concat(i).concat(a)},"".concat(e.categoryId,"-").concat(a,"-").concat(r)))})()})]},e.categoryId)})}):(0,o.jsx)("div",{className:D().errorBox,children:(0,o.jsx)("p",{className:D().errorText,children:"No categories available to receive funds. Create a new category first."})})]}),(0,o.jsxs)("div",{className:D().footer,children:[(0,o.jsx)("div",{className:D().footerLeft}),(0,o.jsx)("div",{className:D().footerRight,children:(0,o.jsx)("button",{type:"submit",disabled:u||!w,className:D().primaryButton,children:u?(0,o.jsxs)("span",{className:"flex items-center gap-2",children:[(0,o.jsxs)("svg",{className:D().spinner,width:"16",height:"16",viewBox:"0 0 24 24",children:[(0,o.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),(0,o.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),"Saving..."]}):"Apply Changes"})})]})]})]})}):null}},93637:(e,t,a)=>{"use strict";a.d(t,{Y:()=>r});var o=a(81699);let r={getAllBudgets:async()=>(await o.uE.get("/budgets")).data,getBudgetById:async e=>(await o.uE.get("/budgets/".concat(e))).data,createBudget:async e=>(await o.uE.post("/budgets",e)).data,updateBudget:async(e,t)=>(await o.uE.put("/budgets/".concat(e),t)).data,updateIncome:async(e,t,a)=>(await o.uE.patch("/budgets/".concat(e,"/income"),{income:t,adjustment:a})).data,async deleteBudget(e){await o.uE.delete("/budgets/".concat(e))},getBudgetSummary:async e=>(await o.uE.get("/budgets/summary",{params:e?{period:e}:{}})).data,getBudgetCategories:async e=>(await o.uE.get("/budgets/".concat(e,"/categories"))).data,createCategory:async(e,t)=>(await o.uE.post("/budgets/".concat(e,"/categories"),t)).data,updateCategory:async(e,t,a)=>(await o.uE.put("/budgets/".concat(e,"/categories/").concat(t),a)).data,copyBudget:async(e,t)=>(await o.uE.post("/budgets/".concat(e,"/copy"),t)).data,getLatestBudgetForPeriod:async e=>(await o.uE.get("/budgets/latest/".concat(e))).data,async getUserIncome(){try{return(await o.uE.get("/income/stats?period=month")).data.totalMonthlyIncome||0}catch(e){return 0}},updateUserIncome:async e=>e,rebalanceCategories:async(e,t)=>(await o.uE.post("/budgets/".concat(e,"/rebalance"),{changes:t})).data}}}]);
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.