@actual-app/web 23.10.0 → 23.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/asset-manifest.json +15 -15
- package/build/index.html +1 -1
- package/build/kcab/{kcab.worker.b835d2cdcf8004c363da.js → kcab.worker.8a181a0b032adc34600e.js} +54 -54
- package/build/kcab/{kcab.worker.b835d2cdcf8004c363da.js.map → kcab.worker.8a181a0b032adc34600e.js.map} +1 -1
- package/build/static/js/312.9f087b98.chunk.js +2 -0
- package/build/static/js/312.9f087b98.chunk.js.map +1 -0
- package/build/static/js/{713.1731d555.chunk.js → 444.301f7ece.chunk.js} +2 -2
- package/build/static/js/444.301f7ece.chunk.js.map +1 -0
- package/build/static/js/848.aa73d5a0.chunk.js +19 -0
- package/build/static/js/848.aa73d5a0.chunk.js.map +1 -0
- package/build/static/js/main.fd0bdfe2.js +188 -0
- package/build/static/js/main.fd0bdfe2.js.map +1 -0
- package/build/static/js/narrow-components.9ae206be.chunk.js +2 -0
- package/build/static/js/narrow-components.9ae206be.chunk.js.map +1 -0
- package/build/static/js/reports.778a42ee.chunk.js +2 -0
- package/build/static/js/reports.778a42ee.chunk.js.map +1 -0
- package/build/static/js/wide-components.481c39ec.chunk.js +2 -0
- package/build/static/js/wide-components.481c39ec.chunk.js.map +1 -0
- package/package.json +3 -2
- package/build/static/js/389.c8f94185.chunk.js +0 -2
- package/build/static/js/389.c8f94185.chunk.js.map +0 -1
- package/build/static/js/678.bf349f5d.chunk.js +0 -2
- package/build/static/js/678.bf349f5d.chunk.js.map +0 -1
- package/build/static/js/713.1731d555.chunk.js.map +0 -1
- package/build/static/js/main.7e6eedd0.js +0 -188
- package/build/static/js/main.7e6eedd0.js.map +0 -1
- package/build/static/js/narrow-components.11cf3591.chunk.js +0 -2
- package/build/static/js/narrow-components.11cf3591.chunk.js.map +0 -1
- package/build/static/js/reports.39b7254a.chunk.js +0 -2
- package/build/static/js/reports.39b7254a.chunk.js.map +0 -1
- package/build/static/js/wide-components.fd8595f4.chunk.js +0 -2
- package/build/static/js/wide-components.fd8595f4.chunk.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";(self["webpackChunk_actual_app_web"]=self["webpackChunk_actual_app_web"]||[]).push([[447],{18535:function(e,t,n){n.d(t,{Z:function(){return c}});var r=n(43188);var o=n(66204);var i=n(75433);var s=n(24307);var l=n(52582);var a=n(57651);var d=n(31038);function c({carryover:e,balance:t,disabled:n,style:o,balanceStyle:c,carryoverStyle:u}){let g=(0,a.Z)(e);let p=(0,a.Z)(t);return(0,r.jsxs)(s.Z,{style:o,children:[(0,r.jsx)(l.Z,{binding:t,type:"financial",getStyle:d.TV,style:{textAlign:"right",...!n&&{cursor:"pointer",":hover":{textDecoration:"underline"}},...c}}),g&&(0,r.jsx)(s.Z,{style:{alignSelf:"center",marginLeft:2,position:"absolute",right:-8,top:0,bottom:0,justifyContent:"center",...u},children:(0,r.jsx)(i.Z,{width:7,height:7,style:(0,d.TV)(p)})})]})}},94477:function(e,t,n){n.d(t,{Z:function(){return m}});var r=n(43188);var o=n(66204);var i=n(46055);var s=n(31941);var l=n(57651);var a=n(63541);var d=n(9579);var c=n(44048);var u=n(56816);var g=n(91871);var p=n(24307);var h=n(31038);function f({tooltipProps:e,onSubmit:t,onClose:n}){let{grouped:i}=(0,d.Z)();i=(0,h.iX)(i.filter(e=>!e.is_income));let[s,l]=(0,o.useState)(null);function f(){if(s){t(s);n()}}return(0,r.jsxs)(a.u,{position:"bottom-right",width:200,style:{padding:10},...e,onClose:n,children:[(0,r.jsx)(p.Z,{style:{marginBottom:5},children:"Cover from category:"}),(0,r.jsx)(g.Z,{children:e=>(0,r.jsx)(c.Z,{categoryGroups:i,value:null,openOnFocus:true,onUpdate:e=>{},onSelect:e=>l(e),inputProps:{inputRef:e,onKeyDown:e=>{if(e.key==="Enter"){f()}}}})}),(0,r.jsx)(p.Z,{style:{alignItems:"flex-end",marginTop:10},children:(0,r.jsx)(u.Z,{type:"primary",style:{fontSize:12,paddingTop:3},onClick:f,children:"Transfer"})})]})}var y=n(45990);function m({categoryId:e,tooltip:t,monthIndex:n,onBudgetAction:d,onClose:c,...u}){let g=(0,l.Z)(i.aK.catCarryover(e));let p=(0,l.Z)(i.aK.catBalance(e));let[h,m]=(0,o.useState)("menu");let x=()=>{t.close();c?.()};return(0,r.jsxs)(r.Fragment,{children:[h==="menu"&&(0,r.jsx)(a.u,{position:"bottom-right",width:200,style:{padding:0},onClose:x,...u,children:(0,r.jsx)(s.Z,{onMenuSelect:t=>{if(t==="carryover"){d(n,"carryover",{category:e,flag:!g});x()}else{m(t)}},items:[{name:"transfer",text:"Transfer to another category"},{name:"carryover",text:g?"Remove overspending rollover":"Rollover overspending"},p<0&&{name:"cover",text:"Cover overspending"}].filter(e=>e)})}),h==="transfer"&&(0,r.jsx)(y.Z,{initialAmountName:i.aK.catBalance(e),showToBeBudgeted:true,onClose:x,onSubmit:(t,r)=>{d(n,"transfer-category",{amount:t,from:e,to:r})}}),h==="cover"&&(0,r.jsx)(f,{onClose:x,onSubmit:t=>{d(n,"cover",{to:e,from:t})}})]})}},45990:function(e,t,n){n.d(t,{Z:function(){return m}});var r=n(43188);var o=n(66204);var i=n(55833);var s=n(11535);var l=n(89362);var a=n(9579);var d=n(44048);var c=n(56816);var u=n(91871);var g=n(383);var p=n(24307);var h=n(57201);var f=n(63541);var y=n(31038);function m({initialAmount:e,initialAmountName:t,showToBeBudgeted:n,tooltipProps:m,onSubmit:x,onClose:v}){let b=(0,i.M)();let j=(0,o.useContext)(h.Z);let{grouped:w}=(0,a.Z)();w=w.filter(e=>!e.is_income);if(n){w=(0,y.iX)(w)}let[S,C]=(0,o.useState)(null);let[Z,T]=(0,o.useState)(null);(0,o.useEffect)(()=>{(async()=>{if(t){const e=await b.get(j,t);C((0,l.zA)(Math.max(e.value,0)))}else{C((0,l.zA)(Math.max(e,0)))}})()},[]);function E(){let e=(0,s.Z)(S,null);if(e&&Z){x((0,l.l9)(e),Z);v()}}if(S===null){return null}return(0,r.jsxs)(f.u,{position:"bottom-right",width:200,style:{padding:10},...m,onClose:v,children:[(0,r.jsx)(p.Z,{style:{marginBottom:5},children:"Transfer this amount:"}),(0,r.jsx)(p.Z,{children:(0,r.jsx)(u.Z,{children:(0,r.jsx)(g.ZP,{value:S,onChange:e=>C(e.target["value"]),onEnter:E})})}),(0,r.jsx)(p.Z,{style:{margin:"10px 0 5px 0"},children:"To:"}),(0,r.jsx)(d.Z,{categoryGroups:w,value:null,openOnFocus:true,onUpdate:e=>{},onSelect:e=>T(e),inputProps:{onEnter:E,placeholder:"(none)"}}),(0,r.jsx)(p.Z,{style:{alignItems:"flex-end",marginTop:10},children:(0,r.jsx)(c.Z,{type:"primary",style:{fontSize:12,paddingTop:3,paddingBottom:3},onClick:E,children:"Transfer"})})]})}},31038:function(e,t,n){n.d(t,{Df:function(){return d},Rk:function(){return i},TV:function(){return l},XE:function(){return a},hd:function(){return s},iX:function(){return o},np:function(){return u},qc:function(){return c}});var r=n(45492);function o(e){return[{id:"to-be-budgeted",name:"To Be Budgeted",categories:[{id:"to-be-budgeted",name:"To Be Budgeted",cat_group:"to-be-budgeted",group:{id:"to-be-budgeted",name:"To Be Budgeted"}}]},...e]}function i(e){return[e.filter(e=>!e.is_income),e.find(e=>e.is_income)]}function s(e){return e===0||e==="0"||e===""||e==null?{color:r.rS.altMenuItemText}:null}function l(e){const t=s(e);if(t){return t}if(e<0){return{color:r.rS.errorText}}}function a(e){return{color:e<0?r.rS.errorText:e===0?r.rS.altMenuItemText:r.rS.noticeText}}function d(e,t,n){if(t==="top"){return{targetId:n}}else{let t=e.findIndex(e=>e.id===n);if(t===-1){throw new Error("findSort: item not found: "+n)}let r=t+1;if(r<e.length-1){return{targetId:e[r].id}}else{return{targetId:null}}}}function c(e,t,n){if(t==="bottom"){return{targetId:n}}else{let t=e.findIndex(e=>e.id===n);if(t===-1){throw new Error("findSort: item not found: "+n)}let r=t-1;if(r>=0){return{targetId:e[r].id}}else{return{targetId:null}}}}function u(){return Math.max(r.W2.scrollbarWidth-2,0)}},10646:function(e,t,n){n.d(t,{Z:function(){return a}});var r=n(43188);var o=n(66204);var i=n(59379);var s=n(24868);var l=n(56816);function a({to:e,style:t,activeStyle:n,...o}){const a=(0,s.Z)();const d=(0,i.bS)({path:e});return(0,r.jsx)(l.Z,{style:{...t,...d?n:{}},activeStyle:n,...o,onClick:t=>{o.onClick?.(t);a(e)}})}},75001:function(e,t,n){n.r(t);n.d(t,{Account:function(){return e$},Accounts:function(){return eE},Budget:function(){return es}});var r=n(43188);var o=n(66204);var i=n(37496);var s=n(55833);var l=n(84094);var a=n(25258);var d=n(73416);var c=n(1447);var u=n(9579);var g=n(76926);var p=n(99458);var h=n(45492);var f=n(24307);function y({onSync:e,children:t}){let[n,r]=(0,o.useState)(false);async function i(){r(true);await e();r(false)}return t({refreshing:n,onRefresh:i})}var m=n(99024);var x=n(46055);const v=e=>(0,r.jsx)("svg",{...e,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",style:{color:"inherit",...e.style},children:(0,r.jsx)("path",{d:"m3.828 9 6.071-6.071-1.414-1.414L0 10l.707.707 7.778 7.778 1.414-1.414L3.828 11H20V9H3.828z",fill:"currentColor"})});var b=v;var j=n(75433);var w=n(94276);var S=n(76074);var C=n(56816);const Z=(0,o.forwardRef)(({children:e,...t},n)=>{return(0,r.jsx)(f.Z,{...t,ref:n,style:{marginTop:15,marginLeft:5,marginRight:5,borderRadius:6,backgroundColor:h.rS.cardBackground,borderColor:h.rS.cardBorder,boxShadow:"0 1px 2px #9594A8",...t.style},children:(0,r.jsx)(f.Z,{style:{borderRadius:6,overflow:"hidden"},children:e})})});var T=Z;var E=n(46405);var B=n(77644);function A({title:e,style:t}){return(0,r.jsx)(B.Z,{style:{...h.W2.text,color:h.rS.tableRowHeaderText,textAlign:"right",fontSize:12,marginBottom:2,...t},children:e})}var k=n(31941);var I=n(11800);var D=n(52582);var _=n(57201);var M=n(5291);var W=n(57651);var R=n(44593);var G=n(63541);var L=n(7623);var O=n(18535);const N=50;const P=({children:e,style:t,...n})=>{return(0,r.jsx)(f.Z,{style:{height:N,borderBottomWidth:1,borderColor:h.rS.tableBorder,flexDirection:"row",alignItems:"center",paddingLeft:10,paddingRight:10,zIndex:1,...t},...n,children:e})};var z=n(94477);var U=n(31038);function F({toBudget:e,onClick:t}){let n=(0,W.Z)(e);return(0,r.jsxs)(C.Z,{type:"bare",style:{flexDirection:"column",alignItems:"flex-start"},onClick:t,children:[(0,r.jsx)(A,{title:n<0?"OVERBUDGETED":"TO BUDGET",style:{...h.W2.underlinedText,color:h.rS.formInputText,flexShrink:0,textAlign:"left"}}),(0,r.jsx)(D.Z,{binding:e,type:"financial",style:{...h.W2.smallText,fontWeight:"500",color:n<0?h.rS.errorText:h.rS.formInputText}})]})}function H({projected:e}){let t=e?x.u8.totalBudgetedSaved:x.u8.totalSaved;let n=(0,W.Z)(t)||0;let o=n<0;return(0,r.jsxs)(f.Z,{style:{flexDirection:"column",alignItems:"flex-start"},children:[e?(0,r.jsx)(A,{title:"PROJECTED SAVINGS",style:{color:h.rS.formInputText,textAlign:"left"}}):(0,r.jsx)(A,{title:o?"OVERSPENT":"SAVED",style:{color:h.rS.formInputText,textAlign:"left"}}),(0,r.jsx)(D.Z,{binding:t,type:"financial",style:{...h.W2.smallText,fontWeight:"500",color:e?h.rS.alt2WarningText:o?h.rS.errorTextDark:h.rS.formInputText}})]})}function K({name:e,binding:t,style:n,textStyle:o,categoryId:i,month:s,onBudgetAction:l,onEdit:a,isEditing:d}){let c=(0,W.Z)(t);function u(e){l?.(s,"budget-amount",{category:i,amount:e})}function g(e){a?.(i)}return(0,r.jsx)(f.Z,{style:n,children:d?(0,r.jsx)(L._,{initialValue:c,zeroSign:"+",style:{height:N,transform:"translateX(6px)"},focused:d,textStyle:{...h.W2.smallText,...o},onChange:u,onBlur:()=>a?.(null)}):(0,r.jsx)(f.Z,{role:"button",style:{justifyContent:"center",alignItems:"flex-end",height:N},children:(0,r.jsx)(D.Z,{binding:t,type:"financial",style:{...h.W2.smallText,...o,...h.W2.underlinedText},getStyle:U.hd,"data-testid":e,onPointerUp:g,onPointerDown:e=>e.preventDefault()})})})}function V({group:e,pending:t,style:n}){return _jsxs(Card,{style:{marginTop:7,marginBottom:7,opacity:t?1:.4},children:[_jsx(q,{group:e,blank:true}),e.categories.map((e,t)=>_jsx(Y,{category:e,blank:true,index:t},e.id))]})}function $({name:e,pending:t,style:n}){return _jsx(ListItem,{style:{flex:1,borderColor:"transparent",borderRadius:4},children:_jsx(Text,{style:styles.smallText,children:e})})}const Y=(0,o.memo)(function e({category:e,index:t,blank:n,style:i,month:s,editMode:l,isEditing:a,onEdit:c,isEditingBudget:u,onEditBudget:g,onSave:p,onDelete:y,isBudgetActionMenuOpen:m,onOpenBudgetActionMenu:v,onBudgetAction:b,show3Cols:j,showBudgetedCol:S}){let Z=n?0:1;let T=l||a;let[A,I]=(0,o.useState)(e.name);let[_,M]=(0,o.useState)(e.hidden);let W=x.aK.catBudgeted(e.id);let R=x.aK.catSumAmount(e.id);let L=(0,G.lL)();let F=(0,G.lL)();(0,o.useEffect)(()=>{if(m){F.open()}},[m,F]);(0,o.useEffect)(()=>{if(!a&&L.isOpen){L.close()}},[a,L]);let H=()=>{if(A){p?.({...e,name:A})}else{I(e.name)}c?.(null)};let V=t=>{c?.(null);switch(t){case"toggle-visibility":M(!_);p?.({...e,hidden:!_});break;case"delete":y?.(e.id);break;default:throw new Error(`Unrecognized category menu type: ${t}`)}};let $=(0,o.useRef)();let Y=(0,o.useRef)();let q=(0,r.jsxs)(P,{style:{backgroundColor:u?h.rS.altTableTextEditing:"transparent",borderBottomWidth:0,borderTopWidth:t>0?1:0,opacity:_?.5:undefined,...i},"data-testid":"row",innerRef:$,children:[(0,r.jsx)(f.Z,{style:{...!T&&{display:"none"},flexDirection:"row",flex:1,justifyContent:"center",alignItems:"center",height:N},children:(0,r.jsx)(E.Z,{focused:a,inputRef:Y,rightContent:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z,{type:"bare",style:{padding:10},...L.getOpenEvents(),children:(0,r.jsx)(w.Z,{width:12,height:12})}),L.isOpen&&(0,r.jsx)(G.u,{position:"bottom-stretch",offset:1,style:{padding:0},onClose:()=>{L.close();Y.current?.focus()},children:(0,r.jsx)(k.Z,{onMenuSelect:V,items:[{name:"toggle-visibility",text:_?"Show":"Hide"},{name:"delete",text:"Delete"}]})})]}),style:{width:"100%"},placeholder:"Category Name",value:A,onUpdate:I,onEnter:H,onBlur:e=>{if(!$.current?.contains(e.relatedTarget)){H()}}})}),(0,r.jsx)(f.Z,{role:"button",style:{...T&&{display:"none"},flex:1},children:(0,r.jsx)(B.Z,{style:{...h.W2.smallText,...h.W2.underlinedText,...h.W2.lineClamp(2)},onPointerUp:()=>c?.(e.id),"data-testid":"category-name",children:e.name})}),(0,r.jsxs)(f.Z,{style:{...T&&{display:"none"},justifyContent:"center",alignItems:"center",flexDirection:"row",opacity:Z},children:[(0,r.jsx)(K,{name:"budgeted",binding:W,style:{...!j&&!S&&{display:"none"},width:90},textStyle:{...h.W2.smallText,textAlign:"right"},categoryId:e.id,month:s,onBudgetAction:b,isEditing:u,onEdit:g}),(0,r.jsx)(f.Z,{style:{...!j&&S&&{display:"none"},justifyContent:"center",alignItems:"flex-end",width:90,height:N},children:(0,r.jsx)(D.Z,{name:"spent",binding:R,style:{...h.W2.smallText,textAlign:"right"},getStyle:U.hd,type:"financial"})}),(0,r.jsx)(f.Z,{style:{...h.W2.noTapHighlight,justifyContent:"center",alignItems:"flex-end",width:90,height:N},children:(0,r.jsxs)("span",{role:"button",onPointerUp:()=>v?.(e.id),onPointerDown:e=>e.preventDefault(),children:[(0,r.jsx)(O.Z,{carryover:x.aK.catCarryover(e.id),balance:x.aK.catBalance(e.id),balanceStyle:{...h.W2.smallText,...h.W2.underlinedText}}),F.isOpen&&(0,r.jsx)(z.Z,{offset:5,categoryId:e.id,tooltip:F,monthIndex:d.yl(s),onBudgetAction:(e,t,n)=>{b?.(d.sl(d.So(s),e),t,n)},onClose:()=>{v?.(null)}})]})})]})]});return(0,r.jsx)(f.Z,{children:q})});const q=(0,o.memo)(function e({group:e,editMode:t,isEditing:n,onEdit:i,blank:s,onAddCategory:l,onSave:a,onDelete:d,show3Cols:c,showBudgetedCol:u}){let g=s?0:1;let p=t||n;let[y,m]=(0,o.useState)(e.name);let[v,b]=(0,o.useState)(e.hidden);let j=(0,G.lL)();(0,o.useEffect)(()=>{if(!n&&j.isOpen){j.close()}},[n]);let S=()=>{if(y){a?.({...e,name:y})}else{m(e.name)}i?.(null)};let Z=t=>{i?.(null);switch(t){case"add-category":l?.(e.id,e.is_income);break;case"toggle-visibility":b(!v);a?.({...e,hidden:!v});break;case"delete":d?.(e.id);break;default:throw new Error(`Unrecognized group menu type: ${t}`)}};let T=(0,o.useRef)();let A=(0,o.useRef)();let I=(0,r.jsxs)(P,{style:{flexDirection:"row",alignItems:"center",backgroundColor:h.rS.tableRowHeaderBackground,opacity:v?.5:undefined},"data-testid":"totals",innerRef:T,children:[(0,r.jsx)(f.Z,{style:{...!p&&{display:"none"},flexDirection:"row",flex:1,justifyContent:"center",alignItems:"center",height:N},children:(0,r.jsx)(E.Z,{focused:n,inputRef:A,rightContent:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z,{type:"bare",style:{padding:10},...j.getOpenEvents(),children:(0,r.jsx)(w.Z,{width:12,height:12})}),j.isOpen&&(0,r.jsx)(G.u,{position:"bottom-stretch",offset:1,style:{padding:0},onClose:()=>{j.close();A.current?.focus()},children:(0,r.jsx)(k.Z,{onMenuSelect:Z,items:[{name:"add-category",text:"Add category"},{name:"toggle-visibility",text:v?"Show":"Hide"},{name:"delete",text:"Delete"}]})})]}),style:{width:"100%"},placeholder:"Category Group Name",value:y,onUpdate:m,onEnter:S,onBlur:e=>{if(!T.current?.contains(e.relatedTarget)){S()}}})}),(0,r.jsx)(f.Z,{role:"button",style:{...p&&{display:"none"},flex:1},children:(0,r.jsx)(B.Z,{tabIndex:-1,style:{...h.W2.smallText,...h.W2.underlinedText,...h.W2.lineClamp(2),fontWeight:"500"},onPointerUp:()=>i?.(e.id),"data-testid":"name",children:e.name})}),(0,r.jsxs)(f.Z,{style:{...p&&{display:"none"},flexDirection:"row",justifyContent:"center",alignItems:"center",height:N,opacity:g},children:[(0,r.jsx)(f.Z,{style:{...!c&&!u&&{display:"none"},width:90,height:N,justifyContent:"center",alignItems:"flex-end"},children:(0,r.jsx)(D.Z,{binding:x.aK.groupBudgeted(e.id),style:{...h.W2.smallText,fontWeight:"500",textAlign:"right"},type:"financial"})}),(0,r.jsx)(f.Z,{style:{...!c&&u&&{display:"none"},width:90,height:N,justifyContent:"center",alignItems:"flex-end"},children:(0,r.jsx)(D.Z,{binding:x.aK.groupSumAmount(e.id),style:{...h.W2.smallText,fontWeight:"500",textAlign:"right"},type:"financial"})}),(0,r.jsx)(f.Z,{style:{width:90,height:N,justifyContent:"center",alignItems:"flex-end"},children:(0,r.jsx)(D.Z,{binding:x.aK.groupBalance(e.id),style:{...h.W2.smallText,fontWeight:"500",textAlign:"right"},type:"financial"})})]})]});if(!t){return I}return I});const X=(0,o.memo)(function e({group:e,budget:t,balance:n,style:i,onAddCategory:s,onSave:l,onDelete:a,editMode:d,isEditing:c,onEdit:u}){let[g,p]=(0,o.useState)(e.name);let[y,m]=(0,o.useState)(e.hidden);let x=d||c;let v=(0,G.lL)();(0,o.useEffect)(()=>{if(!c&&v.isOpen){v.close()}},[c]);let b=()=>{if(g){l?.({...e,name:g})}else{p(e.name)}u?.(null)};let j=t=>{u?.(null);switch(t){case"add-category":s?.(e.id,e.is_income);break;case"toggle-visibility":m(!y);l?.({...e,hidden:!y});break;case"delete":a?.(e.id);break;default:throw new Error(`Unrecognized group menu type: ${t}`)}};let S=(0,o.useRef)();let Z=(0,o.useRef)();return(0,r.jsxs)(P,{style:{flexDirection:"row",alignItems:"center",padding:10,backgroundColor:h.rS.tableRowHeaderBackground,opacity:y?.5:undefined,...i},innerRef:S,children:[(0,r.jsx)(f.Z,{style:{...!x&&{display:"none"},flexDirection:"row",flex:1,justifyContent:"center",alignItems:"center",height:N},children:(0,r.jsx)(E.Z,{focused:c,inputRef:Z,rightContent:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z,{type:"bare",style:{padding:10},...v.getOpenEvents(),children:(0,r.jsx)(w.Z,{width:12,height:12})}),v.isOpen&&(0,r.jsx)(G.u,{position:"bottom-stretch",offset:1,style:{padding:0},onClose:()=>{v.close();Z.current?.focus()},children:(0,r.jsx)(k.Z,{onMenuSelect:j,items:[{name:"add-category",text:"Add category"},{name:"toggle-visibility",text:y?"Show":"Hide"},{name:"delete",text:"Delete"}]})})]}),style:{width:"100%"},placeholder:"Category Group Name",value:g,onUpdate:p,onEnter:b,onBlur:e=>{if(!S.current?.contains(e.relatedTarget)){b()}}})}),(0,r.jsx)(f.Z,{role:"button",style:{...x&&{display:"none"},flex:1,justifyContent:"center",alignItems:"flex-start",height:N},children:(0,r.jsx)(B.Z,{style:{...h.W2.smallText,...h.W2.underlinedText,...h.W2.lineClamp(2),fontWeight:"500"},onPointerUp:()=>u?.(e.id),"data-testid":"name",children:e.name})}),t&&(0,r.jsx)(f.Z,{style:{...x&&{display:"none"},justifyContent:"center",alignItems:"flex-end",width:90,height:N},children:(0,r.jsx)(D.Z,{binding:t,style:{...h.W2.smallText,textAlign:"right",fontWeight:"500"},type:"financial"})}),(0,r.jsx)(f.Z,{style:{...x&&{display:"none"},justifyContent:"center",alignItems:"flex-end",width:90,height:N},children:(0,r.jsx)(D.Z,{binding:n,style:{...h.W2.smallText,textAlign:"right",fontWeight:"500"},type:"financial"})})]})});const Q=(0,o.memo)(function e({category:e,budget:t,balance:n,style:i,onSave:s,onDelete:l,editMode:a,isEditing:d,onEdit:c}){let[u,g]=(0,o.useState)(e.name);let[p,y]=(0,o.useState)(e.hidden);let m=a||d;let x=(0,G.lL)();(0,o.useEffect)(()=>{if(!d&&x.isOpen){x.close()}},[d]);let v=()=>{if(u){s?.({...e,name:u})}else{g(e.name)}c?.(null)};let b=t=>{c?.(null);switch(t){case"toggle-visibility":y(!p);s?.({...e,hidden:!p});break;case"delete":l?.(e.id);break;default:throw new Error(`Unrecognized category menu type: ${t}`)}};let j=(0,o.useRef)();let S=(0,o.useRef)();return(0,r.jsxs)(P,{style:{flexDirection:"row",alignItems:"center",padding:10,backgroundColor:"transparent",opacity:p?.5:undefined,...i},innerRef:j,children:[(0,r.jsx)(f.Z,{style:{...!m&&{display:"none"},flexDirection:"row",flex:1,justifyContent:"center",alignItems:"center",height:N},children:(0,r.jsx)(E.Z,{focused:d,inputRef:S,rightContent:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z,{type:"bare",style:{padding:10},...x.getOpenEvents(),children:(0,r.jsx)(w.Z,{width:12,height:12})}),x.isOpen&&(0,r.jsx)(G.u,{position:"bottom-stretch",offset:1,style:{padding:0},onClose:()=>{x.close();S.current?.focus()},children:(0,r.jsx)(k.Z,{onMenuSelect:b,items:[{name:"toggle-visibility",text:p?"Show":"Hide"},{name:"delete",text:"Delete"}]})})]}),style:{width:"100%"},placeholder:"Category Name",value:u,onUpdate:g,onEnter:v,onBlur:e=>{if(!j.current?.contains(e.relatedTarget)){v()}}})}),(0,r.jsx)(f.Z,{role:"button",style:{...m&&{display:"none"},flex:1,justifyContent:"center",alignItems:"flex-start",height:N},children:(0,r.jsx)(B.Z,{tabIndex:-1,style:{...h.W2.smallText,...h.W2.underlinedText,...h.W2.lineClamp(2)},onPointerUp:()=>c?.(e.id),"data-testid":"name",children:e.name})}),t&&(0,r.jsx)(f.Z,{style:{...m&&{display:"none"},justifyContent:"center",alignItems:"flex-end",width:90,height:N},children:(0,r.jsx)(D.Z,{binding:t,style:{...h.W2.smallText,textAlign:"right"},type:"financial"})}),(0,r.jsx)(f.Z,{style:{...m&&{display:"none"},justifyContent:"center",alignItems:"flex-end",width:90,height:N},children:(0,r.jsx)(D.Z,{binding:n,style:{...h.W2.smallText,textAlign:"right"},type:"financial"})})]})});const J=(0,o.memo)(function e({group:e,editMode:t,editingGroupId:n,onEditGroup:o,editingCategoryId:i,onEditCategory:s,editingBudgetCategoryId:l,onEditCategoryBudget:a,openBudgetActionMenuId:d,onOpenBudgetActionMenu:c,month:u,onSaveCategory:g,onDeleteCategory:p,onAddCategory:h,onSave:f,onDelete:y,onBudgetAction:m,showBudgetedCol:v,show3Cols:b,showHiddenCategories:j}){function w(e){if(!t){return e}return e}return w((0,r.jsxs)(T,{style:{marginTop:7,marginBottom:7},children:[(0,r.jsx)(q,{group:e,showBudgetedCol:v,budgeted:x.aK.groupBudgeted(e.id),balance:x.aK.groupBalance(e.id),show3Cols:b,editMode:t,onAddCategory:h,onSave:f,onDelete:y,isEditing:n===e.id,onEdit:o}),e.categories.filter(e=>!e.hidden||j).map((e,n)=>{const o=i===e.id;const h=l===e.id;const f=d===e.id;return(0,r.jsx)(Y,{show3Cols:b,index:n,category:e,showBudgetedCol:v,editMode:t,isEditing:o,onEdit:s,isEditingBudget:h,onEditBudget:a,isBudgetActionMenuOpen:f,onOpenBudgetActionMenu:c,month:u,onSave:g,onDelete:p,onBudgetAction:m},e.id)})]}))});function ee({type:e,group:t,onSave:n,onDelete:o,onAddCategory:i,onSaveCategory:s,onDeleteCategory:l,showHiddenCategories:a,editMode:d,editingGroupId:c,onEditGroup:u,editingCategoryId:g,onEditCategory:p}){return(0,r.jsxs)(f.Z,{children:[(0,r.jsxs)(f.Z,{style:{flexDirection:"row",alignItems:"center",justifyContent:"flex-end",marginTop:50,marginBottom:5,marginRight:14},children:[e==="report"&&(0,r.jsx)(A,{title:"BUDGETED",style:{width:90}}),(0,r.jsx)(A,{title:"RECEIVED",style:{width:90}})]}),(0,r.jsxs)(T,{style:{marginTop:0},children:[(0,r.jsx)(X,{group:t,budget:e==="report"?x.u8.groupBudgeted(t.id):null,balance:e==="report"?x.u8.groupSumAmount(t.id):x.aK.groupSumAmount(t.id),style:{backgroundColor:h.rS.altTableBackground},onAddCategory:i,onSave:n,onDelete:o,editMode:d,isEditing:c===t.id,onEdit:u}),t.categories.filter(e=>!e.hidden||a).map((t,n)=>{return(0,r.jsx)(Q,{category:t,type:e,budget:e==="report"?x.u8.catBudgeted(t.id):null,balance:e==="report"?x.u8.catSumAmount(t.id):x.aK.catSumAmount(t.id),index:n,onSave:s,onDelete:l,editMode:d,isEditing:g===t.id,onEdit:p},t.id)})]})]})}function et({type:e,categoryGroups:t,editingGroupId:n,onEditGroup:o,editingCategoryId:i,onEditCategory:s,editingBudgetCategoryId:l,onEditCategoryBudget:a,openBudgetActionMenuId:d,onOpenBudgetActionMenu:c,editMode:u,gestures:g,month:p,onSaveCategory:h,onDeleteCategory:y,onAddCategory:x,onAddGroup:v,onSaveGroup:b,onDeleteGroup:j,onReorderCategory:w,onReorderGroup:S,onBudgetAction:Z,showBudgetedCol:T,show3Cols:E,showHiddenCategories:B}){const A=(0,m.Z)(e=>{return{incomeGroup:e.find(e=>e.is_income),expenseGroups:e.filter(e=>!e.is_income)}});const{incomeGroup:k,expenseGroups:I}=A(t);return(0,r.jsxs)(f.Z,{"data-testid":"budget-groups",style:{flex:"1 0 auto",overflowY:"auto",paddingBottom:15},children:[I.filter(e=>!e.hidden||B).map(e=>{return(0,r.jsx)(J,{group:e,showBudgetedCol:T,gestures:g,month:p,editMode:u,editingGroupId:n,onEditGroup:o,editingCategoryId:i,onEditCategory:s,editingBudgetCategoryId:l,onEditCategoryBudget:a,openBudgetActionMenuId:d,onOpenBudgetActionMenu:c,onSaveCategory:h,onDeleteCategory:y,onAddCategory:x,onSave:b,onDelete:j,onReorderCategory:w,onReorderGroup:S,onBudgetAction:Z,show3Cols:E,showHiddenCategories:B},e.id)}),(0,r.jsx)(f.Z,{style:{alignItems:"flex-start",justifyContent:"flex-start"},children:(0,r.jsx)(C.Z,{onPointerUp:v,style:{fontSize:12,margin:10},children:"Add Group"})}),k&&(0,r.jsx)(ee,{type:e,group:k,onSave:b,onDelete:j,onAddCategory:x,onSaveCategory:h,onDeleteCategory:y,showHiddenCategories:B,editMode:u,editingGroupId:n,onEditGroup:o,editingCategoryId:i,onEditCategory:s})]})}function en(e){const{type:t,categoryGroups:n,month:s,monthBounds:l,editMode:a,onPrevMonth:c,onNextMonth:u,onSaveGroup:g,onDeleteGroup:p,onAddGroup:y,onAddCategory:m,onSaveCategory:v,onDeleteCategory:b,onEditMode:j,onReorderCategory:w,onReorderGroup:Z,onShowBudgetDetails:T,onBudgetAction:E,savePrefs:B}=e;const k="group";const[I,W]=(0,o.useState)(null);function R(e){X(k,e)}const G="category";const[L,O]=(0,o.useState)(null);function N(e){X(G,e)}const P="category-budget";const[z,U]=(0,o.useState)(null);function K(e){X(P,e)}const V="budget-menu";const[$,Y]=(0,o.useState)(null);function q(e){X(V,e)}function X(e,t){const n=I||L||z||$;W(e===k&&!n?t:null);O(e===G&&!n?t:null);U(e===P&&!n?t:null);Y(e===V&&!n?t:null)}const{width:Q}=(0,S.F)();const J=Q>=360;let ee=d.dK();let en=(0,M.Z)();const er=(0,i.v9)(e=>{return e.prefs?.local?.toggleMobileDisplayPref||true});const ei=(0,i.v9)(e=>{return e.prefs?.local?.["budget.showHiddenCategories"]||false});let[es,el]=(0,o.useState)(!er&&!document.cookie.match(/mobileShowBudgetedColPref=true/));function ea(){el(!es);if(!es){B({mobileShowBudgetedColPref:true})}}let ed={padding:0,backgroundColor:"transparent",borderRadius:"unset"};return(0,r.jsx)(_.Z.Provider,{value:d.cv(s,t),children:(0,r.jsxs)(f.Z,{style:{flex:1,overflowY:"hidden"},"data-testid":"budget-table",children:[(0,r.jsx)(eo,{currentMonth:s,toggleDisplay:ea,monthBounds:l,editMode:a,onEditMode:j,onPrevMonth:c,onNextMonth:u,showHiddenCategories:ei,savePrefs:B}),(0,r.jsxs)(f.Z,{style:{flexDirection:"row",flex:"0 0 auto",padding:10,paddingRight:14,backgroundColor:"white",borderBottomWidth:1,borderColor:h.rS.tableBorder},children:[t==="report"?(0,r.jsx)(H,{projected:s>=ee}):(0,r.jsx)(F,{toBudget:x.aK.toBudget,onClick:T}),(0,r.jsx)(f.Z,{style:{flex:1}}),(J||es)&&(0,r.jsx)(C.Z,{type:"bare",disabled:J,onClick:ea,style:{...ed,padding:"0 8px",margin:"0 -8px",background:es&&!J?`linear-gradient(-45deg, ${h.rS.formInputBackgroundSelection} 8px, transparent 0)`:null},children:(0,r.jsxs)(f.Z,{style:{flexBasis:90,width:90,justifyContent:"center",alignItems:"flex-end"},children:[(0,r.jsx)(A,{title:"BUDGETED",style:{color:h.rS.buttonNormalText}}),(0,r.jsx)(D.Z,{binding:x.u8.totalBudgetedExpense,type:"financial",style:{...h.W2.smallText,color:h.rS.buttonNormalText,textAlign:"right",fontWeight:"500"},formatter:e=>{return en(-parseFloat(e||"0"),"financial")}})]})}),(J||!es)&&(0,r.jsx)(C.Z,{type:"bare",disabled:J,onClick:ea,style:{...ed,background:!es&&!J?`linear-gradient(45deg, ${h.rS.formInputBackgroundSelection} 8px, transparent 0)`:null},children:(0,r.jsxs)(f.Z,{style:{width:90,justifyContent:"center",alignItems:"flex-end"},children:[(0,r.jsx)(A,{title:"SPENT",style:{color:h.rS.formInputText}}),(0,r.jsx)(D.Z,{binding:x.aK.totalSpent,type:"financial",style:{...h.W2.smallText,color:h.rS.formInputText,textAlign:"right",fontWeight:"500"}})]})}),(0,r.jsxs)(f.Z,{style:{width:90,justifyContent:"center",alignItems:"flex-end"},children:[(0,r.jsx)(A,{title:"BALANCE",style:{color:h.rS.formInputText}}),(0,r.jsx)(D.Z,{binding:x.aK.totalBalance,type:"financial",style:{...h.W2.smallText,color:h.rS.formInputText,textAlign:"right",fontWeight:"500"}})]})]}),(0,r.jsx)(f.Z,{style:{overflowY:"auto"},children:!a?(0,r.jsx)(f.Z,{children:(0,r.jsx)(et,{type:t,categoryGroups:n,showBudgetedCol:es,show3Cols:J,showHiddenCategories:ei,month:s,editMode:a,editingGroupId:I,onEditGroup:R,editingCategoryId:L,onEditCategory:N,editingBudgetCategoryId:z,onEditCategoryBudget:K,openBudgetActionMenuId:$,onOpenBudgetActionMenu:q,onSaveCategory:v,onDeleteCategory:b,onAddCategory:m,onAddGroup:y,onSaveGroup:g,onDeleteGroup:p,onReorderCategory:w,onReorderGroup:Z,onBudgetAction:E})}):(0,r.jsx)(f.Z,{children:(0,r.jsx)(et,{type:t,categoryGroups:n,showBudgetedCol:es,show3Cols:J,showHiddenCategories:ei,editMode:a,editingGroupId:I,onEditGroup:R,editingCategoryId:L,onEditCategory:N,editingBudgetCategoryId:z,onEditCategoryBudget:K,onSaveCategory:v,onDeleteCategory:b,onAddCategory:m,onAddGroup:y,onSaveGroup:g,onDeleteGroup:p,onReorderCategory:w,onReorderGroup:Z,onBudgetAction:E})})})]})})}const er=50;function eo({currentMonth:e,monthBounds:t,onPrevMonth:n,onNextMonth:o,editMode:i,onEditMode:s,showHiddenCategories:l,savePrefs:a}){let c=(0,I.o1)();let u=e>t.start;let g=e<d.W9(t.end,1);let p={paddingLeft:15,paddingRight:15,backgroundColor:"transparent"};let y=()=>{a({"budget.showHiddenCategories":!l})};let m=(0,G.lL)();let x=e=>{m.close();switch(e){case"edit-mode":s?.(true);break;case"toggle-hidden-categories":y();break;default:throw new Error(`Unrecognized menu option: ${e}`)}};return(0,r.jsxs)(f.Z,{style:{flexDirection:"row",flexShrink:0,height:er,backgroundColor:h.rS.buttonPrimaryBackground},children:[(0,r.jsx)(f.Z,{style:{flexBasis:"25%",justifyContent:"flex-start",flexDirection:"row"},children:c&&(0,r.jsx)(R.rD,{isMobile:true,style:{color:"white",backgroundColor:"transparent",paddingLeft:12,paddingRight:12}})}),(0,r.jsxs)(f.Z,{style:{flexBasis:"50%",justifyContent:"center",alignItems:"center",flexDirection:"row"},children:[(0,r.jsx)(C.Z,{type:"bare",onClick:u&&n,style:{...p,opacity:u?1:.6},children:(0,r.jsx)(b,{style:{color:h.rS.formInputTextReadOnlySelection},width:"15",height:"15"})}),(0,r.jsx)(B.Z,{style:{...h.W2.mediumText,color:h.rS.formInputTextSelected,textAlign:"center"},children:d.WU(e,"MMMM ''yy")}),(0,r.jsx)(C.Z,{type:"bare",onClick:g&&o,style:{...p,opacity:g?1:.6},children:(0,r.jsx)(j.Z,{style:{color:h.rS.formInputTextReadOnlySelection},width:"15",height:"15"})})]}),(0,r.jsx)(f.Z,{style:{flexBasis:"25%",justifyContent:"flex-end",flexDirection:"row"},children:!i?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(C.Z,{type:"bare",style:{backgroundColor:"transparent",paddingLeft:12,paddingRight:12},...m.getOpenEvents(),children:(0,r.jsx)(w.Z,{width:"20",height:"20",style:{color:"white"}})}),m.isOpen&&(0,r.jsx)(G.u,{position:"bottom-right",width:200,style:{padding:0},onClose:m.close,children:(0,r.jsx)(k.Z,{onMenuSelect:x,items:[{name:"edit-mode",text:"Edit mode"},{name:"toggle-hidden-categories",text:"Toggle hidden categories"}]})})]}):(0,r.jsx)(C.Z,{type:"bare",style:{backgroundColor:"transparent",paddingLeft:12,paddingRight:12,...h.W2.mediumText,color:"white"},onClick:()=>s?.(false),children:"Done"})})]})};class ei extends o.Component{constructor(e){super(e);const t=d.dK();this.state={bounds:{start:t,end:t},currentMonth:t,initialized:false,editMode:false,categoryGroups:[]}}async loadCategories(){let e=await this.props.getCategories();this.setState({categoryGroups:e.grouped})}async componentDidMount(){this.loadCategories();const{start:e,end:t}=await (0,l.lW)("get-budget-bounds");this.setState({bounds:{start:e,end:t}});this.prewarmMonth(this.state.currentMonth);let n=(0,l.oL)("sync-event",({type:e,tables:t})=>{if(e==="success"&&(t.includes("categories")||t.includes("category_mapping")||t.includes("category_groups"))){this.loadCategories()}});this.cleanup=()=>{n()}}componentWillUnmount(){this.cleanup?.()}prewarmMonth=async(e,t=null)=>{t=t||this.props.budgetType;let n=t==="report"?"report-budget-month":"rollover-budget-month";let r=await (0,l.lW)(n,{month:e});for(let e of r){this.props.spreadsheet.prewarmCache(e.name,e)}if(!this.state.initialized){this.setState({initialized:true})}};onShowBudgetDetails=()=>{this.props.pushModal("budget-summary",{month:this.state.currentMonth})};onBudgetAction=e=>{const{currentMonth:t}=this.state;this.props.applyBudgetAction(t,e,this.state.bounds)};onAddGroup=()=>{this.props.pushModal("new-category-group",{onValidate:e=>!e?"Name is required.":null,onSubmit:async e=>{const t=await this.props.createGroup(e);this.setState(n=>({categoryGroups:(0,a.Rp)(n.categoryGroups,{id:t,name:e,categories:[],is_income:0})}))}})};onAddCategory=(e,t)=>{this.props.pushModal("new-category",{onValidate:e=>!e?"Name is required.":null,onSubmit:async n=>{const r=await this.props.createCategory(n,e,t);this.setState(o=>({categoryGroups:(0,a.i8)(o.categoryGroups,{id:r,name:n,cat_group:e,is_income:t?1:0})}))}})};onSaveGroup=e=>{this.props.updateGroup(e);this.setState(t=>({categoryGroups:(0,a.mD)(t.categoryGroups,e)}))};onDeleteGroup=async e=>{let t=this.state.categoryGroups?.find(t=>t.id===e);if(!t){return}let n=false;for(let e of t.categories){if(await (0,l.lW)("must-category-transfer",{id:e.id})){n=true;break}}if(n){this.props.pushModal("confirm-category-delete",{group:e,onDelete:t=>{this.props.deleteGroup(e,t);this.setState(t=>({categoryGroups:(0,a.iE)(t.categoryGroups,e)}))}})}else{this.props.deleteGroup(e);this.setState(t=>({categoryGroups:(0,a.iE)(t.categoryGroups,e)}))}};onSaveCategory=e=>{this.props.updateCategory(e);this.setState(t=>({categoryGroups:(0,a.yr)(t.categoryGroups,e)}))};onDeleteCategory=async e=>{const t=await (0,l.lW)("must-category-transfer",{id:e});if(t){this.props.pushModal("confirm-category-delete",{category:e,onDelete:t=>{if(e!==t){this.props.deleteCategory(e,t);this.setState(t=>({categoryGroups:(0,a.uu)(t.categoryGroups,e)}))}}})}else{this.props.deleteCategory(e);this.setState(t=>({categoryGroups:(0,a.uu)(t.categoryGroups,e)}))}};onReorderCategory=(e,{inGroup:t,aroundCategory:n})=>{let{categoryGroups:r}=this.state;let o,i;if(t){o=t}else if(n){let{id:e,position:t}=n;let s=r.find(t=>t.categories.find(t=>t.id===e));if(t==="bottom"){let{categories:t}=s;let n=t.findIndex(t=>t.id===e);e=n<t.length-1?t[n+1].id:null}o=s.id;i=e}this.props.moveCategory(e,o,i);this.setState({categoryGroups:(0,a.Wr)(r,e,o,i)})};onReorderGroup=(e,t,n)=>{let{categoryGroups:r}=this.state;if(n==="bottom"){let e=r.findIndex(e=>e.id===t);t=e<r.length-1?r[e+1].id:null}this.props.moveCategoryGroup(e,t);this.setState({categoryGroups:(0,a.eq)(r,e,t)})};sync=async()=>{const{updated:e,error:t}=await this.props.sync();if(t){return"error"}else if(e){return"updated"}return null};onPrevMonth=async()=>{let e=d.W9(this.state.currentMonth,1);await this.prewarmMonth(e);this.setState({currentMonth:e})};onNextMonth=async()=>{let e=d.zI(this.state.currentMonth,1);await this.prewarmMonth(e);this.setState({currentMonth:e})};onOpenActionSheet=()=>{let{budgetType:e}=this.props;let t=["Edit Categories","Copy last month’s budget","Set budgets to zero","Set budgets to 3 month average",e==="report"&&"Apply to all future budgets","Cancel"].filter(Boolean);this.props.showActionSheetWithOptions({options:t,cancelButtonIndex:t.length-1,title:"Actions"},t=>{switch(t){case 0:this.setState({editMode:true});break;case 1:this.onBudgetAction("copy-last");break;case 2:this.onBudgetAction("set-zero");break;case 3:this.onBudgetAction("set-3-avg");break;case 4:if(e==="report"){this.onBudgetAction("set-all-future")}break;default:}})};render(){const{currentMonth:e,bounds:t,editMode:n,initialized:o}=this.state;const{categories:i,categoryGroups:s,prefs:l,savePrefs:a,budgetType:d,navigation:c,applyBudgetAction:u}=this.props;let g=l.numberFormat||"comma-dot";let m=l.hideFraction||false;if(!s||!o){return(0,r.jsx)(f.Z,{style:{flex:1,backgroundColor:h.rS.pageBackgroundLineTop,alignItems:"center",justifyContent:"center",marginBottom:25},children:(0,r.jsx)(p.Z,{width:25,height:25})})}return(0,r.jsx)(y,{onSync:this.sync,children:({refreshing:o,onRefresh:l})=>(0,r.jsx)(en,{categories:i,categoryGroups:s,type:d,month:e,monthBounds:t,navigation:c,editMode:n,onEditMode:e=>this.setState({editMode:e}),onShowBudgetDetails:this.onShowBudgetDetails,onPrevMonth:this.onPrevMonth,onNextMonth:this.onNextMonth,onSaveGroup:this.onSaveGroup,onDeleteGroup:this.onDeleteGroup,onAddGroup:this.onAddGroup,onAddCategory:this.onAddCategory,onSaveCategory:this.onSaveCategory,onDeleteCategory:this.onDeleteCategory,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup,onOpenActionSheet:()=>{},onBudgetAction:u,savePrefs:a},g+m)})}}function es(){let{list:e,grouped:t}=(0,u.Z)();let n=(0,i.v9)(e=>e.prefs.local.budgetType||"rollover");let o=(0,i.v9)(e=>e.prefs.local);let l=(0,c.o)();let a=(0,s.M)();(0,g.j)(h.rS.mobileBudgetViewTheme);return(0,r.jsx)(ei,{categoryGroups:t,categories:e,budgetType:n,prefs:o,...l,spreadsheet:a})}var el=n(24868);var ea=n(42308);var ed=n(13308);var ec;(function(e){e[e["UP"]=-1]="UP";e[e["DOWN"]=1]="DOWN"})(ec||(ec={}));function eu(e){var t=getComputedStyle(e).overflowY;if(e===document.scrollingElement&&t==="visible"){return true}if(t!=="scroll"&&t!=="auto"){return false}return true}function eg(e,t){if(!eu(e)){return false}if(t===ec.DOWN){var n=e.scrollTop+e.clientHeight;return n<e.scrollHeight}if(t===ec.UP){return e.scrollTop>0}throw new Error("unsupported direction")}function ep(e,t){if(eg(e,t)){return true}if(e.parentElement==null){return false}return ep(e.parentElement,t)}function eh(e,t){if(t===void 0)t={};var n=t.insertAt;if(!e||typeof document==="undefined"){return}var r=document.head||document.getElementsByTagName("head")[0];var o=document.createElement("style");o.type="text/css";if(n==="top"){if(r.firstChild){r.insertBefore(o,r.firstChild)}else{r.appendChild(o)}}else{r.appendChild(o)}if(o.styleSheet){o.styleSheet.cssText=e}else{o.appendChild(document.createTextNode(e))}}var ef=".lds-ellipsis {\n display: inline-block;\n position: relative;\n width: 64px;\n height: 64px; }\n\n.lds-ellipsis div {\n position: absolute;\n top: 27px;\n width: 11px;\n height: 11px;\n border-radius: 50%;\n background: #363636;\n animation-timing-function: cubic-bezier(0, 1, 1, 0); }\n\n.lds-ellipsis div:nth-child(1) {\n left: 6px;\n animation: lds-ellipsis1 0.6s infinite; }\n\n.lds-ellipsis div:nth-child(2) {\n left: 6px;\n animation: lds-ellipsis2 0.6s infinite; }\n\n.lds-ellipsis div:nth-child(3) {\n left: 26px;\n animation: lds-ellipsis2 0.6s infinite; }\n\n.lds-ellipsis div:nth-child(4) {\n left: 45px;\n animation: lds-ellipsis3 0.6s infinite; }\n\n@keyframes lds-ellipsis1 {\n 0% {\n transform: scale(0); }\n 100% {\n transform: scale(1); } }\n\n@keyframes lds-ellipsis3 {\n 0% {\n transform: scale(1); }\n 100% {\n transform: scale(0); } }\n\n@keyframes lds-ellipsis2 {\n 0% {\n transform: translate(0, 0); }\n 100% {\n transform: translate(19px, 0); } }\n";eh(ef);var ey=function(){return o.createElement("div",{className:"lds-ellipsis"},o.createElement("div",null),o.createElement("div",null),o.createElement("div",null),o.createElement("div",null))};var em=function(){return o.createElement("div",null,o.createElement("p",null,"↧\xa0\xa0pull to refresh\xa0\xa0↧"))};var ex=".ptr,\n.ptr__children {\n height: 100%;\n width: 100%;\n overflow: hidden;\n -webkit-overflow-scrolling: touch;\n position: relative; }\n\n.ptr.ptr--fetch-more-treshold-breached .ptr__fetch-more {\n display: block; }\n\n.ptr__fetch-more {\n display: none; }\n\n/**\n * Pull down transition \n */\n.ptr__children,\n.ptr__pull-down {\n transition: transform 0.2s cubic-bezier(0, 0, 0.31, 1); }\n\n.ptr__pull-down {\n position: absolute;\n overflow: hidden;\n left: 0;\n right: 0;\n top: 0;\n visibility: hidden; }\n .ptr__pull-down > div {\n display: none; }\n\n.ptr--dragging {\n /**\n * Hide PullMore content is treshold breached\n */\n /**\n * Otherwize, display content\n */ }\n .ptr--dragging.ptr--pull-down-treshold-breached .ptr__pull-down--pull-more {\n display: none; }\n .ptr--dragging .ptr__pull-down--pull-more {\n display: block; }\n\n.ptr--pull-down-treshold-breached {\n /**\n * Force opacity to 1 is pull down trashold breached\n */\n /**\n * And display loader\n */ }\n .ptr--pull-down-treshold-breached .ptr__pull-down {\n opacity: 1 !important; }\n .ptr--pull-down-treshold-breached .ptr__pull-down--loading {\n display: block; }\n\n.ptr__loader {\n margin: 0 auto;\n text-align: center; }\n";eh(ex);var ev=function(e){var t=e.isPullable,n=t===void 0?true:t,r=e.canFetchMore,i=r===void 0?false:r,s=e.onRefresh,l=e.onFetchMore,a=e.refreshingContent,d=a===void 0?o.createElement(ey,null):a,c=e.pullingContent,u=c===void 0?o.createElement(em,null):c,g=e.children,p=e.pullDownThreshold,h=p===void 0?67:p,f=e.fetchMoreThreshold,y=f===void 0?100:f,m=e.maxPullDownDistance,x=m===void 0?95:m,v=e.resistance,b=v===void 0?1:v,j=e.backgroundColor,w=e.className,S=w===void 0?"":w;var C=(0,o.useRef)(null);var Z=(0,o.useRef)(null);var T=(0,o.useRef)(null);var E=(0,o.useRef)(null);var B=false;var A=false;var k=false;var I=0;var D=0;(0,o.useEffect)(function(){if(!n||!Z||!Z.current)return;var e=Z.current;e.addEventListener("touchstart",W,{passive:true});e.addEventListener("mousedown",W);e.addEventListener("touchmove",R,{passive:false});e.addEventListener("mousemove",R);window.addEventListener("scroll",G);e.addEventListener("touchend",L);e.addEventListener("mouseup",L);document.body.addEventListener("mouseleave",L);return function(){e.removeEventListener("touchstart",W);e.removeEventListener("mousedown",W);e.removeEventListener("touchmove",R);e.removeEventListener("mousemove",R);window.removeEventListener("scroll",G);e.removeEventListener("touchend",L);e.removeEventListener("mouseup",L);document.body.removeEventListener("mouseleave",L)}},[g,n,s,h,x,i,y]);(0,o.useEffect)(function(){var e;if(!((e=C)===null||e===void 0?void 0:e.current))return;var t=C.current.classList.contains("ptr--fetch-more-treshold-breached");if(t)return;if(i&&_()<y&&l){C.current.classList.add("ptr--fetch-more-treshold-breached");A=true;l().then(M).catch(M)}},[i,g]);var _=function(){if(!Z||!Z.current)return-1;var e=window.scrollY;var t=Z.current.scrollHeight;return t-e-window.innerHeight};var M=function(){requestAnimationFrame(function(){if(Z.current){Z.current.style.overflowX="hidden";Z.current.style.overflowY="auto";Z.current.style.transform="unset"}if(T.current){T.current.style.opacity="0"}if(C.current){C.current.classList.remove("ptr--pull-down-treshold-breached");C.current.classList.remove("ptr--dragging");C.current.classList.remove("ptr--fetch-more-treshold-breached")}if(B)B=false;if(A)A=false})};var W=function(e){k=false;if(e instanceof MouseEvent){I=e.pageY}if(window.TouchEvent&&e instanceof TouchEvent){I=e.touches[0].pageY}D=I;if(e.type==="touchstart"&&ep(e.target,ec.UP)){return}if(Z.current.getBoundingClientRect().top<0){return}k=true};var R=function(e){if(!k){return}if(window.TouchEvent&&e instanceof TouchEvent){D=e.touches[0].pageY}else{D=e.pageY}C.current.classList.add("ptr--dragging");if(D<I){k=false;return}if(e.cancelable){e.preventDefault()}var t=Math.min((D-I)/b,x);if(t>=h){k=true;B=true;C.current.classList.remove("ptr--dragging");C.current.classList.add("ptr--pull-down-treshold-breached")}if(t>=x){return}T.current.style.opacity=(t/65).toString();Z.current.style.overflow="visible";Z.current.style.transform="translate(0px, "+t+"px)";T.current.style.visibility="visible"};var G=function(e){if(A)return;if(i&&_()<y&&l){A=true;C.current.classList.add("ptr--fetch-more-treshold-breached");l().then(M).catch(M)}};var L=function(){k=false;I=0;D=0;if(!B){if(T.current)T.current.style.visibility="hidden";M();return}if(Z.current){Z.current.style.overflow="visible";Z.current.style.transform="translate(0px, "+h+"px)"}s().then(M).catch(M)};return o.createElement("div",{className:"ptr "+S,style:{backgroundColor:j},ref:C},o.createElement("div",{className:"ptr__pull-down",ref:T},o.createElement("div",{className:"ptr__loader ptr__pull-down--loading"},d),o.createElement("div",{className:"ptr__pull-down--pull-more"},u)),o.createElement("div",{className:"ptr__children",ref:Z},g,o.createElement("div",{className:"ptr__fetch-more",ref:E},o.createElement("div",{className:"ptr__loader ptr__fetch-more--loading"},d))))};var eb=ev;var ej=n(99818);function ew(e){return(0,r.jsx)("div",{style:{overflow:"auto"},children:(0,r.jsx)(eb,{pullDownThreshold:80,resistance:2,className:String((0,ej.iv)({"& .ptr__pull-down":{textAlign:"center"},"& .ptr__children":{overflow:"hidden auto"}})),...e})})};function eS({name:e,amount:t,style:n={}}){return(0,r.jsxs)(f.Z,{style:{flex:"1 0 auto",flexDirection:"row",marginTop:10,color:h.rS.pageTextLight,...n},children:[(0,r.jsx)(f.Z,{style:{flex:1},children:(0,r.jsx)(B.Z,{style:{...h.W2.text,textTransform:"uppercase",fontSize:13},"data-testid":"name",children:e})}),(0,r.jsx)(D.Z,{binding:t,style:{...h.W2.text,fontSize:13},type:"financial"})]})}function eC({account:e,updated:t,getBalanceQuery:n,onSelect:o}){return(0,r.jsx)(f.Z,{style:{flex:"1 0 auto",flexDirection:"row",backgroundColor:h.rS.tableBackground,boxShadow:`0 1px 1px ${h.rS.mobileAccountShadow}`,borderRadius:6,marginTop:10},"data-testid":"account",children:(0,r.jsxs)(C.Z,{onMouseDown:()=>o(e.id),style:{flexDirection:"row",flex:1,alignItems:"center",borderRadius:6,"&:active":{opacity:.1}},children:[(0,r.jsx)(f.Z,{style:{flex:"1 auto",margin:"10px 0"},children:(0,r.jsxs)(f.Z,{style:{flexDirection:"row",alignItems:"center"},children:[(0,r.jsx)(ea.Z,{style:{...h.W2.text,fontSize:17,fontWeight:600,color:t?h.rS.mobileAccountText:h.rS.pillText,paddingRight:30},"data-testid":"account-name",children:e.name}),e.bankId&&(0,r.jsx)(f.Z,{style:{backgroundColor:h.rS.noticeBackgroundDark,marginLeft:"-23px",width:8,height:8,borderRadius:8}})]})}),(0,r.jsx)(D.Z,{binding:n(e),type:"financial",style:{fontSize:16,color:"inherit"},getStyle:e=>e<0&&{color:"inherit"},"data-testid":"account-balance"})]})})}function eZ({onAdd:e}){return(0,r.jsxs)(f.Z,{style:{flex:1,padding:30},children:[(0,r.jsx)(B.Z,{style:h.W2.text,children:"For Actual to be useful, you need to add an account. You can link an account to automatically download transactions, or manage it locally yourself."}),(0,r.jsx)(C.Z,{type:"primary",style:{marginTop:20,alignSelf:"center"},onClick:()=>alert("Account creation is not supported on mobile on the self-hosted service yet"),children:"Add Account"}),(0,r.jsx)(B.Z,{style:{marginTop:20,color:h.rS.pageTextLight},children:"In the future, you can add accounts using the add button in the header."})]})}function eT({accounts:e,updatedAccounts:t,getBalanceQuery:n,getOnBudgetBalance:o,getOffBudgetBalance:i,onAddAccount:s,onSelectAccount:l}){const{syncAndDownload:a}=(0,c.o)();const d=e.filter(e=>e.offbudget===0);const u=e.filter(e=>e.offbudget===1);if(e.length===0){return(0,r.jsx)(eZ,{onAdd:s})}return(0,r.jsx)(f.Z,{style:{flex:1},children:(0,r.jsx)(ed.T,{title:"Accounts",children:(0,r.jsxs)(ew,{onRefresh:a,children:[(0,r.jsx)(eS,{name:"For Budget",amount:o()}),d.map(e=>(0,r.jsx)(eC,{account:e,updated:t.includes(e.id),getBalanceQuery:n,onSelect:l},e.id)),(0,r.jsx)(eS,{name:"Off budget",amount:i(),style:{marginTop:30}}),u.map(e=>(0,r.jsx)(eC,{account:e,updated:t.includes(e.id),getBalanceQuery:n,onSelect:l},e.id))]})})})}function eE(){let e=(0,i.v9)(e=>e.queries.accounts);let t=(0,i.v9)(e=>e.queries.newTransactions);let n=(0,i.v9)(e=>e.queries.updatedAccounts);let s=(0,i.v9)(e=>e.prefs.local.numberFormat||"comma-dot");let l=(0,i.v9)(e=>e.prefs.local.hideFraction||false);const{list:a}=(0,u.Z)();let{getAccounts:d}=(0,c.o)();const p=(0,o.useState)({});const y=(0,el.Z)();(0,o.useEffect)(()=>{(async()=>d())()},[]);const m=e=>{y(`/accounts/${e}`)};const v=e=>{y(`/transaction/${e}`)};(0,g.j)(h.rS.mobileAccountsViewTheme);return(0,r.jsx)(f.Z,{style:{flex:1},children:(0,r.jsx)(eT,{accounts:e.filter(e=>!e.closed),categories:a,transactions:p||[],updatedAccounts:n,newTransactions:t,getBalanceQuery:x.cW,getOnBudgetBalance:x.SZ,getOffBudgetBalance:x.An,onAddAccount:()=>{},onSelectAccount:m,onSelectTransaction:v},s+l)})}var eB=n(59379);var eA=n(82478);var ek=n.n(eA);var eI=n(65485);var eD=n(43044);var e_=n(62829);var eM=n(10959);var eW=n(76804);var eR=n(45485);var eG=n(74684);var eL=n(89116);var eO=n(28339);var eN=n(10646);var eP=n(80636);function ez({accountName:e,onSearch:t}){const[n,i]=(0,o.useState)("");return(0,r.jsx)(f.Z,{style:{flexDirection:"row",alignItems:"center",backgroundColor:h.rS.tableHeaderBackground,margin:"11px auto 4px",borderRadius:4,padding:10,width:"100%"},children:(0,r.jsx)(E.Z,{leftContent:(0,r.jsx)(eO.Z,{style:{width:13,height:13,flexShrink:0,color:n?h.rS.formInputTextHighlight:"inherit",margin:5,marginRight:0}}),value:n,onUpdate:e=>{i(e);t(e)},placeholder:`Search ${e}`,style:{backgroundColor:h.rS.formInputBackground,border:`1px solid ${h.rS.formInputBorder}`,fontSize:15,flex:1,height:32,marginLeft:4,padding:8}})})}const eU=70;function eF({account:e,prependTransactions:t,transactions:n,accounts:i,categories:s,payees:l,balance:a,isNewTransaction:d,onLoadMore:u,onSearch:g,onSelectTransaction:p,pushModal:y}){let m=(0,o.useMemo)(()=>{return t.concat(n)},[t,n]);const{syncAndDownload:x}=(0,c.o)();const v=async()=>{await x(e.id)};return(0,r.jsxs)(f.Z,{style:{flex:1,backgroundColor:h.rS.tableHeaderBackground,overflowY:"hidden",width:"100%"},children:[(0,r.jsxs)(f.Z,{style:{alignItems:"center",flexShrink:0,overflowY:"hidden",paddingTop:10,top:0,width:"100%"},children:[(0,r.jsxs)(f.Z,{style:{alignItems:"center",flexDirection:"row",justifyContent:"space-between",width:"100%"},children:[(0,r.jsxs)(eR.rU,{to:-1,style:{color:h.rS.formLabelText,alignItems:"center",display:"flex",textDecoration:"none",width:eU},children:[(0,r.jsx)(eL.Z,{style:{width:32,height:32}}),(0,r.jsx)(B.Z,{style:{...h.W2.text,fontWeight:500},children:"Back"})]}),(0,r.jsx)(f.Z,{style:{fontSize:16,fontWeight:500},role:"heading",children:e.name}),(0,r.jsx)(eN.Z,{to:"transactions/new",type:"bare","aria-label":"Add Transaction",style:{justifyContent:"center",width:eU},hoveredStyle:{background:"transparent"},activeStyle:{background:"transparent"},children:(0,r.jsx)(eG.Z,{width:20,height:20})})]}),(0,r.jsx)(A,{title:"BALANCE",style:{marginTop:10}}),(0,r.jsx)(D.Z,{binding:a,type:"financial",debug:true,style:{fontSize:18,fontWeight:"500"},getStyle:e=>({color:e<0?h.rS.errorText:h.rS.pillTextHighlighted}),"data-testid":"account-balance"}),(0,r.jsx)(ez,{accountName:e.name,onSearch:g})]}),(0,r.jsx)(ew,{onRefresh:v,children:(0,r.jsx)(eP.z4,{transactions:m,categories:s,accounts:i,payees:l,showCategory:!e.offbudget,isNew:d,onLoadMore:u,onSelect:p,pushModal:y})})]})};const eH=(0,m.Z)((e,t)=>{let n=x.PK(e,"_account");if(t){n={id:null}}return e=>{e=e.filter({$and:[n,{"_account.closed":false}]});return e.orderBy({next_date:"desc"})}});function eK({accountId:e,children:t}){let n=(0,e_.oF)();if(n==null){return t(null)}let r=n.schedules.filter(e=>!e.completed&&["due","upcoming","missed"].includes(n.statuses.get(e.id)));return t(r.map(e=>({id:"preview/"+e.id,payee:e._payee,account:e._account,amount:e._amount,date:e.next_date,notes:n.statuses.get(e.id),schedule:e.id})))}let eV;function e$(e){const t=(0,i.v9)(e=>e.queries.accounts);const n=(0,el.Z)();const[s,a]=(0,o.useState)([]);const[d,c]=(0,o.useState)("");const[p,f]=(0,o.useState)();let y=(0,i.v9)(e=>({payees:e.queries.payees,newTransactions:e.queries.newTransactions,prefs:e.prefs.local,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"}));let m=(0,i.I0)();let v=(0,o.useMemo)(()=>(0,eI.DE)(eD,m),[m]);const{id:b}=(0,eB.UO)();const j=()=>x.yf(b);const w=e=>{if(eV){eV.unsubscribe()}eV=(0,eM.Fr)(e.options({splits:"grouped"}).select("*"),e=>a(e),{pageCount:150,mapper:eW.Xt})};const S=async()=>{let e=j();f(e);w(e)};(0,o.useEffect)(()=>{let e;async function n(){e=(0,l.oL)("sync-event",({type:e,tables:t})=>{if(e==="applied"){if(t.includes("transactions")||t.includes("category_mapping")||t.includes("payee_mapping")){eV?.run()}if(t.includes("payees")||t.includes("payee_mapping")){v.getPayees()}}});if(t.length===0){await v.getAccounts()}await v.initiallyLoadPayees();await S();v.markAccountRead(b)}n();return()=>e()},[]);const C=(0,u.Z)();const Z=ek()(()=>{if(d===""&&p){w(p)}else if(d&&p){w(x.jS(p,d,y.dateFormat))}},150);(0,o.useEffect)(Z,[d,p,y.dateFormat]);(0,g.j)(h.rS.mobileAccountViewTheme);if(!t||!t.length){return null}const T=t.find(e=>e.id===b);const E=e=>{return y.newTransactions.includes(e)};const B=async e=>{eV.unsubscribe();c(e)};const A=e=>{if(!(0,eW.J4)(e.id)){n(`transactions/${e.id}`)}};let k=x.cW(T);let I=y.prefs.numberFormat||"comma-dot";let D=y.prefs.hideFraction||false;return(0,r.jsx)(e_.up,{transform:eH(b,d!==""),children:(0,r.jsx)(eK,{accountId:e.accountId,children:e=>e==null?null:(0,o.createElement)(eF,{...y,...v,key:I+D,account:T,accounts:t,categories:C.list,payees:y.payees,transactions:s,prependTransactions:e||[],balance:k,isNewTransaction:E,onLoadMore:()=>{eV?.fetchNext()},onSearch:B,onSelectTransaction:A})})})};},25258:function(e,t,n){n.d(t,{Rp:function(){return a},Wr:function(){return i},eq:function(){return s},i8:function(){return r},iE:function(){return c},mD:function(){return d},uu:function(){return l},yr:function(){return o}});function r(e,t){return e.map(e=>{if(e.id===t.cat_group){e.categories=[t,...e.categories]}return{...e}})}function o(e,t){return e.map(e=>{if(e.id===t.cat_group){e.categories=e.categories.map(e=>{if(e.id===t.id){return{...e,...t}}return e})}return e})}function i(e,t,n,r){if(t===r){return e}let o=e.reduce((e,n)=>{return e||n.categories.find(e=>e.id===t)},null);o={...o,cat_group:n};return e.map(e=>{if(e.id===n){e.categories=e.categories.reduce((e,n)=>{if(n.id===r){e.push(o);e.push(n)}else if(n.id!==t){e.push(n)}return e},[]);if(!r){e.categories.push(o)}}else{e.categories=e.categories.filter(e=>e.id!==t)}return{...e}})}function s(e,t,n){if(t===n){return e}let r=e.find(e=>e.id===t);e=e.reduce((e,o)=>{if(o.id===n){e.push(r);e.push(o)}else if(o.id!==t){e.push(o)}return e},[]);if(!n){e.push(r)}return e}function l(e,t){return e.map(e=>{e.categories=e.categories.filter(e=>e.id!==t);return e})}function a(e,t){return[...e,t]}function d(e,t){return e.map(e=>{if(e.id===t.id){return{...e,...t}}return e})}function c(e,t){return e.filter(e=>e.id!==t)}}}]);
|
|
2
|
+
//# sourceMappingURL=narrow-components.9ae206be.chunk.js.map
|