actual/packages/browser/build/static/js/main.a27b6a9d.chunk.js
2022-04-28 22:44:38 -04:00

2 lines
No EOL
630 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[0],{1:function(e,t,n){"use strict";(function(e){n.d(t,"z",function(){return N}),n.d(t,"c",function(){return F}),n.d(t,"p",function(){return z}),n.d(t,"b",function(){return $}),n.d(t,"h",function(){return W}),n.d(t,"e",function(){return G}),n.d(t,"d",function(){return H}),n.d(t,"f",function(){return V}),n.d(t,"m",function(){return X}),n.d(t,"n",function(){return ne}),n.d(t,"u",function(){return ae}),n.d(t,"g",function(){return se}),n.d(t,"q",function(){return we}),n.d(t,"a",function(){return Se}),n.d(t,"t",function(){return ke}),n.d(t,"r",function(){return Ne}),n.d(t,"s",function(){return $e}),n.d(t,"l",function(){return We}),n.d(t,"i",function(){return He}),n.d(t,"k",function(){return qe}),n.d(t,"j",function(){return Ye});var r=n(0),a=n.n(r),o=n(12),l=n(319),i=n(131),c=n(245),s=n.n(c),u=n(29),d=n(28),f=n(112),p=n(2),y=(n(9),n(128)),m=n(66),g=n(129),h=n(40),b=n(127),O=n(226),w=n(179);n.d(t,"y",function(){return h.a}),n.d(t,"w",function(){return b.a}),n.d(t,"v",function(){return O.a});var E=n(104);n.d(t,"o",function(){return E.a}),n.d(t,"x",function(){return E.b}),n.d(t,"A",function(){return E.c});const v=["style","innerRef"],j=["style","children"],S=["history","staticContext","to","style","activeStyle","match","location"],x=["children","pressed","primary","hover","bare","style","disabled","hoveredStyle","activeStyle","as"],C=["loading","children"],k=["style","inputRef","onEnter","onUpdate","focused"],P=["leftContent","rightContent","inputStyle","style","getStyle"],A=["style","children"],I=["left","right","style","leftStyle","rightStyle","truncate"],D=["style","isLast","children"];function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function L(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const N=e=>{const t=Object(r.useRef)(),n=Object(r.useCallback)((...e)=>t.current(...e),[]);return Object(r.useLayoutEffect)(()=>{t.current=e}),n};function F(e){e.style;const t=e.innerRef,n=L(e,v);return a.a.createElement("div",Object.assign({},n,{ref:t,className:`${e.className||""} ${Object(o.css)(e.style)}`}))}var U={textDecoration:"none",color:p.c.text,backgroundColor:"transparent",border:0,cursor:"pointer",padding:0,font:"inherit",":hover":{textDecoration:"underline"}};function z(e){let t=e.style,n=e.children,r=L(e,j);return a.a.createElement("button",Object.assign({},Object(o.css)(U,p.c.smallText,t),r),n)}function $({staticContext:e,to:t,exact:n,style:r,activeStyle:l,children:i}){Object(u.g)().createHref("string"===typeof t?{pathname:t}:t);let c=Object(u.j)({path:t,exact:!0});return a.a.createElement(d.a,Object.assign({to:t,exact:n},Object(o.css)([p.c.smallText,r,c?l:null])),i)}const W=a.a.forwardRef((e,t)=>{function n(t){t.preventDefault(),window.Actual.openURLInBrowser(e.href)}return e.asAnchor?a.a.createElement("a",Object.assign({ref:t},e,{onClick:n})):a.a.createElement(H,Object.assign({ref:t,bare:!0},e,{onClick:n}))});const G=Object(u.k)(function(e){let t=e.history,n=(e.staticContext,e.to),r=e.style,o=e.activeStyle,l=(e.match,e.location,L(e,S));return a.a.createElement(u.b,{path:n,children:({match:e})=>a.a.createElement(H,Object.assign({style:[r,e?o:null]},l,{onClick:e=>{l.onClick&&l.onClick(e),t.push(n)}}))})}),H=a.a.forwardRef((e,t)=>{let n=e.children,r=e.pressed,l=e.primary,i=e.hover,c=e.bare,s=e.style,u=e.disabled,d=e.hoveredStyle,f=e.activeStyle,y=e.as,m=void 0===y?"button":y,g=L(e,x);d=[c?{backgroundColor:"rgba(100, 100, 100, .15)"}:{boxShadow:p.c.shadow},d],f=[c?{backgroundColor:"rgba(100, 100, 100, .25)"}:{transform:"translateY(1px)",boxShadow:!c&&(l?"0 1px 4px 0 rgba(0,0,0,0.3)":"0 1px 4px 0 rgba(0,0,0,0.2)"),transition:"none"},f];let h=m,b=[B({alignItems:"center",justifyContent:"center",flexShrink:0,padding:c?"5px":"5px 10px",margin:0,overflow:"hidden",display:"flex",borderRadius:4,backgroundColor:c?"transparent":l?u?p.a.n7:p.a.p5:"white",border:c?"none":"1px solid "+(l?u?p.a.n7:p.a.p5:p.a.n9),color:l?"white":u?p.a.n6:p.a.n1,transition:"box-shadow .25s"},p.c.smallText),{":hover":!u&&d},{":active":!u&&f},i&&d,r&&f,s];return a.a.createElement(h,Object.assign({ref:t},"string"===typeof m?Object(o.css)(b):{style:b},{disabled:u},g),n)});var q={position:"relative"},Y={position:"absolute",top:0,left:0,right:0,bottom:0,alignItems:"center",justifyContent:"center"},K={width:20,height:20,color:"currentColor"};const V=a.a.forwardRef((e,t)=>{let n=e.loading,r=e.children,o=L(e,C);return a.a.createElement(H,Object.assign({},o,{style:[q,o.style]}),n&&a.a.createElement(h.a,{style:Y},a.a.createElement(m.a,{color:"currentColor",style:K})),a.a.createElement(h.a,{style:{opacity:n?0:1,flexDirection:"row",alignItems:"center"}},r))}),Q={outline:0,backgroundColor:"white",margin:0,padding:5,borderRadius:4,border:"1px solid #d0d0d0"};var Z={":focus":{border:"1px solid "+p.a.b5,boxShadow:"0 1px 1px "+p.a.b7},"::placeholder":{color:p.a.n7}};function X(e){let t=e.style,n=e.inputRef,i=e.onEnter,c=e.onUpdate,s=e.focused,u=L(e,k),d=Object(r.useRef)();return Object(w.b)(d,s),a.a.createElement("input",Object.assign({ref:n?Object(l.a)([n,d]):d},Object(o.css)([Q,Z,p.c.smallText,t]),u,{onKeyDown:e=>{13===e.keyCode&&i&&i(e),u.onKeyDown&&u.onKeyDown(e)},onChange:e=>{c&&c(e.target.value),u.onChange&&u.onChange(e)}}))}var J={padding:0,flex:1,flexDirection:"row",alignItems:"center"},ee={border:"1px solid "+p.a.b5,boxShadow:"0 1px 1px "+p.a.b7},te={flex:1,"&, &:focus, &:hover":{border:0,backgroundColor:"transparent",boxShadow:"none",color:"inherit"}};function ne(e){let t=e.leftContent,n=e.rightContent,o=e.inputStyle,l=e.style,i=e.getStyle,c=L(e,P),s=T(Object(r.useState)(!1),2),u=s[0],d=s[1];return a.a.createElement(h.a,{style:[Q,J,u&&ee,l,i&&i(u)]},t,a.a.createElement(X,Object.assign({},c,{style:[o,te],onFocus:e=>{d(!0),c.onFocus&&c.onFocus(e)},onBlur:e=>{d(!1),c.onBlur&&c.onBlur(e)}})),n)}var re={backgroundColor:"transparent",height:28,fontSize:14,flex:1,border:"1px solid #d0d0d0",borderRadius:4,color:p.a.n1,":focus":{border:"1px solid "+p.a.b5,boxShadow:"0 1px 1px "+p.a.b7,outline:"none"}};const ae=a.a.forwardRef((e,t)=>{let n=e.style,r=e.children,l=L(e,A);return a.a.createElement("select",Object.assign({ref:t},Object(o.css)(re,n),l),r)});var oe={lineHeight:"1em"},le={borderWidth:0,padding:5,borderRadius:4},ie={width:7,height:7,paddingTop:3},ce={zIndex:1e4,outline:0,borderRadius:4};function se({options:e,value:t,onChange:n,style:r}){return a.a.createElement(f.b,{value:t,onChange:n,style:oe},a.a.createElement(f.a,Object.assign({},Object(o.css)([le,r]),{arrow:a.a.createElement(g.a,{style:ie})})),a.a.createElement(f.e,{style:ce},a.a.createElement(f.c,null,e.map(([e,t])=>a.a.createElement(f.d,{key:e,value:e},t)))))}var ue={fontSize:10,color:p.a.n6};function de({keyName:e}){return a.a.createElement(b.a,{style:ue},e)}var fe={outline:"none",borderRadius:4,overflow:"hidden"},pe={margin:"3px 0px"},ye={borderTop:"1px solid "+p.a.n10},me={color:p.a.n6,fontSize:11,lineHeight:"1em",textTransform:"uppercase",margin:"3px 9px"},ge={color:p.a.n7},he={backgroundColor:p.a.n10},be={lineHeight:0},Oe={flex:1};function we({header:e,footer:t,items:n,onMenuSelect:o}){let l=Object(r.useRef)(null),i=n.filter(e=>e),c=T(Object(r.useState)(null),2),s=c[0],u=c[1];return Object(r.useEffect)(()=>{l.current.focus();let e=e=>{let t=i.filter(e=>e&&e!==we.line&&e.type!==we.label),n=t.indexOf(i[s]),r=e=>i.indexOf(t[e]);switch(e.keyCode){case 38:e.preventDefault(),u(null===s?0:r(Math.max(n-1,0)));break;case 40:e.preventDefault(),u(null===s?0:r(Math.min(n+1,t.length-1)));break;case 13:e.preventDefault(),null!==s&&o&&o(i[s].name)}};return l.current.addEventListener("keydown",e),()=>{l.current.removeEventListener("keydown",e)}},[s]),a.a.createElement(h.a,{style:fe,tabIndex:1,innerRef:l},e,i.map((e,t)=>{if(e===we.line)return a.a.createElement(h.a,{key:t,style:pe},a.a.createElement(h.a,{style:ye}));if(e.type===we.label)return a.a.createElement(b.a,{style:me},e.name);let n=i[t-1];return a.a.createElement(h.a,{key:e.name,style:[{cursor:"default",padding:"9px 10px",marginTop:0===t||n===we.line||n.type===we.label?0:-3,flexDirection:"row",alignItems:"center"},e.disabled&&ge,!e.disabled&&s===t&&he],onMouseEnter:()=>u(t),onMouseLeave:()=>u(null),onClick:t=>!e.disabled&&o&&o(e.name)},a.a.createElement(b.a,{style:be},e.icon&&a.a.createElement(e.icon,{width:e.iconSize||10,height:e.iconSize||10,style:{marginRight:7,width:10}})),a.a.createElement(b.a,null,e.text),a.a.createElement(h.a,{style:Oe}),e.key&&a.a.createElement(de,{keyName:e.key}))}),t)}we.line=Symbol("menu-line"),we.label=Symbol("menu-label");var Ee={flexDirection:"row",alignItems:"center"},ve={marginRight:10},je={flex:1,textAlign:"right"};function Se(e){let t=e.left,n=e.right,r=e.style,o=e.leftStyle,l=e.rightStyle,i=e.truncate,c=void 0===i?"left":i,s=L(e,I);const u={textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"};return a.a.createElement(h.a,Object.assign({style:[Ee,r]},s),a.a.createElement(F,{style:[ve,"left"===c&&u,o]},t),a.a.createElement(F,{style:[je,"right"===c&&u,l]},n))}var xe={marginBottom:15},Ce={lineHeight:"1.5em"};function ke(e){let t=e.style,n=e.isLast,r=e.children,l=L(e,D);return a.a.createElement("div",Object.assign({},l,Object(o.css)(!n&&xe,t,Ce)),r)}var Pe={display:"none"};function Ae({style:e,size:t,noAnimation:n,isCurrent:o,stackIndex:l,children:i}){let c=Object(r.useRef)(null),s=Object(r.useRef)(!1),u=Object(r.useRef)(10*Math.random()-5);return Object(r.useLayoutEffect)(()=>{function e(){o?(c.current.style.transform="translateY(0px) scale(1)",c.current.style.pointerEvents="auto"):(c.current.style.transform=`translateY(-40px) scale(.95) rotate(${u.current}deg)`,c.current.style.pointerEvents="none")}null!=c.current&&(s.current?e():n?(c.current.style.opacity=1,c.current.style.transform="translateY(0px) scale(1)",setTimeout(()=>{c.current&&(c.current.style.transition="opacity .1s, transform .1s cubic-bezier(.42, 0, .58, 1)")},0)):(c.current.style.opacity=0,c.current.style.transform="translateY(10px) scale(1)",setTimeout(()=>{c.current&&(s.current=!0,c.current.style.transition="opacity .1s, transform .1s cubic-bezier(.42, 0, .58, 1)",c.current.style.opacity=1,e())},0)))},[n,o,l]),a.a.createElement(h.a,{innerRef:c,style:[e,t&&{width:t.width,height:t.height},n&&!o&&Pe]},i)}var Ie={padding:20,position:"relative"},De={color:p.a.n2,flex:1,alignSelf:"center",textAlign:"center",width:"calc(100% - 40px)"},Te={fontSize:25,fontWeight:700,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Me={position:"absolute",right:0,top:0,bottom:0,justifyContent:"center",alignItems:"center"},Re={flexDirection:"row",marginRight:15},Be={padding:"10px 10px"},_e={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, .6)",alignItems:"center",justifyContent:"center",zIndex:1e3},Le={width:20,height:20};function Ne({title:t,isCurrent:n,isHidden:o,size:l,padding:c=20,showHeader:u=!0,showTitle:d=!0,showClose:f=!0,showOverlay:g=!0,loading:O=!1,noAnimation:w=!1,focusAfterClose:E=!0,stackIndex:v,parent:j,style:S,contentStyle:x,overlayStyle:C,children:k,onClose:P}){return Object(r.useEffect)(()=>{let e=i.a.getScope();return i.a.setScope("modal"),()=>i.a.setScope(e)},[]),a.a.createElement(s.a,{isOpen:!0,onRequestClose:P,shouldCloseOnOverlayClick:!1,shouldFocusAfterRender:!e.IS_DESIGN_MODE,shouldReturnFocusAfterClose:E,appElement:document.querySelector("#root"),parentSelector:j&&(()=>j),style:{content:B({top:0,left:0,right:0,bottom:0,display:"flex",justifyContent:"center",alignItems:"center",overflow:"visible",border:0,fontSize:14,backgroundColor:"transparent",padding:0,pointerEvents:"auto"},x),overlay:B(B({zIndex:3e3,backgroundColor:g&&0===v?"rgba(0, 0, 0, .1)":"none",pointerEvents:g?"auto":"none"},C),j?{position:"absolute",top:0,left:0,right:0,bottom:0}:{})}},a.a.createElement(Ae,{noAnimation:w,isCurrent:n,size:l,style:[{willChange:"opacity, transform",minWidth:500,minHeight:0,boxShadow:p.c.shadowLarge,borderRadius:4,backgroundColor:"white",opacity:o?0:1},S,p.c.lightScrollbar]},u&&a.a.createElement(h.a,{style:Ie},d&&a.a.createElement(h.a,{style:De},a.a.createElement(b.a,{style:Te},t)),a.a.createElement(h.a,{style:Me},a.a.createElement(h.a,{style:Re},f&&a.a.createElement(H,{bare:!0,onClick:e=>P(),style:Be},a.a.createElement(y.a,{width:10}))))),a.a.createElement(h.a,{style:{padding:c,paddingTop:0,flex:1}},"function"===typeof k?k():k),O&&a.a.createElement(h.a,{style:_e},a.a.createElement(m.a,{style:Le,color:p.a.n1}))))}var Fe={flexDirection:"row",marginTop:30},Ue={display:"none"},ze={flex:1};function $e({style:e,leftContent:t,focusButton:n=!1,children:o}){let l=Object(r.useRef)(null);return Object(r.useEffect)(()=>{if(n&&l.current){let e=l.current.querySelector("button:not([data-hidden])");e&&e.focus()}},[n]),a.a.createElement(h.a,{innerRef:l,style:[Fe,e]},a.a.createElement(H,{"data-hidden":!0,style:Ue}),t,a.a.createElement(h.a,{style:ze}),o)}function We({label:e,labelWidth:t,children:n,width:r,style:l}){return a.a.createElement("label",Object(o.css)({display:"flex",flexDirection:"row",alignItems:"center",margin:"7px 0",width:r},l),a.a.createElement("div",{style:{width:t||75,textAlign:"right",paddingRight:10}},e,":"),n)}var Ge={color:"red",fontSize:13};function He({style:e,children:t}){return a.a.createElement(h.a,{style:[Ge,e]},t)}function qe({children:t}){let n=Object(r.useRef)(null);return Object(r.useEffect)(()=>{n.current&&!e.IS_DESIGN_MODE&&setTimeout(()=>{n.current&&(n.current.focus(),n.current.setSelectionRange(0,1e4))},0)},[]),"function"===typeof t?t(n):a.a.cloneElement(t,{inputRef:n})}class Ye extends a.a.Component{constructor(...e){super(...e),this.state={hovered:!1},this.onMouseEnter=(()=>{this.props.disabled||this.setState({hovered:!0})}),this.onMouseLeave=(()=>{this.props.disabled||this.setState({hovered:!1})})}componentDidUpdate(e){this.props.disabled&&this.state.hovered&&this.setState({hovered:!1})}render(){let e=this.props,t=e.style,n=e.contentStyle,r=e.children,o=e.renderContent;return a.a.createElement(h.a,{style:t},a.a.createElement(h.a,{onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,style:n},r),this.state.hovered&&o())}}}).call(this,n(56))},104:function(e,t,n){"use strict";n.d(t,"a",function(){return d}),n.d(t,"c",function(){return f}),n.d(t,"b",function(){return p});var r=n(0),a=n.n(r),o=n(320),l=n.n(o),i=n(12),c=n(2);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const d=a.a.createContext();function f(){let e=s(Object(r.useState)(!1),2),t=e[0],n=e[1];return{getOpenEvents:(e={})=>({onClick:t=>{t.stopPropagation(),e.onClick&&e.onClick(t),n(!0)}}),isOpen:t,close:()=>n(!1)}}class p extends a.a.Component{constructor(e){super(e),this.state={position:null},this.position=e.position||"bottom-right",this.contentRef=a.a.createRef()}setup(){this.layout();let e=e=>{let t=e.target;for(;t&&t!==document.documentElement&&"tooltip"!==t.dataset.testid&&null==t.dataset.reachPopover;)t=t.parentNode;t===document.documentElement&&this.props.onClose&&this.props.onClose()};window.document.addEventListener("mousedown",e,!1),this.contentRef.current.addEventListener("keydown",e=>{27===e.keyCode&&this.props.onClose&&this.props.onClose()},!1),this.cleanup=(()=>{window.document.removeEventListener("mousedown",e)})}componentDidMount(){this.getContainer()?this.setup():this.forceUpdate(()=>{this.getContainer()?this.setup():console.log("Warning: could not mount tooltip, container missing")})}componentDidUpdate(e){(e.targetRect!==this.props.targetRect||e.forceTop!==this.props.forceTop||this.props.forceLayout)&&this.layout()}getContainer(){let e=this.props.ignoreBoundary;return!(void 0!==e&&e)&&this.context?this.context.current:document.body}getBoundsContainer(){let e=this.getContainer();return e.parentNode&&"auto"===e.parentNode.style.overflow?e.parentNode:e}layout(){let e=this.props,t=e.targetRect,n=e.offset,r=void 0===n?0:n,a=this.contentRef.current;if(!a)return;let o=a.getBoundingClientRect(),l=this.target.parentNode,i=t||l.getBoundingClientRect();i={top:i.top,left:i.left,width:i.width,height:i.height};let c=this.getBoundsContainer();if(!c)return;let s=c.getBoundingClientRect();if(i.left-=s.left,i.top-=s.top,this.props.forceTop)i.top=this.props.forceTop;else{let e=o.height+r,t=i.top-e,n=i.top+i.height+e;(-1!==this.position.indexOf("top")&&t<s.top||-1!==this.position.indexOf("bottom")&&n>s.height&&t>0)&&(this.position=this.getOppositePosition(this.position)),i.top+=c.scrollTop}const u=this.getStyleForPosition(this.position,o,i,this.getContainer().getBoundingClientRect(),r);a.style.top=u.top,a.style.bottom=u.bottom,a.style.left=u.left,a.style.right=u.right,a.style.width=u.width}componentWillUnmount(){this.cleanup&&this.cleanup()}getOppositePosition(e){switch(e){case"top":case"top-left":return"bottom";case"top-right":return"bottom-right";case"bottom":case"bottom-left":return"top";case"bottom-right":return"top-right";case"bottom-stretch":return"top-stretch";case"top-stretch":return"bottom-stretch";case"bottom-center":return"top-center";case"top-center":return"bottom-center"}}getStyleForPosition(e,t,n,r,a){const o={top:"inherit",bottom:"inherit",left:"inherit",right:"inherit"};if("top"===e||"top-right"===e||"top-left"===e)o.top=n.top-t.height-a+"px",o.left="top-right"===e?n.left+(n.width-t.width)+"px":n.left+"px";else if("bottom"===e||"bottom-right"===e||"bottom-left"===e)o.top=n.top+n.height+a+"px",o.left="bottom-right"===e?n.left+(n.width-t.width)+"px":n.left+"px";else if("bottom-center"===e)o.top=n.top+n.height+a+"px",o.left=n.left-(t.width-n.width)/2+"px";else if("top-center"===e)o.top=n.top-t.height-a+"px",o.left=n.left-(t.width-n.width)/2+"px";else if("left-center"===e)o.top=n.top-(t.height-n.height)/2+"px",o.left=n.left-t.width+"px";else if("top-stretch"===e)o.bottom=r.height-n.top+a+"px",o.left=n.left+"px",o.width=n.width+"px";else{if("bottom-stretch"!==e)throw new Error("Invalid position for Tooltip: "+e);o.top=n.top+n.height+a+"px",o.left=n.left+"px",o.width=n.width+"px"}return o}render(){const e=this.props,t=e.children,n=e.width,r=e.style,o={position:"absolute",zIndex:3e3,padding:5,width:n,boxShadow:c.c.shadowLarge,borderRadius:4,backgroundColor:"white"};return this.getContainer()?a.a.createElement("div",{ref:e=>this.target=e},l.a.createPortal(a.a.createElement("div",Object.assign({},Object(i.css)(o,r,c.c.darkScrollbar),{ref:this.contentRef,"data-testid":"tooltip",onClick:e=>{e.stopPropagation()}}),t),this.getContainer())):null}}p.contextType=d},11:function(e,t,n){"use strict";t.a={LOAD_TRANSACTIONS:"LOAD_TRANSACTIONS",SET_NEW_TRANSACTIONS:"SET_NEW_TRANSACTIONS",UPDATE_NEW_TRANSACTIONS:"UPDATE_NEW_TRANSACTIONS",SET_LAST_TRANSACTION:"SET_LAST_TRANSACTION",MARK_ACCOUNT_READ:"MARK_ACCOUNT_READ",LOAD_ACCOUNTS:"LOAD_ACCOUNTS",UPDATE_ACCOUNT:"UPDATE_ACCOUNT",LOAD_CATEGORIES:"LOAD_CATEGORIES",ADD_CATEGORY:"ADD_CATEGORY",DELETE_CATEGORY:"DELETE_CATEGORY",LOAD_PAYEES:"LOAD_PAYEES",LOAD_BANKS:"LOAD_BANKS",SET_PROFILE:"SET_PROFILE",SET_PREFS:"SET_PREFS",MERGE_LOCAL_PREFS:"MERGE_LOCAL_PREFS",MERGE_GLOBAL_PREFS:"MERGE_GLOBAL_PREFS",SET_BUDGETS:"SET_BUDGETS",SET_REMOTE_FILES:"SET_REMOTE_FILES",SET_ALL_FILES:"SET_ALL_FILES",SET_AVAILABLE_IMPORTS:"SET_AVAILABLE_IMPORTS",CLOSE_BUDGET:"CLOSE_BUDGET",SET_APP_STATE:"SET_APP_STATE",DEBUG_CELL:"DEBUG_CELL",PUSH_MODAL:"PUSH_MODAL",REPLACE_MODAL:"REPLACE_MODAL",HIDE_MODALS:"HIDE_MODALS",SHOW_MODALS:"SHOW_MODALS",CLOSE_MODAL:"CLOSE_MODAL",POP_MODAL:"POP_MODAL",ADD_NOTIFICATION:"ADD_NOTIFICATION",REMOVE_NOTIFICATION:"REMOVE_NOTIFICATION",GET_USER_DATA:"GET_USER_DATA",SET_LAST_UNDO_STATE:"SET_LAST_UNDO_STATE",SET_LAST_SPLIT_STATE:"SET_LAST_SPLIT_STATE",SET_ACCOUNTS_SYNCING:"SET_ACCOUNTS_SYNCING",ACCOUNT_SYNC_STATUS:"ACCOUNT_SYNC_STATUS",ACCOUNT_SYNC_FAILURES:"ACCOUNT_SYNC_FAILURES",SIGN_OUT:"SIGN_OUT",SET_TUTORIAL_STAGE:"SET_TUTORIAL_STAGE",DEACTIVATE_TUTORIAL:"DEACTIVATE_TUTORIAL"}},120:function(e,t,n){"use strict";var r=n(0),a=n.n(r);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=(e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:l({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M0 11l2-2 5 5L18 3l2 2L7 18z",fill:"currentColor"})))},124:function(e,t,n){"use strict";(function(e){n.d(t,"b",function(){return o}),n.d(t,"d",function(){return l}),n.d(t,"c",function(){return i}),n.d(t,"e",function(){return c}),n.d(t,"a",function(){return s});var r=n(3),a=n(11);function o(e){return{type:a.a.SET_APP_STATE,state:e}}function l(){return async t=>{e.Actual.applyAppUpdate(),t(o({updateInfo:null}))}}function i(e){return{type:a.a.SET_LAST_UNDO_STATE,undoState:e}}function c(e,t){return n=>Object(r.send)("upload-file-web",{filename:e,contents:t})}function s(){return e=>Object(r.send)("app-focused")}}).call(this,n(56))},127:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(12);const l=["numberOfLines","style","innerRef"];function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}t.a=function(e){e.numberOfLines,e.style;const t=e.innerRef,n=i(e,l);return a.a.createElement("span",Object.assign({},n,{ref:t,className:`${e.className||""} ${Object(o.css)(e.style)}`}))}},128:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(12);const l=["width","height","style","color"];function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}t.a=function(e){let t=e.width,n=e.height,r=e.style,c=e.color,s=void 0===c?"currentColor":c,u=i(e,l);return a.a.createElement("svg",Object.assign({width:t,height:n},u,Object(o.css)(r),{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"}),a.a.createElement("line",{fill:"none",stroke:s,className:"path",strokeWidth:"4",strokeLinecap:"round",strokeMiterlimit:"10",x1:"2",y1:"2",x2:"22",y2:"22"}),a.a.createElement("line",{fill:"none",stroke:s,className:"path",strokeWidth:"4",strokeLinecap:"round",strokeMiterlimit:"10",x1:"22",y1:"2",x2:"2",y2:"22"}))}},129:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(12);const l=["width","height","style","color"];function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}t.a=function(e){let t=e.width,n=e.height,r=e.style,c=e.color,s=void 0===c?"currentColor":c,u=i(e,l);return a.a.createElement("svg",Object.assign({width:t,height:n},u,Object(o.css)(r),{viewBox:"0 0 25 15",version:"1.1",xmlns:"http://www.w3.org/2000/svg"}),a.a.createElement("path",{fill:s,className:"path",d:"M24.4825085,0.57623494 C24.1741468,0.24939759 23.8086177,0.0861144578 23.3862628,0.0861144578 L1.55921502,0.0861144578 C1.13668942,0.0861144578 0.771416382,0.24939759 0.462798635,0.57623494 C0.154180887,0.903433735 0,1.29027108 0,1.73746988 C0,2.18457831 0.154180887,2.57141566 0.462798635,2.89834337 L11.3763652,14.4562048 C11.6853242,14.7830422 12.0505973,14.9466867 12.4727816,14.9466867 C12.8949659,14.9466867 13.2605802,14.7830422 13.568942,14.4562048 L24.4825085,2.89825301 C24.790785,2.57141566 24.9455631,2.18457831 24.9455631,1.73737952 C24.9455631,1.29027108 24.790785,0.903433735 24.4825085,0.57623494 Z"}))}},130:function(e,t,n){"use strict";n.d(t,"b",function(){return l}),n.d(t,"d",function(){return i}),n.d(t,"a",function(){return c}),n.d(t,"c",function(){return s});var r=n(11),a=n(41),o=n(3);function l(){return async(e,t)=>{let n=await Object(o.send)("load-prefs"),l=t().prefs.local;return n&&n.id&&!l&&e(Object(a.a)()),e({type:r.a.SET_PREFS,prefs:n,globalPrefs:await Object(o.send)("load-global-prefs")}),n}}function i(e){return async t=>{await Object(o.send)("save-prefs",e),t({type:r.a.MERGE_LOCAL_PREFS,prefs:e})}}function c(){return async(e,t)=>{let n=await Object(o.send)("load-global-prefs");return e({type:r.a.SET_PREFS,prefs:t().prefs.local,globalPrefs:n}),n}}function s(e){return async t=>{await Object(o.send)("save-global-prefs",e),t({type:r.a.MERGE_GLOBAL_PREFS,globalPrefs:e})}}},135:function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return c}),n.d(t,"c",function(){return s});var r=n(3),a=n(11),o=n(130),l=n(57);function i(){return async e=>{const t=await Object(r.send)("subscribe-get-user");return e({type:a.a.GET_USER_DATA,data:t}),t}}function c(){return async e=>{await e(i()),e(Object(l.i)())}}function s(){return async e=>{await Object(r.send)("subscribe-sign-out");e(i()),e(Object(o.a)()),e(Object(l.b)()),e({type:a.a.SIGN_OUT})}}},137:function(e,t,n){"use strict";n.d(t,"b",function(){return c}),n.d(t,"a",function(){return s}),n.d(t,"c",function(){return u});var r=n(11);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){l(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const i=n(96);function c(e){return{type:r.a.ADD_NOTIFICATION,notification:o(o({},e),{},{id:e.id||i.v4Sync()})}}function s(){return c({type:"error",message:"Something internally went wrong. You may want to restart the app if anything looks wrong. We have been notified of the issue and will try to fix it soon."})}function u(e){return{type:r.a.REMOVE_NOTIFICATION,id:e}}},140:function(e,t,n){"use strict";function r({reason:e,meta:t}){switch(e){case"unauthorized":return"You are not logged in.";case"encrypt-failure":return t.isMissingKey?"Encrypting your file failed because you are missing your encryption key. Create your key in the next step.":"Encrypting the file failed. You have the correct key so this is an internal bug. To fix this, generate a new key in the next step.";case"file-has-reset":return"Something went wrong while resetting your file. Please try again.";case"file-has-new-key":return"Unable to encrypt your data because you are missing the key. Create the latest key in the next step.";case"network":return"Uploading the file failed. Check your network connection.";case"beta-version":return"You cannot perform this action in the beta version (resetting sync, deleting a file, etc).";default:return`An internal error occurred, sorry! Contact help@actualbudget.com for support. (ref: ${e})`}}function a({reason:e,meta:t,fileName:n}){switch(e){case"network":case"download-failure":return"Downloading the file failed. Check your network connection.";case"invalid-zip-file":case"invalid-meta-file":return"Downloaded file is invalid, sorry! Contact help@actualbudget.com for support.";case"decrypt-failure":return"Unable to decrypt file "+(n||"(unknown)")+". To change your key, first download this file with the proper password.";case"out-of-sync-migrations":return"This budget cannot be loaded with this version of the app. Make sure the app is up-to-date.";default:return"Something went wrong trying to download that file, sorry! Contact help@actualbudget.com for support. "+(t&&t.fileId?`(fileId: ${t.fileId})`:"")}}function o(e){return r(e)}function l({reason:e}){switch(e){case"network":return"Unable to connect to the server. We need to access our server to get some information about your keys.";case"old-key-style":return"This file is encrypted with an old unsupported key style. Recreate the key on a device where the file is available, or use an older version of Actual to download it.";case"decrypt-failure":return"Unable to decrypt file with this password. Please try again.";default:return"Something went wrong trying to create a key, sorry! Contact help@actualbudget.com for support."}}n.d(t,"d",function(){return r}),n.d(t,"b",function(){return a}),n.d(t,"a",function(){return o}),n.d(t,"c",function(){return l})},16:function(e,t,n){"use strict";var r=n(3);var a=n(71);n.d(t,"f",function(){return o}),n.d(t,"d",function(){return l}),n.d(t,"e",function(){return i}),n.d(t,"a",function(){return c}),n.d(t,"b",function(){return s});t.c=a.a;async function o(e){return Object(r.send)("query",e.serialize())}function l(e,t,n){let r=new c(e,t,n);return r.run(),r}function i(e,t,n){let r=new s(e,t,n);return r.run(),r}class c{constructor(e,t,n={}){this.onData=((e,t)=>{for(let n=0;n<this.listeners.length;n++)this.listeners[n](e,t)}),this.onUpdate=(e=>{(null==this.dependencies||e.find(e=>this.dependencies.has(e)))&&this.run()}),this.run=(()=>(this.subscribe(),this._fetchData(()=>o(this.query)))),this._fetchData=(async e=>{let t=Math.random();this.inflightRequestId=t;let n=await e(),r=n.data,a=n.dependencies;if(null==this.dependencies&&(this.dependencies=new Set(a)),this.inflightRequestId===t&&this._unsubscribe){let e=this.mappedData;this.data=r,this.mappedData=this.mapData(r),this.onData(this.mappedData,e),this.inflightRequestId=null}}),this.subscribe=(()=>{null==this._unsubscribe&&(this._unsubscribe=Object(r.listen)("sync-event",({type:e,tables:t})=>{-1!==(this.onlySync?["success"]:["applied","success"]).indexOf(e)&&this.onUpdate(t)}))}),this.unsubscribe=(()=>{this._unsubscribe&&(this._unsubscribe(),this._unsubscribe=null)}),this.mapData=(e=>this.mapper?this.mapper(e):e),this.getQuery=(()=>this.query),this.getData=(()=>this.mappedData),this.getNumListeners=(()=>this.listeners.length),this.isRunning=(()=>null!=this._unsubscribe),this._optimisticUpdate=((e,t)=>{this.data=e(this.data),this.mappedData=t(this.mappedData)}),this.optimisticUpdate=((e,t)=>{let n=this.mappedData;this._optimisticUpdate(e,t),this.onData(this.mappedData,n)}),this.error=new Error,this.query=e,this.data=null,this.mappedData=null,this.dependencies=null,this.mapper=n.mapper,this.onlySync=n.onlySync,this.listeners=[],this.inflight=!1,this.restart=!1,t&&this.addListener(t)}addListener(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}}class s extends c{constructor(e,t,n={}){super(e,t,n),this._fetchCount=(()=>o(this.query.calculate({$count:"*"})).then(({data:e})=>{this.totalCount=e})),this.run=(()=>(this.subscribe(),this.runPromise=this._fetchData(async()=>(this.done=!1,this._fetchCount(),o(this.query.limit(null==this.data?this.pageCount:Math.max(this.data.length,this.pageCount))))),this.runPromise)),this.refetchUpToRow=(async(e,t)=>(this.runPromise=this._fetchData(async()=>{this.done=!1,this._fetchCount();let n=Object(a.b)(this.query,t);if(null==n)throw new Error("refetchUpToRow requires a query with orderBy");let r=n.field,l=n.order,i=await o(this.query.filter({id:e}).select(r));if(0===i.data.length)return;let c=i.data[0],s=(i=await o(this.query.filter({[r]:{["asc"===l?"$lte":"$gte"]:c[r]}}))).data;return i=await o(this.query.filter({[r]:{["asc"===l?"$gt":"$lt"]:c[r]}}).limit(this.pageCount)),{data:s.concat(i.data),dependencies:i.dependencies}}),this.runPromise)),this._fetchNext=(async()=>{for(;this.inflightRequestId;)await this.runPromise;let e=this.data;if(!this.done){let t=(await o(this.query.limit(this.pageCount).offset(e.length))).data;if(this.inflightRequestId||e!==this.data)return this._fetchNext();if(0===t.length)this.done=!0;else{this.done=t.length<this.pageCount,this.data=this.data.concat(t);let e=this.mappedData,n=this.mapData(t);this.mappedData=this.mappedData.concat(n),this.onPageData(n),this.onData(this.mappedData,e)}}}),this.fetchNext=function(e){let t=null;return(...n)=>t||(t=e(...n).finally(()=>{t=null}))}(this._fetchNext),this.isFinished=(()=>this.done),this.getTotalCount=(()=>this.totalCount),this.optimisticUpdate=((e,t)=>{let n=this.data,r=this.mappedData;this._optimisticUpdate(e,t),this.totalCount+=this.data.length-n.length,this.onData(this.mappedData,r)}),this.totalCount=null,this.pageCount=n.pageCount||500,this.runPromise=null,this.done=!1,this.onPageData=n.onPageData||(()=>{})}}},176:function(e,t,n){"use strict";n.d(t,"a",function(){return l});n(11);var r=n(3),a=n(43),o=n(41);function l(){return(e,t)=>{return!t().prefs.global.seenTutorial&&(Object(r.send)("set-tutorial-seen"),"web"===a.a.env)&&(setTimeout(()=>{e(Object(o.d)("welcome-screen"))},500),!0)}}},179:function(e,t,n){"use strict";n.d(t,"a",function(){return l}),n.d(t,"b",function(){return i});var r=n(0),a=n.n(r);let o=a.a.createContext(null);function l({children:e}){let t=Object(r.useRef)(null),n=Object(r.useMemo)(()=>({keyRef:t,onKeyChange:e=>{t.current=e}}),[t]);return a.a.createElement(o.Provider,{value:n},e)}function i(e,t){let n=Object(r.useContext)(o),a=Object(r.useRef)(null);Object(r.useLayoutEffect)(()=>{let r=a.current,o=e.current;if(o&&t&&(null===r||!1===r)){let e="input,button,div[tabindex]",r=o.matches(e)?o:o.querySelector(e);t&&r&&function(e,t){if(t){let n=function(e){let t=e;for(let n=0;n<10&&t;n++){let e=t.dataset&&t.dataset.focusKey;if(e)return e;t=t.parentNode}return null}(e);e.focus({preventScroll:n&&n===t.keyRef.current}),t.onKeyChange(n)}else e.focus();"INPUT"===e.tagName&&e.setSelectionRange(0,1e4)}(r,n)}a.current=t},[t])}},194:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(10),l=n(29),i=n(21),c=(n(3),n(1)),s=n(2);n(264);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f={color:s.a.n5,fontStyle:"italic"},p={flexDirection:"row",alignItems:"center"},y={padding:0};t.a=Object(o.b)(e=>({userData:e.user.data,files:e.budgets.allFiles,budgetId:e.prefs.local&&e.prefs.local.id}),i)(Object(l.k)(function({history:e,files:t,budgetId:n,userData:o,getUserData:l,setAppState:i,signOut:s,pushModal:d,closeBudget:m,style:g,color:h}){let b=u(Object(r.useState)(!0),2),O=b[0],w=b[1],E=u(Object(r.useState)(!1),2),v=E[0],j=E[1];return Object(r.useEffect)(()=>{l().then(()=>w(!1))},[]),O?a.a.createElement(c.w,{style:[f,g]},"Loading account..."):o?o.offline?a.a.createElement(c.y,{style:[{color:h},g]},"Offline"):a.a.createElement(c.y,{style:[p,g]},a.a.createElement(c.d,{bare:!0,onClick:function(){j(!0)},style:{color:h}},"Server"),v&&a.a.createElement(c.x,{position:"bottom-right",style:y,onClose:()=>j(!1)},a.a.createElement(c.q,{onMenuSelect:function(e){switch(j(!1),e){case"change-password":!async function(){await m(),window.__history.push("/change-password")}();break;case"sign-out":s()}},items:[{name:"change-password",text:"Change password"},{name:"sign-out",text:"Sign out"}].filter(e=>e)}))):a.a.createElement(c.y,{style:[{color:h},g]},"Not logged in")}))},195:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(27),l=n(10),i=n(21),c=n(1),s=n(128),u=n(66),d=n(2);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var y={lineHeight:"1.4em"};var m={fontWeight:700,marginBottom:10},g={flexShrink:0,color:"currentColor"},h={width:9,height:9,color:"currentColor"},b={position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(250, 250, 250, .75)",alignItems:"center",justifyContent:"center"},O={width:20,height:20,color:"currentColor"};function w({notification:e,onRemove:t}){e.id;let n=e.type,o=e.title,l=e.message,i=e.messageActions,p=e.sticky,w=e.internal,E=e.button,v=f(Object(r.useState)(!1),2),j=v[0],S=v[1],x=f(Object(r.useState)(!1),2),C=x[0],k=x[1];Object(r.useEffect)(()=>{"error"===n&&w&&console.error("Internal error:",w),p||setTimeout(t,6500)},[]);let P="message"===n,A="error"===n,I=Object(r.useMemo)(()=>(function(e,t,n,r){return a.a.createElement(c.v,{spacing:2},e.split(/\n\n/).map((e,o)=>{let l=e.split(/(\[[^\]]*\]\([^)]*\))/g);return a.a.createElement(c.w,{key:o,style:y},l.map((e,o)=>{let l=e.match(/\[([^\]]*)\]\(([^)]*)\)/);if(l){let e=f(l,3),i=(e[0],e[1]),s=e[2];if("#"===s[0]){let e=s.slice(1);return a.a.createElement("a",{href:"#",onClick:async a=>{a.preventDefault(),t[e]&&(n(!0),await t[e](),r())}},i)}return a.a.createElement(c.h,{key:o,asAnchor:!0,href:l[2]},l[1])}return a.a.createElement(c.w,{key:o},e)}))}))})(l,i,k,t),[l,i]);return a.a.createElement(c.y,{style:{marginTop:10,color:P?d.a.g3:A?d.a.r3:d.a.y2}},a.a.createElement(c.v,{align:"center",direction:"row",style:{padding:"14px 14px",fontSize:14,backgroundColor:P?d.a.g11:A?d.a.r11:d.a.y10,borderTop:`3px solid ${P?d.a.g5:A?d.a.r5:d.a.y4}`,boxShadow:d.c.shadowLarge,maxWidth:550,"& a":{color:"currentColor"}}},a.a.createElement(c.v,{align:"flex-start"},o&&a.a.createElement(c.y,{style:m},o),a.a.createElement(c.y,null,I),E&&a.a.createElement(c.f,{bare:!0,loading:j,onClick:async()=>{S(!0),await E.action(),t(),S(!1)},style:{backgroundColor:"transparent",border:`1px solid ${P?d.a.g5:A?d.a.r4:d.a.y3}`,color:"currentColor",fontSize:14,flexShrink:0,"&:hover, &:active":{backgroundColor:P?d.a.g9:A?d.a.r10:d.a.y9}}},E.title)),p&&a.a.createElement(c.d,{bare:!0,style:g,onClick:t},a.a.createElement(s.a,{style:h}))),C&&a.a.createElement(c.y,{style:b},a.a.createElement(u.a,{color:"currentColor",style:O})))}var E={position:"absolute",bottom:20,right:13,zIndex:1e4};t.a=Object(l.b)(e=>({notifications:e.notifications.notifications}),e=>Object(o.b)(i,e))(function({notifications:e,removeNotification:t,style:n}){return a.a.createElement(c.y,{style:[E,n]},e.map(e=>a.a.createElement(w,{key:e.id,notification:e,onRemove:()=>{e.onClose&&e.onClose(),t(e.id)}})))})},196:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(1),l=n(6),i=n(2),c={flex:1,maxHeight:200,overflow:"auto"},s={cursor:"pointer"},u={paddingLeft:20};class d extends a.a.Component{constructor(...e){super(...e),this.state={hoveredBackup:null},this.onHover=(e=>{this.setState({hoveredBackup:e})})}render(){const e=this.props,t=e.backups,n=e.onSelect,r=this.state.hoveredBackup;return a.a.createElement(o.y,{style:c,onMouseLeave:()=>this.onHover(null)},t.map((e,t)=>a.a.createElement(l.h,{key:e.id,collapsed:0!==t,focused:r===e.id,onMouseEnter:()=>this.onHover(e.id),onClick:()=>n(e.id),style:s},a.a.createElement(l.a,{width:"flex",value:e.date?e.date:"Revert to Latest",valueStyle:u}))))}}var f={flex:0},p={marginBottom:30},y={margin:20,marginTop:0,marginBottom:15,lineHeight:1.5},m={marginBottom:10},g={fontWeight:600},h={alignItems:"flex-start"},b={marginBottom:10},O={fontWeight:600},w={color:i.a.n6,marginLeft:20};t.a=function({budgetId:e,backups:t,backupDisabled:n,actions:r,modalProps:l}){const i=t.find(e=>e.isLatest),c=t.filter(e=>!e.isLatest);return a.a.createElement(o.r,Object.assign({title:"Load Backup",padding:0},l,{style:f}),()=>a.a.createElement(o.y,{style:p},a.a.createElement(o.y,{style:y},i?a.a.createElement(o.c,null,a.a.createElement(o.c,{style:m},a.a.createElement(o.w,{style:g},"You are currently working from a backup.")," ","You can load a different backup or revert to the original version below."),a.a.createElement(o.d,{primary:!0,onClick:()=>r.loadBackup(e,i.id)},"Revert to original version")):a.a.createElement(o.y,{style:h},a.a.createElement(o.c,{style:b},"Select a backup to load. After loading a backup, you will have a chance to revert to the current version in this screen."," ",a.a.createElement(o.w,{style:O},"If you use a backup, you will have to setup all your devices to sync from the new budget.")),a.a.createElement(o.d,{primary:!0,disabled:n,onClick:()=>r.makeBackup()},"Backup Now"))),0===c.length?a.a.createElement(o.c,{style:w},"No backups available"):a.a.createElement(d,{backups:c,onSelect:t=>r.loadBackup(e,t)})))}},197:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(0);function a(e){let t=Object(r.useRef)(null);return t.current||(t.current=new ResizeObserver(t=>{e(t[0].contentRect)})),Object(r.useCallback)(e=>{t.current.disconnect(),e&&t.current.observe(e,{box:"border-box"})},[])}},198:function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(131),a=n(0),o=n.n(a);let l=o.a.createContext("app");function i({keyName:e,eventType:t="keydown",handler:n}){let o=Object(a.useContext)(l);if("keyup"!==t&&"keydown"!==t)throw new Error("KeyHandler: unknown event type: "+t);return Object(a.useEffect)(()=>{function a(e,r){if(e.preventDefault(),e.type===t&&n)return n(e,r)}return Object(r.a)(e,{scope:o,keyup:!0},a),()=>{r.a.unbind({key:e,scope:o,method:a})}},[e,n,o]),null}function c({eventType:e,keys:t={}}){return Object.keys(t).map(n=>o.a.createElement(i,{key:n,keyName:n,eventType:e,handler:t[n]}))}r.a.filter=(e=>{var t=e.target||e.srcElement,n=t.tagName;return!!(e.metaKey||!t.isContentEditable&&("INPUT"!==n&&"TEXTAREA"!==n&&"SELECT"!==n||t.readOnly))})},2:function(e,t,n){"use strict";n.d(t,"a",function(){return a}),n.d(t,"c",function(){return o}),n.d(t,"b",function(){return s});var r=n(43);const a={y1:"#733309",y2:"#87540d",y3:"#B88115",y4:"#D4A31C",y5:"#E6BB20",y6:"#F2D047",y7:"#F5E35D",y8:"#FCF088",y9:"#FFF7C4",y10:"#FFFBEA",y11:"#FFFEFA",r1:"#610316",r2:"#8A041A",r3:"#AB091E",r4:"#CF1124",r5:"#E12D39",r6:"#EF4E4E",r7:"#F86A6A",r8:"#FF9B9B",r9:"#FFBDBD",r10:"#FFE3E3",r11:"#FFF1F1",b1:"#034388",b2:"#0B5FA3",b3:"#1271BF",b4:"#1980D4",b5:"#2B8FED",b6:"#40A5F7",b7:"#66B5FA",b8:"#8BCAFD",b9:"#B3D9FF",b10:"#E3F0FF",b11:"#F5FCFF",n1:"#102A43",n2:"#243B53",n3:"#334E68",n4:"#486581",n5:"#627D98",n6:"#829AB1",n7:"#9FB3C8",n8:"#BCCCDC",n9:"#D9E2EC",n10:"#E8ECF0",n11:"#F7FAFC",g1:"#014D40",g2:"#0C6B58",g3:"#147D64",g4:"#199473",g5:"#27AB83",g6:"#3EBD93",g7:"#65D6AD",g8:"#8EEDC7",g9:"#C6F7E2",g10:"#EFFCF6",g11:"#FAFFFD",p1:"#44056E",p2:"#580A94",p3:"#690CB0",p4:"#7A0ECC",p5:"#8719E0",p6:"#9446ED",p7:"#A368FC",p8:"#B990FF",p9:"#DAC4FF",p10:"#F2EBFE",p11:"#F9F6FE"};a.border=a.n10,a.hover="#fafafa",a.selected=a.b9,a.resolve=((e,t)=>{switch(e){case"border":return a["n"+(8+t)]}throw new Error("Unknown color name: "+e)});const o={veryLargeText:{fontSize:30,fontWeight:600},largeText:{fontSize:20,fontWeight:700,letterSpacing:.5},mediumText:{fontSize:15,fontWeight:500},smallText:{fontSize:13},verySmallText:{fontSize:13},page:{paddingTop:36,minWidth:500,flex:1},pageHeader:{fontSize:25,borderBottomWidth:5,borderColor:a.purple2,borderStyle:"solid",display:"inline",flex:0,color:a.grey4,marginTop:40,marginBottom:20,paddingBottom:5},pageContent:{paddingLeft:20,paddingRight:20},staticText:{cursor:"default",userSelect:"none"},shadow:"0 2px 4px 0 rgba(0,0,0,0.1)",shadowLarge:"0 15px 30px 0 rgba(0,0,0,0.11), 0 5px 15px 0 rgba(0,0,0,0.08)",tnum:"web"===r.a.env?{fontFeatureSettings:'"tnum"'}:null,notFixed:{fontFeatureSettings:""}};let l=!1;function i(){o.lightScrollbar=!l&&{"& ::-webkit-scrollbar":{width:11,backgroundColor:"rgba(200, 200, 200, .2)"},"& ::-webkit-scrollbar-thumb":{width:7,borderRadius:30,backgroundClip:"padding-box",border:"2px solid rgba(0, 0, 0, 0)"},"& ::-webkit-scrollbar-thumb:vertical":{backgroundColor:"#d0d0d0"}},o.darkScrollbar=!l&&{"& ::-webkit-scrollbar":{width:7,backgroundColor:"rgba(0, 0, 0, 0)"},"& ::-webkit-scrollbar-thumb:vertical":{backgroundColor:"rgba(200, 200, 200, .5)"}},o.scrollbarWidth=l?0:13}if("web"===r.a.env){function c(){let e=document.createElement("div");e.innerHTML='<div style="width:100px;height:100px;overflow:scroll;position:absolute;top:-9999px;"/>',document.body.appendChild(e);let t=e.childNodes[0];return t.offsetWidth===t.clientWidth}l=c(),i(),window.addEventListener("focus",()=>{l=c(),i()})}const s=()=>l;a.n9,a.n1,a.n1,a.n1,a.n1},200:function(e,t,n){"use strict";n.d(t,"a",function(){return j});var r=n(0),a=n.n(r),o=n(12),l=n(1),i=n(3),c=n(2),s=n(140);function u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f={width:600},p={marginTop:5},y={marginTop:0,"& li":{marginBottom:8}},m={marginTop:5},g={alignItems:"center"},h={fontWeight:600,marginBottom:3},b={color:c.a.r4,textAlign:"center",fontSize:13,marginBottom:3},O={width:300},w={marginTop:5},E={userSelect:"none"},v={marginTop:20};function j({modalProps:e,actions:t,budgetId:n,options:c={}}){let d=u(Object(r.useState)(!1),2),j=(d[0],d[1],u(Object(r.useState)(""),2)),S=j[0],x=j[1],C=u(Object(r.useState)(!1),2),k=C[0],P=C[1],A=u(Object(r.useState)(""),2),I=A[0],D=A[1],T=u(Object(r.useState)(!1),2),M=T[0],R=T[1],B=c.recreate;return a.a.createElement(l.r,Object.assign({},e,{style:f,title:B?"Generate new key":"Enable encryption",onClose:()=>t.popModal()}),()=>a.a.createElement(a.a.Fragment,null,B?a.a.createElement(a.a.Fragment,null,a.a.createElement(l.t,{style:m},"This will generate a new key for encrypting your data."," ",a.a.createElement("strong",null,"This requires a sync reset")," and all other devices will have to revert to this version of your data. Actual will take you through that process on those devices."," ",a.a.createElement(l.h,{asAnchor:!0,href:"https://actualbudget.com/encrypted-syncing"},"Learn more")),a.a.createElement(l.t,null,"Key generation is randomized. The same password will create different keys, so this will change your key regardless of the password being different.")):a.a.createElement(a.a.Fragment,null,a.a.createElement(l.t,{style:p},"To enable end-to-end encryption, you need to create a key. We will generate a key based on a password and use it to encrypt from now on. ",a.a.createElement("strong",null,"This requires a sync reset")," and all other devices will have to revert to this version of your data."," ",a.a.createElement(l.h,{asAnchor:!0,href:"https://actualbudget.com/encrypted-syncing"},"Learn more")),a.a.createElement(l.t,null,a.a.createElement("ul",Object(o.css)(y),a.a.createElement("li",null,a.a.createElement("strong",null,"Important:")," if you forget this password"," ",a.a.createElement("em",null,"and")," you don't have any local copies of your data, you will lose access to all your data. We cannot decrypt your data."),a.a.createElement("li",null,"This key only applies to this file. You will need to generate a new key for each file you want to encrypt."),a.a.createElement("li",null,"If you've already downloaded your data on other devices, you will need to reset them. Actual will automatically take you through this process.")))),a.a.createElement("form",{onSubmit:e=>{e.preventDefault(),async function(){if(""!==S&&!k){P(!0),D(null);let e=await Object(i.send)("key-make",{password:S});if(e.error)return P(null),void D(Object(s.a)(e.error));t.loadGlobalPrefs(),t.loadAllFiles(),t.sync(),P(!1),t.popModal()}}()}},a.a.createElement(l.y,{style:g},a.a.createElement(l.w,{style:h},"Password"),I&&a.a.createElement(l.y,{style:b},I),a.a.createElement(l.k,null,a.a.createElement(l.m,{type:M?"text":"password",style:O,onChange:e=>x(e.target.value)})),a.a.createElement(l.w,{style:w},a.a.createElement("label",{style:E},a.a.createElement("input",{type:"checkbox",onClick:()=>R(!M)})," ","Show password"))),a.a.createElement(l.s,{style:v},a.a.createElement(l.f,{loading:k,primary:!0},"Enable")))))}},201:function(e,t,n){"use strict";n.d(t,"a",function(){return v});var r=n(0),a=n.n(r),o=n(1),l=n(3),i=n(2),c=n(140);function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return u(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return u(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var d={width:600},f={flex:1},p={fontSize:25,fontWeight:700,color:i.a.n2,margin:"20px 0"},y={marginTop:15,flexDirection:"column",alignItems:"center"},m={fontWeight:600,marginBottom:5},g={color:i.a.r4,textAlign:"center",fontSize:13,marginBottom:3},h={width:"50%"},b={marginTop:5},O={userSelect:"none"},w={marginTop:20},E={marginRight:10};function v({modalProps:e,actions:t,options:n={}}){let i=n.hasExistingKey,u=n.cloudFileId,v=n.onSuccess,j=s(Object(r.useState)(""),2),S=j[0],x=j[1],C=s(Object(r.useState)(""),2),k=C[0],P=C[1],A=s(Object(r.useState)(!1),2),I=A[0],D=A[1],T=s(Object(r.useState)(!1),2),M=T[0],R=T[1];async function B(){if(""!==S&&!I){D(!0),P(null);let e=(await Object(l.send)("key-test",{password:S,fileId:u})).error;if(e)return P(Object(c.c)(e)),void D(!1);t.popModal(),v&&v()}}return a.a.createElement(o.r,Object.assign({},e,{showHeader:!1,style:d}),()=>a.a.createElement(o.y,{style:f},a.a.createElement(o.w,{style:p},i?"Unable to decrypt file":"This file is encrypted"),i?a.a.createElement(o.t,null,"This file was encrypted with a different key than you are currently using. This probably means you changed your password. Enter your current password to update your key."," ",a.a.createElement(o.h,{asAnchor:!0,href:"https://actualbudget.com/encrypted-syncing"},"Learn more")):a.a.createElement(o.t,null,"We don","'","t have a key that encrypts or decrypts this file. Enter the password for this file to create the key for encryption."," ",a.a.createElement(o.h,{asAnchor:!0,href:"https://actualbudget.com/encrypted-syncing"},"Learn more")),a.a.createElement("form",{onSubmit:e=>{e.preventDefault(),B()}},a.a.createElement(o.y,{style:y},a.a.createElement(o.w,{style:m},"Password")," ",k&&a.a.createElement(o.y,{style:g},k),a.a.createElement(o.k,null,a.a.createElement(o.m,{type:M?"text":"password",style:h,onChange:e=>x(e.target.value)})),a.a.createElement(o.w,{style:b},a.a.createElement("label",{style:O},a.a.createElement("input",{type:"checkbox",onClick:()=>R(!M)})," ","Show password"))),a.a.createElement(o.s,{style:w},a.a.createElement(o.d,{style:E,onClick:()=>e.onBack(),type:"button"},"Back"),a.a.createElement(o.f,{loading:I,primary:!0,onClick:B},i?"Update key":"Create key")))))}},21:function(e,t,n){"use strict";n.r(t);var r=n(63),a=n(3),o=n(11),l=n(137);function i(e){return{type:o.a.SET_ACCOUNTS_SYNCING,name:e}}function c(e,t,n){return{type:"ACCOUNT_SYNC_STATUS",id:e,failed:!0,errorType:t,errorCode:n}}function s(e){return{type:"ACCOUNT_SYNC_STATUS",id:e,failed:!1}}function u(e){return{type:"ACCOUNT_SYNC_FAILURES",syncErrors:e}}function d(e){return async t=>{await Object(a.send)("account-unlink",{id:e}),t(s(e)),t(Object(r.j)())}}function f(e,t,n,o){return async l=>{await Object(a.send)("accounts-link",{institution:e,publicToken:t,accountId:n,upgradingId:o}),await l(Object(r.l)()),await l(Object(r.j)())}}function p(e,t,n,o){return async l=>{let i=await Object(a.send)("accounts-connect",{institution:e,publicToken:t,accountIds:n,offbudgetIds:o});return await l(Object(r.l)()),await l(Object(r.j)()),i}}function y(e){return async(t,n)=>{if(n().account.accountsSyncing)return!1;if(e){let r=n().queries.accounts.find(t=>t.id===e);t(i(r.name))}else t(i("__all"));const r=await Object(a.send)("accounts-sync",{id:e}),d=r.errors,f=r.newTransactions,p=r.matchedTransactions,y=r.updatedAccounts;if(t(i(null)),e){let n=d.find(t=>t.accountId===e);n?"SyncError"===n.type&&t(c(e,n.category,n.code)):t(s(e))}else t(u(d.filter(e=>"SyncError"===e.type).map(e=>({id:e.accountId,type:e.category,code:e.code}))));return d.forEach(e=>{"SyncError"===e.type?t(Object(l.b)({type:"error",message:e.message})):t(Object(l.b)({type:"error",message:e.message,internal:e.internal}))}),t({type:o.a.SET_NEW_TRANSACTIONS,newTransactions:f,matchedTransactions:p,updatedAccounts:y}),f.length>0||p.length>0}}function m(e){return{type:o.a.SET_LAST_TRANSACTION,transaction:e}}function g(e,t){return async n=>await Object(a.send)("transactions-parse-file",{filepath:e,options:t})}function h(e,t){return async n=>{let r=await Object(a.send)("transactions-import",{accountId:e,transactions:t}),i=r.errors,c=void 0===i?[]:i,s=r.added,u=r.updated;return c.forEach(e=>{n(Object(l.b)({type:"error",message:e.message,internal:e.internal}))}),n({type:o.a.SET_NEW_TRANSACTIONS,newTransactions:s,matchedTransactions:u,updatedAccounts:s.length>0?[e]:[]}),s.length>0||u.length>0}}function b(e){return{type:o.a.UPDATE_NEW_TRANSACTIONS,changedId:e}}function O(e){return{type:o.a.MARK_ACCOUNT_READ,accountId:e}}function w(){return async e=>{e({type:o.a.LOAD_BANKS,banks:await Object(a.send)("banks")})}}function E(e,t){return{type:o.a.DEBUG_CELL,sheet:e,name:t}}var v=n(41),j=n(130),S=n(57),x=n(124),C=n(176);function k(e,t){return async(n,r)=>{const o=r().prefs.local;o&&o.id&&await n(Object(S.b)()),await Object(a.send)("backup-load",{id:e,backupId:t}),n(Object(S.j)(e))}}function P(){return async(e,t)=>{const n=t().prefs.local;n&&n.id&&await Object(a.send)("backup-make",{id:n.id})}}var A=n(140);function I(){return async e=>{const t=await Object(a.send)("unregister");e({type:o.a.SET_PROFILE,profile:t})}}function D(){return async(e,t)=>{let n=(await Object(a.send)("sync-reset")).error;n?(alert(Object(A.d)(n)),"encrypt-failure"===n.reason&&n.meta.isMissingKey||"file-has-new-key"===n.reason?e(Object(v.d)("fix-encryption-key",{onSuccess:()=>{e(D())}})):"encrypt-failure"===n.reason&&e(Object(v.d)("create-encryption-key",{recreate:!0}))):(await e(T()),await e(Object(j.b)()))}}function T(){return async(e,t)=>{const n=t().prefs.local;if(n&&n.id){return{error:(await Object(a.send)("sync")).error}}}}function M(e){return async(t,n)=>{let r=await t(T());if(r.error)return{error:r.error};let a=await t(y(e));if(a){let e=await t(T());return!e.error||{error:e.error}}return{hasUpdated:a||r.updated}}}var R=n(135);n.d(t,"applyBudgetAction",function(){return r.a}),n.d(t,"getCategories",function(){return r.k}),n.d(t,"createCategory",function(){return r.d}),n.d(t,"deleteCategory",function(){return r.g}),n.d(t,"updateCategory",function(){return r.v}),n.d(t,"moveCategory",function(){return r.n}),n.d(t,"moveCategoryGroup",function(){return r.o}),n.d(t,"createGroup",function(){return r.e}),n.d(t,"updateGroup",function(){return r.w}),n.d(t,"deleteGroup",function(){return r.h}),n.d(t,"getPayees",function(){return r.l}),n.d(t,"initiallyLoadPayees",function(){return r.m}),n.d(t,"createPayee",function(){return r.f}),n.d(t,"getAccounts",function(){return r.j}),n.d(t,"updateAccount",function(){return r.u}),n.d(t,"createAccount",function(){return r.c}),n.d(t,"openAccountCloseModal",function(){return r.p}),n.d(t,"closeAccount",function(){return r.b}),n.d(t,"reopenAccount",function(){return r.r}),n.d(t,"forceCloseAccount",function(){return r.i}),n.d(t,"setUndoEnabled",function(){return r.s}),n.d(t,"undo",function(){return r.t}),n.d(t,"redo",function(){return r.q}),n.d(t,"setAccountsSyncing",function(){return i}),n.d(t,"markAccountFailed",function(){return c}),n.d(t,"markAccountSuccess",function(){return s}),n.d(t,"setFailedAccounts",function(){return u}),n.d(t,"unlinkAccount",function(){return d}),n.d(t,"linkAccount",function(){return f}),n.d(t,"connectAccounts",function(){return p}),n.d(t,"syncAccounts",function(){return y}),n.d(t,"setLastTransaction",function(){return m}),n.d(t,"parseTransactions",function(){return g}),n.d(t,"importTransactions",function(){return h}),n.d(t,"updateNewTransactions",function(){return b}),n.d(t,"markAccountRead",function(){return O}),n.d(t,"getBanks",function(){return w}),n.d(t,"debugCell",function(){return E}),n.d(t,"pushModal",function(){return v.d}),n.d(t,"replaceModal",function(){return v.e}),n.d(t,"hideModals",function(){return v.b}),n.d(t,"showModals",function(){return v.f}),n.d(t,"popModal",function(){return v.c}),n.d(t,"closeModal",function(){return v.a}),n.d(t,"addNotification",function(){return l.b}),n.d(t,"addGenericErrorNotification",function(){return l.a}),n.d(t,"removeNotification",function(){return l.c}),n.d(t,"loadPrefs",function(){return j.b}),n.d(t,"savePrefs",function(){return j.d}),n.d(t,"loadGlobalPrefs",function(){return j.a}),n.d(t,"saveGlobalPrefs",function(){return j.c}),n.d(t,"updateStatusText",function(){return S.m}),n.d(t,"loadBudgets",function(){return S.k}),n.d(t,"loadRemoteFiles",function(){return S.l}),n.d(t,"loadAllFiles",function(){return S.i}),n.d(t,"loadBudget",function(){return S.j}),n.d(t,"closeBudget",function(){return S.b}),n.d(t,"closeBudgetUI",function(){return S.c}),n.d(t,"deleteBudget",function(){return S.e}),n.d(t,"createBudget",function(){return S.d}),n.d(t,"importBudget",function(){return S.h}),n.d(t,"uploadBudget",function(){return S.n}),n.d(t,"closeAndDownloadBudget",function(){return S.a}),n.d(t,"downloadBudget",function(){return S.f}),n.d(t,"getYNAB4Imports",function(){return S.g}),n.d(t,"setAppState",function(){return x.b}),n.d(t,"updateApp",function(){return x.d}),n.d(t,"setLastUndoState",function(){return x.c}),n.d(t,"uploadFile",function(){return x.e}),n.d(t,"focused",function(){return x.a}),n.d(t,"startTutorialFirstTime",function(){return C.a}),n.d(t,"loadBackup",function(){return k}),n.d(t,"makeBackup",function(){return P}),n.d(t,"unregister",function(){return I}),n.d(t,"resetSync",function(){return D}),n.d(t,"sync",function(){return T}),n.d(t,"syncAndDownload",function(){return M}),n.d(t,"getUserData",function(){return R.a}),n.d(t,"loggedIn",function(){return R.b}),n.d(t,"signOut",function(){return R.c})},226:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(40),l=n(127);const i=a.a.forwardRef(({direction:e="column",align:t,justify:n,spacing:r=3,children:i,debug:c,style:s},u)=>{const d=e.endsWith("reverse"),f=e.startsWith("row"),p=function e(t,n){return a.a.Children.toArray(n).reduce((n,r)=>r?r.type===a.a.Fragment?n.concat(e(r.key,r.props.children)):(n.push({key:t+r.key,child:r}),n):n,[])}("",i);return a.a.createElement(o.a,{style:[{flexDirection:e,alignItems:t,justifyContent:n},s],innerRef:u},p.map(({key:e,child:t},n)=>{let o,i=p.length===n+1;return o=f?d?"marginLeft":"marginRight":d?"marginTop":"marginBottom",a.a.cloneElement("string"===typeof t?a.a.createElement(l.a,null,t):t,{key:e,style:[c&&{borderWidth:1,borderColor:"red"},i?null:{[o]:5*r},t.props?t.props.style:null]})}))});t.a=i},25:function(e,t,n){"use strict";n.d(t,"c",function(){return m}),n.d(t,"d",function(){return b}),n.d(t,"e",function(){return O}),n.d(t,"a",function(){return w}),n.d(t,"b",function(){return E});var r=n(0),a=n.n(r),o=n(33),l=n(10),i=n(60),c=n(3);function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?s(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):s(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function y(e,t){let n=Math.min(e.start,e.end),r=Math.max(e.start,e.end);for(let a=n;a<=r;a++)t(a)}function m(e,t,n){let a=f(Object(r.useReducer)((e,n)=>{switch(n.type){case"select":{let r=e.selectedRange,a=new Set(e.selectedItems),l=n.id;if(Object(o.a)("shift")&&r){let n,o,i=t.findIndex(e=>e.id===l),c=t.findIndex(e=>e.id===r.start),s=t.findIndex(e=>e.id===r.end);return-1===s?n={start:c,end:i}:s<c?i<=c?(n={start:c,end:i},i>s&&(o={start:i-1,end:s})):n={start:s,end:i}:i>=c?(n={start:c,end:i},i<s&&(o={start:i+1,end:s})):n={start:s,end:i},y(n,e=>a.add(t[e].id)),o&&y(o,e=>a.delete(t[e].id)),u(u({},e),{},{selectedItems:a,selectedRange:{start:t[n.start].id,end:t[n.end].id}})}{let t=null;return a.delete(l)||(a.add(l),t={start:l,end:null}),u(u({},e),{},{selectedItems:a,selectedRange:t})}}case"select-none":return u(u({},e),{},{selectedItems:new Set});case"select-all":return u(u({},e),{},{selectedItems:new Set(n.ids||t.map(e=>e.id)),selectedRange:n.ids&&1===n.ids.length?{start:n.ids[0],end:null}:null});default:throw new Error("Unexpected action: "+n.type)}},null,()=>({selectedItems:new Set(n||[]),selectedRange:n&&1===n.length?{start:n[0],end:null}:null})),2),s=a[0],d=a[1],p=Object(r.useRef)(t);Object(r.useEffect)(()=>{if(s.selectedItems.size>0){let e=new Set(t.map(e=>e.id));if(!(p.current.length===t.length&&p.current.every(t=>e.has(t.id)))){let t=[...s.selectedItems],n=t.filter(t=>e.has(t));t.length!==n.length&&d({type:"select-all",ids:n})}}p.current=t},[t,s.selectedItems]),Object(r.useEffect)(()=>{let t=i.getUndoState("selectedItems");return i.setUndoState("selectedItems",{name:e,items:s.selectedItems}),()=>i.setUndoState("selectedItems",t)},[s.selectedItems]);let m=Object(l.d)(e=>e.app.lastUndoState);return Object(r.useEffect)(()=>{function t({messages:t,undoTag:n}){let r=i.getTaggedState(n),a=new Set(t.filter(e=>"tombstone"===e.column&&1===e.value).map(e=>e.row));r&&r.selectedItems&&r.selectedItems.name===e&&d({type:"select-all",ids:[...r.selectedItems.items].filter(e=>!a.has(e))})}return m&&m.current&&t(m.current),Object(c.listen)("undo-event",t)},[]),{items:s.selectedItems,setItems:s.setSelectedItems,dispatch:d}}let g=a.a.createContext(null),h=a.a.createContext(null);function b(){return Object(r.useContext)(g)}function O(){return Object(r.useContext)(h)}function w({instance:e,fetchAllIds:t,children:n}){let o=Object(r.useRef)(null);Object(r.useEffect)(()=>{o.current=e.items},[e.items]);let l=Object(r.useCallback)(async n=>"select-all"===n.type?o.current&&o.current.size>0?e.dispatch({type:"select-none"}):t?e.dispatch({type:"select-all",ids:await t()}):e.dispatch({type:"select-all"}):e.dispatch(n),[e.dispatch,t]);return a.a.createElement(h.Provider,{value:e.items},a.a.createElement(g.Provider,{value:l},n))}function E({name:e,items:t,initialSelectedIds:n,fetchAllIds:o,registerDispatch:l,children:i}){let c=m(e,t,n);return Object(r.useEffect)(()=>{l&&l(c.dispatch)},[l]),a.a.createElement(w,{instance:c,fetchAllIds:o,children:i})}},264:function(e,t,n){"use strict";n(0)},293:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(1),l=n(12),i=n(337),c={position:"absolute",top:0,bottom:0,left:0,right:0,background:`url(${n.n(i).a}) no-repeat center center fixed`,backgroundSize:"100% 100%"};var s=function({selected:e}){return a.a.createElement("div",Object(l.css)(c))},u=n(66),d=n(2),f={position:"absolute",top:0,left:0,right:0,padding:50,paddingTop:200,color:d.a.n1,alignItems:"center"},p={marginBottom:20,fontSize:18};t.a=function({initializing:e,loadingText:t}){return a.a.createElement(a.a.Fragment,null,a.a.createElement(s,null),(null!=t||e)&&a.a.createElement(o.y,Object(l.css)(f),a.a.createElement(o.c,{style:p},t),a.a.createElement(u.a,{width:25,color:d.a.n1})))}},3:function(e,t,n){const r=n(60),a=n(399),o=a.captureException,l=a.captureBreadcrumb,i=n(96);let c=new Map,s=new Map,u=[],d=null;class f extends Error{constructor(e,t,n,r,a){super(e),this.name=this.constructor.name,this.message=e,Object.defineProperty(this,"stack",{get:function(){return"extended "+this._stack},set:function(e){this._stack=e}}),this.stack=t,this.url=n,this.line=r,this.column=a}}function p(e,t,n){d=e,e.addEventListener("message",a=>{let i=a.data;"connect"===i.type?(u.length>0&&(u.forEach(t=>e.postMessage(t)),u=[]),t()):"app-init-failure"===i.type?n(i):"capture-exception"===i.type?(o(i.stack?new f(i.message,i.stack,i.url,i.line,i.column):i.exc),i.message&&i.message.includes("indexeddb-quota-error")&&alert("We hit a limit on the local storage available. Edits may not be saved. Please contact help@actualbudget.com to help debug this.")):"capture-breadcrumb"===i.type?l(i.data):function(e){if("error"===e.type){const t=e.id;c.delete(t)}else if("reply"===e.type){const t=e.id,n=e.result,a=e.mutated,o=e.undoTag,l=c.get(t);l&&(c.delete(t),a||r.gc(o),l.resolve(n))}else if("push"===e.type){const t=e.name,n=e.args,r=s.get(t);if(r)for(let e=0;e<r.length&&!0!==r[e](n);e++);}else if(!e.type.startsWith("__"))throw new Error("Unknown message type: "+JSON.stringify(e))}(i)}),e instanceof MessagePort&&e.start()}e.exports.init=async function(e){return new Promise((t,n)=>p(e,t,n))},e.exports.send=function(e,t,{catchErrors:n=!1}={}){return new Promise((a,o)=>{i.v4().then(l=>{c.set(l,{resolve:a,reject:o}),d?d.postMessage({id:l,name:e,args:t,undoTag:r.snapshot(),catchErrors:n}):u.push({id:l,name:e,args:t,undoTag:r.snapshot(),catchErrors:n})})})},e.exports.sendCatch=function(t,n){return e.exports.send(t,n,{catchErrors:!0})},e.exports.listen=function(e,t){return s.get(e)||s.set(e,[]),s.get(e).push(t),()=>{let n=s.get(e);s.set(e,n.filter(e=>e!==t))}},e.exports.unlisten=function(e){s.set(e,[])}},30:function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n(9);function a(e,t="string"){switch(t){case"string":const n=JSON.stringify(e);return'"'===n.charAt(0)&&'"'===n.charAt(n.length-1)?n.slice(1,-1):n;case"number":return""+e;case"financial-with-sign":let o=a(e,"financial");return e>=0?"+"+o:o;case"financial":if(null==e||""===e)return Object(r.integerToCurrency)(0);if("string"===typeof e){const t=parseFloat(e);e=isNaN(t)?0:t}if("number"!==typeof e)throw new Error("Value is not a number ("+typeof e+"): "+e);return Object(r.integerToCurrency)(e);default:throw new Error("Unknown format type: "+t)}}},31:function(e,t,n){"use strict";n.d(t,"a",function(){return u}),n.d(t,"b",function(){return d}),n.d(t,"e",function(){return f}),n.d(t,"d",function(){return p}),n.d(t,"c",function(){return y});var r=n(11),a=n(32),o=n(9);function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?l(Object(n),!0).forEach(function(t){c(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const s={newTransactions:[],matchedTransactions:[],lastTransaction:null,updatedAccounts:[],accounts:[],categories:{grouped:[],list:[]},payees:[],earliestTransaction:null};function u(e=s,t){switch(t.type){case r.a.SET_NEW_TRANSACTIONS:return i(i({},e),{},{newTransactions:t.newTransactions||[],matchedTransactions:t.matchedTransactions||[],updatedAccounts:t.updatedAccounts||[]});case r.a.UPDATE_NEW_TRANSACTIONS:return i(i({},e),{},{newTransactions:e.newTransactions.filter(e=>e!==t.changedId),matchedTransactions:e.matchedTransactions.filter(e=>e!==t.changedId)});case r.a.SET_LAST_TRANSACTION:return i(i({},e),{},{lastTransaction:t.transaction});case r.a.MARK_ACCOUNT_READ:return i(i({},e),{},{updatedAccounts:e.updatedAccounts.filter(e=>e!==t.accountId)});case r.a.LOAD_ACCOUNTS:return i(i({},e),{},{accounts:t.accounts});case r.a.UPDATE_ACCOUNT:return i(i({},e),{},{accounts:e.accounts.map(e=>e.id===t.account.id?i(i({},e),t.account):e)});case r.a.LOAD_CATEGORIES:return i(i({},e),{},{categories:t.categories});case r.a.LOAD_PAYEES:return i(i({},e),{},{payees:t.payees});case r.a.ADD_CATEGORY:{let n={id:"temp",name:t.name};return i(i({},e),{},{categories:{grouped:e.categories.grouped.map(e=>e.id===t.groupId?i(i({},e),{},{categories:[n,...e.categories]}):e),list:[n,...e.categories.list]}})}case r.a.DELETE_CATEGORY:return i(i({},e),{},{categories:{grouped:e.categories.grouped.map(e=>i(i({},e),{},{categories:e.categories.filter(e=>e.id!==t.id)})),list:e.categories.list.filter(e=>e.id!==t.id)}})}return e}const d=Object(a.a)(e=>Object(o.groupById)(e)),f=Object(a.a)(e=>Object(o.groupById)(e)),p=Object(a.a)(e=>{let t={};return e.forEach(e=>{e.categories.forEach(e=>{t[e.id]=e})}),t}),y=Object(a.a)((e,t)=>{let n=d(t);return e.filter(e=>{if(e.transfer_acct){let t=n[e.transfer_acct];return null!=t&&!t.closed}return!0})})},310:function(e,t,n){"use strict";function r(){return new Worker(n.p+"static/js/browser-server.06b54be5.worker.js")}n.d(t,"a",function(){return r})},316:function(e,t,n){"use strict";(function(e){var r=n(0),a=n.n(r),o=n(10),l=n(12),i=n(21),c=n(3),s=n(317),u=n(2),d=n(318),f=n(343),p=n(342),y=n(293),m=n(345),g=n(338),h={height:"100%",backgroundColor:"#E8ECF0",overflow:"hidden"};t.a=Object(o.b)(e=>({budgetId:e.prefs.local&&e.prefs.local.id,cloudFileId:e.prefs.local&&e.prefs.local.cloudFileId,loadingText:e.app.loadingText,showingTutorial:null!==e.tutorial.stage}),i)(class extends a.a.Component{constructor(...e){super(...e),this.state={fatalError:null,initializing:!0,hiddenScrollbars:Object(u.b)()}}async init(){const t=await e.Actual.getServerSocket();try{await Object(c.init)(t)}catch(r){if("app-init-failure"===r.type)return void this.setState({initializing:!1,fatalError:r});throw r}await this.props.loadGlobalPrefs();const n=await Object(c.send)("get-last-opened-backup");n&&(await this.props.loadBudget(n),Object(c.send)("get-remote-files").then(e=>{if(e){let t=e.find(e=>e.fileId===this.props.cloudFileId);t&&t.deleted&&this.props.closeBudget()}}))}async componentDidMount(){await Promise.all([Object(s.a)(),this.init()]),this.setState({initializing:!1});let e=()=>{this.state.hiddenScrollbars!==Object(u.b)()&&this.setState({hiddenScrollbars:Object(u.b)()})};window.addEventListener("focus",e),this.cleanup=(()=>window.removeEventListener("focus",e))}componentDidCatch(e,t){window.SentryClient.captureException(e,{extra:t}),this.setState({fatalError:e})}componentDidUpdate(t){this.props.budgetId!==t.budgetId&&e.Actual.updateAppMenu(!!this.props.budgetId)}render(){const e=this.props,t=e.budgetId,n=e.loadingText,r=(e.showingTutorial,this.state),o=r.fatalError,i=r.initializing,c=r.hiddenScrollbars;return a.a.createElement("div",Object.assign({key:c?"hidden-scrollbars":"scrollbars"},Object(l.css)([h,u.c.lightScrollbar])),o?a.a.createElement(a.a.Fragment,null,a.a.createElement(y.a,null),a.a.createElement(d.a,{error:o,buttonText:"Restart app"})):i?a.a.createElement(y.a,{initializing:i,loadingText:n}):t?a.a.createElement(p.a,null):a.a.createElement(a.a.Fragment,null,a.a.createElement(y.a,{initializing:i,loadingText:n}),a.a.createElement(f.a,null)),a.a.createElement(m.a,null),a.a.createElement(g.a,null))}})}).call(this,n(56))},317:function(e,t,n){"use strict";async function r(){if("ResizeObserver"in window===!1){const e=await n.e(2).then(n.bind(null,530));window.ResizeObserver=e.ResizeObserver}}n.d(t,"a",function(){return r})},318:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(1),l=n(2),i={alignItems:"center",justifyContent:"center",height:"100%"},c={paddingBottom:100,maxWidth:500,color:l.a.r4,lineHeight:"1.5em",fontSize:15,"& a":{color:l.a.r4}},s={maxWidth:500},u={color:l.a.p4},d={fontSize:11},f={color:l.a.p4},p={marginTop:5,height:100,overflow:"auto"};t.a=class extends a.a.Component{constructor(...e){super(...e),this.state={showError:!1}}renderSimple(e){let t;return t=e.IDBFailure?a.a.createElement(o.w,null,"Your browser doesn","'","t support IndexedDB in this environment, a feature that Actual requires to run. This might happen if you are in private browsing mode. Please try a different browser or turn off private browsing."):a.a.createElement(o.w,null,"There was a problem loading the app in this browser version. If this continues to be a problem, you can"," ",a.a.createElement("a",{href:"https://actualbudget.com/download"},"download the desktop app"),"."),a.a.createElement(o.y,{style:i},a.a.createElement(o.v,{style:c},a.a.createElement(o.w,null,t),a.a.createElement(o.w,null,"Contact"," ",a.a.createElement("a",{href:"mailto:help@actualbudget.com"},"help@actualbudget.com")," for support")))}render(){const e=this.props,t=e.buttonText,n=e.error,r=this.state.showError;return"app-init-failure"===n.type?this.renderSimple(n):a.a.createElement(o.r,{isCurrent:!0,showClose:!1,title:"Fatal Error"},()=>a.a.createElement(o.y,{style:s},a.a.createElement(o.t,null,"There was an unrecoverable error in the UI. Sorry! This error has been reported and hopefully will be fixed soon."),a.a.createElement(o.t,null,"If you want to talk about what happened or give any feedback, send an email to"," ",a.a.createElement("a",{href:"mailto:help@actualbudget.com",style:u},"help@actualbudget.com"),"."),a.a.createElement(o.t,null,a.a.createElement(o.d,{onClick:()=>window.Actual.relaunch()},t)),a.a.createElement(o.t,{isLast:!0,style:d},a.a.createElement(o.p,{onClick:()=>this.setState({showError:!0}),style:f},"Show Error"),r&&a.a.createElement(o.c,{style:p},n.stack))))}}},321:function(e,t,n){"use strict";n.d(t,"a",function(){return g});var r=n(0),a=n.n(r),o=n(32),l=n(197),i=n(1);function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const p=150,y=(e,t)=>e;function m({onResize:e,children:t}){return t(Object(l.a)(e))}class g extends a.a.PureComponent{constructor(e){super(e),this._outerRef=void 0,this._resetIsScrollingTimeoutId=null,this.setRowAnimation=(e=>{this.animationEnabled=e;let t=this._outerRef;t&&(this.animationEnabled?t.classList.add("animated"):t.classList.remove("animated"))}),this.onHeaderResize=(e=>{}),this.getItemOffset=(e=>e*this.props.itemSize),this.getItemSize=(e=>this.props.itemSize),this.getEstimatedTotalSize=(()=>this.props.itemSize*this.props.itemCount),this.getOffsetForIndexAndAlignment=((e,t,n)=>{const r=this.props.height,a=Math.max(0,this.props.itemCount*this.props.itemSize-r),o=Math.min(a,e*this.props.itemSize),l=Math.max(0,e*this.props.itemSize-r+this.props.itemSize);switch("smart"===t&&(t=n>=l-r&&n<=o+r?"auto":"center"),t){case"start":return o;case"end":return l;case"center":{const e=Math.round(l+(o-l)/2);return e<Math.ceil(r/2)?0:e>a+Math.floor(r/2)?a:e}case"auto":default:return n>=l&&n<=o?n:n<l?l:o}}),this.getStartIndexForOffset=(e=>Math.max(0,Math.min(this.props.itemCount-1,Math.floor(e/this.props.itemSize)))),this.getStopIndexForStartIndex=((e,t)=>{const n=e*this.props.itemSize,r=this.props.width,a=Math.ceil((r+t-n)/this.props.itemSize);return Math.max(0,Math.min(this.props.itemCount-1,e+a-1))}),this._callOnItemsRendered=Object(o.a)((e,t,n,r)=>this.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:r})),this._callOnScroll=Object(o.a)((e,t,n)=>this.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})),this._getItemStyle=(e=>{const t=this.props,n=t.direction,r=t.itemSize,a=t.layout,o=this._getItemStyleCache(r,a,n);let l;if(o.hasOwnProperty(e))l=o[e];else{const t=this.getItemOffset(e),n=this.getItemSize(e);o[e]=l={position:"absolute",left:0,top:t,height:n,width:"100%"}}return l}),this._getItemStyleCache=Object(o.a)((e,t,n)=>({})),this._onScrollVertical=(e=>{let t=e.currentTarget,n=(t.clientHeight,t.scrollHeight,t.scrollTop);this.setState(e=>{if(e.scrollOffset===n)return null;let t=n;return{isScrolling:!0,scrollDirection:e.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!1}},this._resetIsScrollingDebounced)}),this._outerRefSetter=(e=>{const t=this.props.outerRef;this._outerRef=e,"function"===typeof t?t(e):null!=t&&"object"===typeof t&&t.hasOwnProperty("current")&&(t.current=e)}),this._resetIsScrollingDebounced=(()=>{null!==this._resetIsScrollingTimeoutId&&clearTimeout(this._resetIsScrollingTimeoutId),this._resetIsScrollingTimeoutId=setTimeout(this._resetIsScrolling,p)}),this._resetIsScrolling=(()=>{this._resetIsScrollingTimeoutId=null,this.setState({isScrolling:!1},()=>{this._getItemStyleCache(-1,null)})}),this.lastPositions=a.a.createRef(),this.lastPositions.current=new Map,this.needsAnimationRerender=a.a.createRef(),this.needsAnimationRerender.current=!1,this.animationEnabled=!1,this.state={instance:this,isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"===typeof this.props.initialScrollOffset?this.props.initialScrollOffset:0,scrollUpdateWasRequested:!1}}scrollTo(e){e=Math.max(0,e),this.setState(t=>t.scrollOffset===e?null:(this.requestScrollUpdateHandled=!1,{scrollDirection:t.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!0}),this._resetIsScrollingDebounced)}scrollToItem(e,t="auto"){const n=this.props.itemCount,r=this.state.scrollOffset;e=Math.max(0,Math.min(e,n-1)),this.scrollTo(this.getOffsetForIndexAndAlignment(e,t,r))}componentDidMount(){const e=this.props,t=(e.direction,e.initialScrollOffset);e.layout;if("number"===typeof t&&null!=this._outerRef){let e=this._outerRef;(e=this._outerRef).scrollTop=t}this._callPropsCallbacks()}getAnchoredScrollPos(){if(this.anchored&&this.props.indexForKey&&null!=this._outerRef){let e=this.props.indexForKey(this.anchored.key),t=this.getOffsetForIndexAndAlignment(e,"start");this._outerRef;return t+this.anchored.offset}return null}componentDidUpdate(){const e=this.state,t=e.scrollOffset,n=e.scrollUpdateWasRequested;let r=this.getAnchoredScrollPos();if(null!=r){this._outerRef.scrollTop=r}else if(n&&!this.requestScrollUpdateHandled&&null!=this._outerRef){this.requestScrollUpdateHandled=!0,this._outerRef.scrollTop=t}this.needsAnimationRerender.current&&(this.needsAnimationRerender.current=!1,this.rerenderTimeout=setTimeout(()=>{this.forceUpdate()},10)),this._callPropsCallbacks()}componentWillUnmount(){null!==this._resetIsScrollingTimeoutId&&clearTimeout(this._resetIsScrollingTimeoutId)}render(){const e=this.props,t=e.className,n=e.height,r=e.header,o=e.innerRef,l=e.innerElementType,c=e.innerTagName,u=e.itemCount,f=e.renderRow,p=e.itemKey,g=void 0===p?y:p,h=e.outerElementType,b=e.outerTagName,O=e.style,w=e.useIsScrolling,E=e.width,v=(e.version,this.state.isScrolling),j=d(this._getRangeToRender(),2),S=j[0],x=j[1],C=new Map,k=[];if(u>0)for(let a=S;a<=x;a++){let e=g(a),t=this._getItemStyle(a),n=this.lastPositions.current.get(e),r=!1;C.set(e,t.top),this.animationEnabled&&null!=n&&n!==t.top&&(t=s(s({},t),{},{top:n}),this.needsAnimationRerender.current=!0,r=!0),k.push(f({index:a,key:e,style:t,isScrolling:w?v:void 0,isAnimating:r}))}this.lastPositions.current=C;let P=this.getEstimatedTotalSize(),A=h||b||"div",I=l||c||"div";var D=s({height:n,width:E,overflow:"auto"},O),T={position:"relative",height:P,width:"100%",pointerEvents:v?"none":void 0};return a.a.createElement(m,{onResize:this.onHeaderResize},e=>a.a.createElement(A,{className:t,onScroll:this._onScrollVertical,ref:this._outerRefSetter,style:D},a.a.createElement(i.y,{innerRef:e},r),a.a.createElement(I,{ref:o,style:T},k)))}anchor(){let e=this.props.itemKey||y,t=this._outerRef,n=t?t.scrollTop:0,r=this.getStartIndexForOffset(n),a=e(r);this.anchored={key:a,offset:n-this.getItemOffset(r)}}unanchor(){this.anchored=null}isAnchored(){return null!=this.anchored}_callPropsCallbacks(){if("function"===typeof this.props.onItemsRendered){if(this.props.itemCount>0){const e=d(this._getRangeToRender(),4),t=e[0],n=e[1],r=e[2],a=e[3];this._callOnItemsRendered(t,n,r,a)}}if("function"===typeof this.props.onScroll){const e=this.state,t=e.scrollDirection,n=e.scrollOffset,r=e.scrollUpdateWasRequested;this._callOnScroll(t,n,r)}}_getRangeToRender(){let e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,a=r.isScrolling,o=r.scrollDirection,l=r.scrollOffset,i=this.getAnchoredScrollPos();if(null!=i&&(l=i),0===t)return[0,0,0,0];const c=this.getStartIndexForOffset(l),s=this.getStopIndexForStartIndex(c,l),u=a&&"backward"!==o?1:Math.max(1,n),d=a&&"forward"!==o?1:Math.max(1,n);return[Math.max(0,c-u),Math.max(0,Math.min(t-1,s+d)),c,s]}}g.defaultProps={direction:"ltr",renderRow:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1,headerHeight:0}},323:function(e,t,n){e.exports=n.p+"static/media/DateSelect.left.1ae92674.png"},324:function(e,t,n){e.exports=n.p+"static/media/DateSelect.right.2a470dc0.png"},326:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return o});var r=n(3),a=n(43);function o(t,n,o){Object(r.send)("get-upgrade-notifications").then(n=>{n.forEach(n=>{switch(n){case"schedules":{let n="Track bills and subscriptions and much more with scheduled transactions. We can search all your existing transactions and try to find existing schedules.\n\n"+(e.IS_BETA?"NOTE: You are using the beta version, and this will not reset your sync data. This is safe to do.":"");"mobile"===a.a.env&&(n="Track bills and subscriptions and much more with scheduled transactions. Upcoming transactions will be shown in the accounts screen. Use the desktop app to create schedules."),t({type:"message",title:"Scheduled transactions are now available!",message:n,sticky:!0,id:"find-schedules",button:"mobile"!==a.a.env&&{title:"Find schedules",action:async()=>{__history&&__history.push("/schedule/discover",{locationPtr:__history.location})}},onClose:()=>{Object(r.send)("seen-upgrade-notification",{type:"schedules"})}});break}case"repair-splits":o&&t({type:"message",title:"Split transactions now support transfers & payees",message:"The payee field is now available on split transactions, allowing you to perform transfers on individual split transactions.\n\nAll existing split transactions have a blank payee and we recommend using the tool below to set the payee from the parent. [View a video walkthrough](https://actualbudget.com/blog/split-transactions-transfer)",sticky:!0,id:"repair-splits",button:{title:"Repair splits...",action:()=>o.push("/tools/fix-splits",{locationPtr:o.location})},onClose:()=>{Object(r.send)("seen-upgrade-notification",{type:"repair-splits"})}})}})})}}).call(this,n(56))},33:function(e,t,n){"use strict";n.d(t,"b",function(){return r}),n.d(t,"a",function(){return l});const r={ESC:27,TAB:9,ENTER:13,SHIFT:16,ALT:18,META:91,CTRL:17,SPACE:32,UP:38,DOWN:40,J:74,K:75,X:88};let a={},o={shift:!1,ctrl:!1,alt:!1,meta:!1};function l(e){return!!o[e]}document.addEventListener("keydown",e=>{if(e.keyCode===r.SHIFT&&(o.shift=!0),e.keyCode===r.CTRL&&(o.ctrl=!0),e.keyCode===r.ALT&&(o.alt=!0),e.keyCode===r.META&&(o.meta=!0),!e.target||!e.target.matches("input")){let t=a[e.key.toUpperCase()];t&&t.length>0&&(t[t.length-1](o),e.preventDefault(),e.stopPropagation())}}),document.addEventListener("keyup",e=>{e.keyCode===r.SHIFT&&(o.shift=!1),e.keyCode===r.CTRL&&(o.ctrl=!1),e.keyCode===r.ALT&&(o.alt=!1),e.keyCode===r.META&&(o.meta=!1)})},337:function(e,t,n){e.exports=n.p+"static/media/bg.ad9dce3b.svg"},338:function(e,t,n){"use strict";n.d(t,"a",function(){return y});var r=n(0),a=n.n(r),o=n(1),l=n(2);function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let s={border:0,fontSize:15,padding:"10px 13px"};var u={position:"absolute",bottom:0,left:0,right:0,backgroundColor:l.a.n1,color:"white",padding:10,margin:10,borderRadius:6,zIndex:1e4,fontSize:15,boxShadow:l.c.shadowLarge},d={lineHeight:"1.5em"},f={marginTop:20,flexDirection:"row",justifyContent:"flex-end"},p={marginLeft:10};function y(){let e=function(){var e=window.navigator.userAgent,t=!!e.match(/iPad/i)||!!e.match(/iPhone/i),n=!!e.match(/WebKit/i);return t&&n&&!e.match(/CriOS/i)}()?"https://itunes.apple.com/us/app/actual-budget-your-finances/id1444818585":"https://play.google.com/store/apps/details?id=com.shiftreset.actual",t=i(Object(r.useState)(window.innerWidth<600&&!document.cookie.match(/hideMobileMessage=true/)),2),n=t[0],l=t[1];return n?a.a.createElement(o.y,{style:u},a.a.createElement(o.w,{style:d},a.a.createElement("strong",null,"It looks like you are using a mobile device.")," This app is built for desktop, but you can try it anyway. For the best mobile experience, download the app."),a.a.createElement(o.y,{style:f},a.a.createElement(o.d,{style:s,onClick:function(){l(!1);let e=new Date;e.setTime(e.getTime()+3e5),document.cookie="hideMobileMessage=true;path=/;expires="+e.toGMTString()}},"Try it anyway"),a.a.createElement(o.h,{bare:!1,href:e,style:[s,p]},"Download app"))):null}},339:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return l});var r=n(3),a=n(60),o=n(340);function l(t,n){e.Actual.onEventFromMain("update-downloaded",(e,n)=>{t.setAppState({updateInfo:n})}),e.Actual.onEventFromMain("update-error",e=>{}),Object(r.listen)("server-error",e=>{t.addGenericErrorNotification()}),Object(r.listen)("update-loading-status",e=>{switch(e){case"updating":t.updateStatusText("Updating...")}}),Object(r.listen)("orphaned-payees",({orphanedIds:e,updatedPayeeIds:n})=>{t.pushModal("merge-unused-payees",{payeeIds:e,targetPayeeId:n[0]})}),Object(r.listen)("schedules-offline",({payees:e})=>{let t=window.__history;t&&t.push("/schedule/posts-offline-notification",{locationPtr:t.location,payees:e})}),Object(r.listen)("sync-event",async({type:e,tables:r})=>{let a=n.getState().prefs.local;a&&a.id&&"applied"===e&&(r.includes("payees")||r.includes("payee_mapping"))&&t.getPayees()}),Object(r.listen)("sync-event",async({type:e})=>{"unauthorized"===e&&t.addNotification({type:"warning",message:"Unable to authenticate with server",sticky:!0,id:"auth-issue"})}),o.a(t,n),Object(r.listen)("undo-event",e=>{e.messages;let r=e.tables,o=e.undoTag,l=[];(r.includes("categories")||r.includes("category_groups")||r.includes("category_mapping"))&&l.push(t.getCategories()),r.includes("accounts")&&l.push(t.getAccounts());let i=a.getTaggedState(o);i&&Promise.all(l).then(()=>{if(t.setLastUndoState(e),i.openModal){let e=n.getState().modals.modalStack;0!==e.length&&e[e.length-1].name===i.openModal||t.replaceModal(i.openModal)}else if(t.closeModal(),window.location.href!==i.url)return window.location.href=i.url,!0})}),Object(r.listen)("fallback-write-error",()=>{t.addNotification({type:"error",title:"Unable to save changes",sticky:!0,message:"This browser only supports using the app in one tab at a time, and another tab has opened the app. No changes will be saved from this tab; please close it and continue working in the other one."})}),Object(r.listen)("start-load",()=>{t.closeBudgetUI(),t.setAppState({loadingText:""})}),Object(r.listen)("finish-load",()=>{t.closeModal(),t.setAppState({loadingText:null}),t.loadPrefs()}),Object(r.listen)("start-import",()=>{t.closeBudgetUI(),t.setAppState({loadingText:"Importing..."})}),Object(r.listen)("finish-import",()=>{t.closeModal(),t.setAppState({loadingText:null}),t.loadPrefs()}),Object(r.listen)("show-budgets",()=>{t.closeBudgetUI(),t.setAppState({loadingText:null})})}}).call(this,n(56))},34:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return d});var r=n(0),a=n(68),o=n(65);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(t,n){if(!t)throw new Error("SheetValue binding is required");if(e.IS_TESTING&&"string"!==typeof t&&!t.name&&(t=s(s({},t),{},{name:t.value.toString()})),null==(t="string"===typeof t?{name:t,value:null}:t).name)throw new Error("Binding name is now required");let i=Object(r.useContext)(a.a)||"__global",c=function(e){let t=e.indexOf("!");return-1!==t?{sheet:e.slice(0,t),name:e.slice(t+1)}:{sheet:null,name:e}}(t.name);c.sheet&&(i=c.sheet,t=s(s({},t),{},{name:c.name}));let u=Object(r.useContext)(o.a),d=l(Object(r.useState)({name:i+"!"+t.name,value:t.value,query:t.query}),2),f=d[0],p=d[1],y=Object(r.useRef)(n),m=Object(r.useRef)(f.value);return Object(r.useLayoutEffect)(()=>{y.current=n,m.current=f.value}),Object(r.useLayoutEffect)(()=>(t.query&&u.createQuery(i,t.name,t.query),u.bind(i,t,null,e=>{y.current&&y.current(e),e.value!==m.current&&p(e)})),[i,t.name]),f.value}}).call(this,n(56))},340:function(e,t,n){"use strict";n.d(t,"a",function(){return l});var r=n(3);function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){let n=!1;Object(r.listen)("sync-event",l=>{let i=l.type,c=l.subtype,s=l.meta,u=l.tables,d=t.getState().prefs.local;if(d&&d.id)if("success"===i)n&&(n=!1,e.addNotification({title:"Syncing has been fixed!",message:"Happy budgeting!",type:"message"})),u.includes("prefs")&&e.loadPrefs(),(u.includes("categories")||u.includes("category_groups")||u.includes("category_mapping"))&&e.getCategories(),(u.includes("payees")||u.includes("payee_mapping"))&&e.getPayees(),u.includes("accounts")&&e.getAccounts();else if("error"===i){let l=null,i="[Learn more](https://actualbudget.com/docs/overview/syncing-across-devices/#debugging-sync-issues)";switch(c){case"out-of-sync":l=n?{title:"Your data is still out of sync",message:"We were unable to repair your sync state, sorry! You need to reset your sync state. "+i,sticky:!0,id:"reset-sync",button:{title:"Reset sync",action:e.resetSync}}:{title:"Your data is out of sync",message:"There was a problem syncing your data. We can try to repair your sync state to fix it. "+i,type:"warning",sticky:!0,id:"repair-sync",button:{title:"Repair",action:async()=>{n=!0,await Object(r.send)("sync-repair"),e.sync()}}};break;case"file-old-version":l={title:"Actual has updated the syncing format",message:"This happens rarely (if ever again). The internal syncing format has changed and you need to reset sync. This will upload data from this device and revert all other devices. [Learn more about what this means](https://actualbudget.com/docs/overview/syncing-across-devices/#what-does-resetting-sync-mean).\n\nOld encryption keys are not migrated. If using encryption, [reset encryption here](#makeKey).",messageActions:{makeKey:()=>e.pushModal("create-encryption-key")},sticky:!0,id:"old-file",button:{title:"Reset sync",action:e.resetSync}};break;case"file-key-mismatch":l={title:"Your encryption key need to be reset",message:"Something went wrong when registering your encryption key id. You need to recreate your key. "+i,sticky:!0,id:"invalid-key-state",button:{title:"Reset key",action:()=>e.pushModal("create-encryption-key")}};break;case"file-not-found":l={title:"This file is not a cloud file",message:"You need to register it to take advantage of syncing which allows you to use it across devices and never worry about losing your data. "+i,type:"warning",sticky:!0,id:"register-file",button:{title:"Register",action:async()=>{await e.uploadBudget(),e.sync(),e.loadPrefs()}}};break;case"file-needs-upload":l={title:"File needs upload",message:"Something went wrong when creating this cloud file. You need to upload this file to fix it. "+i,sticky:!0,id:"upload-file",button:{title:"Upload",action:e.resetSync}};break;case"file-has-reset":case"file-has-new-key":let a=t.getState().prefs.local,o=(a.groupId,a.cloudFileId);l={title:"Syncing has been reset on this cloud file",message:"You need to revert it to continue syncing. Any unsynced data will be lost. If you like, you can instead [upload this file](#upload) to be the latest version. "+i,messageActions:{upload:e.resetSync},sticky:!0,id:"needs-revert",button:{title:"Revert",action:()=>e.closeAndDownloadBudget(o)}};break;case"encrypt-failure":case"decrypt-failure":l=s.isMissingKey?{title:"Missing encryption key",message:"Unable to encrypt your data because you are missing the key. Create your key to sync your data.",sticky:!0,id:"encrypt-failure-missing",button:{title:"Create key",action:()=>e.pushModal("fix-encryption-key",{onSuccess:()=>e.sync()})}}:{message:"Unable to encrypt your data. You have the correct key so this is likely an internal failure. To fix this, reset your sync data with a new key.",sticky:!0,id:"encrypt-failure",button:{title:"Reset key",action:()=>e.pushModal("create-encryption-key",{onSuccess:()=>e.sync()})}};break;case"invalid-schema":l={title:"Update required",message:"We couldn't apply changes from the server. This probably means you need to update the app to support the latest database.",type:"warning"};break;case"apply-failure":l={message:"We couldn't apply that change to the database. This is a bug, and it has been reported."};break;case"beta-version":case"network":break;default:l={message:"We had problems syncing your changes. This is a bug, and it has been reported."}}l&&e.addNotification(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({type:"error"},l))}})}},342:function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"BudgetSummary",function(){return Gy}),n.d(r,"BudgetTotalsMonth",function(){return cm}),n.d(r,"IncomeHeaderMonth",function(){return dm}),n.d(r,"ExpenseGroupMonth",function(){return gm}),n.d(r,"ExpenseCategoryMonth",function(){return Sm}),n.d(r,"IncomeGroupMonth",function(){return km}),n.d(r,"IncomeCategoryMonth",function(){return Tm});var a={};n.r(a),n.d(a,"BudgetSummary",function(){return gg}),n.d(a,"BudgetTotalsMonth",function(){return xg}),n.d(a,"IncomeHeaderMonth",function(){return Ag}),n.d(a,"GroupMonth",function(){return Rg}),n.d(a,"CategoryMonth",function(){return Gg}),n.d(a,"ExpenseGroupMonth",function(){return Hg}),n.d(a,"ExpenseCategoryMonth",function(){return qg}),n.d(a,"IncomeGroupMonth",function(){return Yg}),n.d(a,"IncomeCategoryMonth",function(){return Kg});var o=n(0),l=n.n(o),i=n(29),c=n(61),s=n(10),u=n(551),d=n(344),f=n(131),p=n(21),y=n(325),m=n.n(y),g=n(65),h=n(3);function b({children:e}){let t=Object(o.useMemo)(()=>(function(){const e={},t=new m.a({max:1200}),n={};let r=!1;return new class{observeCell(t,r){return e[t]||(e[t]=[]),e[t].push(r),()=>{e[t]=e[t].filter(e=>e!==r),0===e[t].length&&(n[t]=null)}}disableObservers(){r=!0}enableObservers(){r=!1}prewarmCache(e,n){t.set(e,n)}listen(){return Object(h.listen)("cells-changed",function(a){r||a.forEach(r=>{const a=e[r.name];a&&(a.forEach(e=>e(r)),n[r.name]=Promise.resolve(r),t.set(r.name,r))})})}bind(e="__global",r,a,o){let l=`${e}!${(r="string"===typeof r?{name:r,value:null}:r).name}`,i=this.observeCell(l,o);if(t.has(l)&&o(t.get(l)),null!=n[l])n[l].then(o);else{const i=this.get(e,r.name,a);n[l]=i,i.then(e=>{n[l]===i&&(t.set(l,e),o(e))})}return i}get(e,t){return Object(h.send)("getCell",{sheetName:e,name:t})}getCellNames(e){return Object(h.send)("getCellNamesInSheet",{sheetName:e})}createQuery(e,t,n){return Object(h.send)("create-query",{sheetName:e,name:t,query:n.serialize()})}}})(),[]);return Object(o.useEffect)(()=>t.listen(),[t]),o.createElement(g.a.Provider,{value:t},e)}var O=n(326),w=n(2),E=n(1),v=n(249),j=n(12);function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach(function(t){C(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var k=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:x({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M10 3v2a5 5 0 0 0-3.54 8.54l-1.41 1.41A7 7 0 0 1 10 3zm4.95 2.05A7 7 0 0 1 10 17v-2a5 5 0 0 0 3.54-8.54l1.41-1.41zM10 20l-4-4 4-4v8zm0-12V0l4 4-4 4z",fill:"currentColor"}));function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?P(Object(n),!0).forEach(function(t){I(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):P(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let D=j.css.keyframes({"0%":{transform:"rotateZ(0deg)"},"100%":{transform:"rotateZ(360deg)"}});j.css.keyframes({"0%":{transform:"rotateZ(0deg)"},"100%":{transform:"rotateZ(180deg)"}});function T({animating:e,iconStyle:t}){return l.a.createElement(E.y,{style:[{animation:e?`${D} 1s infinite linear`:null}]},l.a.createElement(k,{width:14,height:14,style:A({color:"currentColor"},t)}))}var M={position:"absolute",top:0,left:0,right:0,marginTop:5,alignItems:"center",zIndex:501},R={borderRadius:4,backgroundColor:w.a.b9,color:w.a.b1,padding:"5px 13px",flexDirection:"row",alignItems:"center",boxShadow:w.c.shadow},B={color:w.a.b1};var _=Object(s.b)(e=>({accountsSyncing:e.account.accountsSyncing}),p)(function({accountsSyncing:e}){let t=e?"__all"===e?"accounts":e:null;const n=Object(v.b)(t,null,{from:{opacity:0,transform:"translateY(-100px)"},enter:{opacity:1,transform:"translateY(0)"},leave:{opacity:0,transform:"translateY(-100px)"},unique:!0});return l.a.createElement(E.y,{style:M},n.map(({item:e,key:t,props:n})=>e&&l.a.createElement(v.a.div,{key:t,style:n},l.a.createElement(E.y,{style:R},l.a.createElement(T,{animating:!0,iconStyle:B}),l.a.createElement(E.w,null,"Syncing ",e)))))}),L=n(202);function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let U=l.a.createContext();function z({children:e}){let t=N(Object(o.useState)(1),2),n=t[0],r=t[1];Object(L.a)();return l.a.createElement(U.Provider,{value:{displayMax:n,setDisplayMax:r}},e)}function $(){return Object(o.useContext)(U)}var W=n(60);let G=l.a.createContext({type:"page"});function H({type:e,current:t,children:n}){return l.a.createElement(G.Provider,{value:{type:e,current:t}},n)}function q(){return l.a.useContext(G)}var Y={fontSize:25,fontWeight:500,marginBottom:15};function K({name:e}){return l.a.createElement(E.w,{style:Y},e)}var V={paddingLeft:20,paddingRight:20,flex:1};function Q({title:e,modalSize:t,children:n}){let r=q(),a=r.type,o=r.current,c=Object(i.g)();if("modal"===a){let r=t;return"string"===typeof t&&(r="medium"===t?{width:750,height:600}:{width:600}),l.a.createElement(E.r,{title:e,isCurrent:o,size:r,onClose:()=>c.goBack()},n)}return l.a.createElement(E.y,{style:[w.c.page,V]},l.a.createElement(K,{name:e}),n)}function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach(function(t){J(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let ee=Date.now();function te(e,t){return e.state&&e.state._version===ee?t?e.state[t]:e.state:null}let ne=l.a.createContext(null);function re({location:e,children:t}){return l.a.createElement(ne.Provider,{value:e,children:t})}var ae=n(16),oe=n(31);function le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ie(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ie(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ie(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let ce=l.a.createContext(null);function se({children:e}){let t=function(){let e=le(Object(o.useState)(null),2),t=e[0],n=e[1];return Object(o.useEffect)(()=>{let e=Object(ae.d)(Object(ae.c)("payees").select("*"),async t=>{e&&n(t)});return()=>{e.unsubscribe(),e=null}},[]),t}();return l.a.createElement(ce.Provider,{value:t,children:e})}function ue({children:e,idKey:t}){return e(de({idKey:t}))}function de({idKey:e}={}){let t=Object(o.useContext)(ce);return e&&t?Object(oe.e)(t):t}function fe(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return pe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pe(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let ye=l.a.createContext(null);function me({children:e}){let t=function(){let e=fe(Object(o.useState)(null),2),t=e[0],n=e[1];return Object(o.useEffect)(()=>{let e=Object(ae.d)(Object(ae.c)("accounts").select("*"),async t=>{e&&n(t)});return()=>{e.unsubscribe(),e=null}},[]),t}();return l.a.createElement(ye.Provider,{value:t,children:e})}function ge({children:e,idKey:t}){return e(he({idKey:t}))}function he({idKey:e}={}){let t=Object(o.useContext)(ye);return e&&t?Object(oe.b)(t):t}var be=n(554),Oe=n(416),we=n(9),Ee=n(8),ve=n(71);function je(e,t="account"){return e?"budgeted"===e?{[`${t}.offbudget`]:!1,[`${t}.closed`]:!1}:"offbudget"===e?{[`${t}.offbudget`]:!0,[`${t}.closed`]:!1}:"uncategorized"===e?{[`${t}.offbudget`]:!1,category:null,is_parent:!1,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]}:{[t]:e}:null}function Se(e){return{name:`balance-${e.id}`,query:Object(ve.a)("transactions").filter({account:e.id}).options({splits:"none"}).calculate({$sum:"$amount"})}}function xe(){return{name:"budgeted-accounts-balance",query:Object(ve.a)("transactions").filter({"account.offbudget":!1,"account.closed":!1}).calculate({$sum:"$amount"})}}function Ce(){return{name:"offbudget-accounts-balance",query:Object(ve.a)("transactions").filter({"account.offbudget":!0,"account.closed":!1}).calculate({$sum:"$amount"})}}let ke=Object(ve.a)("transactions").filter({"account.offbudget":!1,category:null,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]});const Pe={incomeAvailable:"available-funds",lastMonthOverspent:"last-month-overspent",forNextMonth:"buffered",totalBudgeted:"total-budgeted",toBudget:"to-budget",fromLastMonth:"from-last-month",totalIncome:"total-income",totalSpent:"total-spent",totalBalance:"total-leftover",groupSumAmount:e=>`group-sum-amount-${e}`,groupIncomeReceived:"total-income",groupBudgeted:e=>`group-budget-${e}`,groupBalance:e=>`group-leftover-${e}`,catBudgeted:e=>`budget-${e}`,catSumAmount:e=>`sum-amount-${e}`,catBalance:e=>`leftover-${e}`,catCarryover:e=>`carryover-${e}`},Ae={totalBudgetedExpense:"total-budgeted",totalBudgetedIncome:"total-budget-income",totalBudgetedSaved:"total-saved",totalIncome:"total-income",totalSpent:"total-spent",totalSaved:"real-saved",totalLeftover:"total-leftover",groupSumAmount:e=>`group-sum-amount-${e}`,groupIncomeReceived:"total-income",groupBudgeted:e=>`group-budget-${e}`,groupBalance:e=>`group-leftover-${e}`,catBudgeted:e=>`budget-${e}`,catSumAmount:e=>`sum-amount-${e}`,catBalance:e=>`leftover-${e}`,catCarryover:e=>`carryover-${e}`};var Ie=n(43),De=n(93);function Te(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Me(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Te(Object(n),!0).forEach(function(t){Re(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Te(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Re(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Be=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Me({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M21.5 3h-2.75a.25.25 0 0 1-.25-.25V1a1 1 0 0 0-2 0v4.75a.75.75 0 0 1-.75.75.75.75 0 0 1-.75-.75V3.5a.5.5 0 0 0-.5-.5H8.25A.25.25 0 0 1 8 2.751V1a1 1 0 1 0-2 0v4.75a.75.75 0 0 1-.75.75.75.75 0 0 1-.75-.75V3.5A.5.5 0 0 0 4 3H2.5a2 2 0 0 0-2 2v17a2 2 0 0 0 2 2h19a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zM21 22H3a.5.5 0 0 1-.5-.5v-12A.5.5 0 0 1 3 9h18a.5.5 0 0 1 .5.5v12a.5.5 0 0 1-.5.5z",fill:"currentColor"}));function _e({color:e,onClick:t}){return l.a.createElement(Be,{style:{width:13,height:13,color:e,marginRight:5},onClick:t})}var Le={flexDirection:"row",marginRight:20,marginTop:-1,"& svg":{transition:"transform .15s"},"& svg:hover":{transform:"scale(1.2)"}};function Ne({maxMonths:e,onChange:t}){let n=$().displayMax;w.a.n8,w.a.n5;if(n<=1)return null;let r=[];for(let a=1;a<=n;a++)r.push(l.a.createElement(_e,{key:a,color:e>=a?w.a.n5:w.a.n8,onClick:()=>t(a)}));return l.a.createElement(E.y,{style:Le,title:"Choose the number of months shown at a time"},r)}function Fe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fe(Object(n),!0).forEach(function(t){ze(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ze(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $e=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Ue({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M13.584 12a2.643 2.643 0 0 1-.775 1.875l-9.541 9.541a1.768 1.768 0 0 1-2.5-2.5l8.739-8.739a.25.25 0 0 0 0-.354L.768 3.084a1.768 1.768 0 0 1 2.5-2.5l9.541 9.541A2.643 2.643 0 0 1 13.584 12z",fill:"currentColor"}),l.a.createElement("path",{d:"M23.75 12a2.643 2.643 0 0 1-.775 1.875l-9.541 9.541a1.768 1.768 0 0 1-2.5-2.5l8.739-8.739a.25.25 0 0 0 0-.354l-8.739-8.739a1.768 1.768 0 0 1 2.5-2.5l9.541 9.541A2.643 2.643 0 0 1 23.75 12z",fill:"currentColor"}));function We(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ge(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?We(Object(n),!0).forEach(function(t){He(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):We(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function He(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qe=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Ge({color:"#242134"},e.style)}),l.a.createElement("rect",{x:.5,y:2.5,width:23,height:3,rx:1,ry:1,fill:"currentColor"}),l.a.createElement("rect",{x:.5,y:10.5,width:23,height:3,rx:1,ry:1,fill:"currentColor"}),l.a.createElement("rect",{x:.5,y:18.5,width:23,height:3,rx:1,ry:1,fill:"currentColor"}));function Ye(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ke(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ye(Object(n),!0).forEach(function(t){Ve(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ye(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ve(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qe=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Ke({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M3.828 9l6.071-6.071-1.414-1.414L0 10l.707.707 7.778 7.778 1.414-1.414L3.828 11H20V9H3.828z",fill:"currentColor"}));function Ze(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(n),!0).forEach(function(t){Je(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ze(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Je(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var et=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Xe({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M23.119 20L13.772 2.15a2 2 0 0 0-3.543 0L.881 20a2 2 0 0 0 1.772 2.928h18.694A2 2 0 0 0 23.119 20zM11 8.423a1 1 0 0 1 2 0v6a1 1 0 1 1-2 0zm1.05 11.51h-.028a1.528 1.528 0 0 1-1.522-1.47 1.476 1.476 0 0 1 1.448-1.53h.028A1.527 1.527 0 0 1 13.5 18.4a1.475 1.475 0 0 1-1.45 1.533z",fill:"currentColor"}));function tt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function nt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tt(Object(n),!0).forEach(function(t){rt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function rt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var at=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:nt({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 5h2v6H9V5zm0 8h2v2H9v-2z",fill:"currentColor"}));function ot(e,t,{onSuccess:n,onClose:r}){e("plaid-external-msg",{onMoveExternal:async()=>{let e=await Object(h.send)("create-web-token"),n="http://link.actualbudget.com/?token="+e;t&&(n=n+"&plaidToken="+t),window.Actual.openURLInBrowser(n);let r=await Object(h.send)("poll-web-token",{token:e});return{error:r.error,data:r.data}},onClose:r,onSuccess:n})}async function lt(e,{upgradingId:t}={}){ot(e,null,{onSuccess:async n=>{e("select-linked-accounts",{institution:n.metadata.institution,publicToken:n.publicToken,accounts:n.metadata.accounts,upgradingId:t})}})}function it(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ct(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ct(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var st={flexDirection:"row",alignItems:"center",color:w.a.r5,backgroundColor:w.a.r10,padding:"4px 8px",borderRadius:4},ut={width:14,height:14,marginRight:5,color:"currentColor"},dt={fontSize:14,padding:15,maxWidth:400},ft={marginBottom:"1.15em"},pt={marginBottom:"1.25em",color:w.a.r5},yt={justifyContent:"flex-end",flexDirection:"row"},mt={marginLeft:5};var gt=Object(s.b)(e=>({accounts:e.queries.accounts,failedAccounts:e.account.failedAccounts}),p)(function({id:e,accounts:t,failedAccounts:n,syncAndDownload:r,markAccountSuccess:a,unlinkAccount:i,pushModal:c,closeModal:s,getAccounts:u,addNotification:d}){if(!n)return null;let f=n.get(e);if(!f)return null;let p=it(Object(o.useState)(!1),2),y=p[0],m=p[1],g=t.find(t=>t.id===e),b=f.type,O=f.code,w="ITEM_ERROR"===b&&"ITEM_LOGIN_REQUIRED"===O||"INVALID_INPUT"===b&&"INVALID_ACCESS_TOKEN"===O;async function v(){i(g.id),m(!1)}return l.a.createElement(E.y,null,l.a.createElement(E.d,{bare:!0,style:st,onClick:()=>m(!0)},l.a.createElement(at,{style:ut})," ","This account is experiencing connection problems. Let","'","s fix it."),y&&l.a.createElement(E.x,{position:"bottom-left",onClose:()=>m(!1),style:dt},l.a.createElement("div",{style:ft},"The server returned the following error:"),l.a.createElement("div",{style:pt},function(e,t){switch(e.toUpperCase()){case"ITEM_ERROR":switch(t.toUpperCase()){case"NO_ACCOUNTS":return"No open accounts could be found. Did you close the account? If so, unlink the account.";case"ITEM_LOGIN_REQUIRED":return"Your password or something else has changed with your bank and you need to login again."}break;case"INVALID_INPUT":switch(t.toUpperCase()){case"INVALID_ACCESS_TOKEN":return"Item is no longer authorized. You need to login again."}break;case"API_ERROR":switch(t.toUpperCase()){case"PLANNED_MAINTENANCE":return"Our servers are currently undergoing maintenance and will be available again soon."}break;case"RATE_LIMIT_EXCEEDED":return"Rate limit exceeded for this item. Please try again later."}return"An internal error occurred. Try to login again, or contact help@actualbudget.com for support."}(f.type,f.code)),l.a.createElement(E.y,{style:yt},w?l.a.createElement(l.a.Fragment,null,l.a.createElement(E.d,{onClick:v},"Unlink"),l.a.createElement(E.d,{primary:!0,onClick:function(){m(!1),async function(e,t,n){let r=await Object(h.send)("make-plaid-public-token",{bankId:t}),a=(r.error,r.linkToken);return!!a&&(ot(e,a,{onSuccess:n,onClose:n}),!0)}(c,g.bankId,()=>{s(),r(n.size>1?null:g.id)})||d({type:"error",message:"Unable to process this item, sorry!"})},style:mt},"Reauthorize")):l.a.createElement(E.d,{onClick:v},"Unlink account"))))}),ht=n(194),bt=n(41),Ot=n(57),wt=n(30),Et=n(127);var vt=function({binding:e,type:t,formatter:n,style:r,getStyle:a,debug:o}){return l.a.createElement(De.a,{binding:e,debug:o},({name:e,value:o})=>l.a.createElement(Et.a,{style:["financial"===t&&w.c.tnum,r,a&&a(o)],numberOfLines:1,"data-testid":e,"data-cellname":e},n?n(o):Object(wt.a)(o,t)))};function jt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function St(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?jt(Object(n),!0).forEach(function(t){xt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):jt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function xt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ct=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:St({color:"#242134"},e.style)}),l.a.createElement("path",{fill:"currentColor",className:"path",d:"M23 11.5a1.5 1.5 0 0 1-1.5 1.5h-20a1.5 1.5 0 0 1 0-3h20a1.5 1.5 0 0 1 1.5 1.5z"}),l.a.createElement("path",{fill:"currentColor",className:"path",d:"M11.5 23a1.5 1.5 0 0 1-1.5-1.5v-20a1.5 1.5 0 0 1 3 0v20a1.5 1.5 0 0 1-1.5 1.5z"}));function kt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?kt(Object(n),!0).forEach(function(t){At(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):kt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function At(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var It=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Pt({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M0 4c0-1.1.9-2 2-2h15a1 1 0 0 1 1 1v1H2v1h17a1 1 0 0 1 1 1v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm16.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z",fill:"currentColor"}));function Dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Dt(Object(n),!0).forEach(function(t){Mt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Rt=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Tt({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M19 18h-1v-8c0-.6-.4-1-1-1s-1 .4-1 1v8h-3V1c0-.6-.4-1-1-1s-1 .4-1 1v17H8V7c0-.6-.4-1-1-1s-1 .4-1 1v11H3V3c0-.6-.4-1-1-1s-1 .4-1 1v15c-.6 0-1 .4-1 1s.4 1 1 1h18c.6 0 1-.4 1-1s-.4-1-1-1z",fill:"currentColor"}));function Bt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _t(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bt(Object(n),!0).forEach(function(t){Lt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Nt=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:_t({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M10.416 12a2.643 2.643 0 0 1 .775-1.875L20.732.584a1.768 1.768 0 0 1 2.5 2.5l-8.739 8.739a.25.25 0 0 0 0 .354l8.739 8.739a1.768 1.768 0 0 1-2.5 2.5l-9.541-9.541A2.643 2.643 0 0 1 10.416 12z",fill:"currentColor"}),l.a.createElement("path",{d:"M.25 12a2.643 2.643 0 0 1 .775-1.875L10.566.584a1.768 1.768 0 0 1 2.5 2.5l-8.739 8.739a.25.25 0 0 0 0 .354l8.739 8.739a1.768 1.768 0 0 1-2.5 2.5l-9.541-9.541A2.643 2.643 0 0 1 .25 12z",fill:"currentColor"}));function Ft(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ut(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ft(Object(n),!0).forEach(function(t){zt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ft(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $t=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Ut({color:"#242134"},e.style)}),l.a.createElement("g",{clipPath:"url(#piggy-bank_svg__clip0)"},l.a.createElement("path",{d:"M1.857 7.612H.98a.98.98 0 0 0-.98.98v2.224c0 .449.184.857.51 1.163.612.551 1.816 1.49 3.735 2.368a.571.571 0 0 1 .306.346l.939 3.286a.484.484 0 0 0 .469.347h1.47a.479.479 0 0 0 .469-.367l.47-1.817a.262.262 0 0 1 .326-.183c.571.122 1.183.163 1.795.163.613 0 1.225-.061 1.796-.163.143-.02.286.06.327.183l.47 1.817a.502.502 0 0 0 .468.367h1.47a.484.484 0 0 0 .47-.347l1.224-4.245a.487.487 0 0 1 .122-.224c.919-.98 1.53-2.163 1.735-3.47h.49c.53 0 .959-.448.938-.979-.02-.51-.47-.918-.98-.918h-.448C18.06 4.673 14.632 2 10.489 2c-1.775 0-3.428.49-4.755 1.326-.591-.408-1.469-.734-2.693-.632-.49.04-.715.612-.388.959.408.429.796 1 .877 1.735L1.857 7.612zm3.122.98a.862.862 0 0 1-.857-.858c0-.469.388-.857.857-.857.47 0 .858.388.858.857 0 .47-.388.858-.858.858z",fill:"currentColor"})),l.a.createElement("defs",null,l.a.createElement("clipPath",{id:"piggy-bank_svg__clip0"},l.a.createElement("path",{fill:"currentColor",d:"M0 0h20v20H0z"}))));function Wt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wt(Object(n),!0).forEach(function(t){Ht(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ht(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qt=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Gt({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M3.94 6.5L2.22 3.64l1.42-1.42L6.5 3.94c.52-.3 1.1-.54 1.7-.7L9 0h2l.8 3.24c.6.16 1.18.4 1.7.7l2.86-1.72 1.42 1.42-1.72 2.86c.3.52.54 1.1.7 1.7L20 9v2l-3.24.8c-.16.6-.4 1.18-.7 1.7l1.72 2.86-1.42 1.42-2.86-1.72c-.52.3-1.1.54-1.7.7L11 20H9l-.8-3.24c-.6-.16-1.18-.4-1.7-.7l-2.86 1.72-1.42-1.42 1.72-2.86c-.3-.52-.54-1.1-.7-1.7L0 11V9l3.24-.8c.16-.6.4-1.18.7-1.7zM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",fill:"currentColor"})),Yt=n(75),Kt=n(557),Vt=n(558);function Qt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Zt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Zt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Xt({item:e,type:t,makePreview:n,children:r,canDrag:a,onDragChange:l}){let i=Object(o.useRef)(l);const c=Qt(Object(Kt.a)({item:{type:t,item:e},collect:e=>({isDragging:e.isDragging()}),begin(n){i.current({state:"start-preview",type:t,item:e}),setTimeout(()=>{i.current({state:"start"})},0)},end(e,n){i.current({state:"end",type:t,item:e})},canDrag:()=>a}),2),s=(c[0].isDragging,c[1]);return Object(o.useLayoutEffect)(()=>{i.current=l}),{dragRef:s}}function Jt({types:e,id:t,onDrop:n,onLongHover:r}){let a=Object(o.useRef)(null),l=Qt(Object(o.useState)(null),2),i=l[0],c=l[1],s=Qt(Object(Vt.a)({accept:e,drop({item:e},r){n(e.id,i,t)},hover({item:e,type:t},n){let r=a.current.getBoundingClientRect(),o=(r.bottom-r.top)/2,l=n.getClientOffset().y-r.top;c(l<o?"top":"bottom")},collect:e=>({isOver:e.isOver()})}),2),u=s[0].isOver,d=s[1];return Object(o.useEffect)(()=>{let e;return r&&u&&(e=setTimeout(r,700)),()=>e&&clearTimeout(e)},[u]),{dropRef:(f=d,p=a,Object(o.useMemo)(()=>(function(e){[f,p].forEach(t=>{"function"===typeof t?t(e):null!=t&&(t.current=e)})}),[f,p])),dropPos:u?i:null};var f,p}const en=l.a.createContext(null);var tn={position:"absolute",left:2,right:2,borderRadius:3,height:3,background:`linear-gradient(90deg, ${w.a.b4} 0%, ${w.a.b5} 100%)`,zIndex:1e4,pointerEvents:"none"};function nn({pos:e,offset:t={}}){if(null==e)return null;let n=Object(o.useContext)(en),r=("first"===n?2:0)+(t.top||0),a=("last"===n?2:0)+(t.bottom||0),i="top"===e?{top:-2+r}:{bottom:-1+a};return l.a.createElement(E.y,{style:[tn,i]})}function rn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return an(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return an(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function on(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ln(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?on(Object(n),!0).forEach(function(t){cn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):on(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function cn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const sn=240;var un=ln(ln({},w.c.mediumText),{},{paddingTop:9,paddingBottom:9,paddingLeft:19,paddingRight:10,textDecoration:"none",color:w.a.n9}),dn={":hover":{backgroundColor:w.a.n2}},fn={borderLeft:"4px solid "+w.a.p8,paddingLeft:15,color:w.a.p8},pn={flexDirection:"row",alignItems:"center",height:20},yn={marginLeft:8},mn={flex:1},gn={color:w.a.n6},hn={marginTop:5};function bn({children:e,icon:t,title:n,style:r,to:a,exact:o,onButtonPress:i}){const c="Accounts"===n;return l.a.createElement(E.y,{style:r},l.a.createElement(E.b,{style:[un,dn],to:a,exact:o,activeStyle:fn},l.a.createElement(E.y,{style:pn},t,l.a.createElement(E.c,{style:yn},n),l.a.createElement(E.y,{style:mn}),c&&l.a.createElement(E.d,{bare:!0,onClick:e=>{e.stopPropagation(),e.preventDefault(),i()}},l.a.createElement(Ct,{width:12,height:12,style:gn})))),e?l.a.createElement(E.y,{style:hn},e):null)}let On=[{marginTop:-2,marginBottom:2,paddingTop:4,paddingBottom:4,paddingRight:15,paddingLeft:10,textDecoration:"none",color:w.a.n9},{":hover":{backgroundColor:w.a.n2}},w.c.smallText];var wn={flexShrink:0},En={position:"relative",borderLeft:"4px solid transparent"},vn={fontWeight:700},jn={borderColor:w.a.p8,color:w.a.p8,fontWeight:"normal","& .dot":{backgroundColor:w.a.p8,transform:"translateX(-4.5px)"}},Sn={position:"absolute",left:0,top:0,bottom:0,flexDirection:"row",alignItems:"center"};function xn({name:e,account:t,connected:n,failed:r,updated:a,to:o,query:i,style:c,outerStyle:s,onDragChange:u,onDrop:d}){let f=t?t.closed?"account-closed":t.offbudget?"account-offbudget":"account-onbudget":"title",p=Xt({type:f,onDragChange:u,item:{id:t&&t.id},canDrag:null!=t}).dragRef,y=Jt({types:t?[f]:[],id:t&&t.id,onDrop:d}),m=y.dropRef,g=y.dropPos;return l.a.createElement(E.y,{innerRef:m,style:[wn,s]},l.a.createElement(E.y,null,l.a.createElement(nn,{pos:g}),l.a.createElement(E.y,{innerRef:p},l.a.createElement(E.b,{ref:p,to:o,style:[On,c,En,a&&vn],activeStyle:jn},l.a.createElement(E.y,{style:Sn},l.a.createElement("div",Object.assign({className:"dot"},Object(j.css)({marginRight:3,width:5,height:5,borderRadius:5,backgroundColor:r?w.a.r7:w.a.g5,marginLeft:2,transition:"transform .3s",opacity:n?1:0})))),l.a.createElement(E.a,{left:e,right:l.a.createElement(vt,{debug:!0,binding:i,type:"financial"})})))," "))}var Cn={marginBottom:5,flex:1},kn={overflow:"auto",marginTop:-5},Pn={marginTop:15,color:w.a.n6},An={color:w.a.n6},In={marginTop:15,color:w.a.n6,flexDirection:"row",userSelect:"none",alignItems:"center",flexShrink:0};function Dn({accounts:e,failedAccounts:t,updatedAccounts:n,to:r,icon:a,history:i,getAccountPath:c,budgetedAccountPath:s,offBudgetAccountPath:u,getBalanceQuery:d,getOnBudgetBalance:f,getOffBudgetBalance:p,showClosedAccounts:y,onAddAccount:m,onToggleClosedAccounts:g,onReorder:h}){let b=rn(Object(o.useState)(!1),2),O=b[0],w=b[1],v=Object(o.useMemo)(()=>e.filter(e=>0===e.closed&&1===e.offbudget),[e]),j=Object(o.useMemo)(()=>e.filter(e=>0===e.closed&&0===e.offbudget),[e]),S=Object(o.useMemo)(()=>e.filter(e=>1===e.closed),[e]);function x(e){w("start"===e.state)}let C=(e,t)=>0===e?{paddingTop:O?15:0,marginTop:O?-15:0}:e===t-1?{paddingBottom:15}:null;return l.a.createElement(bn,{title:"Accounts",to:r,icon:a,exact:!0,style:Cn,onButtonPress:m},l.a.createElement(E.y,{style:kn},j.length>0&&l.a.createElement(xn,{name:"For budget",to:s,query:f(),style:Pn}),j.map((e,r)=>l.a.createElement(xn,{key:e.id,name:e.name,account:e,connected:!!e.bankId,failed:t&&t.has(e.id),updated:n&&n.includes(e.id),to:c(e),query:d(e),onDragChange:x,onDrop:h,outerStyle:C(r,j.length)})),v.length>0&&l.a.createElement(xn,{name:"Off budget",to:u,query:p(),style:An}),v.map((e,r)=>l.a.createElement(xn,{key:e.id,name:e.name,account:e,connected:!!e.bankId,failed:t&&t.has(e.id),updated:n&&n.includes(e.id),to:c(e),query:d(e),onDragChange:x,onDrop:h,outerStyle:C(r,v.length)})),S.length>0&&l.a.createElement(E.y,{style:[On,In],onClick:g},"Closed Accounts"+(y?"":"...")),y&&S.map((e,t)=>l.a.createElement(xn,{key:e.id,name:e.name,account:e,to:c(e),query:d(e),onDragChange:x,onDrop:h}))))}var Tn={flexShrink:0},Mn={width:13,height:13,color:w.a.n5};function Rn({style:e,onFloat:t}){return l.a.createElement(E.y,{className:"float",style:[e,Tn]},l.a.createElement(E.d,{bare:!0,onClick:t},l.a.createElement(Nt,{style:Mn})))}var Bn={color:w.a.n5,flexShrink:0},_n={color:w.a.p7},Ln={color:"inherit",transform:"rotateZ(0deg)"},Nn={padding:0};const Fn=Object(i.k)(function({history:e}){let t=Object(s.c)(),n=rn(Object(o.useState)(!1),2),r=n[0],a=n[1];let i=[{name:"open-payees",text:"Manage Payees"},{name:"open-rules",text:"Manage Rules"},{name:"find-schedules",text:"Find schedules"},{name:"repair-splits",text:"Repair split transactions"},E.q.line,{name:"settings",text:"Settings"},{name:"close",text:"Close File"}];return l.a.createElement(E.d,{bare:!0,style:Bn,activeStyle:_n,onClick:()=>a(!0)},l.a.createElement(Yt.a,{width:15,height:15,style:Ln}),r&&l.a.createElement(E.x,{position:"bottom-right",style:Nn,onClose:()=>a(!1)},l.a.createElement(E.q,{onMenuSelect:function(n){switch(a(!1),n){case"open-payees":t(Object(bt.d)("manage-payees"));break;case"open-rules":t(Object(bt.d)("manage-rules"));break;case"find-schedules":e.push("/schedule/discover",{locationPtr:e.location});break;case"repair-splits":e.push("/tools/fix-splits",{locationPtr:e.location});break;case"settings":e.push("/settings");break;case"close":t(Object(Ot.b)())}},items:i})))});var Un={paddingTop:35,height:30,flexDirection:"row",alignItems:"center",margin:"0 8px 23px 20px",transition:"padding .4s"},zn={paddingTop:20,justifyContent:"flex-start"},$n={color:w.a.p7},Wn={color:"inherit"},Gn={flex:1,flexDirection:"row"},Hn={color:"inherit"},qn={color:"inherit"},Yn={color:"inherit"},Kn={color:"inherit"};function Vn({style:e,budgetName:t,accounts:n,failedAccounts:r,updatedAccounts:a,getBalanceQuery:o,getOnBudgetBalance:i,getOffBudgetBalance:c,showClosedAccounts:s,isFloating:u,onFloat:d,onAddAccount:f,onToggleClosedAccounts:p,onReorder:y}){let m=!Ie.a.isBrowser&&"mac"===Ie.a.OS;return l.a.createElement(E.y,{style:[{width:sn,color:w.a.n9,overflow:"auto",backgroundColor:w.a.n1,"& .float":{opacity:0,transition:"opacity .25s, width .25s",width:m?null:0},"&:hover .float":{opacity:1,width:m?null:"auto"}},e]},m&&l.a.createElement(Rn,{style:[{height:u?0:36,alignItems:"flex-end",justifyContent:"center",overflow:"hidden",WebkitAppRegion:"drag",paddingRight:8}],onFloat:d}),l.a.createElement(E.y,{style:[Un,m&&zn]},t,!Ie.a.isBrowser&&l.a.createElement(E.e,{bare:!0,to:"/settings",style:{display:"inherit",color:w.a.n5,marginLeft:m?0:5,flexShrink:0},activeStyle:$n},l.a.createElement(qt,{width:15,height:15,style:Wn})),l.a.createElement(E.y,{style:Gn}),!m&&l.a.createElement(Rn,{onFloat:d}),Ie.a.isBrowser&&l.a.createElement(Fn,null)),l.a.createElement(bn,{title:"Budget",icon:l.a.createElement(It,{width:15,height:15,style:Hn}),to:"/budget"}),l.a.createElement(bn,{title:"Reports",icon:l.a.createElement(Rt,{width:15,height:15,style:qn}),to:"/reports"}),l.a.createElement(bn,{title:"Schedules",icon:l.a.createElement(Be,{width:15,height:15,style:Yn}),to:"/schedules"}),l.a.createElement(Dn,{to:"/accounts",icon:l.a.createElement($t,{width:15,height:15,style:Kn}),accounts:n,failedAccounts:r,updatedAccounts:a,getAccountPath:e=>`/accounts/${e.id}`,budgetedAccountPath:"/accounts/budgeted",offBudgetAccountPath:"/accounts/offbudget",getBalanceQuery:o,getOnBudgetBalance:i,getOffBudgetBalance:c,showClosedAccounts:s,onAddAccount:f,onToggleClosedAccounts:p,onReorder:y}))}var Qn=n(27),Zn=n(78),Xn=n.n(Zn);function Jn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return er(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return er(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function er(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var tr={width:160,fontSize:16,fontWeight:500},nr={color:w.a.n9,fontSize:16,fontWeight:500,marginLeft:-5,flex:"0 auto"},rr={whiteSpace:"nowrap",overflow:"hidden"};function ar({prefs:e,savePrefs:t}){const n=Jn(Object(o.useState)(!1),2),r=n[0],a=n[1];return r?l.a.createElement(E.k,null,l.a.createElement(E.m,{style:tr,defaultValue:e.budgetName,onEnter:async e=>{""!==e.target.value.trim()&&(await t({budgetName:e.target.value}),a(!1))},onBlur:()=>a(!1)})):l.a.createElement(E.d,{bare:!0,style:nr,onClick:()=>a(!0)},l.a.createElement(E.w,{style:rr},e.budgetName||"A budget has no name"))}var or={flex:1};var lr=Object(i.k)(Object(s.b)(e=>({accounts:e.queries.accounts,failedAccounts:e.account.failedAccounts,updatedAccounts:e.queries.updatedAccounts,prefs:e.prefs.local,floatingSidebar:e.prefs.global.floatingSidebar}),e=>Object(Qn.b)(p,e))(function({accounts:e,failedAccounts:t,updatedAccounts:n,replaceModal:r,prefs:a,floatingSidebar:i,savePrefs:c,saveGlobalPrefs:s,getAccounts:u}){return Object(o.useEffect)(()=>void u(),[u]),l.a.createElement(Vn,{isFloating:i,budgetName:l.a.createElement(ar,{prefs:a,savePrefs:c}),accounts:e,failedAccounts:t,updatedAccounts:n,getBalanceQuery:Se,getOnBudgetBalance:xe,getOffBudgetBalance:Ce,onFloat:()=>s({floatingSidebar:!i}),onReorder:async function(t,n,r){if("bottom"===n){let t=e.findIndex(e=>e.id===r)+1;r=t<e.length?e[t].id:null}await Object(h.send)("account-move",{id:t,targetId:r}),await u()},onAddAccount:()=>r(a["flags.syncAccount"]?"add-account":"add-local-account"),showClosedAccounts:a["ui.showClosedAccounts"],onToggleClosedAccounts:()=>c({"ui.showClosedAccounts":!a["ui.showClosedAccounts"]}),style:[or,w.c.darkScrollbar]})}));function ir(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return cr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cr(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}const sr=l.a.createContext(null);function ur({children:e}){let t=Object(L.a)();return l.a.createElement(sr.Provider,{value:{show:()=>t.emit("show"),hide:()=>t.emit("hide"),on:(e,n)=>(t.on(e,n),()=>t.off(e,n))}},e)}function dr(){return Object(o.useContext)(sr)}var fr={position:"absolute",top:0,bottom:0,left:0};var pr=Object(i.k)(Object(s.b)(e=>({floatingSidebar:e.prefs.global.floatingSidebar}),p)(function({floatingSidebar:e}){let t=ir(Object(o.useState)(!0),2),n=t[0],r=t[1],a=dr();return!e&&n&&r(!1),Object(o.useEffect)(()=>{let e=[a.on("show",()=>r(!1)),a.on("hide",()=>r(!0))];return()=>{e.forEach(e=>e())}},[a]),l.a.createElement(l.a.Fragment,null,e&&l.a.createElement(E.y,{onMouseOver:()=>r(!1),onMouseLeave:()=>r(!0),style:{position:"absolute",top:0,bottom:0,left:0,width:n?0:160,zIndex:999}}),l.a.createElement(E.y,{onMouseOver:e?e=>{e.stopPropagation(),r(!1)}:null,onMouseLeave:e?()=>r(!0):null,style:{position:"absolute",top:50,bottom:e?50:-50,zIndex:1001,borderRadius:"0 6px 6px 0",overflow:"hidden",boxShadow:!e||n?"none":"0 15px 30px 0 rgba(0,0,0,0.25), 0 3px 15px 0 rgba(0,0,0,.5)",transform:`translateY(${e?0:-50}px)\n translateX(${n?-sn:0}px)`,transition:"transform .5s, box-shadow .5s"}},l.a.createElement(lr,null)),l.a.createElement(E.y,{style:[{backgroundColor:w.a.n1,opacity:e?0:1,transform:`translateX(${e?-50:0}px)`,transition:"transform .4s, opacity .2s",width:sn},e&&fr]}))}));function yr(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return mr(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return mr(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function mr(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let gr=l.a.createContext();function hr({children:e}){let t=Object(o.useRef)([]);return l.a.createElement(gr.Provider,{value:{sendEvent:function(e){t.current.forEach(t=>t(e))},subscribe:function(e){return t.current.push(e),()=>t.current=t.current.filter(t=>t!==e)}},children:e})}var br={color:w.a.r5};function Or(){return l.a.createElement(De.a,{binding:{name:"uncategorized-amount",query:ke.calculate({$count:"$id"})}},e=>{const t=e.value;return 0!==t&&l.a.createElement(E.e,{bare:!0,to:"/accounts/uncategorized",style:br},t," uncategorized ",1===t?"transaction":"transactions")})}var wr={color:"currentColor"},Er={marginLeft:3};function vr({localPrefs:e,style:t,onSync:n}){let r=yr(Object(o.useState)(!1),2),a=r[0],i=r[1],c=yr(Object(o.useState)(null),2),s=c[0],u=c[1];return Object(o.useEffect)(()=>{return Object(h.listen)("sync-event",({type:t,subtype:n,syncDisabled:r})=>{"start"===t?(i(!0),u(null)):setTimeout(()=>{i(!1)},20),"error"===t?"network"===n?u("offline"):e.cloudFileId?u("error"):u("local"):"success"===t&&u(r?"disabled":null)})},[]),l.a.createElement(E.d,{bare:!0,style:[t,{WebkitAppRegion:"none",color:"error"===s?w.a.r4:"disabled"===s||"offline"===s||"local"===s?w.a.n6:null}],onClick:n},"error"===s?l.a.createElement(et,{width:13,style:wr}):l.a.createElement(T,{animating:a}),l.a.createElement(E.w,{style:Er},"disabled"===s?"Disabled":"offline"===s?"Offline":"Sync"))}var jr={flexDirection:"row",alignItems:"center"},Sr={marginLeft:-5},xr={alignSelf:"flex-start",padding:"4px 7px"},Cr={padding:10,maxWidth:400},kr={fontWeight:600},Pr={color:w.a.n4,fontStyle:"italic"};function Ar({globalPrefs:e,saveGlobalPrefs:t,localPrefs:n}){let r=Object(o.useContext)(gr).sendEvent,a=yr(Object(o.useState)(!1),2),i=a[0],c=a[1],s=yr(Object(o.useState)(!1),2),u=s[0],d=s[1],f=n["flags.reportBudget"];Object(o.useEffect)(()=>{c(!1)},[n.budgetType]);let p=n.budgetType;return l.a.createElement(E.y,{style:jr},l.a.createElement(Ne,{maxMonths:e.maxMonths||1,onChange:e=>t({maxMonths:e})}),f&&l.a.createElement(E.y,{style:Sr},l.a.createElement(E.d,{bare:!0,loading:i,style:xr,title:"Learn more about budgeting",onClick:()=>d(!0)},"report"===p?"Report budget":"Rollover budget"),u&&l.a.createElement(E.x,{position:"bottom-left",onClose:()=>d(!1),style:Cr},l.a.createElement(E.t,null,"You are currently using a"," ",l.a.createElement(E.w,{style:kr},"report"===p?"Report budget":"Rollover budget",".")," ","Switching will not lose any data and you can always switch back."),l.a.createElement(E.t,null,l.a.createElement(E.f,{primary:!0,loading:i,onClick:function(){c(!0),i||r("budget/switch-type")}},"Switch to a"," ","report"===p?"Rollover budget":"Report budget")),l.a.createElement(E.t,{isLast:!0},l.a.createElement("a",{href:"#",style:Pr},"How do these types of budgeting work?")))))}var Ir={flexDirection:"row",alignItems:"center",padding:"0 15px",height:36,pointerEvents:"none","& *":{pointerEvents:"auto"}},Dr={paddingLeft:80},Tr={marginRight:8,"& .arrow-right":{opacity:0,transition:"opacity .3s"},"& .menu":{opacity:1,transition:"opacity .3s"},"&:hover .arrow-right":{opacity:1},"&:hover .menu":{opacity:0}},Mr={width:15,height:15},Rr={width:13,height:13,color:w.a.n5,position:"absolute",top:1,left:1},Br={width:15,height:15,color:w.a.n5,position:"absolute",top:0,left:0},_r={marginRight:5,color:"currentColor"},Lr={flex:1},Nr={marginLeft:10},Fr={marginLeft:10};var Ur=Object(i.k)(Object(s.b)(e=>({globalPrefs:e.prefs.global,localPrefs:e.prefs.local,userData:e.user.data,floatingSidebar:e.prefs.global.floatingSidebar}),p)(function({location:e,globalPrefs:t,saveGlobalPrefs:n,localPrefs:r,userData:a,floatingSidebar:o,syncError:c,setAppState:s,style:u,sync:d}){let f=dr();return l.a.createElement(E.y,{style:[Ir,!Ie.a.isBrowser&&"mac"===Ie.a.OS&&o&&Dr,u]},o&&l.a.createElement(E.d,{bare:!0,style:Tr,onMouseEnter:()=>f.show(),onMouseLeave:()=>f.hide(),onClick:()=>{n({floatingSidebar:!o})}},l.a.createElement(E.y,{style:Mr},l.a.createElement($e,{className:"arrow-right",style:Rr}),l.a.createElement(qe,{className:"menu",style:Br}))),l.a.createElement(i.d,null,l.a.createElement(i.b,{path:"/accounts",exact:!0,children:e=>(e.location.state||{}).goBack?l.a.createElement(E.d,{onClick:()=>e.history.goBack(),bare:!0},l.a.createElement(Qe,{width:10,height:10,style:_r})," ","Back"):null}),l.a.createElement(i.b,{path:"/accounts/:id",exact:!0,children:e=>e.match&&l.a.createElement(gt,{id:e.match.params.id})}),l.a.createElement(i.b,{path:"/budget",exact:!0,children:()=>l.a.createElement(Ar,{globalPrefs:t,saveGlobalPrefs:n,localPrefs:r})})),l.a.createElement(E.y,{style:Lr}),l.a.createElement(Or,null),l.a.createElement(vr,{style:Nr,localPrefs:r,onSync:d}),l.a.createElement(ht.a,{style:Fr}))})),zr=(n(245),n(88)),$r=n(327),Wr=n(328),Gr=n.n(Wr);class Hr extends l.a.Component{constructor(...e){super(...e),this.ref=(e=>{this.context.setTutorialNode&&this.context.setTutorialNode(this.props.name,e,this.props.expand)})}render(){return l.a.createElement("div",{ref:this.ref})}}Hr.contextTypes={setTutorialNode:Gr.a.func};function qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qr(Object(n),!0).forEach(function(t){Kr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Vr=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Yr({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M15.067 3.986a.5.5 0 0 0-.354-.148.5.5 0 0 0-.354.147L3.437 14.91a.5.5 0 0 0 0 .707l4.948 4.948a.5.5 0 0 0 .707 0L20.009 9.648a.5.5 0 0 0 0-.706zM2.43 16.8a.5.5 0 0 0-.489-.127.5.5 0 0 0-.351.364L.084 23.314a.5.5 0 0 0 .133.47.507.507 0 0 0 .47.132l6.272-1.5a.5.5 0 0 0 .237-.84zM23.2 2.924L21.077.8a2.5 2.5 0 0 0-3.532 0l-1.418 1.417a.5.5 0 0 0 0 .707l4.95 4.949a.5.5 0 0 0 .707 0L23.2 6.454a2.5 2.5 0 0 0 0-3.53z",fill:"currentColor"}));function Qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Zr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qr(Object(n),!0).forEach(function(t){Xr(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Jr=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Zr({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M23.384 21.619l-6.529-6.529a9.284 9.284 0 1 0-1.768 1.768l6.529 6.529a1.266 1.266 0 0 0 1.768 0 1.251 1.251 0 0 0 0-1.768zM2.75 9.5a6.75 6.75 0 1 1 6.75 6.75A6.758 6.758 0 0 1 2.75 9.5z",fill:"currentColor"}));function ea(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ta(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ea(Object(n),!0).forEach(function(t){na(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ea(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function na(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ra=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:ta({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M8.616 1.741A1.455 1.455 0 0 1 10.07.287h3.392a1.455 1.455 0 0 1 1.453 1.454v8.228a.25.25 0 0 0 .25.25h2.9a1.138 1.138 0 0 1 .827 2l-6.1 6.1a1.489 1.489 0 0 1-2.056 0l-6.1-6.1a1.137 1.137 0 0 1 .827-2h2.9a.249.249 0 0 0 .25-.25z",fill:"currentColor"}),l.a.createElement("path",{d:"M0 19.677a4.039 4.039 0 0 0 4.035 4.035h15.93A4.039 4.039 0 0 0 24 19.677V17.8a1.225 1.225 0 0 0-2.449 0v1.874a1.588 1.588 0 0 1-1.586 1.586H4.035a1.588 1.588 0 0 1-1.586-1.586V17.8A1.225 1.225 0 0 0 0 17.8z",fill:"currentColor"})),aa=n(34);function oa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function la(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oa(Object(n),!0).forEach(function(t){ia(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ca=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:la({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z",fill:"currentColor"}));function sa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ua(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sa(Object(n),!0).forEach(function(t){da(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function da(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var fa=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:ua({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M12 0a12 12 0 1 0 12 12A12.014 12.014 0 0 0 12 0zm6.927 8.2l-6.845 9.289a1.011 1.011 0 0 1-1.43.188l-4.888-3.908a1 1 0 1 1 1.25-1.562l4.076 3.261 6.227-8.451a1 1 0 1 1 1.61 1.183z",fill:"currentColor"})),pa=n(66);function ya(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ma(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ya(Object(n),!0).forEach(function(t){ga(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ya(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ga(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ha=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",fill:"none",style:ma({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M19.611 2.571h-3.754a1.286 1.286 0 1 1 0-2.571h6.857A1.286 1.286 0 0 1 24 1.286v6.857a1.286 1.286 0 0 1-2.571 0V4.39L15.48 10.34a1.286 1.286 0 0 1-1.817-1.817l5.948-5.95zM1.286 14.571a1.286 1.286 0 0 1 1.285 1.286v3.754l5.949-5.946a1.286 1.286 0 0 1 1.817 1.817L4.39 21.429h3.753a1.285 1.285 0 1 1 0 2.571H1.286A1.286 1.286 0 0 1 0 22.714v-6.857a1.286 1.286 0 0 1 1.286-1.286z",fill:"currentColor"}));function ba(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Oa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ba(Object(n),!0).forEach(function(t){wa(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ba(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wa(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ea=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",fill:"none",style:Oa({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M14.143 1.714A1.286 1.286 0 0 1 15.429 3v3.753L21.806.377a1.286 1.286 0 0 1 1.817 1.817l-6.376 6.377H21a1.286 1.286 0 1 1 0 2.572h-6.857a1.286 1.286 0 0 1-1.286-1.286V3a1.286 1.286 0 0 1 1.286-1.286zM9.857 22.286A1.285 1.285 0 0 1 8.571 21v-3.753l-6.377 6.376a1.286 1.286 0 0 1-1.817-1.817l6.376-6.377H3a1.286 1.286 0 0 1 0-2.572h6.857a1.286 1.286 0 0 1 1.286 1.286V21a1.286 1.286 0 0 1-1.286 1.286z",fill:"currentColor"}));function va(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ja(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ja(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ja(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Sa(e,t,n){let r=new n(e,null,t),a=l.a.createContext(null);return{Provider:function({children:e}){let t=va(Object(o.useState)(r.getData()),2),n=t[0],i=t[1],c=Object(o.useMemo)(()=>({data:n,query:r}),[n,r]);return Object(o.useEffect)(()=>{if(0!==r.getNumListeners())throw new Error("Query already has listeners. You cannot use the same query context `Provider` twice");let e=r.addListener(e=>i(e));return r.isRunning()||r.run(),i(r.getData()),()=>{e(),r.unsubscribe()}},[]),l.a.createElement(a.Provider,{value:c,children:e})},useQuery:function(){let e=Object(o.useContext)(a);if(null==e)throw new Error("`useQuery` tried to access a query that hasn't been run. You need to put its `Provider` in a parent component");return e}}}var xa=n(6);const Ca=["subtransactions"];function ka(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Pa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Aa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pa(Object(n),!0).forEach(function(t){Ia(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ia(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Da=n(96);function Ta(e){return"number"===typeof e?e:0}function Ma(e,t){return{type:"SplitTransactionError",version:1,difference:Ta(t.amount)-e}}function Ra(e,t){let n="temp"===e.id?"temp":"";return Aa(Aa({amount:0},t),{},{payee:t.payee||e.payee,id:t.id?t.id:n+Da.v4Sync(),account:e.account,date:e.date,cleared:null!=e.cleared?e.cleared:null,starting_balance_flag:null!=e.starting_balance_flag?e.starting_balance_flag:null,is_child:!0,parent_id:e.id,error:null})}function Ba(e){const t=e.subtransactions.reduce((e,t)=>e+Ta(t.amount),0);return Aa(Aa({},e),{},{error:t===Ta(e.amount)?null:Ma(t,e)})}function _a(e){return e.reduce((e,t)=>{let n=t.subtransactions,r=ka(t,Ca);n=n||[],e.push(r);for(let a=0;a<n.length;a++)e.push(n[a]);return e},[])}function La(e){return Aa(Aa({},e[0]),{},{subtransactions:e.slice(1)})}function Na(e){return null==e?null:_a([e])}function Fa(e,t,n){let r=e.findIndex(e=>e.id===t),a=e[r],o=[...e];if(-1===r)throw new Error("Tried to edit unknown transaction id: "+t);if(a.is_parent||a.is_child){let t=function(e,t){for(;t>=0;){if(e[t].is_parent)return t;t--}return null}(e,r);if(null==t)return console.log("Cannot find parent index"),{diff:{deleted:[],updated:[]}};let a,l=function(e,t){let n=[e[t]],r=t+1;for(;r<e.length&&e[r].is_child;)n.push(e[r]),r++;return n}(e,t),i=n(La(l)),c=Na(i);return null==c?(a={deleted:[{id:l[0].id}],updated:[]},i={id:l[0].id,_deleted:!0},o.splice(t,l.length)):(a=Object(we.diffItems)(l,c),o.splice(t,l.length,...c)),{data:o,newTransaction:i,diff:a}}{let e=n(a),t=Na(e)||[];return e&&(e.subtransactions=e.subtransactions||[]),o.splice(r,1,...t),{data:o,newTransaction:e||{id:a.id,_deleted:!0},diff:Object(we.diffItems)([a],t)}}}function Ua(e,t){return Fa(e,t,e=>{if(!e.is_parent)return e;let t=Object(we.last)(e.subtransactions);return e.subtransactions.push(Ra(e,{amount:0,sort_order:Ta(t&&t.sort_order)-1})),e})}function za(e,t){return Fa(e,t.id,e=>{if(e.is_parent){let n=e.id===t.id?t:e,r=e.subtransactions.map(r=>{let a=r;return e.id===t.id?a=Aa(Aa({},r),{},{payee:r.payee===e.payee?t.payee:r.payee}):r.id===t.id&&(a=t),Ra(n,a)});return Ba(Aa(Aa({},n),{},{subtransactions:r}))}return t})}function $a(e,t){return Fa(e,t,e=>{if(e.is_parent){if(e.id===t)return null;if(1===e.subtransactions.length)return Aa(Aa({},e),{},{subtransactions:null,is_parent:!1,error:null});{let n=e.subtransactions.filter(e=>e.id!==t);return Ba(Aa(Aa({},e),{},{subtransactions:n}))}}return null})}function Wa(e,t){return Fa(e,t,e=>e.is_parent||e.is_child?e:Aa(Aa({},e),{},{is_parent:!0,error:0===Ta(e.amount)?null:Ma(0,e),subtransactions:[Ra(e,{amount:0,sort_order:-1})]}))}var Ga=n(545),Ha=n(555),qa=n(91);function Ya(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ka(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ya(Object(n),!0).forEach(function(t){Va(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ya(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Va(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Qa=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Ka({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M.439 21.44a1.5 1.5 0 0 0 2.122 2.121l9.262-9.261a.25.25 0 0 1 .354 0l9.262 9.263a1.5 1.5 0 1 0 2.122-2.121L14.3 12.177a.25.25 0 0 1 0-.354l9.263-9.262A1.5 1.5 0 0 0 21.439.44L12.177 9.7a.25.25 0 0 1-.354 0L2.561.44A1.5 1.5 0 0 0 .439 2.561L9.7 11.823a.25.25 0 0 1 0 .354z",fill:"currentColor"}));const Za=["value","onSelect","suggestions","strict"],Xa=["multi"];function Ja(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return eo(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return eo(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eo(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function to(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function no(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ro(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?no(Object(n),!0).forEach(function(t){ao(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):no(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ao(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oo(e,t,n){if(e){let e=t.findIndex(e=>e.id===n);return-1===e?null:t[e]}return n}function lo(e){return null==e?"":"string"===typeof e?e:e.name||""}function io(e){return"string"===typeof e?e:e?e.id:null}function co({props:{value:e,suggestions:t,embedded:n,isOpen:r=!1,strict:a,initialFilterSuggestions:o}}){let l=oo(a,t,e),i=o?o(t,e):null;return{selectedItem:l,value:l?lo(l):"",originalItem:l,filteredSuggestions:i,highlightedIndex:null,isOpen:n||r}}function so(e,t){return lo(e).toLowerCase().includes(t.toLowerCase())}function uo(e,t){return e.filter(e=>so(e,t))}function fo(e,t,n,r,a){let o=null;if(t)if(null==r){let e=n.find(e=>e.id===a);e&&(o=e.id)}else r<n.length&&(o=n[r].id);else o=a;e&&e(o)}function po({props:{suggestions:e,onUpdate:t,multi:n,highlightFirst:r,strict:a,filterSuggestions:o=uo,getHighlightedIndex:l},state:{isOpen:i}},c,s){if(!document.hasFocus())return;if(s.type===qa.a.stateChangeTypes.controlledPropUpdatedSelectedItem)return;const u=o(e,c);if(""===c)return s.type!==qa.a.stateChangeTypes.clickItem&&fo(t,a,u,null,null),{value:c,filteredSuggestions:u,highlightedIndex:null};{let e=e=>r&&e.length?0:null,n=(l||e)(u);return s.type!==qa.a.stateChangeTypes.clickItem&&fo(t,a,u,n,c),{value:c,filteredSuggestions:u,highlightedIndex:n}}}function yo({props:e,state:t,inst:n},r,a){if(e.tableBehavior&&r.type===qa.a.stateChangeTypes.mouseUp)return;const o={};return"highlightedIndex"in r&&(o.highlightedIndex=r.highlightedIndex),"isOpen"in r&&(o.isOpen=!!e.embedded||r.isOpen),"selectedItem"in r&&(o.selectedItem=r.selectedItem),!t.isOpen||r.type!==qa.a.stateChangeTypes.keyDownArrowUp&&r.type!==qa.a.stateChangeTypes.keyDownArrowDown||fo(e.onUpdate,e.strict,t.filteredSuggestions||e.suggestions,null!=o.highlightedIndex?o.highlightedIndex:t.highlightedIndex,t.value),n.lastChangeType=r.type,o}function mo({props:{onSelect:e,clearAfterSelect:t,suggestions:n},inst:r},a){return e&&setTimeout(()=>{e(io(a))},0),go(n,t,r)}function go(e,t,n){if(t)return{value:"",selectedItem:null,highlightedIndex:null,filteredSuggestions:e};n.input&&n.input.setSelectionRange(0,1e4)}function ho({props:{inputProps:e}},t){const n=(e||{}).onChange;n&&n(t.target.value)}function bo({props:{suggestions:e,clearAfterSelect:t,initialFilterSuggestions:n,embedded:r,onUpdate:a,onSelect:o,inputProps:l,shouldSaveFromKey:i=Eo,strict:c},state:{selectedItem:s,filteredSuggestions:u,highlightedIndex:d,originalItem:f,isNulled:p,isOpen:y,value:m},inst:g},h){let b=(l||{}).onKeyDown;if(y)if(13===h.keyCode)if(null!=d)g.lastChangeType===qa.a.stateChangeTypes.itemMouseEnter?h.preventDefault():h.stopPropagation();else{if(!c)return h.stopPropagation(),o(m),go(e,t,g);h.preventDefault(),b&&b(h)}else i(h)&&(h.preventDefault(),b&&b(h));if(27===h.keyCode){h.preventDefault(),r||h.stopPropagation();let t=n?n(e,lo(f)):null;return fo(a,c,e,null,io(f)),{value:lo(f),selectedItem:oo(c,e,f),filteredSuggestions:t,highlightedIndex:null,isOpen:!!r}}}function Oo(e){return l.a.createElement(E.m,e)}function wo(e,t,n){return l.a.createElement("div",null,e.map((e,r)=>{let a=lo(e);return l.a.createElement("div",Object.assign({},t({item:e}),{key:a},Object(j.css)({padding:5,cursor:"default",backgroundColor:n===r?w.a.n4:null})),a)}))}function Eo(e){return 13===e.keyCode}function vo({inst:e,props:{inputProps:t={},openOnFocus:n=!0}},r){if(t.onFocus&&t.onFocus(r),n)return{isOpen:!0}}function jo({inst:e,props:t,state:{selectedItem:n}},r){let a=t.inputProps,o=void 0===a?{}:a,l=t.onSelect;if(r.preventDownshiftDefault=!0,o.onBlur&&o.onBlur(r),t.tableBehavior)return{isOpen:!1};{if(""===r.target.value)return l&&l(null),{selectedItem:null,originalValue:null,isOpen:!1};let e=n?io(n):null;return co({props:ro(ro({},t),{},{value:e,originalValue:e})})}}function So(e){return e?lo(e):""}var xo={display:"flex"},Co={marginTop:5};const ko=Xn()(function({props:{focused:e,embedded:t,containerProps:n,inputProps:r,children:a,suggestions:o,tooltipStyle:i,onItemClick:c,strict:s,tooltipProps:u,renderInput:d=Oo,renderItems:f=wo,itemToString:p=So},state:{value:y,selectedItem:m,filteredSuggestions:g,highlightedIndex:h,isOpen:b},updater:O,inst:v}){var S=ro({padding:0,backgroundColor:w.a.n1,color:"white"},i);const x=g||o;return l.a.createElement(qa.a,{onSelect:O(mo),highlightedIndex:h,selectedItem:m||null,itemToString:p,inputValue:y,isOpen:b,onInputValueChange:O(po),onStateChange:O(yo)},({getInputProps:a,getItemProps:o,getRootProps:i,isOpen:c,inputValue:s,selectedItem:p,highlightedIndex:y})=>l.a.createElement("div",Object.assign({className:"view "+Object(j.css)(xo).toString()},n),d(a(ro(ro({focused:e},r),{},{onFocus:O(vo),onBlur:O(jo),onKeyDown:O(bo),onChange:O(ho)}))),c&&x.length>0&&(t?l.a.createElement(E.y,{style:Co,"data-testid":"autocomplete"},f(x,o,y,s)):l.a.createElement(E.x,Object.assign({position:"bottom-stretch",offset:2,style:S},u,{"data-testid":"autocomplete"}),f(x,o,y,s)))))},{getInitialState:co,componentWillReceiveProps:function(e,t){let n=t.strict,r=t.suggestions,a=t.filterSuggestions,o=void 0===a?uo:a,l=t.initialFilterSuggestions,i=t.value,c=t.itemToString,s=void 0===c?So:c,u=e.state.value,d=null;function f(){let e=oo(n,r,i);e&&((d=d||{}).value=s(e),d.selectedItem=e)}if(e.props.value!==i&&f(),e.props.suggestions!==r){let t=null;t=null!=e.state.highlightedIndex?o(r,u):l?l(r,u):null,d=d||{},f(),d.filteredSuggestions=t}return d}});var Po={alignItems:"center",flexDirection:"row",backgroundColor:w.a.b9,padding:"2px 4px",margin:"2px",borderRadius:4},Ao={marginLeft:1},Io={width:8,height:8};function Do({name:e,onRemove:t}){return l.a.createElement(E.y,{style:Po},e,l.a.createElement(E.d,{type:"button",bare:!0,style:Ao,onClick:t},l.a.createElement(Qa,{style:Io})))}var To={display:"flex",flexWrap:"wrap",flexDirection:"row",alignItems:"center",backgroundColor:"white",borderRadius:4,border:"1px solid #d0d0d0"},Mo={border:"1px solid "+w.a.b5,boxShadow:"0 1px 1px "+w.a.b7},Ro={flex:1,minWidth:30,border:0,":focus":{border:0,boxShadow:"none"}};function Bo(e){let t=e.value,n=e.onSelect,r=e.suggestions,a=e.strict,i=to(e,Za),c=Ja(Object(o.useState)(!1),2),s=c[0],u=c[1],d=Object(o.useRef)();function f(e){let r=t.filter(t=>t!==e);n(r)}return Object(o.useEffect)(()=>{d.current=t}),l.a.createElement(Wo,Object.assign({},i,{value:null,suggestions:r.filter(e=>!t.includes(io(e))),onSelect:function(e){e&&(e=e.trim(),n([...t,e],e))},clearAfterSelect:!0,highlightFirst:!0,strict:a,tooltipProps:{forceLayout:d.current!==t},renderInput:e=>l.a.createElement(E.y,{style:[To,s&&Mo]},t.map((e,t)=>(e=oo(a,r,e))&&l.a.createElement(Do,{key:io(e)||t,name:lo(e),onRemove:()=>f(io(e))})),l.a.createElement(E.m,Object.assign({},e,{onKeyDown:n=>(function(e,n){"Backspace"===e.key&&""===e.target.value&&f(t[t.length-1]),n&&n(e)})(n,e.onKeyDown),onFocus:t=>{u(!0),e.onFocus(t)},onBlur:t=>{u(!1),e.onBlur(t)},style:[Ro,e.style]})))}))}var _o={fontSize:12,color:w.a.n10,backgroundColor:"transparent",borderColor:w.a.n5},Lo={backgroundColor:"rgba(200, 200, 200, .25)"};function No({title:e,style:t,hoveredStyle:n,onClick:r}){return l.a.createElement(E.d,{style:[_o,t],hoveredStyle:[Lo,n],onClick:r},e)}var Fo={flexShrink:0},Uo={paddingTop:5},zo={padding:5};function $o({show:e=!0,embedded:t,children:n}){return e&&l.a.createElement(E.y,{style:[Fo,t?Uo:zo],onMouseDown:e=>e.preventDefault()},n)}function Wo(e){let t=e.multi,n=to(e,Xa);return t?l.a.createElement(Bo,n):l.a.createElement(ko,n)}const Go=["width","height","style","color"];function Ho(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var qo=function(e){let t=e.width,n=e.height,r=e.style,a=e.color,o=void 0===a?"currentColor":a,i=Ho(e,Go);return l.a.createElement("svg",Object.assign({width:t,height:n},i,Object(j.css)(r),{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),l.a.createElement("path",{d:"M30 9L26 5",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M30 9L26 13",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M6 5L2 9",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M2 9L6 13",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M10 9H3",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M22 9H29",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 15L22 9",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 15L10 9",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 28L16 15",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}))};const Yo=["categoryGroups","emptyLabel"],Ko=["categoryGroups","showSplitOption","embedded","onSplit"];function Vo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qo(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vo(Object(n),!0).forEach(function(t){Zo(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vo(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zo(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xo(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const Jo=l.a.forwardRef((e,t)=>{let n=e.categoryGroups,r=e.emptyLabel,a=Xo(e,Yo);return l.a.createElement(E.u,Object.assign({},a,{ref:t}),l.a.createElement("option",{value:""},r||"Select category..."),n.map(e=>l.a.createElement("optgroup",{key:e.id,label:e.name},e.categories.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name)))))});var el={overflow:"auto",padding:"5px 0"},tl={maxHeight:175},nl={lineHeight:0},rl={marginRight:5},al={color:w.a.y9,padding:"4px 9px"};function ol({items:e,getItemProps:t,highlightedIndex:n,embedded:r,footer:a}){let o=null;return l.a.createElement(E.y,null,l.a.createElement(E.y,{style:[el,!r&&tl]},e.map((e,a)=>{if("split"===e.id)return l.a.createElement(E.y,Object.assign({key:"split"},t?t({item:e}):null,{style:{backgroundColor:n===a?w.a.n4:"transparent",borderRadius:r?4:0,flexShrink:0,flexDirection:"row",alignItems:"center",fontSize:11,fontWeight:500,color:w.a.g8,padding:"6px 8px"},"data-testid":"split-transaction-button"}),l.a.createElement(E.w,{style:nl},l.a.createElement(qo,{width:10,height:10,style:rl})),"Split Transaction");const i=e.cat_group!==o;return o=e.cat_group,l.a.createElement(l.a.Fragment,{key:e.id},i&&l.a.createElement("div",{style:al,"data-testid":"category-item-group"},e.groupName),l.a.createElement("div",Object.assign({},t?t({item:e}):null,{style:{backgroundColor:n===a?w.a.n4:"transparent",padding:4,paddingLeft:20,borderRadius:r?4:0},"data-testid":"category-item"+(n===a?"-highlighted":"")}),e.name))})),a)}function ll(e){let t=e.categoryGroups,n=e.showSplitOption,r=e.embedded,a=(e.onSplit,Xo(e,Ko)),i=Object(o.useMemo)(()=>t.reduce((e,t)=>e.concat(t.categories.map(e=>Qo(Qo({},e),{},{groupName:t.name}))),n?[{id:"split",name:""}]:[]),[t]);return l.a.createElement(Wo,Object.assign({strict:!0,highlightFirst:!0,embedded:r,getHighlightedIndex:e=>0===e.length?null:"split"===e[0].id?e.length>1?1:null:0,filterSuggestions:(e,t)=>e.filter(e=>"split"===e.id||so(e,t)||e.groupName.toLowerCase().includes(t.toLowerCase())),suggestions:i,renderItems:(e,t,n)=>l.a.createElement(ol,{items:e,embedded:r,getItemProps:t,highlightedIndex:n})},a))}var il=n(63);const cl=["value","inputProps","showMakeTransfer","showManagePayees","defaultFocusTransferPayees","tableBehavior","embedded","onUpdate","onSelect","onManagePayees"];function sl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ul(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?sl(Object(n),!0).forEach(function(t){dl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):sl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function dl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function fl(e,t){return bl(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||gl(e,t)||ml()}function pl(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function yl(e){return bl(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||gl(e)||ml()}function ml(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function gl(e,t){if(e){if("string"===typeof e)return hl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?hl(e,t):void 0}}function hl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function bl(e){if(Array.isArray(e))return e}function Ol(e,t,n){let r=n?Object(oe.c)(e,n):e;return t&&r&&(r=r.filter(e=>!!e.transfer_acct)),r||[]}function wl(e,t){return"new"!==e||t.current.startsWith("new:")?e:"new:"+t.current}function El(e){return"string"===typeof e&&e.startsWith("new:")?"new":e}var vl={overflow:"auto",padding:"5px 0"},jl={maxHeight:175},Sl={display:"block",color:w.a.g8,borderRadius:4,fontSize:11,fontWeight:500},xl={color:w.a.g8,marginRight:5,display:"inline-block"},Cl={color:w.a.y9,padding:"4px 9px"},kl={fontSize:11,padding:5,color:w.a.n5,textAlign:"center"};function Pl({items:e,getItemProps:t,highlightedIndex:n,embedded:r,inputValue:a,footer:o}){let i=e.filtered,c=null;if("new"===(e=[...e])[0].id){let t=yl(e),n=t[0],r=t.slice(1);c=n,e=r}let s=c?1:0,u=null;return l.a.createElement(E.y,null,l.a.createElement(E.y,{style:[vl,!r&&jl]},c&&l.a.createElement(E.y,Object.assign({},t?t({item:c}):null,{style:{flexShrink:0,padding:"6px 9px",backgroundColor:0===n?w.a.n4:"transparent",borderRadius:r?4:0}}),l.a.createElement(E.y,{style:Sl},l.a.createElement(Ct,{width:8,height:8,style:xl}),'Create Payee "',a,'"')),e.map((a,o)=>{let c,d=a.transfer_acct?"account":"payee";"payee"===d&&u!==d?c="Payees":"account"===d&&u!==d&&(c="Transfer To/From");let f=o===e.length-1&&i;return u=d,l.a.createElement(l.a.Fragment,{key:a.id},c&&l.a.createElement("div",{key:"title-"+o,style:Cl},c),l.a.createElement("div",Object.assign({},t?t({item:a}):null,{key:a.id,style:{backgroundColor:n===o+s?w.a.n4:"transparent",borderRadius:r?4:0,padding:4,paddingLeft:20}}),a.name),f&&l.a.createElement("div",{style:kl},"More payees are available, search to find them"))})),o)}var Al={marginBottom:5},Il={backgroundColor:w.a.y8,color:w.a.g2,borderColor:w.a.y8},Dl={backgroundColor:w.a.y8,colors:w.a.y2};function Tl(e){let t=e.value,n=e.inputProps,r=e.showMakeTransfer,a=void 0===r||r,i=e.showManagePayees,c=void 0!==i&&i,u=e.defaultFocusTransferPayees,d=void 0!==u&&u,f=e.tableBehavior,p=e.embedded,y=e.onUpdate,m=e.onSelect,g=e.onManagePayees,h=pl(e,cl),b=de(),O=he(),w=fl(Object(o.useState)(d),2),E=w[0],v=w[1],j=Object(o.useMemo)(()=>[{id:"new",name:""},...Ol(b,E,O)],[b,E,O]),S=Object(o.useRef)(""),x=Object(s.c)();return l.a.createElement(Wo,Object.assign({key:E?"transfers":"all",strict:!0,embedded:p,value:El(t),suggestions:j,tableBehavior:f,itemToString:e=>e?"new"===e.id?S.current:e.name:"",inputProps:ul(ul({},n),{},{onChange:e=>S.current=e}),onUpdate:e=>y&&y(wl(e,S)),onSelect:async function(e){if(f)m&&m(wl(e,S));else{let t=()=>x(Object(il.f)(S.current));Array.isArray(e)?e=await Promise.all(e.map(e=>"new"===e?t():e)):"new"===e&&(e=await t()),m&&m(e)}},getHighlightedIndex:e=>e.length>1&&"new"===e[0].id?1:0,filterSuggestions:(e,t)=>{let n=e.filter((e,n)=>"new"===e.id?!(!t||""===t||E):so(e,t));n.sort((e,n)=>{let r=e.name.toLowerCase().startsWith(t.toLowerCase()),a=n.name.toLowerCase().startsWith(t.toLowerCase()),o=e.name.toLowerCase()===t.toLowerCase(),l=n.name.toLowerCase()===t.toLowerCase();return"new"===e.id?-1:"new"===n.id?1:o&&!l?-1:!o&&l?1:r===a?0:r&&!a?-1:1});let r=n.length>100;return(n=n.slice(0,100)).filtered=r,n.length>=2&&"new"===n[0].id&&n[1].name.toLowerCase()===t.toLowerCase()?n.slice(1):n},initialFilterSuggestions:e=>{let t=!1,n=e.filter((e,n)=>"new"!==e.id&&(!(n>=100&&!e.transfer_acct)||(t=!0,!1)));return t&&(n.filtered=!0),n},renderItems:(e,t,n,r)=>l.a.createElement(Pl,{items:e,getItemProps:t,highlightedIndex:n,inputValue:r,embedded:p,footer:l.a.createElement($o,{embedded:p},a&&l.a.createElement(No,{title:"Make Transfer",style:[c&&Al,E&&Il],hoveredStyle:E&&Dl,onClick:()=>{y&&y(null),v(!E)}}),c&&l.a.createElement(No,{title:"Manage Payees",onClick:()=>g()}))})},h))}const Ml=["embedded"];function Rl(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Bl={overflow:"auto",padding:"5px 0"},_l={maxHeight:175},Ll={color:w.a.y9,padding:"4px 9px"};function Nl({items:e,getItemProps:t,highlightedIndex:n,embedded:r}){let a=null;return l.a.createElement(E.y,null,l.a.createElement(E.y,{style:[Bl,!r&&_l]},e.map((e,o)=>{const i=!a||e.offbudget!==a.offbudget,c=e.offbudget?"Off Budget":"For Budget";return a=e,[i?l.a.createElement("div",{key:c,style:Ll,"data-testid":"account-item-group"},c):null,l.a.createElement("div",Object.assign({},t?t({item:e}):null,{key:e.id,style:{backgroundColor:n===o?w.a.n4:"transparent",padding:4,paddingLeft:20,borderRadius:r?4:0},"data-testid":"account-item"+(n===o?"-highlighted":"")}),e.name)]})))}function Fl(e){let t=e.embedded,n=Rl(e,Ml),r=he()||[];return l.a.createElement(Wo,Object.assign({strict:!0,highlightFirst:!0,embedded:t,suggestions:r,renderItems:(e,n,r)=>l.a.createElement(Nl,{items:e,getItemProps:n,highlightedIndex:r,embedded:t})},n))}var Ul=n(76);const zl=["width","height","style","color"];function $l(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Wl=function(e){let t=e.width,n=e.height,r=e.style,a=e.color,o=void 0===a?"black":a,i=$l(e,zl);return l.a.createElement("svg",Object.assign({width:t,height:n},i,Object(j.css)(r),{viewBox:"0 0 91 51",version:"1.1",xmlns:"http://www.w3.org/2000/svg"}),l.a.createElement("path",{fill:o,className:"path",d:"M63.0035243,0.00287814875 C61.7906378,0.0600658892 60.7317989,0.842666173 60.3212412,1.985385 C59.9106836,3.12810382 60.2293609,4.40562012 61.1285243,5.22162815 L79.4410243,22.0341281 L3.15977426,22.0341281 C3.05570186,22.0291281 2.95134666,22.0291281 2.84727426,22.0341281 C1.27629006,22.1156281 -0.078297035,23.6193781 0.00352426499,25.1903781 C0.085345265,26.7612781 1.58881846,28.1162281 3.15977426,28.0341281 L79.4410243,28.0341281 L61.1285243,44.8153781 C60.2782139,45.5247824 59.8877978,46.6448836 60.1129217,47.7291351 C60.3380455,48.8133866 61.142102,49.6854787 62.204541,49.9977376 C63.2669799,50.3099965 64.4150384,50.0116459 65.1910243,49.2216281 L89.1910243,27.2216281 C89.8053452,26.6537206 90.1546504,25.8551089 90.1546504,25.0185031 C90.1546504,24.1818974 89.8053452,23.3832857 89.1910243,22.8153781 L65.1910243,0.815378149 C64.6013672,0.2604644 63.812455,-0.0325601255 63.0035243,0.00287814875 Z"}))};const Gl=["width","height","style","color"];function Hl(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var ql=function(e){let t=e.width,n=e.height,r=e.style,a=e.color,o=void 0===a?"black":a,i=Hl(e,Gl);return l.a.createElement("svg",Object.assign({width:t,height:n},i,Object(j.css)(r),{viewBox:"0 0 91 51",version:"1.1",xmlns:"http://www.w3.org/2000/svg"}),l.a.createElement("path",{fill:o,className:"path",d:"M30.2563657,48.6143861 C30.2183019,47.790406 29.8626205,47.0158388 29.2674654,46.4614308 L10.8027839,29.0634209 L87.7179501,29.0634209 C87.8228144,29.068595 87.9281828,29.068595 88.0330471,29.0634209 C89.6171025,28.9790826 90.9828587,27.4229632 90.9004294,25.7972517 C90.818,24.1715403 89.3017535,22.7693512 87.7179501,22.8544657 L10.8027839,22.8544657 L29.2674654,5.48879403 C30.5505402,4.39032637 30.7227091,2.43243582 29.6523878,1.11587861 C28.5820665,-0.200678607 26.6743435,-0.377892537 25.3915208,0.720575124 C25.3146371,0.786286567 25.2410305,0.855878607 25.171205,0.929092537 L0.971759003,23.6952617 C-0.255102493,24.8594408 -0.330221607,26.8235403 0.803875346,28.0826647 C0.857567867,28.1424259 0.913781163,28.1998587 0.971759003,28.2549632 L25.171205,51.0211323 C25.7656039,51.5954607 26.5614127,51.8986647 27.3768837,51.8619284 C29.0458892,51.7812119 30.3347618,50.3270229 30.2563657,48.6143861 Z"}))};function Yl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yl(Object(n),!0).forEach(function(t){Vl(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vl(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ql=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Kl({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M12.406 14.905a1 1 0 0 0-.543 1.307 1 1 0 0 1-.217 1.09l-2.828 2.829a2 2 0 0 1-2.828 0L3.868 18.01a2 2 0 0 1 0-2.829L6.7 12.353a1.013 1.013 0 0 1 1.091-.217 1 1 0 0 0 .763-1.849 3.034 3.034 0 0 0-3.268.652l-2.832 2.828a4.006 4.006 0 0 0 0 5.657l2.122 2.121a4 4 0 0 0 5.656 0l2.829-2.828a3.008 3.008 0 0 0 .651-3.27 1 1 0 0 0-1.306-.542z",fill:"currentColor"}),l.a.createElement("path",{d:"M7.757 16.241a1.011 1.011 0 0 0 1.414 0l7.779-7.778a1 1 0 0 0-1.414-1.414l-7.779 7.778a1 1 0 0 0 0 1.414z",fill:"currentColor"}),l.a.createElement("path",{d:"M21.546 4.574l-2.121-2.121a4.006 4.006 0 0 0-5.657 0l-2.829 2.828a3.006 3.006 0 0 0-.651 3.269 1 1 0 1 0 1.849-.764 1 1 0 0 1 .217-1.086l2.828-2.828a2 2 0 0 1 2.829 0l2.121 2.121a2 2 0 0 1 0 2.829L17.3 11.645a1.015 1.015 0 0 1-1.091.217 1 1 0 0 0-.765 1.849 3.026 3.026 0 0 0 3.27-.651l2.828-2.828a4.007 4.007 0 0 0 .004-5.658z",fill:"currentColor"})),Zl=n(128);function Xl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Jl(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xl(Object(n),!0).forEach(function(t){ei(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xl(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ei(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ti=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Jl({color:"#242134"},e.style)}),l.a.createElement("g",{fill:"#000"},l.a.createElement("path",{d:"M23.962 17.457l-.82-3.297a1.287 1.287 0 0 0-1.56-.934l-3.294.823a1.286 1.286 0 0 0-.343 2.35L19 17.03A9.538 9.538 0 0 1 12 20.604a8.652 8.652 0 0 1-8.085-5.667 1.286 1.286 0 0 0-2.415.884A11.232 11.232 0 0 0 12 23.175a12.108 12.108 0 0 0 9.214-4.8l.839.503a1.286 1.286 0 0 0 1.91-1.415zM2.422 10.774l3.295-.823a1.286 1.286 0 0 0 .352-2.35l-.972-.583A9.588 9.588 0 0 1 12 3.396a8.652 8.652 0 0 1 8.085 5.667A1.286 1.286 0 0 0 22.5 8.18 11.232 11.232 0 0 0 12 .825 12.242 12.242 0 0 0 2.866 5.68l-.919-.552a1.286 1.286 0 0 0-1.91 1.414l.82 3.297a1.287 1.287 0 0 0 1.246.974 1.311 1.311 0 0 0 .32-.04z",fill:"currentColor"})));function ni(e,t){throw new Error(t+": "+JSON.stringify(e.str.slice(e.index,10)))}function ri(e){return e.str[e.index]}function ai(e){if(e.index>=e.str.length)return null;let t=ri(e);return e.index++,t}function oi(e,t){return ri(e)===t&&(ai(e),!0)}function li(e){if("("===ri(e)){ai(e);let t=ii(e);return")"!==ri(e)&&ni(e,"Unbalanced parentheses"),ai(e),t}return function(e){let t="-"===ri(e);t&&ai(e),"$"===ri(e)&&ai(e);let n="";for(;ri(e)&&ri(e).match(/[0-9,.]/);){let t=","===Object(we.getNumberFormat)().separator?".":",";ri(e)===t?ai(e):n+=ai(e)}""===n&&ni(e,"Unexpected character");let r=parseFloat(n.replace(Object(we.getNumberFormat)().separator,"."));return t?-r:r}(e)}let ii=function(...e){return e.reduce((e,t)=>n=>{let r=e(n);for(;oi(n,t);)r={op:t,left:r,right:e(n)};return r},li)}("^","/","*","-","+");function ci(e,t=null){if(""===e)return t;let n;try{n=function e(t){if("number"===typeof t)return t;let n=t.left,r=t.right,a=t.op;switch(a){case"+":return e(n)+e(r);case"-":return e(n)-e(r);case"*":return e(n)*e(r);case"/":return e(n)/e(r);case"^":return Math.pow(e(n),e(r));default:throw new Error("Unknown operator: "+a)}}(function(e){let t={str:e.replace(/\s/g,""),index:0};return ii(t)}(e))}catch(r){return t}return isNaN(n)?t:n}var si=n(25);n(33);function ui(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function di(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ui(Object(n),!0).forEach(function(t){fi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ui(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function fi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var pi=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:di({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M12 0a10.286 10.286 0 0 0-6.243 18.45 1.714 1.714 0 0 1 .672 1.36v1.619A2.571 2.571 0 0 0 9 24a1.714 1.714 0 0 0 1.714-1.714V21a1.286 1.286 0 0 1 2.572 0v1.286A1.714 1.714 0 0 0 15 24a2.571 2.571 0 0 0 2.571-2.571V19.81a1.714 1.714 0 0 1 .672-1.36A10.286 10.286 0 0 0 12 0zM7.714 12.429a2.143 2.143 0 1 1 2.143-2.143 2.143 2.143 0 0 1-2.143 2.143zm8.572 0a2.143 2.143 0 1 1 2.143-2.143 2.143 2.143 0 0 1-2.143 2.143z",fill:"currentColor"}));function yi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yi(Object(n),!0).forEach(function(t){gi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var hi=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:mi({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M7.176 22.5a4.111 4.111 0 0 1-3.17-1.486l-3.62-4.6a1.8 1.8 0 1 1 2.828-2.228l3.6 4.56a.384.384 0 0 0 .379.152.52.52 0 0 0 .408-.197L20.794 2.177a1.8 1.8 0 1 1 2.812 2.246L10.39 20.964A4.12 4.12 0 0 1 7.2 22.5z",fill:"currentColor"}));function bi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Oi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bi(Object(n),!0).forEach(function(t){wi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Ei=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Oi({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M23.91 9.113a1.785 1.785 0 0 0-1.453-1.227l-6.132-.926-2.714-5.506a1.863 1.863 0 0 0-3.222 0l-2.78 5.552-6.066.88a1.798 1.798 0 0 0-1 3.068l4.428 4.361-1.028 6.055a1.797 1.797 0 0 0 2.607 1.895l5.488-2.865 5.429 2.858a1.797 1.797 0 0 0 2.607-1.895l-1.011-6.128 4.394-4.286a1.786 1.786 0 0 0 .454-1.836z",fill:"currentColor"}));function vi(e){let t,n,r;switch(e){case"missed":t=w.a.r1,n=w.a.r10,r=pi;break;case"due":t=w.a.y1,n=w.a.y9,r=et;break;case"upcoming":t=w.a.p1,n=w.a.p10,r=Be;break;case"paid":t=w.a.g2,n=w.a.g10,r=hi;break;case"completed":t=w.a.n4,n=w.a.n11,r=Ei;break;case"pending":t=w.a.g4,n=w.a.g11,r=Be;break;case"scheduled":t=w.a.n1,n=w.a.n11,r=Be;break;default:t=w.a.n1,n=w.a.n11,r=fa}return{color:t,backgroundColor:n,Icon:r}}var ji={width:13,height:13,color:"inherit",marginRight:7},Si={lineHeight:"1em"};function xi({status:e,style:t}){let n=vi(e),r=n.color,a=n.backgroundColor,o=n.Icon;return l.a.createElement(E.y,{style:[{color:r,backgroundColor:a,padding:"6px 8px",borderRadius:4,flexDirection:"row",alignItems:"center",flexShrink:0},t]},l.a.createElement(o,{style:ji}),l.a.createElement(E.w,{style:Si},Object(we.titleFirst)(e)))}function Ci(e,t,n){let r=Ee.c();return t?"completed":n?"paid":e===r?"due":e>r&&e<=Ee.a(r,7)?"upcoming":e<r?"missed":"scheduled"}function ki(e){return Ee.g(new Date(2020,0,e,12),"do")}function Pi(e){return{SU:"Sunday",MO:"Monday",TU:"Tuesday",WE:"Wednesday",TH:"Thursday",FR:"Friday",SA:"Saturday"}[e]}function Ai(e){let t=e.interval||1;switch(e.frequency){case"weekly":{let n="Every ";return n+=1!==t?`${t} weeks`:"week",n+=" on "+Ee.g(e.start,"EEEE")}case"monthly":{let n="Every ";if(n+=1!==t?`${t} months`:"month",e.patterns&&e.patterns.length>0){let t=[...e.patterns].sort((e,t)=>{let n=("day"===e.type?1:0)-("day"===t.type?1:0),r=e.value-t.value;return 0===n?r:n}).filter(e=>-1!==e.value);t=t.concat(e.patterns.filter(e=>-1===e.value)),n+=" on the ";let r=[],a=new Set(t.map(e=>e.type)),o=1===a.length&&!a.has("day");for(let e of t)if("day"===e.type)-1===e.value?r.push("last day"):r.push(ki(e.value));else{let t=o?"":" "+Pi(e.type);-1===e.value?r.push("last"+t):r.push(ki(e.value)+t)}r.length>2?(n+=r.slice(0,r.length-1).join(", "),n+=", and ",n+=r[r.length-1]):n+=r.join(" and "),o&&(n+=" "+Pi(t[0].type))}else n+=" on the "+Ee.g(e.start,"do");return n}case"yearly":{let n="Every ";return n+=1!==t?`${t} years`:"year",n+=" on "+Ee.g(e.start,"LLL do")}default:return"Recurring error"}}function Ii(e){return{payee:e.find(e=>"is"===e.op&&"payee"===e.field)||e.find(e=>"is"===e.op&&"description"===e.field)||null,account:e.find(e=>"is"===e.op&&"account"===e.field)||e.find(e=>"is"===e.op&&"acct"===e.field)||null,amount:e.find(e=>("is"===e.op||"isapprox"===e.op||"isbetween"===e.op)&&"amount"===e.field)||null,date:e.find(e=>("is"===e.op||"isapprox"===e.op)&&"date"===e.field)||null}}function Di(e){return e&&"number"!==typeof e?(e.num1+e.num2)/2|0:e}function Ti(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Mi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Mi(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ri(e,t){return Object(ae.d)(function(e){let t=e.map(e=>{let t=e._conditions.find(e=>"date"===e.field);return{$and:{schedule:e.id,date:{$gte:t&&"is"===t.op?e.next_date:Ee.x(e.next_date,2)}}}});return Object(ve.a)("transactions").filter({$or:t}).orderBy({date:"desc"}).groupBy("schedule").select(["schedule","date"])}(e),t,{mapper:t=>{let n=new Set(t.filter(Boolean).map(e=>e.schedule));return new Map(e.map(e=>[e.id,Ci(e.next_date,e.completed,n.has(e.id))]))}})}function Bi({transform:e}={}){let t=Ti(Object(o.useState)(null),2),n=t[0],r=t[1];return Object(o.useEffect)(()=>{let t,n,a=Object(ae.c)("schedules").select("*");return t=Object(ae.d)(e?e(a):a,async e=>{t&&(n&&n.unsubscribe(),n=Ri(e,t=>r({schedules:e,statuses:t})))}),()=>{t&&t.unsubscribe(),n&&n.unsubscribe()}},[e]),n}let _i=l.a.createContext(null);function Li({transform:e,children:t}){let n=Bi({transform:e});return l.a.createElement(_i.Provider,{value:n,children:t})}function Ni(){return Object(o.useContext)(_i)}const Fi=["debit","credit","date"];function Ui(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return zi(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zi(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function $i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Wi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wi(Object(n),!0).forEach(function(t){Hi(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hi(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}w.a.n11;function qi(e,t,n){let r=e.amount,a=e.date;Rc(e.id)&&(r=Di(r));let o=r<0?-r:null,l=r>0?r:null;return 0===r&&(t?l=0:o=0),Object(Oe.a)(Object(Ga.a)(a))||(a=null),Gi(Gi({},e),{},{date:a,debit:null!=o?Object(we.integerToCurrency)(o):"",credit:null!=l?Object(we.integerToCurrency)(l):""})}function Yi(e,t){let n=e[t],r=t;for(;r>=0;){if(e[r].id===n.parent_id)return e[r];r--}return null}function Ki(e,t){let n=e[t];return n&&n.is_child&&(null==e[t+1]||e[t+1].parent_id!==n.parent_id)}let Vi=l.a.createContext(null);function Qi(){let e=Object(o.useContext)(Vi);return Object(o.useMemo)(()=>Gi(Gi({},e),{},{expanded:t=>"collapse"===e.state.mode?!e.state.ids.has(t):e.state.ids.has(t)}),[e])}function Zi({children:e,initialMode:t="expand"}){let n=Object(s.d)(e=>e.app.lastSplitState),r=Object(s.c)(),a=Ui(Object(o.useReducer)((e,t)=>{switch(t.type){case"toggle-split":{let n=new Set([...e.ids]),r=t.id;return n.has(r)?n.delete(r):n.add(r),Gi(Gi({},e),{},{ids:n})}case"open-split":{let n=new Set([...e.ids]),r=t.id;return"collapse"===e.mode?n.delete(r):n.add(r),Gi(Gi({},e),{},{ids:n})}case"set-mode":return Gi(Gi({},e),{},{mode:t.mode,ids:new Set,transitionId:null});case"switch-mode":return null!=e.transitionId?e:Gi(Gi({},e),{},{mode:"expand"===e.mode?"collapse":"expand",transitionId:t.id,ids:new Set});case"finish-switch-mode":return Gi(Gi({},e),{},{transitionId:null});default:throw new Error("Unknown action type: "+t.type)}},n.current||{ids:new Set,mode:t}),2),i=a[0],c=a[1];Object(o.useEffect)(()=>{null!=i.transitionId&&setTimeout(()=>{c({type:"finish-switch-mode"})},250)},[i.transitionId]),Object(o.useEffect)(()=>{null==i.transitionId&&r({type:"SET_LAST_SPLIT_STATE",splitState:i})},[i]);let u=Object(o.useMemo)(()=>({state:i,dispatch:c}),[i,c]);return l.a.createElement(Vi.Provider,{value:u},e)}var Xi={color:w.a.n4,fontWeight:300,zIndex:200};const Ji=l.a.memo(({hasSelected:e,showAccount:t,showCategory:n,showBalance:r})=>{let a=Object(si.d)();return l.a.createElement(xa.h,{borderColor:w.a.n9,backgroundColor:"white",style:Xi},l.a.createElement(xa.i,{exposed:!0,focused:!1,selected:e,width:20,onSelect:()=>a({type:"select-all"})}),l.a.createElement(xa.a,{value:"Date",width:110}),t&&l.a.createElement(xa.a,{value:"Account",width:"flex"}),l.a.createElement(xa.a,{value:"Payee",width:"flex"}),l.a.createElement(xa.a,{value:"Notes",width:"flex"}),n&&l.a.createElement(xa.a,{value:"Category",width:"flex"}),l.a.createElement(xa.a,{value:"Payment",width:80,textAlign:"right"}),l.a.createElement(xa.a,{value:"Deposit",width:80,textAlign:"right"}),r&&l.a.createElement(xa.a,{value:"Balance",width:85,textAlign:"right"}),l.a.createElement(xa.e,{width:21,truncate:!1}),l.a.createElement(xa.a,{value:"",width:15+w.c.scrollbarWidth}))});var ec={flexDirection:"row",alignItems:"center"},tc={marginRight:5,flexShrink:0};var nc={padding:1},rc={visibility:"hidden"};function ac({id:e,focused:t,selected:n,status:r,isChild:a,onEdit:o,onUpdate:i}){let c="cleared"===r||null==r,s=vi(r),u={color:"cleared"===r?w.a.g5:"missed"===r?w.a.r6:"due"===r?w.a.y5:n?w.a.b7:w.a.n6};return l.a.createElement(xa.a,{name:"cleared",width:"auto",focused:t,style:nc,plain:!0},l.a.createElement(xa.b,{style:[{padding:3,border:"1px solid transparent",borderRadius:50,":focus":{border:"1px solid "+u.color,boxShadow:`0 1px 2px ${u.color}`}},a&&rc],onEdit:()=>o(e,"cleared"),onSelect:function(){c&&i("cleared",!("cleared"===r))}},l.a.createElement(s.Icon,{style:{width:13,height:13,color:u.color,marginTop:"due"===r?-1:0}})))}var oc={color:w.a.n8};function lc({id:e,payeeId:t,focused:n,inherited:r,payees:a,accounts:i,valueStyle:c,transaction:s,payee:u,transferAcct:d,importedPayee:f,isPreview:p,onEdit:y,onUpdate:m,onCreatePayee:g,onManagePayees:h}){let b=Object(o.useRef)(!1);return l.a.createElement(xa.c,{width:"flex",name:"payee",value:t,valueStyle:[c,r&&oc],formatter:e=>(function(e,t,n){let r=e.payee;if(n){const t=e.amount>0?ql:Wl;return l.a.createElement(E.y,{style:ec},l.a.createElement(t,{width:10,height:8,style:tc}),l.a.createElement("div",null,n.name))}return t&&!t.transfer_acct?t.name:r&&r.startsWith("new:")?r.slice("new:".length):""})(s,u,d),exposed:n,title:f||t,onExpose:!p&&(t=>y(e,t)),onUpdate:async e=>{if(m("payee",e),e&&e.startsWith("new:")&&!b.current){b.current=!0;let t=await g(e.slice("new:".length));m("payee",t),b.current=!1}}},({onBlur:e,onKeyDown:n,onUpdate:r,onSave:o,shouldSaveFromKey:c,inputStyle:u})=>l.a.createElement(l.a.Fragment,null,l.a.createElement(Tl,{payees:a,accounts:i,value:t,shouldSaveFromKey:c,inputProps:{onBlur:e,onKeyDown:n,style:u},showManagePayees:!0,tableBehavior:!0,defaultFocusTransferPayees:s.is_child,focused:!0,onUpdate:r,onSelect:o,onManagePayees:()=>h(t)})))}var ic={flex:1,flexDirection:"row",alignItems:"stretch"};function cc({scheduleId:e,children:t}){let n=Ni().schedules.find(t=>t.id===e);if(null==n)return t;let r=n._date&&!!n._date.frequency,a={width:13,height:13,marginLeft:5,marginRight:3,color:"inherit"};var o=Gi(Gi({},a),{},{transform:"translateY(-1px)"});return l.a.createElement(E.y,{style:ic},l.a.createElement(xa.a,{exposed:!0},()=>r?l.a.createElement(ti,{style:a}):l.a.createElement(Be,{style:o})),t)}var sc={color:w.a.n5,fontStyle:"italic"},uc={opacity:.5},dc={width:110,backgroundColor:w.a.n11,borderBottomWidth:0},fc={flex:1,backgroundColor:w.a.n11,opacity:0},pc={borderLeftWidth:1},yc={lineHeight:0},mc={borderLeftWidth:1},gc={width:13,height:13,color:w.a.n7},hc={alignItems:"flex-start"},bc={padding:0},Oc={alignSelf:"flex-start",color:w.a.n6,borderRadius:4,transition:"none","&:hover":{backgroundColor:"rgba(100, 100, 100, .15)",color:w.a.n5}},wc={flexDirection:"row",alignItems:"center",alignSelf:"stretch",borderRadius:4,flex:1,padding:4},Ec={fontStyle:"italic",userSelect:"none"},vc={fontStyle:"italic",color:"#c0c0c0",fontWeight:300},jc={fontStyle:"italic",fontWeight:300,color:w.a.p8},Sc={fontStyle:"italic"},xc={fontStyle:"italic"};const Cc=l.a.memo(function(e){let t=e.transaction,n=e.editing,r=e.backgroundColor,a=void 0===r?"white":r,i=e.showAccount,c=e.showBalance,s=e.showZeroInDeposit,u=e.style,d=e.hovered,f=e.selected,p=e.highlighted,y=e.added,m=e.matched,g=e.expanded,h=e.inheritedFields,b=e.focusedField,O=e.categoryGroups,v=e.payees,j=e.accounts,S=e.balance,x=e.dateFormat,C=void 0===x?"MM/dd/yyyy":x,k=e.onSave,P=e.onEdit,A=e.onHover,I=e.onDelete,D=e.onSplit,T=e.onManagePayees,M=e.onCreatePayee,R=e.onToggleSplit,B=Object(si.d)(),_=Ui(Object(o.useState)(s),2),L=_[0],N=_[1],F=Ui(Object(o.useState)(t),2),U=F[0],z=F[1],$=Ui(Object(o.useState)(qi(t,s)),2),W=$[0],G=$[1],H=Rc(W.id);function q(e,n){if(W[e]!==n){let r=Gi(Gi({},W),{},{[e]:n});if("account"===e&&n&&Object(oe.b)(j)[n].offbudget&&(r.category=null),"credit"===e?r.debit="":"debit"===e&&(r.credit=""),"payee"===e&&n&&n.startsWith("new:"))G(r);else{let e=function(e,t,n){let r,a=e.debit,o=e.credit,l=e.date,i=$i(e,Fi);if(""!==a){let e=ci(a,null);r=null!=e?-e:null}else r=ci(o,null);return r=null!=r?Object(we.amountToInteger)(r):t.amount,null==l&&(l=t.date||Object(Ee.c)()),Gi(Gi({},i),{},{date:l,amount:r})}(r,t);G(qi(e,s)),k(e)}}}t===U&&s===L||(G(qi(t,s)),z(t),N(s));let Y=W.id,K=W.debit,V=W.credit,Q=W.payee,Z=W.imported_payee,X=W.notes,J=W.date,ee=W.account,te=W.category,ne=W.cleared,re=W.is_parent,ae=W._unmatched,le=void 0!==ae&&ae,ie=v&&Q&&Object(oe.e)(v)[Q],ce=j&&ee&&Object(oe.b)(j)[ee],se=ie&&ie.transfer_acct&&Object(oe.b)(j)[ie.transfer_acct],ue=W.is_child,de=f?w.a.b8:w.a.border,fe=se&&0===se.offbudget,pe=ce&&1===ce.offbudget,ye=y?{fontWeight:600}:null,me=d||"select"===b;var ge={color:"missed"===X?w.a.r6:"due"===X?w.a.y4:f?w.a.b5:w.a.n6,backgroundColor:"missed"===X?w.a.r10:"due"===X?w.a.y9:f?w.a.b8:w.a.n10,margin:"0 5px",padding:"3px 7px",borderRadius:4};return l.a.createElement(xa.h,{borderColor:de,backgroundColor:f?w.a.selected:me?w.a.hover:H?"#fcfcfc":a,highlighted:p,style:[u,H&&sc,le&&uc],onMouseEnter:()=>A&&A(W.id)},ue&&l.a.createElement(xa.e,{borderColor:"transparent",width:110,style:dc}),ue&&i&&l.a.createElement(xa.e,{borderColor:"transparent",style:fc}),Mc(W.id)?ue?l.a.createElement(xa.d,{onDelete:()=>I&&I(W.id),exposed:d||n,style:[ue&&pc,yc]}):l.a.createElement(xa.a,{width:20}):l.a.createElement(xa.i,{exposed:d||f||n,focused:"select"===b,onSelect:()=>{B({type:"select",id:W.id})},onEdit:()=>P(Y,"select"),selected:f,style:[ue&&mc],value:m&&l.a.createElement(Ql,{style:gc})}),!ue&&l.a.createElement(xa.c,{name:"date",width:110,exposed:"date"===b,value:J,valueStyle:ye,formatter:e=>e?Object(Ha.a)(Object(Ga.a)(e),C):"",onExpose:!H&&(e=>P(Y,e)),onUpdate:e=>{q("date",e)}},({onBlur:e,onKeyDown:t,onUpdate:n,onSave:r,shouldSaveFromKey:a,inputStyle:o})=>l.a.createElement(Ul.a,{value:J||"",dateFormat:C,inputProps:{onBlur:e,onKeyDown:t,style:o},shouldSaveFromKey:a,tableBehavior:!0,onUpdate:n,onSelect:r})),!ue&&i&&l.a.createElement(xa.c,{name:"account",width:"flex",value:ee,formatter:e=>{let t=e&&Object(oe.b)(j)[e];return t?t.name:""},valueStyle:ye,exposed:"account"===b,onExpose:!H&&(e=>P(Y,e)),onUpdate:async e=>{e&&q("account",e)}},({onBlur:e,onKeyDown:t,onUpdate:n,onSave:r,shouldSaveFromKey:a,inputStyle:o})=>l.a.createElement(Fl,{value:ee,accounts:j,shouldSaveFromKey:a,tableBehavior:!0,focused:!0,inputProps:{onBlur:e,onKeyDown:t,style:o},onUpdate:n,onSelect:r})),(()=>{let e=l.a.createElement(lc,{id:Y,payeeId:Q,focused:"payee"===b,inherited:h&&h.has("payee"),payees:v,accounts:j,valueStyle:ye,transaction:W,payee:ie,transferAcct:se,importedPayee:Z,isPreview:H,onEdit:P,onUpdate:q,onCreatePayee:M,onManagePayees:T});return W.schedule?l.a.createElement(cc,{scheduleId:W.schedule},e):e})(),H?l.a.createElement(xa.a,{name:"notes",width:"flex"}):l.a.createElement(xa.f,{width:"flex",name:"notes",exposed:"notes"===b,focused:"notes"===b,value:X||"",valueStyle:ye,onExpose:!H&&(e=>P(Y,e)),inputProps:{value:X||"",onUpdate:q.bind(null,"notes")}}),H?l.a.createElement(xa.a,{width:"flex",style:hc,exposed:!0},()=>l.a.createElement(E.y,{style:ge},Object(we.titleFirst)(X))):re?l.a.createElement(xa.a,{name:"category",width:"flex",focused:"category"===b,style:bc,plain:!0},l.a.createElement(xa.b,{style:Oc,disabled:Mc(W.id),onEdit:()=>P(Y,"category"),onSelect:()=>R(Y)},l.a.createElement(E.y,{style:wc},re&&l.a.createElement(ca,{style:{width:14,height:14,color:"currentColor",transition:"transform .08s",transform:g?"rotateZ(0)":"rotateZ(-90deg)"}}),l.a.createElement(E.w,{style:Ec},"Split")))):fe||pe||H?l.a.createElement(xa.f,{name:"category",width:"flex",exposed:"category"===b,focused:"category"===b,onExpose:!H&&(e=>P(Y,e)),value:re?"Split":pe?"Off Budget":fe?"Transfer":"",valueStyle:ye,style:vc,inputProps:{readOnly:!0,style:{fontStyle:"italic"}}}):l.a.createElement(xa.c,{name:"category",width:"flex",value:te,formatter:e=>e?function(e,t){return e?e[t]:""}(Object(oe.d)(O)[e],"name"):W.id?"Categorize":"",exposed:"category"===b,onExpose:e=>P(Y,e),valueStyle:te?ye:jc,onUpdate:async e=>{"split"===e?D(W.id):q("category",e)}},({onBlur:e,onKeyDown:t,onUpdate:n,onSave:r,shouldSaveFromKey:a,inputStyle:o})=>l.a.createElement(ll,{categoryGroups:O,value:te,focused:!0,tableBehavior:!0,showSplitOption:!ue&&!re,shouldSaveFromKey:a,inputProps:{onBlur:e,onKeyDown:t,style:o},onUpdate:n,onSelect:r})),l.a.createElement(xa.f,{type:"input",width:80,name:"debit",exposed:"debit"===b,focused:"debit"===b,value:null==K?"":K,valueStyle:ye,textAlign:"right",title:K,onExpose:!H&&(e=>P(Y,e)),style:[re&&Sc,w.c.tnum],inputProps:{value:K,onUpdate:q.bind(null,"debit")}}),l.a.createElement(xa.f,{type:"input",width:80,name:"credit",exposed:"credit"===b,focused:"credit"===b,value:null==V?"":V,valueStyle:ye,textAlign:"right",title:V,onExpose:!H&&(e=>P(Y,e)),style:[re&&xc,w.c.tnum],inputProps:{value:V,onUpdate:q.bind(null,"credit")}}),c&&l.a.createElement(xa.a,{name:"balance",value:null==S||ue||H?"":Object(we.integerToCurrency)(S),valueStyle:{color:S<0?w.a.r4:w.a.g4},style:w.c.tnum,width:85,textAlign:"right"}),l.a.createElement(ac,{id:Y,focused:"cleared"===b,selected:f,isPreview:H,status:H?X:ne?"cleared":null,isChild:ue,onEdit:P,onUpdate:q}),l.a.createElement(xa.a,{width:15}))});var kc={flexDirection:"row",alignItems:"center",padding:"0 5px"},Pc={fontWeight:500},Ac={flex:1},Ic={marginLeft:15,padding:"4px 10px"};function Dc({error:e,isDeposit:t,onAddSplit:n,style:r}){switch(e.type){case"SplitTransactionError":if(1===e.version)return l.a.createElement(E.y,{style:[kc,r],"data-testid":"transaction-error"},l.a.createElement(E.w,null,"Amount left:"," ",l.a.createElement(E.w,{style:Pc},Object(we.integerToCurrency)(t?e.difference:-e.difference))),l.a.createElement(E.y,{style:Ac}),l.a.createElement(E.d,{style:Ic,primary:!0,onClick:n},"Add Split"));break;default:return null}}function Tc(e,t){return[{id:"temp",date:t||Object(Ee.c)(),account:e||null,cleared:!1,amount:0}]}function Mc(e){return-1!==e.indexOf("temp")}function Rc(e){return-1!==e.indexOf("preview/")}var Bc={borderBottom:"1px solid #ebebeb",paddingBottom:6,backgroundColor:"white"},_c={marginTop:-1},Lc={flexDirection:"row",alignItems:"center",justifyContent:"flex-end",marginTop:6,marginRight:20},Nc={marginRight:10,padding:"4px 10px"},Fc={padding:"4px 10px"};function Uc({transactions:e,accounts:t,currentAccountId:n,categoryGroups:r,payees:a,editingTransaction:o,hoveredTransaction:i,focusedField:c,showAccount:s,showCategory:u,showBalance:d,dateFormat:f,onHover:p,onClose:y,onSplit:m,onEdit:g,onDelete:h,onSave:b,onAdd:O,onAddSplit:w,onManagePayees:v,onCreatePayee:j}){const S=e[0].error,x=e[0].amount>0;return l.a.createElement(E.y,{style:Bc,"data-testid":"new-transaction",onKeyDown:e=>{27===e.keyCode&&y()},onMouseLeave:()=>p(null)},e.map((e,n)=>l.a.createElement(Cc,{key:e.id,editing:o===e.id,hovered:i===e.id,transaction:e,showAccount:s,showCategory:u,showBalance:d,focusedField:o===e.id&&c,showZeroInDeposit:x,accounts:t,categoryGroups:r,payees:a,dateFormat:f,expanded:!0,onHover:p,onEdit:g,onSave:b,onSplit:m,onDelete:h,onAdd:O,onManagePayees:v,onCreatePayee:j,style:_c})),l.a.createElement(E.y,{style:Lc},l.a.createElement(E.d,{style:Nc,onClick:()=>y(),"data-testid":"cancel-button"},"Cancel"),S?l.a.createElement(Dc,{error:S,isDeposit:x,onAddSplit:()=>w(e[0].id)}):l.a.createElement(E.d,{style:Fc,primary:!0,onClick:O,"data-testid":"add-button"},"Add")))}var zc={transform:"translate(-5px, 2px)"},$c={flex:1,cursor:"default"},Wc={flex:1,overflow:"hidden"},Gc={position:"absolute",top:-20,left:0,right:0,height:20,backgroundColor:"red",boxShadow:"0 0 6px rgba(0, 0, 0, .20)"};class Hc extends l.a.Component{constructor(...e){super(...e),this.container=l.a.createRef(),this.state={highlightedRows:null},this.renderRow=(({item:e,index:t,position:n,editing:r,focusedFied:a,onEdit:o})=>{const i=this.state.highlightedRows,c=this.props,s=c.transactions,u=c.selectedItems,d=c.hoveredTransaction,f=c.accounts,p=c.categoryGroups,y=c.payees,m=c.showAccount,g=c.showCategory,h=c.balances,b=c.dateFormat,O=void 0===b?"MM/dd/yyyy":b,w=c.tableNavigator,v=c.isNew,j=c.isMatched,S=c.isExpanded;let x=e,C=d===x.id,k=u.has(x.id),P=!k&&!!i&&i.has(x.id),A=this.getParent(x,t),I=A&&A.amount>0,D=S&&S((A||x).id),T=D&&A&&A.error||x.error;return l.a.createElement(l.a.Fragment,null,(!D||Ki(s,t))&&T&&"SplitTransactionError"===T.type&&l.a.createElement(E.x,{position:"bottom-right",width:250,forceTop:n,forceLayout:!0,style:zc},l.a.createElement(Dc,{error:T,isDeposit:I,onAddSplit:()=>this.props.onAddSplit(x.id)})),l.a.createElement(Cc,{editing:r,transaction:x,showAccount:m,showCategory:g,showBalance:!!h,hovered:C,selected:k,highlighted:P,added:v&&v(x.id),expanded:S&&S(x.id),matched:j&&j(x.id),showZeroInDeposit:I,balance:h&&h[x.id]&&h[x.id].balance,focusedField:r&&w.focusedField,accounts:f,categoryGroups:p,payees:y,inheritedFields:A&&A.payee===x.payee?new Set(["payee"]):new Set,dateFormat:O,onHover:this.props.onHover,onEdit:w.onEdit,onSave:this.props.onSave,onDelete:this.props.onDelete,onSplit:this.props.onSplit,onManagePayees:this.props.onManagePayees,onCreatePayee:this.props.onCreatePayee,onToggleSplit:this.props.onToggleSplit}))})}componentDidMount(){this.highlight=(e=>{this.setState({highlightedRows:new Set(e)},()=>{this.setState({highlightedRows:null})})})}componentWillReceiveProps(e){!this.props.isAdding&&e.isAdding&&this.props.newNavigator.onEdit("temp","date")}componentDidUpdate(){this._cachedParent=null}getParent(e,t){let n=this.props.transactions;return this._cachedParent&&this._cachedParent.id===e.parent_id?this._cachedParent:e.parent_id?(this._cachedParent=Yi(n,t),this._cachedParent):null}render(){let e=this.props,t=e.tableNavigator,n=e.tableRef,r=e.dateFormat,a=void 0===r?"MM/dd/yyyy":r,o=e.newNavigator,i=e.renderEmpty,c=e.onHover,s=e.onScroll;return l.a.createElement(E.y,{innerRef:this.container,style:[$c,e.style]},l.a.createElement(E.y,null,l.a.createElement(Ji,{hasSelected:e.selectedItems.size>0,showAccount:e.showAccount,showCategory:e.showCategory,showBalance:!!e.balances}),e.isAdding&&l.a.createElement(E.y,o.getNavigatorProps({onKeyDown:t=>e.onCheckNewEnter(t)}),l.a.createElement(Uc,{transactions:e.newTransactions,editingTransaction:o.editingId,hoveredTransaction:e.hoveredTransaction,focusedField:o.focusedField,accounts:e.accounts,currentAccountId:e.currentAccountId,categoryGroups:e.categoryGroups,payees:this.props.payees||[],showAccount:e.showAccount,showCategory:e.showCategory,showBalance:!!e.balances,dateFormat:a,onClose:e.onCloseAddTransaction,onAdd:this.props.onAddTemporary,onAddSplit:this.props.onAddSplit,onSplit:this.props.onSplit,onEdit:o.onEdit,onSave:this.props.onSave,onDelete:this.props.onDelete,onHover:this.props.onHover,onManagePayees:this.props.onManagePayees,onCreatePayee:this.props.onCreatePayee}))),l.a.createElement(E.y,{style:[Wc],"data-testid":"transaction-table",onMouseLeave:()=>c(null)},l.a.createElement(xa.l,{navigator:t,ref:n,items:e.transactions,renderItem:this.renderRow,renderEmpty:i,loadMore:e.loadMoreTransactions,isSelected:t=>e.selectedItems.has(t),onKeyDown:t=>e.onCheckEnter(t),onScroll:s}),e.isAdding&&l.a.createElement("div",{key:"shadow",style:Gc})))}}let qc=l.a.forwardRef((e,t)=>{let n=Ui(Object(o.useState)(null),2),r=n[0],a=n[1],i=Ui(Object(o.useState)(e.hoveredTransaction),2),c=i[0],s=i[1],u=Ui(Object(o.useState)(!1),2),d=u[0],f=u[1],p=Qi(),y=Object(o.useRef)(null),m=Object(o.useRef)(null),g=function(e,t){return Object(o.useMemo)(()=>(function(n){[e,t].forEach(e=>{"function"===typeof e?e(n):null!=e&&(e.current=n)})}),[e,t])}(m,t),h=Object(o.useMemo)(()=>{let t;if(null!=p.state.transitionId){let n=e.transactions.findIndex(e=>e.id===p.state.transitionId);t=e.transactions.filter((e,t)=>{if(e.parent_id){if(t>=n)return p.expanded(e.parent_id);if(y.current)return y.current.expanded(e.parent_id)}return!0})}else y.current&&null!=y.current.state.transitionId&&(m.current.anchor(),m.current.setRowAnimation(!1)),y.current=p,t=e.transactions.filter(e=>!e.parent_id||p.expanded(e.parent_id));return y.current=p,t},[e.transactions,p]);Object(o.useEffect)(()=>{m.current.isAnchored()&&(m.current.unanchor(),m.current.setRowAnimation(!0))},[y.current]);let b=Object(xa.o)(r,k),O=Object(xa.o)(h,k),w=Object(o.useRef)(!1),E=Object(o.useRef)({newTransactions:r,newNavigator:b,tableNavigator:O}),v=Object(o.useRef)(!1),j=Object(o.useRef)(!1),S=Ui(Object(o.useState)({}),2),x=(S[0],S[1]),C=Object(si.e)();Object(si.d)();function k(t){let n=["select","date","account","payee","notes","category","debit","credit","cleared"];return n=t.is_child?["select","payee","notes","category","debit","credit"]:n.filter(t=>(e.showAccount||"account"!==t)&&(e.showCategory||"category"!==t)),Rc(t.id)&&(n=["select","cleared"]),Mc(t.id)&&(n=n.slice(1)),n}function P(t){v.current?j.current=t:t(e)}Object(o.useLayoutEffect)(()=>{E.current={newTransactions:r,newNavigator:b,tableNavigator:O,transactions:e.transactions}}),d!==e.isAdding&&(!d&&e.isAdding&&a(Tc(e.currentAccountId)),f(e.isAdding)),Object(o.useEffect)(()=>{if(w.current){if(null==r[0].account)e.addNotification({type:"error",message:"Account is a required field"}),b.onEdit("temp","account");else{let t=E.current.newTransactions,n=t.length>0?t[0].date:null;a(Tc(e.currentAccountId,n)),b.onEdit("temp","date"),e.onAdd(t)}w.current=!1}}),Object(o.useEffect)(()=>{v.current&&j.current&&(j.current(e),j.current=null),v.current=!1},[r,e.transactions]);let A=Object(o.useCallback)(()=>{w.current=!0,x({})},[e.onAdd,b.onEdit]),I=Object(o.useCallback)(async t=>{if(v.current=!0,Mc(t.id)){e.onApplyRules&&(t=await e.onApplyRules(t));let n=E.current.newTransactions;a(za(n,t).data)}else e.onSave(t)},[e.onSave]),D=Object(o.useCallback)(e=>{s(e)},[]),T=Object(o.useCallback)(e=>{if(Mc(e)){let t=E.current.newTransactions;if(e===t[0].id)return;a($a(t,e).data)}},[]),M=Object(o.useMemo)(()=>t=>{if(Mc(t)){let e=E.current.newNavigator,n=Wa(E.current.newTransactions,t),r=n.data,o=n.diff;a(r),e.onEdit(o.added[0].id,E.current.newNavigator.focusedField)}else{let n=E.current.transactions.find(e=>e.id===t),r=e.onSplit(t);p.dispatch({type:"open-split",id:n.id});let a=E.current.tableNavigator;null==n.amount?a.onEdit(n.id,"debit"):a.onEdit(r,a.focusedField)}},[e.onSplit,p.dispatch]),R=Object(o.useCallback)(t=>{if(Mc(t)){let e=Ua(E.current.newTransactions,t),n=e.data,r=e.diff;a(n),b.onEdit(r.added[0].id,E.current.newNavigator.focusedField)}else{let n=e.onAddSplit(t);O.onEdit(n,E.current.tableNavigator.focusedField)}},[e.onAddSplit]);let B=Object(o.useCallback)(e=>p.dispatch({type:"toggle-split",id:e}),[p.dispatch]);return l.a.createElement(Hc,Object.assign({tableRef:g},e,{transactions:h,selectedItems:C,hoveredTransaction:c,isExpanded:p.expanded,onHover:D,onSave:I,onDelete:T,onSplit:M,onCheckNewEnter:function(e){if(13===e.keyCode)if(e.metaKey)e.stopPropagation(),A();else if(!e.shiftKey){function t(e){let t=e.current.newTransactions;return t[t.length-1]}b.editingId===t(E).id&&e.stopPropagation(),P(()=>{let e=t(E),n=e.parent_id||e.is_parent;E.current.newTransactions[0].error&&b.editingId===e.id?R(e.id):"debit"!==b.focusedField&&"credit"!==b.focusedField||b.editingId!==e.id||n&&e.error||A()})}},onCheckEnter:function(e){if(13===e.keyCode&&!e.shiftKey){let t=O.editingId,n=O.focusedField;P(r=>{let a=E.current.transactions,o=a.findIndex(e=>e.id===t),l=Yi(a,o);Ki(a,o)&&l&&l.error&&"select"!==n&&(e.stopPropagation(),R(t))})}},onAddTemporary:A,onAddSplit:R,onCloseAddTransaction:function(){a(Tc(e.currentAccountId)),e.onCloseAddTransaction()},onToggleSplit:B,newTransactions:r,tableNavigator:O,newNavigator:b}))});function Yc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Kc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yc(Object(n),!0).forEach(function(t){Vc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Vc(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(96);async function Qc(e){let t=await Object(h.send)("transactions-batch-update",Kc(Kc({},e),{},{learnCategories:!0}));return t.length>0?{updates:t}:{}}async function Zc(e,t,n){let r=await Qc(e);n(function(e,t){return La(Object(we.applyChanges)(t,Na(e)))}(t.newTransaction,r),Object(we.applyChanges)(r,t.data))}var Xc={backgroundColor:"white"};function Jc({tableRef:e,transactions:t,allTransactions:n,loadMoreTransactions:r,account:a,accounts:i,categoryGroups:c,payees:u,balances:d,showAccount:f,headerContent:p,animated:y,isAdding:m,isNew:g,isMatched:b,isFiltered:O,dateFormat:w,addNotification:E,renderEmpty:v,onChange:j,onRefetch:S,onRefetchUpToRow:x,onCloseAddTransaction:C,onManagePayees:k,onCreatePayee:P}){Object(s.c)(),Object(o.useRef)();let A=Object(o.useRef)(),I=Object(o.useRef)();function D(){I.current=null}Object(o.useEffect)(D),Object(o.useLayoutEffect)(()=>{A.current=t},[t]);let T=Object(o.useCallback)(async e=>{e=function(e){let t=e.find(e=>!e.is_child);t=Aa(Aa({},t),{},{id:Da.v4Sync()});let n=e.filter(e=>e.is_child);return[t,...n.map(e=>Aa(Aa({},e),{},{id:Da.v4Sync(),parent_id:t.id}))]}(e),await Qc({added:e}),S()},[]),M=Object(o.useCallback)(async e=>{let t=za(A.current,e);if(t.diff.updated.length>0){!!t.diff.updated[0].date?(t.diff.updated[0].sort_order=Date.now(),await Qc(t.diff),S()):(j(t.newTransaction,t.data),Zc(t.diff,t,j))}},[]),R=Object(o.useCallback)(e=>{const t=Ua(A.current,e);return j(t.newTransaction,t.data),Zc(t.diff,t,j),t.diff.added[0].id},[]),B=Object(o.useCallback)(e=>{const t=Wa(A.current,e);return j(t.newTransaction,t.data),Zc(t.diff,t,j),t.diff.added[0].id},[]),_=Object(o.useCallback)(async e=>{let t=await Object(h.send)("rules-run",{transaction:e}),n=Object(we.getChangedValues)(e,t),r=Kc({},e);return n&&Object.keys(n).forEach(e=>{null!=r[e]&&""!==r[e]&&0!==r[e]||(r[e]=n[e])}),r},[]);return l.a.createElement(qc,{ref:e,transactions:n,loadMoreTransactions:r,accounts:i,categoryGroups:c,payees:u,balances:d,showAccount:f,showCategory:!0,animated:y,currentAccountId:a&&a.id,isAdding:m,isNew:g,isMatched:b,isFiltered:O,dateFormat:w,addNotification:E,headerContent:p,renderEmpty:v,onSave:M,onApplyRules:_,onSplit:B,onCloseAddTransaction:C,onAdd:T,onAddSplit:R,onManagePayees:k,onCreatePayee:P,onScroll:D,style:Xc})}var es=n(198),ts=n(246),ns=n.n(ts);const rs=["error","inputKey"];function as(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function os(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ls(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?os(Object(n),!0).forEach(function(t){is(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):os(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function is(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const cs={date:{ops:["is","isapprox","gt","gte","lt","lte"],nullable:!1},id:{ops:["is","contains","oneOf"],nullable:!0},string:{ops:["is","contains","oneOf"],nullable:!1},number:{ops:["is","isapprox","isbetween","gt","gte","lt","lte"],nullable:!1},boolean:{ops:["is"],nullable:!1}},ss=new Map(Object.entries({imported_payee:"string",payee:"id",date:"date",notes:"string",amount:"number",amountInflow:"number",amountOutfow:"number",category:"id",account:"id",cleared:"boolean"}));function us(e,t){switch(t=t||{},e){case"imported_payee":return"imported payee";case"amount":return t.inflow?"amount (inflow)":t.outflow?"amount (outflow)":"amount";case"amount-inflow":return"amount (inflow)";case"amount-outflow":return"amount (outflow)";default:return e}}function ds(e,t){switch(e){case"oneOf":return"one of";case"is":return"is";case"isapprox":return"is approx";case"isbetween":return"is between";case"contains":return"contains";case"gt":return"date"===t?"is after":"is greater than";case"gte":return"date"===t?"is after or equals":"is greater than or equals";case"lt":return"date"===t?"is before":"is less than";case"lte":return"date"===t?"is before or equals":"is less than or equals";case"true":return"is true";case"false":return"is false";case"set":return"set";case"link-schedule":return"link schedule";default:return""}}function fs(e){switch(e){case"date-format":return"Invalid date format";case"no-null":case"no-empty-array":case"no-empty-string":return"Value cannot be empty";case"not-number":return"Value must be a number";case"invalid-field":return"Please choose a valid field for this type of rule";default:return"Internal error, sorry! Contact help@actualbudget.com"}}function ps(e){switch(e.type){case"number":{let t=e.value;return"amount"===e.field&&"isbetween"!==e.op&&(t=Object(we.integerToAmount)(t)),ls(ls({},e),{},{value:t})}case"string":{let t=null==e.value?"":e.value;return ls(ls({},e),{},{value:t})}}return ls(ls({},e),{},{error:null})}function ys(e){e.error,e.inputKey;let t=as(e,rs);switch(t.type){case"number":{let e=t.value;return"amount"===t.field&&"isbetween"!==t.op&&(e=Object(we.amountToInteger)(e)),ls(ls({},t),{},{value:e})}case"string":{let e=null==t.value?"":t.value;return ls(ls({},t),{},{value:e})}}return t}function ms(e,t){switch(t.type){case"number":if("isbetween"!==t.op)return ls(ls({},t),{},{error:null,value:e&&Object(we.currencyToAmount)(e)||0})}return ls(ls({},t),{},{error:null,value:e})}function gs(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function hs(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?gs(Object(n),!0).forEach(function(t){bs(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):gs(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function bs(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Os=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:hs({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M4.5 17.5h6.646a3.5 3.5 0 0 0 6.708 0H19.5a1 1 0 0 0 0-2h-1.646a3.5 3.5 0 0 0-6.708 0H4.5a1 1 0 0 0 0 2zm10-2.5a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3zM19.5 6.5h-6.646a3.5 3.5 0 0 0-6.708 0H4.5a1 1 0 0 0 0 2h1.646a3.5 3.5 0 0 0 6.708 0H19.5a1 1 0 1 0 0-2zM9.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3z",fill:"currentColor"})),ws=n(104);const Es=["width","height","style","color"];function vs(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var js=function(e){let t=e.width,n=e.height,r=e.style,a=e.color,o=void 0===a?"black":a,i=vs(e,Es);return l.a.createElement("svg",Object.assign({width:t,height:n},i,Object(j.css)(r),{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"}),l.a.createElement("path",{fill:o,className:"path",className:"path",d:"M23,11.5 L23,11.5 L23,11.5 C23,12.3284271 22.3284271,13 21.5,13 L1.5,13 L1.5,13 C0.671572875,13 1.01453063e-16,12.3284271 0,11.5 L0,11.5 L0,11.5 C-1.01453063e-16,10.6715729 0.671572875,10 1.5,10 L21.5,10 L21.5,10 C22.3284271,10 23,10.6715729 23,11.5 Z"}))};const Ss=["width","height","style","color"];function xs(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Cs=function(e){let t=e.width,n=e.height,r=e.style,a=e.color,o=void 0===a?"black":a,i=xs(e,Ss);return l.a.createElement("svg",Object.assign({width:t,height:n},i,Object(j.css)(r),{viewBox:"0 0 24 24",version:"1.1",xmlns:"http://www.w3.org/2000/svg"}),l.a.createElement("path",{fill:o,className:"path",className:"path",d:"M23,11.5 L23,11.5 L23,11.5 C23,12.3284271 22.3284271,13 21.5,13 L1.5,13 L1.5,13 C0.671572875,13 1.01453063e-16,12.3284271 0,11.5 L0,11.5 L0,11.5 C-1.01453063e-16,10.6715729 0.671572875,10 1.5,10 L21.5,10 L21.5,10 C22.3284271,10 23,10.6715729 23,11.5 Z"}),l.a.createElement("path",{fill:o,className:"path",className:"path",d:"M11.5,23 C10.6715729,23 10,22.3284271 10,21.5 L10,1.5 C10,0.671572875 10.6715729,1.52179594e-16 11.5,0 C12.3284271,-1.52179594e-16 13,0.671572875 13,1.5 L13,21.5 C13,22.3284271 12.3284271,23 11.5,23 Z"}))};function ks(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ps(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ps(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ps(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function As(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Is(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?As(Object(n),!0).forEach(function(t){Ds(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):As(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ds(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Ts=5,Ms=[{id:"weekly",name:"Weeks"},{id:"monthly",name:"Months"},{id:"yearly",name:"Years"}],Rs=[...Array(31).keys()].map(e=>e+1),Bs=[{id:"SU",name:"Sunday"},{id:"MO",name:"Monday"},{id:"TU",name:"Tuesday"},{id:"WE",name:"Wednesday"},{id:"TH",name:"Thursday"},{id:"FR",name:"Friday"},{id:"SA",name:"Saturday"}];function _s(e){return e||{start:Ee.c(),interval:1,frequency:"monthly",patterns:[Ns(Ee.c())]}}function Ls(e){return Is(Is({},e),{},{interval:Gs(e.interval)})}function Ns(e){return{value:parseInt(Ee.g(e,"d")),type:"day"}}function Fs(e,t){switch(t.type){case"replace-config":return Is(Is({},e),{},{config:t.config});case"change-field":return Is(Is({},e),{},{config:Is(Is({},e.config),{},{[t.field]:t.value,patterns:"monthly"!==e.config.frequency?[]:e.config.patterns})});case"update-recurrence":e.config.patterns.indexOf(t.recurrence);return Is(Is({},e),{},{config:Is(Is({},e.config),{},{patterns:e.config.patterns.map(e=>e===t.recurrence?Is(Is({},t.recurrence),function({field:e,value:t,recurrence:n}){return"value"===e&&"day"!==n.type&&t>Ts||"type"===e&&"day"!==t&&n.value>Ts?{[e]:t,value:Ts}:{[e]:t}}(t)):e)})});case"add-recurrence":return Is(Is({},e),{},{config:Is(Is({},e.config),{},{patterns:[...e.config.patterns||[],Ns(e.config.start)]})});case"remove-recurrence":return Is(Is({},e),{},{config:Is(Is({},e.config),{},{patterns:e.config.patterns.filter(e=>e!==t.recurrence)})});default:return e}}var Us={fontWeight:600},zs={marginTop:10},$s={marginTop:15,color:w.a.n4};function Ws({previewDates:e}){if(!e)return null;let t=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy");t=t.replace("MM","M").replace("dd","d");let n=null;return n="string"===typeof e?l.a.createElement(E.w,null,e):l.a.createElement(E.y,null,l.a.createElement(E.w,{style:Us},"Upcoming dates"),l.a.createElement(E.v,{direction:"row",spacing:4,style:zs},e.map(e=>l.a.createElement(E.y,null,l.a.createElement(E.w,null,Ee.g(e,t)),l.a.createElement(E.w,null,Ee.g(e,"EEEE")))))),l.a.createElement(l.a.Fragment,null,l.a.createElement(E.v,{direction:"column",spacing:1,style:$s},n))}function Gs(e){const t=parseInt(e);return Number.isInteger(t)&&t>0?t:1}var Hs={marginTop:10},qs={display:"flex",flexDirection:"row"},Ys={marginRight:10},Ks={marginRight:10},Vs={padding:7},Qs={width:8,height:8},Zs={padding:7,marginLeft:5},Xs={width:10,height:10};function Js({config:e,dispatch:t}){let n=(e,n,r)=>t({type:"update-recurrence",recurrence:e,field:n,value:r});return l.a.createElement(E.v,{spacing:2,style:Hs},e.patterns.map((e,r)=>l.a.createElement(E.y,{key:r,style:qs},l.a.createElement(E.u,{style:Ys,value:e.value,onChange:t=>n(e,"value",function(e){return"last"===e?-1:Number(e)}(t.target.value))},l.a.createElement("option",{value:-1},"Last"),l.a.createElement("option",{disabled:!0},"---"),Rs.map(e=>l.a.createElement("option",{key:e,value:e},e))),l.a.createElement(E.u,{style:Ks,value:e.type,onChange:t=>n(e,"type",t.target.value)},l.a.createElement("option",{value:"day"},"Day"),l.a.createElement("option",{disabled:!0},"---"),Bs.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name))),l.a.createElement(E.d,{bare:!0,style:Vs,onClick:()=>t({type:"remove-recurrence",recurrence:e})},l.a.createElement(js,{style:Qs})),l.a.createElement(E.d,{bare:!0,style:Zs,onClick:()=>t({type:"add-recurrence"})},l.a.createElement(Cs,{style:Xs})))))}var eu={padding:10,width:380},tu={display:"flex",alignItems:"center"},nu={marginRight:5},ru={marginTop:10},au={whiteSpace:"nowrap"},ou={width:40},lu={flex:0},iu={display:"flex",marginTop:15,justifyContent:"flex-end"},cu={marginLeft:10};function su({config:e,onClose:t,onSave:n}){let r=ks(Object(o.useState)(null),2),a=r[0],i=r[1],c=ks(Object(o.useReducer)(Fs,{config:_s(e)}),2),u=c[0],d=c[1],f=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy");Object(o.useEffect)(()=>{d({type:"replace-config",config:_s(e)})},[e]);let p=u.config,y=(e,t)=>d({type:"change-field",field:e,value:t});return Object(o.useEffect)(()=>{!async function(){let e=await Object(h.sendCatch)("schedule/get-upcoming-dates",{config:Ls(p),count:4}),t=e.data,n=e.error;i(n?"Invalid rule":t)}()},[p]),null==a?null:l.a.createElement(E.x,{style:eu,offset:1,position:"bottom-left",onClose:t},l.a.createElement("div",{style:tu},l.a.createElement("label",{htmlFor:"start",style:nu},"Starts:"),l.a.createElement(Ul.a,{id:"start",inputProps:{placeholder:"Start Date"},value:p.start,onSelect:e=>y("start",e),containerProps:{style:{width:100}},dateFormat:f})),l.a.createElement(E.v,{direction:"row",align:"center",justify:"flex-start",style:ru,spacing:2},l.a.createElement(E.w,{style:au},"Repeat every"),l.a.createElement(E.m,{id:"interval",style:ou,type:"text",onBlur:e=>y("interval",e.target.value),onEnter:e=>y("interval",e.target.value),defaultValue:p.interval||1}),l.a.createElement(E.u,{onChange:e=>y("frequency",e.target.value),value:p.frequency,style:lu},Ms.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name))),"monthly"!==p.frequency||null!=p.patterns&&0!==p.patterns.length?null:l.a.createElement(E.d,{onClick:()=>d({type:"add-recurrence"})},"Add specific days")),"monthly"===p.frequency&&p.patterns&&p.patterns.length>0&&l.a.createElement(Js,{config:p,dispatch:d}),l.a.createElement(Ws,{previewDates:a}),l.a.createElement("div",{style:iu},l.a.createElement(E.d,{onClick:t},"Cancel"),l.a.createElement(E.d,{onClick:()=>n(Ls(p)),primary:!0,style:cu},"Apply")))}var uu={textAlign:"left"};function du({value:e,buttonStyle:t,onChange:n}){let r=Object(ws.c)(),a=r.isOpen,o=r.close,i=r.getOpenEvents;return l.a.createElement(E.y,null,l.a.createElement(E.d,Object.assign({},i(),{style:[uu,t]}),e?Ai(e):"No recurring date"),a&&l.a.createElement(su,{config:e,onClose:o,onSave:function(e){n(e),o()}}))}function fu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pu(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fu(Object(n),!0).forEach(function(t){yu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mu={justifyContent:"flex-start"},gu={flex:1};function hu({field:e,subfield:t,type:n,multi:r,value:a,inputRef:o,style:i,onChange:c}){let u=Object(s.d)(e=>({payees:e.queries.payees,accounts:e.queries.accounts,categoryGroups:e.queries.categories.grouped,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})),d=u.payees,f=u.accounts,p=u.categoryGroups,y=u.dateFormat;if(r&&!Array.isArray(a))a=[];else if(!r&&Array.isArray(a))return null;let m,g=!r||0===a.length;switch(n){case"id":switch(e){case"payee":d.length>0&&(m=l.a.createElement(Tl,{payees:d,accounts:f,multi:r,showMakeTransfer:!1,openOnFocus:!1,value:a,onSelect:c,inputProps:pu({inputRef:o},g?{placeholder:"nothing"}:null)}));break;case"account":m=l.a.createElement(Fl,{accounts:f,value:a,multi:r,openOnFocus:!1,onSelect:c,inputProps:pu({inputRef:o},g?{placeholder:"nothing"}:null)});break;case"category":m=l.a.createElement(ll,{categoryGroups:p,value:a,multi:r,openOnFocus:!1,onSelect:c,inputProps:pu({inputRef:o},g?{placeholder:"nothing"}:null)})}break;case"date":switch(t){case"month":m=l.a.createElement(E.m,{inputRef:o,defaultValue:a||"",placeholder:Object(Ee.l)(y).toLowerCase(),onEnter:e=>c(e.target.value),onBlur:e=>c(e.target.value)});break;case"year":m=l.a.createElement(E.m,{inputRef:o,defaultValue:a||"",placeholder:"yyyy",onEnter:e=>c(e.target.value),onBlur:e=>c(e.target.value)});break;default:m=a&&a.frequency?l.a.createElement(du,{value:a,buttonStyle:mu,onChange:c}):l.a.createElement(Ul.a,{value:a,dateFormat:y,openOnFocus:!1,inputRef:o,inputProps:{placeholder:y.toLowerCase()},onSelect:c})}break;default:m=r?l.a.createElement(Wo,{multi:!0,suggestions:[],value:a,inputProps:{inputRef:o},onSelect:c}):l.a.createElement(E.m,{inputRef:o,defaultValue:a||"",placeholder:"nothing",onEnter:e=>c(e.target.value),onBlur:e=>c(e.target.value)})}return l.a.createElement(E.y,{style:[gu,i]},m)}function bu(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ou(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?bu(Object(n),!0).forEach(function(t){wu(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bu(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function wu(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Eu=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Ou({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 11V9h2v6H9v-4zm0-6h2v2H9V5z",fill:"currentColor"})),vu=n(129);const ju=["data","navigator","loadMore","style","onHoverLeave","children"];function Su(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function xu(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Cu(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Cu(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cu(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let ku=Sa(Object(ae.c)("schedules").select("*"),Pu,ae.a);var Pu,Au={color:w.a.p4},Iu={color:w.a.p4},Du={color:w.a.n3},Tu={color:w.a.p4},Mu={color:w.a.p4},Ru={color:w.a.p4,textDecoration:"none",":hover":{textDecoration:"underline"}},Bu={color:w.a.p4},_u={color:w.a.p4},Lu={color:w.a.p4};function Nu({value:e,field:t,inline:n=!1,data:r,describe:a=(e=>e.name)}){let i=Object(s.d)(e=>{let n;if(r)n=r;else switch(t){case"payee":n=e.queries.payees;break;case"category":n=e.queries.categories.list;break;case"account":n=e.queries.accounts;break;default:n=[]}return{data:n,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"}}),c=i.data,u=i.dateFormat,d=xu(Object(o.useState)(!1),2),f=d[0],p=d[1];function y(e){if(null==e||""===e)return"(nothing)";if("boolean"===typeof e)return e?"true":"false";if("amount"===t)return Object(we.integerToCurrency)(e);if("date"===t)return e?e.frequency?Ai(e):Object(Ha.a)(Object(Ga.a)(e),u):null;if("month"===t)return e?Object(Ha.a)(Object(Ga.a)(e),Object(Ee.l)(u)):null;if("year"===t)return e?Object(Ha.a)(Object(Ga.a)(e),"yyyy"):null;{let t=e;if(c){let n=c.find(t=>t.id===e);n&&(t=a(n))}return t}}if(Array.isArray(e)){if(0===e.length)return l.a.createElement(E.w,{style:Au},"(empty)");if(1===e.length)return l.a.createElement(E.w,null,"[",l.a.createElement(E.w,{style:Iu},y(e[0])),"]");let t=e;!f&&e.length>4&&(t=e.slice(0,3));let r=e.length-t.length;return l.a.createElement(E.w,{style:Du},"[",t.map((t,r)=>{let a,o=l.a.createElement(E.w,{style:Tu},y(t));return a=n?0!==r?" ":"":l.a.createElement(l.a.Fragment,null,0===r&&l.a.createElement("br",null),"\xa0\xa0"),l.a.createElement(E.w,{key:r},a,o,r===e.length-1?"":",",!n&&l.a.createElement("br",null))}),r>0&&l.a.createElement(E.w,{style:Mu},"\xa0\xa0",l.a.createElement("a",Object.assign({href:"#",onClick:function(e){e.preventDefault(),p(!0)}},Object(j.css)(Ru)),r," more items..."),!n&&l.a.createElement("br",null)),"]")}return e&&null!=e.num1&&null!=e.num2?l.a.createElement(E.w,null,l.a.createElement(E.w,{style:Bu},y(e.num1))," and"," ",l.a.createElement(E.w,{style:_u},y(e.num2))):l.a.createElement(E.w,{style:Lu},y(e))}var Fu={display:"block",maxWidth:"100%",backgroundColor:w.a.n10,borderRadius:4,padding:"3px 5px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Uu={color:w.a.p4},zu={color:w.a.n3};function $u({field:e,op:t,value:n,options:r,stage:a,style:o}){return l.a.createElement(E.y,{style:[Fu,o]},l.a.createElement(E.w,{style:Uu},us(e,r))," ",l.a.createElement(E.w,{style:zu},ds(t))," ",l.a.createElement(Nu,{value:n,field:e}))}function Wu({value:e}){let t=Object(s.d)(e=>e.queries.payees),n=Object(oe.e)(t),r=ku.useQuery().data;return l.a.createElement(Nu,{value:e,field:"rule",data:r,describe:e=>{let t=Ii(e._conditions).payee;return t?`${n[t.value].name} (${e.next_date})`:`Next: ${e.next_date}`}})}var Gu={display:"block",maxWidth:"100%",backgroundColor:w.a.n10,borderRadius:4,padding:"3px 5px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Hu={color:w.a.n3},qu={color:w.a.p4},Yu={color:w.a.n3},Ku={color:w.a.n3};function Vu({field:e,op:t,value:n,options:r,style:a}){return l.a.createElement(E.y,{style:[Gu,a]},"set"===t?l.a.createElement(l.a.Fragment,null,l.a.createElement(E.w,{style:Hu},ds(t))," ",l.a.createElement(E.w,{style:qu},us(e,r))," ",l.a.createElement(E.w,{style:Yu},"to "),l.a.createElement(Nu,{value:n,field:e})):"link-schedule"===t?l.a.createElement(l.a.Fragment,null,l.a.createElement(E.w,{style:Ku},ds(t))," ",l.a.createElement(Wu,{value:n})):null)}var Qu={color:w.a.n5},Zu={alignSelf:"flex-start",margin:5,backgroundColor:w.a.b10,color:w.a.b1,borderRadius:4,padding:"3px 5px"},Xu={padding:"15px 0"},Ju={flex:1,alignItems:"flex-start"},ed={marginTop:3},td={width:12,height:12},nd={flex:1,alignItems:"flex-start"},rd={marginTop:3},ad={padding:"0 15px",paddingLeft:5};let od=l.a.memo(({rule:e,hovered:t,selected:n,editing:r,focusedField:a,onHover:o,onEdit:i,onEditRule:c})=>{Object(s.c)();let u=Object(si.d)(),d=n?w.a.b8:w.a.border,f=t||"select"===a;return l.a.createElement(xa.h,{height:"auto",borderColor:d,backgroundColor:n?w.a.selected:f?w.a.hover:"white",style:{fontSize:13,zIndex:r||n?101:"auto"},collapsed:"true",onMouseEnter:()=>o&&o(e.id),onMouseLeave:()=>o&&o(null)},l.a.createElement(xa.i,{exposed:t||n||r,focused:"select"===a,onSelect:()=>{u({type:"select",id:e.id})},onEdit:()=>i(e.id,"select"),selected:n}),l.a.createElement(xa.a,{name:"stage",width:50,plain:!0,style:Qu},e.stage&&l.a.createElement(E.y,{style:Zu},e.stage)),l.a.createElement(xa.e,{width:"flex",style:Xu,truncate:!1},l.a.createElement(E.v,{direction:"row",align:"center"},l.a.createElement(E.y,{style:Ju},e.conditions.map((t,n)=>l.a.createElement($u,{key:n,field:t.field,op:t.op,value:t.value,options:t.options,stage:e.stage,style:0!==n&&ed}))),l.a.createElement(E.w,null,l.a.createElement(Wl,{color:w.a.n4,style:td})),l.a.createElement(E.y,{style:nd},e.actions.map((e,t)=>l.a.createElement(Vu,{key:t,field:e.field,op:e.op,value:e.value,options:e.options,style:0!==t&&rd}))))),l.a.createElement(xa.a,{name:"edit",focused:"edit"===a,plain:!0,style:ad},l.a.createElement(E.d,{as:xa.b,onSelect:()=>c(e),onEdit:()=>i(e.id,"edit")},"Edit")))});var ld={flex:1,outline:"none","& .animated .animated-row":{transition:".25s transform"}},id={maxWidth:"100%",overflow:"auto"};let cd=l.a.forwardRef((e,t)=>{let n=e.data,r=e.navigator,a=e.loadMore,i=e.style,c=e.onHoverLeave,s=e.children,u=Su(e,ju),d=Object(o.useRef)(),f=Object(o.useRef)(),p=Object(o.useRef)(),y=r.getNavigatorProps;return Object(o.useEffect)(()=>{d.current?f.current=d.current.getBoundingClientRect().height:f.current=null},[d.current,n]),l.a.createElement(E.y,Object.assign({style:[ld,i],tabIndex:"1"},y(u)),l.a.createElement(E.y,{innerRef:p,style:id,onScroll:function(e){null!=f.current&&a&&e.target.scrollTop>f.current-750&&a()}},l.a.createElement("div",{ref:d,onMouseLeave:c},s)))});function sd(){let e=Object(si.e)(),t=Object(si.d)();return l.a.createElement(xa.m,null,l.a.createElement(xa.i,{exposed:!0,focused:!1,selected:e.size>0,onSelect:()=>t({type:"select-all"})}),l.a.createElement(xa.a,{value:"Stage",width:50}),l.a.createElement(xa.a,{value:"Rule",width:"flex"}))}function ud({rules:e,selectedItems:t,navigator:n,hoveredRule:r,collapsed:a,onHover:o,onCollapse:i,onEditRule:c}){return 0===e.length?null:l.a.createElement(E.y,null,e.map(e=>{let a=r===e.id,i=t.has(e.id),s=n.editingId===e.id;return l.a.createElement(od,{key:e.id,rule:e,hovered:a,selected:i,editing:s,focusedField:s&&n.focusedField,onHover:o,onEdit:n.onEdit,onEditRule:c})}))}var dd={flex:1,maxWidth:"90%"},fd={height:"70vh"},pd={flex:1},yd={marginBottom:-1},md={flexDirection:"row",alignItems:"center",padding:"13px 15px",borderTop:"1px solid "+w.a.border},gd={color:w.a.n4,flexDirection:"row",alignItems:"center",width:"50%"},hd={color:w.a.n4},bd={flex:1};function Od({history:e,modalProps:t,payeeId:n}){let r=xu(Object(o.useState)(null),2),a=r[0],i=r[1],c=xu(Object(o.useState)(null),2),u=c[0],d=c[1],f=Object(s.c)(),p=Object(xa.o)(u,["select","edit"]),y=Object(si.c)("manage-rules",a,[]),m=xu(Object(o.useState)(null),2),g=m[0],b=m[1],O=xu(Object(o.useState)(!0),2),w=O[0],v=O[1],j=Object(o.useRef)(null);async function S(){v(!0);let e=null;return e=n?await Object(h.send)("payees-get-rules",{id:n}):await Object(h.send)("rules-get"),i(e),e}function x(){d(u.concat(a.slice(u.length,u.length+50)))}async function C(){v(!0),(await Object(h.send)("rule-delete-all",[...y.items])).someDeletionsFailed&&alert("Some rules were not deleted because they are linked to schedules");let e=await S();d(t=>e.slice(0,t.length)),y.dispatch({type:"select-none"}),v(!1)}Object(o.useEffect)(()=>{return W.setUndoState("openModal","manage-rules"),async function(){let e=await S();d(e.slice(0,100)),v(!1),await f(Object(il.m)())}(),()=>{W.setUndoState("openModal",null)}},[]);let k=Object(o.useCallback)(e=>{f(Object(bt.d)("edit-rule",{rule:e,onSave:async e=>{let t=await S();d(n=>{let r=t.findIndex(t=>t.id===e.id);n.findIndex(t=>t.id===e.id);return r>n.length?t.slice(0,r+75):t.slice(0,n.length)}),v(!1)}}))},[]);function P(){f(Object(bt.d)("edit-rule",{rule:{stage:null,conditions:[{op:"is",field:"payee",value:null,type:"id"}],actions:[{op:"set",field:"category",value:null,type:"id"}]},onSave:async e=>{let t=await S();p.onEdit(e.id,"edit"),d(n=>{let r=t.findIndex(t=>t.id===e.id);return t.slice(0,r+75)}),v(!1)}}))}let A=Object(o.useCallback)(e=>{b(e)},[]);return null===u?null:l.a.createElement(E.r,Object.assign({title:"Rules",padding:0,loading:w},t,{style:[t.style,dd]}),()=>l.a.createElement(ku.Provider,null,l.a.createElement(si.a,{instance:y},l.a.createElement(E.y,{style:fd},l.a.createElement(E.y,{style:pd},l.a.createElement(sd,null),l.a.createElement(cd,{ref:j,data:u,navigator:p,loadMore:x,style:yd},l.a.createElement(ud,{rules:u,selectedItems:y.items,navigator:p,hoveredRule:g,onHover:A,onEditRule:k}))),l.a.createElement(E.y,{style:md},l.a.createElement(E.y,{style:gd},l.a.createElement(E.w,null,"Rules are always run in the order that you see them."," ",l.a.createElement(E.h,{asAnchor:!0,href:"https://actualbudget.com/docs/other/rules/",style:hd},"Learn more"))),l.a.createElement(E.y,{style:bd}),l.a.createElement(E.v,{direction:"row",align:"center",justify:"flex-end",spacing:2},y.items.size>0&&l.a.createElement(E.d,{onClick:C},"Delete ",y.items.size," rules"),l.a.createElement(E.d,{primary:!0,onClick:P},"Create new rule")))))))}function wd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ed(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?wd(Object(n),!0).forEach(function(t){vd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function vd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function jd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Sd(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Sd(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sd(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let xd=["date","account","payee","notes","category","amount","cleared"].map(e=>[e,us(e)]);function Cd(e,t){switch(e){case"amount":switch(t){case"amount-inflow":return{inflow:!0};case"amount-outflow":return{outflow:!0};default:return null}case"date":switch(t){case"month":return{month:!0};case"year":return{year:!0};default:return null}default:return null}}function kd({children:e}){let t=Object(o.useRef)();return Object(o.useEffect)(()=>{t.current.focus()},[]),l.a.createElement("div",{ref:t,tabIndex:-1,onKeyDown:function(e){9===e.keyCode&&ns()(t.current,e)}},e)}var Pd={backgroundColor:w.a.n10,marginBottom:5},Ad={color:"white","&,:hover,:active":{backgroundColor:w.a.b4}};function Id({op:e,selected:t,style:n,onClick:r}){return l.a.createElement(E.d,{bare:!0,style:[Pd,n,t&&Ad],onClick:r},ds(e))}var Dd={padding:15},Td={marginBottom:10},Md={borderWidth:1},Rd={flexWrap:"wrap"},Bd={marginTop:10},_d={marginTop:15};function Ld({field:e,op:t,value:n,dispatch:r,onApply:a}){let i=jd(Object(o.useState)(e),2),c=i[0],s=i[1],u=Object(o.useRef)(),d=Object(o.useRef)(null);Object(o.useEffect)(()=>{d.current!==t&&u.current&&u.current.focus(),d.current=t},[t]);let f=ss.get(e),p=cs[f].ops;return"month"!==c&&"year"!==c||(p=["is"]),l.a.createElement(E.x,{position:"bottom-left",style:Dd,width:300,onClose:()=>r({type:"close"})},l.a.createElement(kd,null,l.a.createElement(E.y,{style:Td},"amount"===e||"date"===e?l.a.createElement(E.g,{options:"amount"===e?[["amount","Amount"],["amount-inflow","Amount (inflow)"],["amount-outflow","Amount (outflow)"]]:"date"===e?[["date","Date"],["month","Month"],["year","Year"]]:null,value:c,onChange:e=>{s(e),"month"!==e&&"year"!==e||r({type:"set-op",op:"is"})},style:Md}):Object(we.titleFirst)(us(e))),l.a.createElement(E.v,{direction:"row",align:"flex-start",spacing:1,style:Rd},"boolean"===f?[l.a.createElement(Id,{op:"true",selected:!0===n,onClick:()=>{r({type:"set-op",op:"is"}),r({type:"set-value",value:!0})}}),l.a.createElement(Id,{op:"false",selected:!1===n,onClick:()=>{r({type:"set-op",op:"is"}),r({type:"set-value",value:!1})}})]:p.map(e=>l.a.createElement(Id,{op:e,selected:e===t,onClick:()=>r({type:"set-op",op:e})}))),l.a.createElement("form",{action:"#"},"boolean"!==f&&l.a.createElement(hu,{inputRef:u,field:e,subfield:c,type:"id"===f&&"contains"===t?"string":f,value:n,multi:"oneOf"===t,style:Bd,onChange:e=>r({type:"set-value",value:e})}),l.a.createElement(E.y,null,l.a.createElement(E.d,{primary:!0,style:_d,onClick:r=>{r.preventDefault(),a({field:e,op:t,value:n,options:Cd(e,c)})}},"Apply")))))}var Nd={width:16,height:16,color:"inherit",marginRight:5},Fd={padding:0};function Ud({onApply:e}){let t=Object(s.d)(e=>({dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})).dateFormat,n=jd(Object(o.useReducer)((e,t)=>{switch(t.type){case"select-field":return Ed(Ed({},e),{},{fieldsOpen:!0,condOpen:!1});case"configure":{let n=function(e){return"amount-inflow"===e?{field:"amount",options:{inflow:!0}}:"amount-outflow"===e?{field:"amount",options:{outflow:!0}}:{field:e}}(t.field).field,r=ss.get(n),a=cs[r].ops;return Ed(Ed({},e),{},{fieldsOpen:!1,condOpen:!0,field:t.field,op:a[0],value:"boolean"===r||null})}case"set-op":{let n=ss.get(e.field),r=e.value;return"id"===n&&"contains"===t.op&&(r=null),Ed(Ed({},e),{},{op:t.op,value:r})}case"set-value":let n=ms(t.value,{type:ss.get(e.field)}).value;return Ed(Ed({},e),{},{value:n});case"close":return{fieldsOpen:!1,condOpen:!1,value:null};default:throw new Error("Unknown action: "+t.type)}},{fieldsOpen:!1,condOpen:!1,field:null,value:null}),2),r=n[0],a=n[1];return l.a.createElement(E.y,null,l.a.createElement(E.d,{bare:!0,onClick:()=>a({type:"select-field"})},l.a.createElement(Os,{style:Nd})," ","Filter"),r.fieldsOpen&&l.a.createElement(E.x,{position:"bottom-left",style:Fd,onClose:()=>a({type:"close"})},l.a.createElement(E.q,{onMenuSelect:e=>{a({type:"configure",field:e})},items:xd.map(([e,t])=>({name:e,text:Object(we.titleFirst)(t)}))})),r.condOpen&&l.a.createElement(Ld,{field:r.field,op:r.op,value:r.value,dispatch:a,onApply:async function(n){if("date"===(n=ys(Ed(Ed({},n),{},{type:ss.get(n.field)}))).type&&n.options)if(n.options.month){let e=Object(be.a)(n.value,Object(Ee.l)(t),new Date);if(!Object(Oe.a)(e))return void alert("Invalid date format");n.value=Object(Ha.a)(e,"yyyy-MM")}else if(n.options.year){let e=Object(be.a)(n.value,"yyyy",new Date);if(!Object(Oe.a)(e))return void alert("Invalid date format");n.value=Object(Ha.a)(e,"yyyy")}let r=(await Object(h.send)("rule-validate",{conditions:[n],actions:[]})).error;if(r&&r.conditionErrors.length>0){let e=Object(we.titleFirst)(us(n.field));alert(e+": "+fs(r.conditionErrors[0]))}else e(n),a({type:"close"})}}))}var zd={backgroundColor:w.a.n10,borderRadius:4,flexDirection:"row",alignItems:"center",padding:5,paddingLeft:10,marginBottom:10,marginRight:10},$d={color:w.a.p4},Wd={color:w.a.p4},Gd={color:w.a.n3},Hd={marginLeft:3},qd={width:8,height:8,color:w.a.n4};function Yd({field:e,customName:t,op:n,value:r,options:a,stage:o,style:i,onDelete:c}){let s=e;return"date"===ss.get(e)&&(7===r.length?s="month":4===r.length&&(s="year")),l.a.createElement(E.y,{style:[zd,i]},l.a.createElement("div",null,t?l.a.createElement(E.w,{style:$d},t):l.a.createElement(l.a.Fragment,null,l.a.createElement(E.w,{style:Wd},us(s,a))," ",l.a.createElement(E.w,{style:Gd},ds(n))," ",l.a.createElement(Nu,{value:r,field:s,inline:!0}))),l.a.createElement(E.d,{bare:!0,style:Hd,onClick:c},l.a.createElement(Zl.a,{style:qd})))}var Kd={flexDirection:"row",alignItems:"center",flexWrap:"wrap",marginTop:10,marginBottom:-5};function Vd({filters:e,editingFilter:t,onDelete:n}){return l.a.createElement(E.y,{style:Kd},e.map((e,r)=>l.a.createElement(Yd,{customName:e.customName,field:e.field,op:e.op,value:e.value,options:e.options,editing:t===e,onDelete:()=>n(e)})))}function Qd(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Zd(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qd(Object(n),!0).forEach(function(t){Xd(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qd(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xd(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jd(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ef(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ef(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ef(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var tf={backgroundColor:"white",flex:1,alignItems:"center",borderTopWidth:1,borderColor:w.a.n9},nf={width:550,marginTop:75,fontSize:15,alignItems:"center"},rf={textAlign:"center",lineHeight:"1.4em"},af={marginTop:20},of={marginTop:20,fontSize:13,color:w.a.n5};function lf({onAdd:e}){return l.a.createElement(E.y,{style:tf},l.a.createElement(E.y,{style:nf},l.a.createElement(E.w,{style:rf},"For Actual to be useful, you need to ",l.a.createElement("strong",null,"add an account"),". You can link an account to automatically download transactions, or manage it locally yourself."),l.a.createElement(E.d,{primary:!0,style:af,onClick:e},"Add account"),l.a.createElement(E.y,{style:of},"In the future, you can add accounts from the sidebar.")))}var cf={flexDirection:"row",alignSelf:"center",backgroundColor:"white",boxShadow:w.c.shadow,borderRadius:4,marginTop:5,marginBottom:15,padding:10},sf={flexDirection:"row",alignItems:"center"},uf={color:w.a.g4,flex:1,flexDirection:"row",alignItems:"center",justifyContent:"center"},df={width:13,height:13,color:w.a.g5,marginRight:3},ff={color:w.a.n3},pf={fontStyle:"italic",textAlign:"center"},yf={fontWeight:700},mf={marginLeft:15};function gf({balanceQuery:e,targetBalance:t,onDone:n}){let r=Object(aa.a)({name:e.name+"-cleared",query:e.query.filter({cleared:!0})}),a=t-r;return l.a.createElement(E.y,{style:cf},l.a.createElement(E.y,{style:sf},0===a?l.a.createElement(E.y,{style:uf},l.a.createElement(fa,{style:df}),"All reconciled!"):l.a.createElement(E.y,{style:ff},l.a.createElement(E.w,{style:pf},"Your cleared balance"," ",l.a.createElement("strong",null,Object(wt.a)(r,"financial"))," needs"," ",l.a.createElement("strong",null,(a>0?"+":"")+Object(wt.a)(a,"financial"))," ","to match",l.a.createElement("br",null)," your bank","'","s balance of"," ",l.a.createElement(E.w,{style:yf},Object(wt.a)(t,"financial")))),l.a.createElement(E.y,{style:mf},l.a.createElement(E.d,{primary:!0,onClick:n},"Done Reconciling"))))}var hf={padding:"5px 8px"},bf={margin:"7px 0"};function Of({account:e,onReconcile:t,onClose:n}){let r=Object(aa.a)(Se(e));return l.a.createElement(E.x,{position:"bottom-right",width:275,onClose:n},l.a.createElement(E.y,{style:hf},l.a.createElement(E.w,null,"Enter the current balance of your bank account that you want to reconcile with:"),l.a.createElement("form",{onSubmit:function(e){let a=e.target.elements[0],o=Object(we.currencyToInteger)(a.value);t(null==o?r:o),n()}},null!=r&&l.a.createElement(E.k,null,l.a.createElement(E.m,{defaultValue:Object(wt.a)(r,"financial"),style:bf})),l.a.createElement(E.d,{primary:!0},"Reconcile"))))}var wf={color:"inherit",transform:"rotateZ(90deg)"};function Ef({onClick:e}){return l.a.createElement(E.d,{bare:!0,onClick:e},l.a.createElement(Yt.a,{width:15,height:15,style:wf}))}var vf={padding:0};function jf({onClose:e,children:t}){return l.a.createElement(E.x,{position:"bottom-right",width:200,style:vf,onClose:e},t)}function Sf({account:e,canSync:t,syncEnabled:n,showBalances:r,canShowBalances:a,onClose:i,onReconcile:c,onMenuSelect:s}){let u=Jd(Object(o.useState)("default"),2),d=u[0],f=u[1];return"reconcile"===d?l.a.createElement(Of,{account:e,onClose:i,onReconcile:c}):l.a.createElement(jf,{onClose:i},l.a.createElement(E.q,{onMenuSelect:e=>{"reconcile"===e?f("reconcile"):s(e)},items:[a&&{name:"toggle-balance",text:(r?"Hide":"Show")+" Running Balance"},{name:"export",text:"Export"},{name:"reconcile",text:"Reconcile"},n&&e&&!e.closed&&(t?{name:"unlink",text:"Unlink Account"}:{name:"link",text:"Link Account"}),e.closed?{name:"reopen",text:"Reopen Account"}:{name:"close",text:"Close Account"}].filter(e=>e)}))}function xf({onClose:e,onMenuSelect:t}){return l.a.createElement(jf,{onClose:e},l.a.createElement(E.q,{onMenuSelect:e=>{t(e)},items:[{name:"export",text:"Export"}]}))}var Cf={marginLeft:15,backgroundColor:w.a.n10,borderRadius:4,padding:"4px 6px",color:w.a.n5},kf={fontWeight:600};function Pf({name:e,balance:t}){return l.a.createElement(E.w,{style:Cf},e," ",l.a.createElement(E.w,{style:kf},Object(wt.a)(t,"financial")))}function Af({selectedItems:e}){let t=Jd(Object(o.useState)(null),2),n=t[0],r=t[1];return Object(o.useEffect)(()=>{!async function(){let t=(await Object(ae.f)(Object(ae.c)("transactions").filter({id:{$oneof:[...e]},parent_id:{$oneof:[...e]}}).select("id"))).data,n=new Set(t.map(e=>e.id)),a=[...e].filter(e=>!n.has(e)),o=(await Object(ae.f)(Object(ae.c)("transactions").filter({id:{$oneof:a}}).options({splits:"all"}).calculate({$sum:"$amount"}))).data;r(o)}()},[e]),null==n?null:l.a.createElement(Pf,{name:"Selected balance:",balance:n})}var If={flexDirection:"row"};function Df({balanceQuery:e}){let t=Object(aa.a)({name:e.name+"-cleared",query:e.query.filter({cleared:!0})}),n=Object(aa.a)({name:e.name+"-uncleared",query:e.query.filter({cleared:!1})});return l.a.createElement(E.y,{style:If},l.a.createElement(Pf,{name:"Cleared total:",balance:t}),l.a.createElement(Pf,{name:"Uncleared total:",balance:n}))}var Tf={flexDirection:"row",alignItems:"center",marginTop:-5,marginLeft:-5},Mf={fontSize:22,fontWeight:400};function Rf({balanceQuery:e,showExtraBalances:t,onToggleExtraBalances:n}){let r=Object(si.e)();return l.a.createElement(E.y,{style:Tf},l.a.createElement(E.d,{bare:!0,onClick:n,style:{"& svg":{opacity:r.size>0||t?1:0},"&:hover svg":{opacity:1}}},l.a.createElement(vt,{binding:Zd(Zd({},e),{},{value:0}),type:"financial",style:Mf,getStyle:e=>({color:e<0?w.a.r5:e>0?w.a.g5:w.a.n8})}),l.a.createElement($e,{style:{width:10,height:10,marginLeft:10,color:w.a.n5,transform:t?"rotateZ(180deg)":"rotateZ(0)"}})),t&&l.a.createElement(Df,{balanceQuery:e}),r.size>0&&l.a.createElement(Af,{selectedItems:r}))}function Bf({style:e,getTransaction:t,onShow:n,onDelete:r,onEdit:a,onUnlink:c,onScheduleAction:s}){let u=Object(si.e)(),d=Object(i.g)(),f=Object(o.useMemo)(()=>{let e=[...u];return{preview:!!e.find(e=>Rc(e)),trans:!!e.find(e=>!Rc(e))}},[u]),p=Object(o.useMemo)(()=>!f.preview&&[...u].every(e=>{let n=t(e);return n&&n.schedule}),[f.preview,u,t]);return l.a.createElement(xa.j,{name:"transactions",keyHandlers:f.trans&&{f:()=>n([...u]),d:()=>r([...u]),a:()=>a("account",[...u]),p:()=>a("payee",[...u]),n:()=>a("notes",[...u]),c:()=>a("category",[...u]),l:()=>a("cleared",[...u])},items:[...f.trans?[{name:"show",text:"Show",key:"F"},{name:"delete",text:"Delete",key:"D"},...p?[{name:"view-schedule",text:"View schedule",disabled:u.size>1},{name:"unlink-schedule",text:"Unlink schedule"}]:[{name:"link-schedule",text:"Link schedule"}],E.q.line,{type:E.q.label,name:"Edit field"},{name:"date",text:"Date"},{name:"account",text:"Account",key:"A"},{name:"payee",text:"Payee",key:"P"},{name:"notes",text:"Notes",key:"N"},{name:"category",text:"Category",key:"C"},{name:"amount",text:"Amount"},{name:"cleared",text:"Cleared",key:"L"}]:[{name:"view-schedule",text:"View schedule"},{name:"post-transaction",text:"Post transaction"},{name:"skip",text:"Skip scheduled date"}]],onSelect:e=>{switch(e){case"show":n([...u]);break;case"delete":r([...u]);break;case"post-transaction":case"skip":s(e,u);break;case"view-schedule":let o,l=[...u][0];if(Rc(l)){o=l.split("/")[1]}else{let e=t(l);o=e&&e.schedule}o&&d.push(`/schedule/edit/${o}`,{locationPtr:d.location});break;case"link-schedule":d.push("/schedule/link",{locationPtr:d.location,transactionIds:[...u]});break;case"unlink-schedule":c([...u]);break;default:a(e,[...u])}}})}var _f={paddingBottom:10,flexShrink:0},Lf={marginTop:2,alignItems:"flex-start"},Nf={fontSize:25,fontWeight:500,marginTop:-5,marginBottom:-2,marginLeft:-5},Ff={fontSize:25,fontWeight:500,marginLeft:-5,marginTop:-5,backgroundColor:"transparent","& svg":{display:"none"},"&:hover svg":{display:"unset"}},Uf={width:11,height:11,marginLeft:5,color:w.a.n4},zf={fontSize:25,fontWeight:500,marginBottom:5},$f={marginTop:12},Wf={color:"currentColor",marginRight:4},Gf={color:"currentColor",marginRight:4},Hf={color:"inherit",marginRight:3},qf={width:13,height:13,flexShrink:0,color:"inherit",margin:5,marginRight:0},Yf={backgroundColor:"transparent",borderWidth:0,boxShadow:"none",transition:"color .15s","& input::placeholder":{color:w.a.n1,transition:"color .25s"}},Kf={boxShadow:"0 0 0 2px "+w.a.b5},Vf={color:w.a.p4},Qf={width:16,height:16},Zf={padding:6},Xf={width:14,height:14,color:"inherit"},Jf={width:14,height:14,color:"inherit"};const ep=l.a.memo(({tableRef:e,editingName:t,isNameEditable:n,workingHard:r,accountName:a,account:i,accountsSyncing:c,accounts:s,transactions:u,syncEnabled:d,showBalances:f,showExtraBalances:p,showEmptyMessage:y,balanceQuery:m,reconcileAmount:g,canCalculateBalance:h,search:b,filters:O,savePrefs:v,onSearch:j,onAddTransaction:S,onShowTransactions:x,onDoneReconciling:C,onToggleExtraBalances:k,onSaveName:P,onExposeName:A,onSync:I,onImport:D,onMenuSelect:M,onReconcile:R,onBatchDelete:B,onBatchEdit:_,onBatchUnlink:L,onApplyFilter:N,onDeleteFilter:F,onScheduleAction:U})=>{let z=Jd(Object(o.useState)(!1),2),$=z[0],W=z[1],G=Object(o.useRef)(null),H=Qi(),q=d&&i&&i.account_id;return i||(q=!!s.find(e=>!!e.account_id)),l.a.createElement(l.a.Fragment,null,l.a.createElement(es.a,{keys:{"mod+f":()=>{G.current&&G.current.focus()}}}),l.a.createElement(E.y,{style:[w.c.pageContent,_f]},l.a.createElement(E.y,{style:Lf},l.a.createElement(E.y,null,t?l.a.createElement(E.k,null,l.a.createElement(E.m,{defaultValue:a,onEnter:e=>P(e.target.value),onBlur:()=>A(!1),style:Nf})):n?l.a.createElement(E.d,{bare:!0,style:Ff,onClick:()=>A(!0)},a,l.a.createElement(Vr,{style:Uf})):l.a.createElement(E.y,{style:zf},a))),l.a.createElement(Rf,{balanceQuery:m,showExtraBalances:p,onToggleExtraBalances:k}),l.a.createElement(E.v,{spacing:2,direction:"row",align:"center",style:$f},(i&&!i.closed||q)&&l.a.createElement(E.d,{bare:!0,onClick:q?I:D},q?l.a.createElement(l.a.Fragment,null,l.a.createElement(T,{width:13,height:13,animating:i&&c===i.name||"__all"===c,style:Wf})," ","Sync"):l.a.createElement(l.a.Fragment,null,l.a.createElement(ra,{width:13,height:13,style:Gf})," ","Import")),!y&&l.a.createElement(E.d,{bare:!0,onClick:S},l.a.createElement(Ct,{width:10,height:10,style:Hf})," ","Add New"),l.a.createElement(E.y,null,l.a.createElement(Ud,{onApply:N})),l.a.createElement(E.n,{leftContent:l.a.createElement(Jr,{style:qf}),inputRef:G,value:b,placeholder:"Search",getStyle:e=>[Yf,e&&Kf,!e&&""!==b&&Vf],onChange:e=>j(e.target.value)}),r?l.a.createElement(E.y,null,l.a.createElement(pa.a,{color:w.a.n1,style:Qf})):l.a.createElement(Bf,{getTransaction:e=>u.find(t=>t.id===e),onShow:x,onDelete:B,onEdit:_,onUnlink:L,onScheduleAction:U}),l.a.createElement(E.d,{bare:!0,disabled:""!==b||O.length>0,style:Zf,onClick:function(){e.current&&(H.dispatch({type:"switch-mode",id:e.current.getScrolledItem()}),v({"expand-splits":!("expand"===H.state.mode)}))},title:"collapse"===H.state.mode?"Collapse split transactions":"Expand split transactions"},"collapse"===H.state.mode?l.a.createElement(Ea,{style:Xf}):l.a.createElement(ha,{style:Jf})),i?l.a.createElement(E.y,null,l.a.createElement(Ef,{onClick:()=>W(!0)}),$&&l.a.createElement(Sf,{account:i,canSync:q,syncEnabled:d,canShowBalances:h(),showBalances:f,onMenuSelect:e=>{W(!1),M(e)},onReconcile:R,onClose:()=>W(!1)})):l.a.createElement(E.y,null,l.a.createElement(Ef,{onClick:()=>W(!0)}),$&&l.a.createElement(xf,{onMenuSelect:e=>{W(!1),M(e)},onClose:()=>W(!1)}))),O&&O.length>0&&l.a.createElement(Vd,{filters:O,onDelete:F})),null!=g&&l.a.createElement(gf,{targetBalance:g,balanceQuery:m,onDone:C}))});function tp({transactions:e,filtered:t,children:n}){let r=Ni(),a=Object(o.useMemo)(()=>r?r.schedules.filter(e=>!e.completed&&["due","upcoming","missed"].includes(r.statuses.get(e.id))):[],[r]),l=Object(o.useMemo)(()=>a.map(e=>({id:"preview/"+e.id,payee:e._payee,account:e._account,amount:e._amount,date:e.next_date,notes:r.statuses.get(e.id),schedule:e.id})),[a]),i=Object(o.useMemo)(()=>!t&&l.length>0?l.concat(e):e,[t,l,e]);return n(null==r?null:i)}var np={backgroundColor:w.a.n11},rp={flex:1},ap={marginTop:20,textAlign:"center",fontStyle:"italic"};class op extends l.a.PureComponent{constructor(e){super(e),this.fetchAllIds=(async()=>{return(await Object(ae.f)(this.paged.getQuery().select("id"))).data.reduce((e,t)=>(e.push(t.id),t.subtransactions.forEach(t=>e.push(t.id)),e),[])}),this.refetchTransactions=(async()=>{this.paged&&this.paged.run()}),this.fetchTransactions=(()=>{let e=this.makeRootQuery();this.rootQuery=this.currentQuery=e,this.updateQuery(e),this.props.accountId&&this.props.markAccountRead(this.props.accountId)}),this.makeRootQuery=(()=>{this.state.transactions;let e=this.props.location.state,t=this.props.accountId;return e&&e.filter?Object(ae.c)("transactions").options({splits:"grouped"}).filter(Zd({"account.offbudget":!1},e.filter)):function(e){let t=Object(ve.a)("transactions").options({splits:"grouped"}),n=je(e);return n&&(t=t.filter(n)),t}(t)}),this.onSearch=(e=>{this.paged.unsubscribe(),this.setState({search:e},this.onSearchDone)}),this.onSearchDone=Object($r.debounce)(()=>{""===this.state.search?this.updateQuery(this.currentQuery,this.state.filters.length>0):this.updateQuery(function(e,t,n){let r,a=Object(we.currencyToAmount)(t);return r=Object(Ee.i)(n).test(t)?Object(be.a)(t,Object(Ee.h)(n),new Date):Object(Ee.n)(n).test(t)?Object(be.a)(t,Object(Ee.m)(n),new Date):Object(be.a)(t,n,new Date),e.filter({$or:{"payee.name":{$like:`%${t}%`},notes:{$like:`%${t}%`},"category.name":{$like:`%${t}%`},"account.name":{$like:`%${t}%`},$or:[Object(Oe.a)(r)&&{date:Object(Ee.e)(r)},null!=a&&{amount:{$transform:"$abs",$eq:Object(we.amountToInteger)(a)}},null!=a&&(o=a,(0|o)===o)&&{amount:{$transform:{$abs:{$idiv:["$",100]}},$eq:a}}].filter(Boolean)}});var o}(this.currentQuery,this.state.search,this.props.dateFormat),!0)},150),this.onSync=(async()=>{const e=this.props.accountId,t=this.props.accounts.find(t=>t.id===e);await this.props.syncAndDownload(t?t.id:null)}),this.onImport=(async()=>{const e=this.props.accountId;if(this.props.accounts.find(t=>t.id===e)){const t=await window.Actual.openFileDialog({filters:[{name:"Financial Files",extensions:["qif","ofx","qfx","csv"]}]});t&&this.props.pushModal("import-transactions",{accountId:e,filename:t[0],onImported:e=>{e&&this.fetchTransactions()}})}}),this.onExport=(async e=>{let t=await Object(h.send)("transactions-export-query",{query:this.currentQuery.serialize()}),n=`${e&&e.replace(/[()]/g,"").replace(/\s+/g,"-")||"transactions"}.csv`;window.Actual.saveFile(t,n,"Export Transactions")}),this.onTransactionsChange=((e,t)=>{this.paged.optimisticUpdate(t=>e._deleted?t.filter(t=>t.id!==e.id):t.map(t=>t.id===e.id?e:t),e=>t),this.props.updateNewTransactions(e.id)}),this.canCalculateBalance=(()=>{let e=this.props.accountId;return this.props.accounts.find(t=>t.id===e)&&""===this.state.search&&0===this.state.filters.length}),this.onAddTransaction=(()=>{this.setState({isAdding:!0})}),this.onExposeName=(e=>{this.setState({editingName:e})}),this.onSaveName=(e=>{const t=this.props.accountId,n=this.props.accounts.find(e=>e.id===t);this.props.updateAccount(Zd(Zd({},n),{},{name:e})),this.setState({editingName:!1})}),this.onToggleExtraBalances=(()=>{let e=this.props,t=e.accountId,n=e.showExtraBalances,r="show-extra-balances-"+t;this.props.savePrefs({[r]:!n})}),this.onMenuSelect=(async e=>{const t=this.props.accountId,n=this.props.accounts.find(e=>e.id===t);switch(e){case"link":lt(this.props.pushModal,{upgradingId:t});break;case"unlink":this.props.unlinkAccount(t);break;case"close":this.props.openAccountCloseModal(t);break;case"reopen":this.props.reopenAccount(t);break;case"export":const r=this.getAccountTitle(n,t);this.onExport(r);break;case"toggle-balance":this.state.showBalances?(this.props.savePrefs({["show-balances-"+t]:!1}),this.setState({showBalances:!1,balances:[]})):(this.props.savePrefs({["show-balances-"+t]:!0}),this.setState({showBalances:!0}),this.calculateBalances())}}),this.isNew=(e=>this.props.newTransactions.includes(e)),this.isMatched=(e=>this.props.matchedTransactions.includes(e)),this.onManagePayees=(e=>{this.props.pushModal("manage-payees",{selectedPayee:e})}),this.onCreatePayee=(e=>{return""!==e.trim()?this.props.createPayee(e):null}),this.onReconcile=(e=>{this.setState({reconcileAmount:e})}),this.onDoneReconciling=(()=>{this.setState({reconcileAmount:null})}),this.onShowTransactions=(async e=>{this.onApplyFilter({customName:"Selected transactions",filter:{id:{$oneof:e}}})}),this.onBatchEdit=(async(e,t)=>{let n=async(e,n)=>{this.setState({workingHard:!0});let r=_a((await Object(ae.f)(Object(ae.c)("transactions").filter({id:{$oneof:t}}).select("*").options({splits:"grouped"}))).data),a={deleted:[],updated:[]};"cleared"===e&&(n=!!r.find(e=>!e.cleared)),r.forEach(t=>{let o=za(r,Zd(Zd({},t),{},{[e]:n})).diff;r=Object(we.applyChanges)(o,r),a.deleted=a.deleted?a.deleted.concat(o.deleted):o.deleted,a.updated=a.updated?a.updated.concat(o.updated):o.updated,a.added=a.added?a.added.concat(o.added):o.added}),await Object(h.send)("transactions-batch-update",a),await this.refetchTransactions(),this.table.current&&this.table.current.edit(r[0].id,"select",!1)};"cleared"===e?n("cleared",null):this.props.pushModal("edit-field",{name:e,onSubmit:n})}),this.onBatchDelete=(async e=>{this.setState({workingHard:!0});let t=_a((await Object(ae.f)(Object(ae.c)("transactions").filter({id:{$oneof:e}}).select("*").options({splits:"grouped"}))).data),n=new Set(e),r={deleted:[],updated:[]};t.forEach(e=>{let a=e.parent_id;if(!n.has(e.id)||a&&n.has(a))return;let o=$a(t,e.id).diff;t=Object(we.applyChanges)(o,t),r.deleted=o.deleted?r.deleted.concat(o.deleted):o.deleted,r.updated=o.updated?r.updated.concat(o.updated):o.updated}),await Object(h.send)("transactions-batch-update",r),await this.refetchTransactions()}),this.onBatchUnlink=(async e=>{await Object(h.send)("transactions-batch-update",{updated:e.map(e=>({id:e,schedule:null}))}),await this.refetchTransactions()}),this.onDeleteFilter=(e=>{this.applyFilters(this.state.filters.filter(t=>t!==e))}),this.onApplyFilter=(async e=>{let t=this.state.filters;e.customName&&(t=t.filter(t=>t.customName!==e.customName)),this.applyFilters([...t,e])}),this.onScheduleAction=(async(e,t)=>{switch(e){case"post-transaction":for(let e of t){let t=e.split("/");await Object(h.send)("schedule/post-transaction",{id:t[1]})}this.refetchTransactions();break;case"skip":for(let e of t){let t=e.split("/");await Object(h.send)("schedule/skip-next-date",{id:t[1]})}}}),this.applyFilters=(async e=>{if(e.length>0){let t=e.filter(e=>!!e.customName).map(e=>e.filter),n=(await Object(h.send)("make-filters-from-conditions",{conditions:e.filter(e=>!e.customName)})).filters;this.currentQuery=this.rootQuery.filter({$and:[...n,...t]}),this.updateQuery(this.currentQuery,!0),this.setState({filters:e,search:""})}else this.setState({transactions:[],transactionCount:0}),this.fetchTransactions(),this.setState({filters:e,search:""})}),this.paged=null,this.table=l.a.createRef(),this.animated=!0,this.state={search:"",filters:[],loading:!0,workingHard:!1,reconcileAmount:null,transactions:[],transactionsCount:0,showBalances:e.showBalances,balances:[],editingName:!1,isAdding:!1,latestDate:null}}async componentDidMount(){let e=e=>{if(e.includes("transactions")||e.includes("category_mapping")||e.includes("payee_mapping"))return this.refetchTransactions()},t=async({tables:t,messages:n,undoTag:r})=>{let a;if(await e(t),n.every(e=>"transactions"===e.dataset)&&!n.find(e=>"tombstone"===e.column)){let e=n.filter(e=>"transactions"===e.dataset&&!("tombstone"===e.column));a=1===e.length?e[0].row:null}this.table.current&&(this.table.current.edit(null),a&&this.table.current.scrollTo(a)),this.props.setLastUndoState(null)},n=[Object(h.listen)("undo-event",t)];this.unlisten=(()=>{n.forEach(e=>e())}),0===this.props.categoryGroups.length&&await this.props.getCategories(),await this.props.initiallyLoadPayees(),await this.fetchTransactions(),this.props.lastUndoState&&this.props.lastUndoState.current&&t(this.props.lastUndoState.current)}componentDidUpdate(e){e.modalShowing&&!this.props.modalShowing&&setTimeout(()=>{this.refetchTransactions()},100)}componentWillUnmount(){this.unlisten&&this.unlisten(),this.paged&&this.paged.unsubscribe()}updateQuery(e,t){this.paged&&this.paged.unsubscribe(),this.paged=Object(ae.e)(e.select("*"),async(e,n)=>{const r=null==n;r&&(this.table.current&&this.table.current.setRowAnimation(!1),t?this.props.splitsExpandedDispatch({type:"set-mode",mode:"collapse"}):this.props.splitsExpandedDispatch({type:"set-mode",mode:this.props.expandSplits?"expand":"collapse"})),this.setState({transactions:e,transactionCount:this.paged.getTotalCount(),transactionsFiltered:t,loading:!1,workingHard:!1},()=>{this.state.showBalances&&this.calculateBalances(),r&&this.table.current&&this.table.current.scrollToTop(),setTimeout(()=>{this.table.current&&this.table.current.setRowAnimation(!0)},0)})},{pageCount:150,onlySync:!0,mapper:_a})}componentWillReceiveProps(e){this.props.match!==e.match&&this.setState({editingName:!1,loading:!0,search:"",showBalances:e.showBalances,balances:[]},()=>{this.fetchTransactions()})}async calculateBalances(){if(!this.canCalculateBalance())return;let e=(await Object(ae.f)(this.paged.getQuery().options({splits:"none"}).select([{balance:{$sumOver:"$amount"}}]))).data;this.setState({balances:Object(we.groupById)(e)})}getAccountTitle(e,t){let n=(this.props.location.state||{}).filterName;return n||(e?(e.closed?"Closed: ":"")+e.name:"budgeted"===t?"Budgeted Accounts":"offbudget"===t?"Off Budget Accounts":"uncategorized"===t?"Uncategorized":t?null:"All Accounts")}getBalanceQuery(e,t){return{name:`balance-query-${t}`,query:this.makeRootQuery().calculate({$sum:"$amount"})}}render(){let e=this.props,t=e.accounts,n=e.categoryGroups,r=e.payees,a=(e.match,e.syncEnabled),o=e.dateFormat,c=e.addNotification,s=e.accountsSyncing,u=e.replaceModal,d=e.showExtraBalances,f=(e.expandSplits,e.accountId),p=this.state,y=p.transactions,m=p.loading,g=p.workingHard,h=p.reconcileAmount,b=(p.transactionCount,p.transactionsFiltered),O=p.editingName,v=p.showBalances,j=p.balances,S=t.find(e=>e.id===f);const x=this.getAccountTitle(S,f);if(!x&&!m)return l.a.createElement(i.a,{to:"/accounts"});let C=!m&&!f&&0===t.length,k=f&&"budgeted"!==f&&"offbudget"!==f&&"uncategorized"!==f,P=this.getBalanceQuery(S,f);return l.a.createElement(tp,{transactions:y,filtered:b},e=>null==e?null:l.a.createElement(si.b,{name:"transactions",items:e,fetchAllIds:this.fetchAllIds,registerDispatch:e=>this.dispatchSelected=e},l.a.createElement(E.y,{style:[w.c.page,np]},l.a.createElement(ep,{tableRef:this.table,editingName:O,isNameEditable:k,workingHard:g,account:S,accountName:x,accountsSyncing:s,accounts:t,transactions:y,showBalances:v,showExtraBalances:d,showEmptyMessage:C,balanceQuery:P,syncEnabled:a,canCalculateBalance:this.canCalculateBalance,reconcileAmount:h,search:this.state.search,filters:this.state.filters,savePrefs:this.props.savePrefs,onSearch:this.onSearch,onShowTransactions:this.onShowTransactions,onMenuSelect:this.onMenuSelect,onAddTransaction:this.onAddTransaction,onToggleExtraBalances:this.onToggleExtraBalances,onSaveName:this.onSaveName,onExposeName:this.onExposeName,onReconcile:this.onReconcile,onDoneReconciling:this.onDoneReconciling,onSync:this.onSync,onImport:this.onImport,onBatchDelete:this.onBatchDelete,onBatchEdit:this.onBatchEdit,onBatchUnlink:this.onBatchUnlink,onDeleteFilter:this.onDeleteFilter,onApplyFilter:this.onApplyFilter,onScheduleAction:this.onScheduleAction}),l.a.createElement(E.y,{style:rp},l.a.createElement(Jc,{tableRef:this.table,account:S,transactions:y,allTransactions:e,animated:this.animated,loadMoreTransactions:()=>this.paged&&this.paged.fetchNext(),accounts:t,categoryGroups:n,payees:r,balances:v&&this.canCalculateBalance()?j:null,showAccount:!f||"offbudget"===f||"budgeted"===f||"uncategorized"===f,isAdding:this.state.isAdding,isNew:this.isNew,isMatched:this.isMatched,isFiltered:""!==this.state.search||this.state.filters.length>0,dateFormat:o,addNotification:c,renderEmpty:()=>C?l.a.createElement(lf,{onAdd:()=>u(a?"add-account":"add-local-account")}):m?null:l.a.createElement(E.y,{style:ap},"No transactions"),onChange:this.onTransactionsChange,onRefetch:this.refetchTransactions,onRefetchUpToRow:e=>this.paged.refetchUpToRow(e,{field:"date",order:"desc"}),onCloseAddTransaction:()=>this.setState({isAdding:!1}),onManagePayees:this.onManagePayees,onCreatePayee:this.onCreatePayee})))))}}function lp(e){let t=Qi().dispatch;return l.a.createElement(op,Object.assign({},e,{splitsExpandedDispatch:t}))}function ip(e){let t=Object(s.d)(t=>({newTransactions:t.queries.newTransactions,matchedTransactions:t.queries.matchedTransactions,accounts:t.queries.accounts,failedAccounts:t.account.failedAccounts,categoryGroups:t.queries.categories.grouped,syncEnabled:t.prefs.local["flags.syncAccount"],dateFormat:t.prefs.local.dateFormat||"MM/dd/yyyy",expandSplits:e.match&&t.prefs.local["expand-splits"],showBalances:e.match&&t.prefs.local["show-balances-"+e.match.params.id],showExtraBalances:e.match&&t.prefs.local["show-extra-balances-"+e.match.params.id],payees:t.queries.payees,modalShowing:t.modals.modalStack.length>0,accountsSyncing:t.account.accountsSyncing,lastUndoState:t.app.lastUndoState,tutorialStage:t.tutorial.stage})),n=Object(s.c)(),r=Object(o.useMemo)(()=>Object(Qn.b)(p,n),[n]),a=Object(i.i)(),c=Object(i.h)(),u=Object(o.useContext)(ne),d=Object(o.useMemo)(()=>{let e=je(a.id,"_account");return(c.state&&c.state.filter||"uncategorized"===a.id)&&(e={id:null}),t=>(t=t.filter({$and:[e,{"_account.closed":!1}]})).orderBy({next_date:"desc"})},[a.id]);return l.a.createElement(Li,{transform:d},l.a.createElement(Zi,{initialMode:t.expandSplits?"collapse":"expand"},l.a.createElement(lp,Object.assign({},t,r,{modalShowing:t.modalShowing||!(!u.state||!u.state.locationPtr),accountId:a.id,location:e.location}))))}var cp=n(100);function sp(e,t,n){return{start:t<e.start?e.start:t,end:n>e.end?e.end:n}}let up=l.a.createContext();function dp({startMonth:e,numMonths:t,monthBounds:n,type:r,children:a}){let o=sp(n,e,Ee.b(e,t-1)),i=Ee.v(o.start,o.end);return l.a.createElement(up.Provider,{value:{months:i,type:r}},a)}let fp=l.a.createContext([]);function pp(e){return[{id:"to-be-budgeted",name:"To Be Budgeted",categories:[{id:"to-be-budgeted",name:"To Be Budgeted"}]},...e]}function yp(e){return 0===e||"0"===e||""===e?{color:w.a.n10}:null}function mp(e){const t=yp(e);return t||(e<0?{color:w.a.r4}:void 0)}function gp(e){return{color:e<0?w.a.r4:0===e?w.a.n10:w.a.g4}}function hp(e,t,n){if("top"===t)return{targetId:n};{let t=e.findIndex(e=>e.id===n);if(-1===t)throw new Error("findSort: item not found: "+n);let r=t+1;return r<e.length-1?{targetId:e[r].id}:{targetId:null}}}const bp="0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24)";var Op=n(68);function wp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ep(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ep(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ep(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var vp={padding:10},jp={marginBottom:5},Sp={margin:"10px 0 5px 0"},xp={alignItems:"flex-end",marginTop:10},Cp={fontSize:12,paddingTop:3,paddingBottom:3};function kp({initialAmount:e,initialAmountName:t,showToBeBudgeted:n,tooltipProps:r,onSubmit:a,onClose:i}){let c=Object(o.useContext)(g.a),s=Object(o.useContext)(Op.a),u=Object(o.useContext)(fp);u=u.filter(e=>!e.is_income),n&&(u=pp(u));let d=wp(Object(o.useState)(null),2),f=d[0],p=d[1],y=wp(Object(o.useState)(null),2),m=y[0],h=y[1];function b(){let e=ci(f,null);e&&m&&(a(Object(we.amountToInteger)(e),m),i())}return Object(o.useEffect)(()=>{(async()=>{if(t){const e=await c.get(s,t);p(Object(we.integerToCurrency)(Math.max(e.value,0)))}else p(Object(we.integerToCurrency)(Math.max(e,0)))})()},[]),null===f?null:l.a.createElement(E.x,Object.assign({position:"bottom-right",width:200,style:vp},r,{onClose:i}),l.a.createElement(E.y,{style:jp},"Transfer this amount:"),l.a.createElement(E.y,null,l.a.createElement(E.k,null,l.a.createElement(E.m,{value:f,onChange:e=>p(e.target.value),onEnter:b}))),l.a.createElement(E.y,{style:Sp},"To:"),l.a.createElement(ll,{categoryGroups:u,value:null,openOnFocus:!1,onUpdate:e=>{},onSelect:e=>h(e),inputProps:{onKeyDown:e=>{13===e.keyCode&&b()}}}),l.a.createElement(E.y,{style:xp},l.a.createElement(E.d,{primary:!0,style:Cp,onClick:b},"Transfer")))}function Pp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Ap(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Pp(Object(n),!0).forEach(function(t){Ip(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Pp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ip(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Dp=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Ap({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M16.172 9l-6.071-6.071 1.414-1.414L20 10l-.707.707-7.778 7.778-1.414-1.414L16.172 11H0V9z",fill:"currentColor"}));function Tp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Mp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Tp(Object(n),!0).forEach(function(t){Rp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Rp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Bp={textAlign:"right"},_p={cursor:"pointer",":hover":{textDecoration:"underline"}},Lp={alignSelf:"center",marginLeft:2,position:"absolute",right:-4,top:0,bottom:0,justifyContent:"center"};function Np({carryover:e,balance:t,category:n,disabled:r}){let a=Object(aa.a)(e),o=Object(aa.a)(t);return l.a.createElement(l.a.Fragment,null,l.a.createElement(vt,{binding:t,type:"financial",getStyle:mp,style:[Bp,!r&&_p]}),!0===a&&l.a.createElement(E.y,{style:Lp},l.a.createElement(Dp,{width:7,height:7,style:Mp({},mp(o))})))}function Fp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Up(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Fp(Object(n),!0).forEach(function(t){zp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Fp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var $p=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Up({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M12 13.584a2.643 2.643 0 0 1-1.875-.775L.584 3.268a1.768 1.768 0 0 1 2.5-2.5l8.739 8.739a.25.25 0 0 0 .354 0L20.916.768a1.768 1.768 0 0 1 2.5 2.5l-9.541 9.541a2.643 2.643 0 0 1-1.875.775z",fill:"currentColor"}),l.a.createElement("path",{d:"M12 23.75a2.643 2.643 0 0 1-1.875-.775L.584 13.434a1.768 1.768 0 0 1 2.5-2.5l8.739 8.739a.25.25 0 0 0 .354 0l8.739-8.739a1.768 1.768 0 0 1 2.5 2.5l-9.541 9.541A2.643 2.643 0 0 1 12 23.75z",fill:"currentColor"}));function Wp(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Gp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wp(Object(n),!0).forEach(function(t){Hp(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wp(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Hp(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var qp=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:Gp({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M12 10.416a2.643 2.643 0 0 1 1.875.775l9.541 9.541a1.768 1.768 0 0 1-2.5 2.5l-8.739-8.739a.25.25 0 0 0-.354 0l-8.739 8.739a1.768 1.768 0 0 1-2.5-2.5l9.541-9.541A2.643 2.643 0 0 1 12 10.416z",fill:"currentColor"}),l.a.createElement("path",{d:"M12 .25a2.643 2.643 0 0 1 1.875.775l9.541 9.541a1.768 1.768 0 0 1-2.5 2.5l-8.739-8.739a.25.25 0 0 0-.354 0l-8.739 8.739a1.768 1.768 0 0 1-2.5-2.5l9.541-9.541A2.643 2.643 0 0 1 12 .25z",fill:"currentColor"}));let Yp=l.a.createContext(null);function Kp({categoryGroups:e,summaryCollapsed:t,onBudgetAction:n,onToggleSummaryCollapse:r,children:a}){let o=Ee.d();return l.a.createElement(Yp.Provider,{value:{currentMonth:o,categoryGroups:e,summaryCollapsed:t,onBudgetAction:n,onToggleSummaryCollapse:r},children:a})}function Vp(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Qp(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Qp(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Qp(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Zp={padding:10},Xp={marginBottom:5},Jp={alignItems:"flex-end",marginTop:10},ey={fontSize:12,paddingTop:3,paddingBottom:3};function ty({onSubmit:e,onClose:t}){const n=Object(o.useContext)(g.a),r=Object(o.useContext)(Op.a),a=Vp(Object(o.useState)(null),2),i=a[0],c=a[1];function s(){const n=ci(i,null);n&&e(Object(we.amountToInteger)(n)),t()}return Object(o.useEffect)(()=>{(async()=>{const e=await n.get(r,"to-budget");c(Object(we.integerToCurrency)(Math.max(e.value,0)))})()},[]),null===i?null:l.a.createElement(E.x,{position:"bottom-right",width:200,style:Zp,onClose:t},l.a.createElement(E.y,{style:Xp},"Hold this amount:"),l.a.createElement(E.y,null,l.a.createElement(E.k,null,l.a.createElement(E.m,{value:i,onChange:e=>c(e.target.value),onEnter:s}))),l.a.createElement(E.y,{style:Jp},l.a.createElement(E.d,{primary:!0,style:ey,onClick:s},"Hold")))}function ny(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ry(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ny(Object(n),!0).forEach(function(t){ay(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ny(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ay(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oy=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 19 24",style:ry({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M17 24H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h9a1 1 0 0 1 .707.293l7 7A1 1 0 0 1 19 8v14a2 2 0 0 1-2 2zM2 21.5a.5.5 0 0 0 .5.5h14a.5.5 0 0 0 .5-.5V9a.5.5 0 0 0-.5-.5h-4a2 2 0 0 1-2-2v-4A.5.5 0 0 0 10 2H2.5a.5.5 0 0 0-.5.5v19z",fill:"currentColor"}));function ly(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return iy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var cy={border:"1px solid "+w.a.border,minWidth:300,minHeight:120,outline:"none"};function sy({defaultNotes:e,position:t="bottom-left",onClose:n}){let r=ly(Object(o.useState)(e),2),a=r[0],i=r[1],c=l.a.createRef();return Object(o.useEffect)(()=>{c.current.focus()},[]),l.a.createElement(E.x,{position:t,onClose:()=>n(a)},l.a.createElement("textarea",Object.assign({ref:c},Object(j.css)(cy),{value:a||"",onChange:e=>i(e.target.value)})))}var uy={flexShrink:0},dy={"& button, & .hover-visible":{display:"flex",opacity:1,color:w.a.n1}},fy={"& button, & .hover-visible":{display:"flex",opacity:1}};function py({id:e,width:t=12,height:n=12,defaultColor:r=w.a.n8,tooltipPosition:a,style:i}){let c=Object(E.A)(),s=function(e,t){let n=va(Object(o.useState)(null),2),r=n[0],a=n[1];return Object(o.useEffect)(()=>{let n=Object(ae.d)(e,async e=>{n&&a(e)},t);return()=>{n.unsubscribe(),n=null}},[e]),{data:r}}(Object(o.useMemo)(()=>Object(ae.c)("notes").filter({id:e}).select("*"),[e])).data,u=s&&s.length>0?s[0].note:null,d=u&&""!==u;return l.a.createElement(E.y,{style:[uy,c.isOpen&&dy,d&&fy]},l.a.createElement(E.d,Object.assign({bare:!0,className:"hover-visible",style:[{color:r},i]},c.getOpenEvents()),l.a.createElement(oy,{style:{width:t,height:n,color:"currentColor"}})),c.isOpen&&l.a.createElement(sy,{defaultNotes:u,position:a,onClose:function(t){Object(h.send)("notes-save",{id:e,note:t}),c.close()}}))}function yy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return my(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return my(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function my(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var gy={flexDirection:"row",lineHeight:1.5,justifyContent:"center"},hy={padding:"5px 0",marginTop:17,backgroundColor:w.a.n11,borderTopWidth:1,borderBottomWidth:1,borderColor:w.a.n9},by={padding:7},Oy={textAlign:"right",marginRight:10,minWidth:50},wy={flexShrink:0},Ey={lineHeight:1.5,padding:"6px 10px"},vy={fontWeight:600},jy={fontWeight:600},Sy={fontWeight:600},xy={fontWeight:600};function Cy({prevMonthName:e,collapsed:t}){return l.a.createElement(E.y,{style:[gy,!t&&hy,t&&by,w.c.smallText]},l.a.createElement(E.y,{style:Oy},l.a.createElement(E.j,{style:wy,renderContent:()=>l.a.createElement(E.x,{width:200,style:Ey},l.a.createElement(E.a,{left:"Income:",right:l.a.createElement(vt,{binding:Pe.totalIncome,type:"financial"})}),l.a.createElement(E.a,{left:"From Last Month:",right:l.a.createElement(vt,{binding:Pe.fromLastMonth,type:"financial"})}))},l.a.createElement(vt,{binding:Pe.incomeAvailable,type:"financial",style:vy})),l.a.createElement(vt,{binding:Pe.lastMonthOverspent,formatter:e=>{let t=Object(wt.a)(e,"financial");return e>0?"+"+t:0===e?"-"+t:t},style:[jy,w.c.tnum]}),l.a.createElement(vt,{binding:Pe.totalBudgeted,formatter:e=>{let t=Object(wt.a)(e,"financial");return e>0?"+"+t:0===e?"-"+t:t},style:[Sy,w.c.tnum]}),l.a.createElement(vt,{binding:Pe.forNextMonth,formatter:e=>{let t=parseInt(e);t=isNaN(t)?0:-t;let n=Object(wt.a)(t,"financial");return t>0?"+"+n:0===t?"-"+n:n},style:[xy,w.c.tnum]})),l.a.createElement(E.y,null,l.a.createElement(E.c,null,"Available Funds"),l.a.createElement(E.c,null,"Overspent in ",e),l.a.createElement(E.c,null,"Budgeted"),l.a.createElement(E.c,null,"For Next Month")))}var ky={alignItems:"center"},Py={padding:0};function Ay({month:e,prevMonthName:t,collapsed:n,onBudgetAction:r}){return l.a.createElement(De.a,{binding:Pe.toBudget,initialValue:0},a=>{const o=parseInt(a.value),i=isNaN(o)?0:o,c=i<0;var s={fontWeight:400,userSelect:"none",cursor:"pointer",color:c?w.a.r4:w.a.p5,marginBottom:-1,borderBottom:"1px solid transparent",":hover":{borderColor:c?w.a.r4:w.a.p5}};return l.a.createElement(E.y,{style:ky},l.a.createElement(E.c,null,c?"Overbudgeted:":"To Budget:"),l.a.createElement(zr.a,{initialState:{menuOpen:null}},({state:o,setState:c})=>l.a.createElement(E.y,null,l.a.createElement(E.j,{disabled:!n||o.menuOpen,renderContent:()=>l.a.createElement(E.x,{position:"bottom-center"},l.a.createElement(Cy,{collapsed:!0,prevMonthName:t}))},l.a.createElement(E.c,Object.assign({onClick:()=>c({menuOpen:"actions"}),"data-cellname":a.name},Object(j.css)([w.c.veryLargeText,s])),Object(wt.a)(i,"financial"))),"actions"===o.menuOpen&&l.a.createElement(E.x,{position:"bottom-center",width:200,style:Py,onClose:()=>c({menuOpen:null})},l.a.createElement(E.q,{onMenuSelect:t=>{"reset-buffer"===t?(r(e,"reset-hold"),c({menuOpen:null})):c({menuOpen:t})},items:[{name:"transfer",text:"Move to a category"},{name:"buffer",text:"Hold for next month"},{name:"buffer-future",text:"Hold for all future months"},{name:"reset-buffer",text:"Reset next month's buffer"}]})),"buffer"===o.menuOpen&&l.a.createElement(ty,{onClose:()=>c({menuOpen:null}),onSubmit:t=>{r(e,"hold",{amount:t})}}),"buffer-future"===o.menuOpen&&l.a.createElement(ty,{onClose:()=>c({menuOpen:null}),onSubmit:t=>{r(e,"hold-all-future",{amount:t})}}),"transfer"===o.menuOpen&&l.a.createElement(kp,{initialAmountName:"leftover",onClose:()=>c({menuOpen:null}),onSubmit:(t,n)=>{r(e,"transfer-available",{amount:t,category:n})}}))))})}var Iy={backgroundColor:"white",boxShadow:bp,borderRadius:6,marginLeft:0,marginRight:0,marginTop:5,flex:1,cursor:"default",marginBottom:5,overflow:"hidden","& .hover-visible":{opacity:0,transition:"opacity .25s"},"&:hover .hover-visible":{opacity:1}},Dy={padding:"0 13px"},Ty={margin:"10px 0"},My={marginTop:16},Ry={position:"absolute",left:10,top:0},By={color:w.a.n6,margin:1},_y={textAlign:"center",marginTop:3,fontSize:18,fontWeight:500,textDecorationSkip:"ink"},Ly={textDecoration:"underline"},Ny={position:"absolute",right:10,top:0,flexDirection:"row",alignItems:"center"},Fy={userSelect:"none",marginLeft:2},Uy={color:w.a.n5},zy={padding:0},$y={alignItems:"center",padding:"10px 20px",justifyContent:"space-between",backgroundColor:w.a.n11,borderTop:"1px solid "+w.a.n10},Wy={margin:"23px 0"},Gy=l.a.memo(function({month:e}){let t=Object(o.useContext)(Yp),n=t.currentMonth,r=t.summaryCollapsed,a=t.onBudgetAction,i=t.onToggleSummaryCollapse,c=yy(Object(o.useState)(!1),2),s=c[0],u=c[1];function d(e){u(!1)}let f=Ee.g(Ee.u(e),"MMM"),p=r?$p:qp;return l.a.createElement(E.y,{style:Iy},l.a.createElement(Op.a.Provider,{value:Ee.w(e)},l.a.createElement(E.y,{style:[Dy,r?Ty:My]},l.a.createElement(E.y,{style:Ry},l.a.createElement(E.d,{className:"hover-visible",bare:!0,onClick:i},l.a.createElement(p,{width:13,height:13,style:By}))),l.a.createElement("div",Object(j.css)([_y,n===e&&Ly]),Ee.g(e,"MMMM")),l.a.createElement(E.y,{style:Ny},l.a.createElement(E.y,null,l.a.createElement(py,{id:`budget-${e}`,width:15,height:15,tooltipPosition:"bottom-right",defaultColor:w.a.n6})),l.a.createElement(E.y,{style:Fy},l.a.createElement(E.d,{bare:!0,onClick:function(e){u(!0)}},l.a.createElement(Yt.a,{width:15,height:15,style:Uy})),s&&l.a.createElement(E.x,{position:"bottom-right",width:200,style:zy,onClose:d},l.a.createElement(E.q,{onMenuSelect:t=>{d(),a(e,t)},items:[{name:"copy-last",text:"Copy last month's budget"},{name:"set-zero",text:"Set budgets to zero"},{name:"set-3-avg",text:"Set budgets to 3 month avg"}]}))))),r?l.a.createElement(E.y,{style:$y},l.a.createElement(Ay,{collapsed:r,prevMonthName:f,month:e,onBudgetAction:a})):l.a.createElement(l.a.Fragment,null,l.a.createElement(Cy,{prevMonthName:f}),l.a.createElement(E.y,{style:Wy},l.a.createElement(Ay,{month:e,onBudgetAction:a})))))});function Hy(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return qy(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qy(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qy(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Yy={padding:10},Ky={marginBottom:5},Vy={alignItems:"flex-end",marginTop:10},Qy={fontSize:12,paddingTop:3};function Zy({showToBeBudgeted:e,inline:t,tooltipProps:n,onSubmit:r,onClose:a}){let i=Object(o.useContext)(fp);i=pp(i.filter(e=>!e.is_income));let c=Hy(Object(o.useState)(null),2),s=c[0],u=c[1];function d(){s&&(r(s),a())}return l.a.createElement(E.x,Object.assign({position:"bottom-right",width:200,style:Yy},n,{onClose:a}),l.a.createElement(E.y,{style:Ky},"Cover from category:"),l.a.createElement(E.k,null,e=>l.a.createElement(ll,{categoryGroups:i,value:null,openOnFocus:!1,onUpdate:e=>{},onSelect:e=>u(e),inputProps:{inputRef:e,onKeyDown:e=>{13===e.keyCode&&d()}}})),l.a.createElement(E.y,{style:Vy},l.a.createElement(E.d,{primary:!0,style:Qy,onClick:d},"Transfer")))}var Xy={padding:0};function Jy({categoryId:e,tooltip:t,monthIndex:n,onBudgetAction:r}){let a=Object(aa.a)(Pe.catCarryover(e)),i=Object(aa.a)(Pe.catBalance(e)),c=Hy(Object(o.useState)("menu"),2),s=c[0],u=c[1];return l.a.createElement(l.a.Fragment,null,"menu"===s&&l.a.createElement(E.x,{position:"bottom-right",width:200,style:Xy,onClose:t.close},l.a.createElement(E.q,{onMenuSelect:o=>{"carryover"===o?(r(n,"carryover",{category:e,flag:!a}),t.close()):u(o)},items:[{name:"transfer",text:"Transfer to another category"},{name:"carryover",text:a?"Remove overspending rollover":"Rollover overspending"},i<0&&{name:"cover",text:"Cover overspending"}].filter(e=>e)})),"transfer"===s&&l.a.createElement(kp,{initialAmountName:Pe.catBalance(e),showToBeBudgeted:!0,onClose:t.close,onSubmit:(t,a)=>{r(n,"transfer-category",{amount:t,from:e,to:a})}}),"cover"===s&&l.a.createElement(Zy,{showToBeBudgeted:!0,onClose:t.close,onSubmit:t=>{r(n,"cover",{to:e,from:t})}}))}let em={flex:1,padding:"0 5px",textAlign:"right"};var tm={flex:1,flexDirection:"row",marginRight:5,paddingTop:10,paddingBottom:10},nm={color:w.a.n4},rm={color:w.a.n4,fontWeight:600},am={color:w.a.n4},om={color:w.a.n4,fontWeight:600},lm={color:w.a.n4},im={color:w.a.n4,fontWeight:600};const cm=l.a.memo(function(){return l.a.createElement(E.y,{style:tm},l.a.createElement(E.y,{style:em},l.a.createElement(E.w,{style:nm},"Budgeted"),l.a.createElement(vt,{binding:Pe.totalBudgeted,type:"financial",style:rm,formatter:e=>Object(wt.a)(-parseFloat(e||"0"),"financial")})),l.a.createElement(E.y,{style:em},l.a.createElement(E.w,{style:am},"Spent"),l.a.createElement(vt,{binding:Pe.totalSpent,type:"financial",style:om})),l.a.createElement(E.y,{style:em},l.a.createElement(E.w,{style:lm},"Balance"),l.a.createElement(vt,{binding:Pe.totalBalance,type:"financial",style:im})))});var sm={color:w.a.n4,alignItems:"center",paddingRight:10},um={flex:1,textAlign:"right"};function dm(){return l.a.createElement(xa.h,{style:sm},l.a.createElement(E.y,{style:um},"Received"))}var fm={flex:1,flexDirection:"row"},pm={fontWeight:600},ym={fontWeight:600},mm={fontWeight:600,paddingRight:5};const gm=l.a.memo(function({group:e}){let t=w.a.border,n=e.id;return l.a.createElement(E.y,{style:fm},l.a.createElement(xa.k,{name:"budgeted",width:"flex",borderColor:t,textAlign:"right",style:[pm,w.c.tnum],valueProps:{binding:Pe.groupBudgeted(n),type:"financial"}}),l.a.createElement(xa.k,{name:"spent",width:"flex",textAlign:"right",borderColor:t,style:[ym,w.c.tnum],valueProps:{binding:Pe.groupSumAmount(n),type:"financial"}}),l.a.createElement(xa.k,{name:"balance",width:"flex",borderColor:t,textAlign:"right",style:[mm,w.c.tnum],valueProps:{binding:Pe.groupBalance(n),type:"financial"}}))});var hm={flex:1,flexDirection:"row"},bm={zIndex:100},Om={cursor:"default",margin:1,padding:"0 4px",borderRadius:4},wm={":hover":{boxShadow:"inset 0 0 0 1px "+w.a.n7,backgroundColor:"white"}},Em={textAlign:"right"},vm={cursor:"pointer",":hover":{textDecoration:"underline"}},jm={paddingRight:5,textAlign:"right"};const Sm=l.a.memo(function({monthIndex:e,category:t,editing:n,onEdit:r,onBudgetAction:a,onShowActivity:o}){let i=w.a.border,c=Object(E.A)();return l.a.createElement(E.y,{style:hm},l.a.createElement(xa.k,{name:"budget",sync:!0,exposed:n,width:"flex",borderColor:i,onExpose:()=>r(t.id,e),style:[n&&bm,w.c.tnum],textAlign:"right",valueStyle:[Om,wm],valueProps:{binding:Pe.catBudgeted(t.id),type:"financial",getValueStyle:yp,formatExpr:e=>Object(we.integerToCurrency)(e),unformatExpr:e=>Object(we.amountToInteger)(ci(e,0))},inputProps:{onBlur:()=>{r(null)}},onSave:n=>{a(e,"budget-amount",{category:t.id,amount:n})}}),l.a.createElement(xa.e,{name:"spent",width:"flex",borderColor:i,style:Em},l.a.createElement("span",{onClick:()=>o(t.name,t.id,e)},l.a.createElement(vt,{binding:Pe.catSumAmount(t.id),type:"financial",getStyle:yp,style:vm}))),l.a.createElement(xa.e,{name:"balance",width:"flex",borderColor:i,style:jm},l.a.createElement("span",c.getOpenEvents(),l.a.createElement(Np,{category:t,carryover:Pe.catCarryover(t.id),balance:Pe.catBalance(t.id)})),c.isOpen&&l.a.createElement(Jy,{categoryId:t.id,tooltip:c,monthIndex:e,onBudgetAction:a})))});var xm={flex:1},Cm={fontWeight:600,paddingRight:5};function km({group:e}){return l.a.createElement(E.y,{style:xm},l.a.createElement(xa.k,{name:"received",width:"flex",borderColor:w.a.border,textAlign:"right",style:[Cm,w.c.tnum],valueProps:{binding:Pe.groupIncomeReceived,type:"financial"}}))}var Pm={flex:1},Am={paddingRight:5,textAlign:"right"},Im={borderBottomWidth:0},Dm={cursor:"pointer",":hover":{textDecoration:"underline"}};function Tm({category:e,isLast:t,monthIndex:n,onShowActivity:r}){return l.a.createElement(E.y,{style:Pm},l.a.createElement(xa.e,{name:"received",width:"flex",borderColor:w.a.border,textAlign:"right",style:[Am,t&&Im]},l.a.createElement("span",{onClick:()=>r(e.name,e.id,n)},l.a.createElement(vt,{binding:Pe.catSumAmount(e.id),type:"financial",style:Dm}))))}let Mm=l.a.createContext(null);function Rm({summaryCollapsed:e,onBudgetAction:t,onToggleSummaryCollapse:n,children:r}){let a=Ee.d();return l.a.createElement(Mm.Provider,{value:{currentMonth:a,summaryCollapsed:e,onBudgetAction:t,onToggleSummaryCollapse:n},children:r})}function Bm(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return _m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _m(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Lm({style:e,progress:t,color:n,backgroundColor:r}){let a=2*Math.PI*4,o=t*a,i=a;return l.a.createElement("svg",{viewBox:"0 0 20 20",style:e},l.a.createElement("circle",{r:"10",cx:"10",cy:"10",fill:r}),l.a.createElement("circle",{r:4,cx:"10",cy:"10",fill:"none",stroke:n,strokeWidth:8,strokeDasharray:`${o} ${i}`,transform:"rotate(-90) translate(-20)"})," ")}function Nm(e,t){return 0===t?e>0?1:0:e/t}var Fm={width:20,height:20};function Um({current:e,target:t}){let n=Object(aa.a)(e)||0,r=!1;n<0&&(r=!0,n=-n);let a=Nm(n,Object(aa.a)(t)||0);return l.a.createElement(Lm,{progress:a,color:r?w.a.r7:w.a.g5,backgroundColor:r?w.a.r10:w.a.n10,style:Fm})}var zm={width:20,height:20};function $m({current:e,target:t}){let n,r=Object(aa.a)(e)||0,a=Object(aa.a)(t)||0,o=!1;return(r=Math.max(-r,0))>a?(n=(r-a)/a,o=!0):n=Nm(r,a),l.a.createElement(Lm,{progress:n,color:o?w.a.r7:w.a.g5,backgroundColor:o?w.a.r10:w.a.n10,style:zm})}var Wm={lineHeight:1.5,flexDirection:"row",alignItems:"center",fontSize:14},Gm={marginLeft:10},Hm={color:w.a.n4},qm={color:w.a.n6,fontStyle:"italic"};function Ym({title:e,current:t,target:n,ProgressComponent:r,style:a}){return l.a.createElement(E.y,{style:[Wm,a]},l.a.createElement(r,{current:t,target:n}),l.a.createElement(E.y,{style:Gm},l.a.createElement(E.y,null,l.a.createElement(E.w,{style:Hm},e)),l.a.createElement(E.w,null,l.a.createElement(vt,{binding:t,type:"financial"}),l.a.createElement(E.w,{style:qm}," of ",l.a.createElement(vt,{binding:n,type:"financial",style:w.c.notFixed})))))}function Km({projected:e,style:t}){return l.a.createElement(Ym,{title:"Income",current:Ae.totalIncome,target:Ae.totalBudgetedIncome,ProgressComponent:Um,style:t})}function Vm({style:e}){return l.a.createElement(Ym,{title:"Expenses",current:Ae.totalSpent,target:Ae.totalBudgetedExpense,ProgressComponent:$m,style:e})}var Qm={alignItems:"center",fontSize:14},Zm={color:w.a.n4},Xm={color:w.a.n4},Jm={padding:10,fontSize:14};function eg({projected:e,style:t}){let n=Object(aa.a)(Ae.totalBudgetedSaved)||0,r=Object(aa.a)(Ae.totalSaved)||0,a=e?n:r,o=a<0;return l.a.createElement(E.y,{style:[Qm,t]},e?l.a.createElement(E.w,{style:Zm},"Projected Savings:"):l.a.createElement(E.y,{style:Xm},o?"Overspent:":"Saved:"),l.a.createElement(E.j,{renderContent:()=>{if(!e){let e=r-n;return l.a.createElement(E.x,{position:"bottom-center",style:Jm},l.a.createElement(E.a,{left:"Projected Savings:",right:l.a.createElement(E.w,{style:[gp(n),w.c.tnum]},Object(wt.a)(n,"financial-with-sign"))}),l.a.createElement(E.a,{left:"Difference:",right:l.a.createElement(E.w,{style:[gp(e),w.c.tnum]},Object(wt.a)(e,"financial-with-sign"))}))}return null}},l.a.createElement(E.y,Object(j.css)([{fontSize:25,color:e?w.a.y3:o?w.a.r4:w.a.p5}]),Object(wt.a)(a,"financial"))))}var tg={backgroundColor:"white",boxShadow:bp,borderRadius:6,marginLeft:0,marginRight:0,marginTop:5,flex:1,cursor:"default",marginBottom:5,overflow:"hidden","& .hover-visible":{opacity:0,transition:"opacity .25s"},"&:hover .hover-visible":{opacity:1}},ng={padding:"0 13px"},rg={margin:"10px 0"},ag={marginTop:16},og={position:"absolute",left:10,top:0},lg={color:w.a.n6,margin:1},ig={textAlign:"center",marginTop:3,fontSize:18,fontWeight:500,textDecorationSkip:"ink"},cg={textDecoration:"underline"},sg={position:"absolute",right:10,top:0,flexDirection:"row",alignItems:"center"},ug={userSelect:"none"},dg={color:w.a.n5},fg={padding:0},pg={alignSelf:"center",backgroundColor:w.a.n11,borderRadius:4,padding:"10px 15px",marginTop:13},yg={alignItems:"center",padding:"10px 20px",justifyContent:"space-between",backgroundColor:w.a.n11,borderTop:"1px solid "+w.a.n10},mg={marginTop:13,marginBottom:20},gg=l.a.memo(function({month:e}){let t=Object(o.useContext)(Mm),n=t.currentMonth,r=t.summaryCollapsed,a=t.onBudgetAction,i=t.onToggleSummaryCollapse,c=Bm(Object(o.useState)(!1),2),s=c[0],u=c[1];function d(e){u(!1)}let f=r?$p:qp;return l.a.createElement(E.y,{style:tg},l.a.createElement(Op.a.Provider,{value:Ee.w(e,"report")},l.a.createElement(E.y,{style:[ng,r?rg:ag]},l.a.createElement(E.y,{style:og},l.a.createElement(E.d,{className:"hover-visible",bare:!0,onClick:i},l.a.createElement(f,{width:13,height:13,style:lg}))),l.a.createElement("div",Object(j.css)([ig,n===e&&cg]),Ee.g(e,"MMMM")),l.a.createElement(E.y,{style:sg},l.a.createElement(E.y,null,l.a.createElement(py,{id:`budget-${e}`,width:15,height:15,tooltipPosition:"bottom-right",defaultColor:w.a.n6})),l.a.createElement(E.y,{style:ug},l.a.createElement(E.d,{bare:!0,onClick:function(e){u(!0)}},l.a.createElement(Yt.a,{width:15,height:15,style:dg})),s&&l.a.createElement(E.x,{position:"bottom-right",width:200,style:fg,onClose:d},l.a.createElement(E.q,{onMenuSelect:t=>{d(),a(e,t)},items:[{name:"copy-last",text:"Copy last month's budget"},{name:"set-zero",text:"Set budgets to zero"},{name:"set-3-avg",text:"Set budgets to 3 month avg"},{name:"set-all-future",text:"Apply to all future budgets"}]}))))),!r&&l.a.createElement(E.v,{spacing:2,style:pg},l.a.createElement(Km,null),l.a.createElement(Vm,null)),r?l.a.createElement(E.y,{style:yg},l.a.createElement(eg,{projected:e>=n})):l.a.createElement(eg,{projected:e>=n,style:mg})))});let hg={flex:1,padding:"0 5px",textAlign:"right"};var bg={flex:1,flexDirection:"row",marginRight:5,paddingTop:10,paddingBottom:10},Og={color:w.a.n4},wg={color:w.a.n4,fontWeight:600},Eg={color:w.a.n4},vg={color:w.a.n4,fontWeight:600},jg={color:w.a.n4},Sg={color:w.a.n4,fontWeight:600};const xg=l.a.memo(function(){return l.a.createElement(E.y,{style:bg},l.a.createElement(E.y,{style:hg},l.a.createElement(E.w,{style:Og},"Budgeted"),l.a.createElement(vt,{binding:Ae.totalBudgetedExpense,type:"financial",style:wg,formatter:e=>Object(wt.a)(parseFloat(e||"0"),"financial")})),l.a.createElement(E.y,{style:hg},l.a.createElement(E.w,{style:Eg},"Spent"),l.a.createElement(vt,{binding:Ae.totalSpent,type:"financial",style:vg})),l.a.createElement(E.y,{style:hg},l.a.createElement(E.w,{style:jg},"Balance"),l.a.createElement(vt,{binding:Ae.totalLeftover,type:"financial",style:Sg})))});var Cg={flexDirection:"row",marginRight:5,paddingBottom:5},kg={color:w.a.n4},Pg={color:w.a.n4};function Ag(){return l.a.createElement(E.y,{style:Cg},l.a.createElement(E.y,{style:hg},l.a.createElement(E.w,{style:kg},"Budgeted")),l.a.createElement(E.y,{style:hg},l.a.createElement(E.w,{style:Pg},"Received")))}var Ig={flex:1,flexDirection:"row"},Dg={fontWeight:600},Tg={fontWeight:600},Mg={fontWeight:600,paddingRight:5};const Rg=l.a.memo(function({group:e}){let t=w.a.border,n=e.id;return l.a.createElement(E.y,{style:Ig},l.a.createElement(xa.k,{name:"budgeted",width:"flex",borderColor:t,textAlign:"right",style:[Dg,w.c.tnum],valueProps:{binding:Ae.groupBudgeted(n),type:"financial"}}),l.a.createElement(xa.k,{name:"spent",width:"flex",textAlign:"right",borderColor:t,style:[Tg,w.c.tnum],valueProps:{binding:Ae.groupSumAmount(n),type:"financial"}}),!e.is_income&&l.a.createElement(xa.k,{name:"balance",width:"flex",borderColor:t,textAlign:"right",style:[Mg,w.c.tnum],valueProps:{binding:Ae.groupBalance(n),type:"financial"}}))});var Bg={padding:0};function _g({categoryId:e,tooltip:t,monthIndex:n,onBudgetAction:r}){let a=Object(aa.a)(Ae.catCarryover(e));return l.a.createElement(E.x,{position:"bottom-right",width:200,style:Bg,onClose:t.close},l.a.createElement(E.q,{onMenuSelect:o=>{r(n,"carryover",{category:e,flag:!a}),t.close()},items:[{name:"carryover",text:a?"Remove overspending rollover":"Rollover overspending"}]}))}var Lg={flex:1,flexDirection:"row"},Ng={zIndex:100},Fg={cursor:"default",margin:1,padding:"0 4px",borderRadius:4},Ug={":hover":{boxShadow:"inset 0 0 0 1px "+w.a.n7,backgroundColor:"white"}},zg={textAlign:"right"},$g={cursor:"pointer",":hover":{textDecoration:"underline"}},Wg={paddingRight:5,textAlign:"right"};const Gg=l.a.memo(function({monthIndex:e,category:t,budgeted:n,currentSum:r,balance:a,editing:o,onEdit:i,onBudgetAction:c,onShowActivity:s}){let u=w.a.border,d=Object(E.A)();return l.a.createElement(E.y,{style:Lg},l.a.createElement(xa.k,{name:"budget",sync:!0,exposed:o,width:"flex",borderColor:u,onExpose:()=>i(t.id,e),style:[o&&Ng,w.c.tnum],textAlign:"right",valueStyle:[Fg,Ug],valueProps:{binding:Ae.catBudgeted(t.id),type:"financial",getValueStyle:yp,formatExpr:e=>Object(we.integerToCurrency)(e),unformatExpr:e=>Object(we.amountToInteger)(ci(e,0))},inputProps:{onBlur:()=>{i(null)}},onSave:n=>{c(e,"budget-amount",{category:t.id,amount:n})}}),l.a.createElement(xa.e,{name:"spent",width:"flex",borderColor:u,style:zg},l.a.createElement("span",{onClick:()=>s(t.name,t.id,e)},l.a.createElement(vt,{binding:Ae.catSumAmount(t.id),type:"financial",getStyle:yp,style:$g}))),!t.is_income&&l.a.createElement(xa.e,{name:"balance",width:"flex",borderColor:u,style:Wg},l.a.createElement("span",t.is_income?{}:d.getOpenEvents(),l.a.createElement(Np,{category:t,disabled:t.is_income,carryover:Ae.catCarryover(t.id),balance:Ae.catBalance(t.id)})),d.isOpen&&l.a.createElement(_g,{categoryId:t.id,tooltip:d,monthIndex:e,onBudgetAction:c})))}),Hg=Rg,qg=Gg,Yg=Rg,Kg=Gg;function Vg(e,t){const n=e.getBoundingClientRect();return t.find(e=>null!=e.width&&n.width<e.width||null!=e.height&&n.height<e.height)||t[t.length-1]}var Qg=Xn()(function({props:{children:e},state:{matched:t},inst:n}){return e(t,e=>n.element=e)},{getInitialState:()=>({matched:null}),componentDidMount({inst:e,props:t,setState:n}){e.observer=new ResizeObserver(r=>{r.forEach(r=>{n({matched:Vg(e.element,t.sizes)})})}),e.observer.observe(e.element)},componentWillUnmount({inst:e}){e.observer.disconnect()}});function Zg(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xg(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Zg(Object(n),!0).forEach(function(t){Jg(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zg(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Jg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var eh=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:Xg({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M3.828 9l6.071-6.071-1.414-1.414L0 10l.707.707 7.778 7.778 1.414-1.414L3.828 11H20V9H3.828z",fill:"currentColor"})),th=n(329),nh=n(197);function rh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ah(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ah(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ah(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var oh={flex:1,overflow:"hidden"},lh={marginLeft:-4,marginRight:-4},ih={paddingLeft:4,paddingRight:4};function ch({SummaryComponent:e}){let t=Object(o.useContext)(up).months,n=rh(Object(o.useState)(0),2),r=n[0],a=n[1],i=Object(o.useRef)(null),c=Object(nh.a)(Object(o.useCallback)(e=>{a(e.width)},[])),s=Object(o.useRef)(),u=Object(o.useRef)(t[0]),d=[...t];d.unshift(Ee.y(t[0],1)),d.push(Ee.b(t[t.length-1],1));let f=r/t.length;Object(o.useLayoutEffect)(()=>{if(!s.current)return;i.current||(i.current=new th.a({stiffness:600,damping:80,mass:3,fromValue:-f}),i.current.onUpdate(e=>{s.current&&(s.current.style.transform="translateX("+e.currentValue+"px)")}));let e=u.current,n=e>t[0],r=f,a=n?2*-r:0;e!==d[0]&&e!==d[2]&&(a=-r);let o=-r;i.current.updateConfig({fromValue:a,toValue:o}).start()},[t[0]]),Object(o.useLayoutEffect)(()=>{u.current=t[0]},[t[0]]),Object(o.useLayoutEffect)(()=>{s.current.style.transform=`translateX(${-f}px)`},[f]);var p={flex:`0 0 ${f}px`};return l.a.createElement("div",Object.assign({},Object(j.css)([oh,1===t.length&&lh]),{ref:c}),l.a.createElement(E.y,{style:{flexDirection:"row",width:r,willChange:"transform"},innerRef:s},d.map((t,n)=>l.a.createElement(E.y,{key:t,style:[p,ih]},l.a.createElement(e,{month:t})))))}function sh(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return uh(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uh(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function uh(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function dh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fh(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?dh(Object(n),!0).forEach(function(t){ph(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):dh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ph(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function yh(){return Math.max(w.c.scrollbarWidth-2,0)}var mh={flex:1},gh={"& ::-webkit-scrollbar":{backgroundColor:"transparent"},"& ::-webkit-scrollbar-thumb:vertical":{backgroundColor:"white"}},hh={flexDirection:"row",overflow:"hidden",flexShrink:0,paddingLeft:5,paddingRight:5+yh()},bh={width:200},Oh={overflowY:"scroll",overflowAnchor:"none",flex:1,paddingLeft:5,paddingRight:5};class wh extends l.a.Component{constructor(e){super(e),this.onEditMonth=((e,t)=>{this.setState({editing:e?{id:e,cell:t}:null})}),this.onEditName=(e=>{this.setState({editing:e?{id:e,cell:"name"}:null})}),this.onReorderCategory=((e,t,n)=>{let r=this.props.categoryGroups;if(!!r.find(e=>e.id===n)){let a=function(e,t,n){if("bottom"===t)return{targetId:n};{let t=e.findIndex(e=>e.id===n);if(-1===t)throw new Error("findSort: item not found: "+n);let r=t-1;return r>=0?{targetId:e[r].id}:{targetId:null}}}(r,t,n).targetId,o=r.find(e=>e.id===a);if(o){let n=o.categories;this.props.onReorderCategory({id:e,groupId:o.id,targetId:0===n.length||"top"===t?null:n[0].id})}}else{let a;for(let e of r)if(e.categories.find(e=>e.id===n)){a=e;break}this.props.onReorderCategory(fh({id:e,groupId:a.id},hp(a.categories,t,n)))}}),this.onReorderGroup=((e,t,n)=>{let r=this.props.categoryGroups;this.props.onReorderGroup(fh({id:e},hp(r,t,n)))}),this.moveVertically=(e=>{let t=this.state.editing,n=this.props,r=n.type,a=n.categoryGroups,o=n.collapsed;const l=a.reduce((e,t)=>o.includes(t.id)?e.concat({id:t.id,isGroup:!0}):e.concat([{id:t.id,isGroup:!0},...t.categories]),[]);if(t){let n=l.findIndex(e=>e.id===t.id)+e;for(;n>=0&&n<l.length;){const a=l[n];if(!a.isGroup){if("report"!==r&&a.is_income)break;return void this.onEditMonth(a.id,t.cell)}n+=e}}}),this.onKeyDown=(e=>{if(!this.state.editing)return null;13!==e.keyCode&&9!==e.keyCode||(e.preventDefault(),this.moveVertically(e.shiftKey?-1:1))}),this.onShowActivity=((e,t,n)=>{this.props.onShowActivity(e,t,this.resolveMonth(n))}),this.onBudgetAction=((e,t,n)=>{this.props.onBudgetAction(this.resolveMonth(e),t,n)}),this.resolveMonth=(e=>Ee.b(this.props.startMonth,e)),this.budgetCategoriesRef=l.a.createRef(),this.state={editing:null,draggingState:null}}clearEditing(){this.setState({editing:null})}render(){let e=this.props,t=e.type,n=e.categoryGroups,r=e.prewarmStartMonth,a=e.startMonth,o=e.numMonths,i=e.monthBounds,c=e.collapsed,s=e.setCollapsed,u=e.newCategoryForGroup,d=e.dataComponents,f=e.isAddingGroup,p=e.onSaveCategory,y=e.onSaveGroup,m=e.onDeleteCategory,g=e.onDeleteGroup,h=e.onShowNewCategory,b=e.onHideNewCategory,O=e.onShowNewGroup,v=e.onHideNewGroup,j=this.state,S=j.editing,x=j.draggingState;return l.a.createElement(E.y,{style:[mh,w.c.lightScrollbar&&gh]},l.a.createElement(E.y,{style:hh},l.a.createElement(E.y,{style:bh}),l.a.createElement(dp,{startMonth:r,numMonths:o,monthBounds:i,type:t},l.a.createElement(ch,{SummaryComponent:d.SummaryComponent}))),l.a.createElement(dp,{startMonth:a,numMonths:o,monthBounds:i,type:t},l.a.createElement(Xh,{MonthComponent:d.BudgetTotalsComponent}),l.a.createElement(E.o.Provider,{value:this.budgetCategoriesRef},l.a.createElement(E.y,{style:Oh,innerRef:this.budgetCategoriesRef},l.a.createElement(E.y,{style:{opacity:x?.5:1,flexShrink:0},onKeyDown:this.onKeyDown,innerRef:e=>this.budgetDataNode=e},l.a.createElement(ub,{categoryGroups:n,newCategoryForGroup:u,isAddingGroup:f,editingCell:S,collapsed:c,setCollapsed:s,dataComponents:d,onEditMonth:this.onEditMonth,onEditName:this.onEditName,onSaveCategory:p,onSaveGroup:y,onDeleteCategory:m,onDeleteGroup:g,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup,onShowNewCategory:h,onHideNewCategory:b,onShowNewGroup:O,onHideNewGroup:v,onBudgetAction:this.onBudgetAction,onShowActivity:this.onShowActivity}))))))}}var Eh={flexDirection:"row",alignItems:"center",userSelect:"none",WebkitUserSelect:"none"},vh={textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},jh={flexShrink:0,marginLeft:5},Sh={color:"currentColor",padding:3},xh={color:"currentColor"},Ch={padding:0},kh={flex:1},Ph={color:"currentColor"},Ah={width:200,"& button":{display:"none"}},Ih={"&:hover button":{display:"flex",color:w.a.n1}},Dh={color:w.a.n8},Th={backgroundColor:"white",zIndex:1e4,borderRadius:6,overflow:"hidden"},Mh={paddingLeft:13},Rh={borderBottomWidth:0};function Bh({innerRef:e,category:t,dragPreview:n,dragging:r,editing:a,style:i,borderColor:c=w.a.border,isLast:s,onDragChange:u,onEditMonth:d,onEditName:f,onSave:p,onDelete:y,onHideNewCategory:m}){const g="new"===t.id,h=sh(Object(o.useState)(!1),2),b=h[0],O=h[1],v=l.a.createElement(E.y,{style:Eh},l.a.createElement("div",{style:vh},t.name),l.a.createElement(E.y,{style:jh},l.a.createElement(E.d,{bare:!0,onClick:e=>{e.stopPropagation(),O(!0)},style:Sh},l.a.createElement(ca,{width:14,height:14,style:xh})),b&&l.a.createElement(E.x,{position:"bottom-left",width:200,style:Ch,onClose:()=>O(!1)},l.a.createElement(E.q,{onMenuSelect:e=>{"rename"===e?f(t.id):y(t.id),O(!1)},items:[{name:"rename",text:"Rename"},{name:"delete",text:"Delete"}]}))),l.a.createElement(E.y,{style:kh}),l.a.createElement(py,{id:t.id,style:r&&Ph}));return l.a.createElement(E.y,{innerRef:e,style:[Ah,!r&&!n&&Ih,r&&Dh,n&&Th,i],onKeyDown:e=>{13===e.keyCode&&(f(null),e.stopPropagation())}},l.a.createElement(xa.f,{value:t.name,formatter:e=>v,width:"flex",exposed:a||g,borderColor:n?"transparent":c,onUpdate:e=>{g?""===e?m():""!==e&&p(fh(fh({},t),{},{name:e})):e!==t.name&&p(fh(fh({},t),{},{name:e}))},onBlur:()=>f(null),style:[Mh,s&&Rh],inputProps:{placeholder:g?"New Category Name":""}}))}var _h={flexDirection:"row",alignItems:"center",userSelect:"none",WebkitUserSelect:"none"},Lh={textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden",minWidth:0},Nh={fontWeight:500},Fh={marginLeft:5,flexShrink:0},Uh={padding:3},zh={padding:0},$h={flex:1},Wh={width:200,backgroundColor:w.a.n11,"& button":{display:"none"},"&:hover button":{display:"flex",color:w.a.n1}},Gh={paddingLeft:10,zIndex:1e4,borderRadius:6,overflow:"hidden"},Hh={fontWeight:600};function qh({group:e,editing:t,collapsed:n,dragPreview:r,innerRef:a,style:i,borderColor:c=w.a.border,onEdit:s,onSave:u,onDelete:d,onShowNewCategory:f,onHideNewGroup:p,onToggleCollapse:y}){const m="new"===e.id,g=sh(Object(o.useState)(!1),2),h=g[0],b=g[1],O=l.a.createElement(E.y,{style:_h,onClick:t=>{y(e.id)}},!r&&l.a.createElement(vu.a,{width:8,height:8,style:{marginRight:5,marginLeft:5,flexShrink:0,transition:"transform .1s",transform:n?"rotate(-90deg)":""}}),l.a.createElement("div",{style:Lh},r&&l.a.createElement(E.w,{style:Nh},"Group: "),e.name),!r&&l.a.createElement(l.a.Fragment,null,l.a.createElement(E.y,{style:Fh},l.a.createElement(E.d,{bare:!0,onClick:e=>{e.stopPropagation(),b(!0)},style:Uh},l.a.createElement(ca,{width:14,height:14})),h&&l.a.createElement(E.x,{position:"bottom-left",width:200,style:zh,onClose:()=>b(!1)},l.a.createElement(E.q,{onMenuSelect:t=>{"rename"===t?s(e.id):"add-category"===t?f(e.id):d(e.id),b(!1)},items:[{name:"add-category",text:"Add category"},{name:"rename",text:"Rename"},d&&{name:"delete",text:"Delete"}]}))),l.a.createElement(E.y,{style:$h}),l.a.createElement(py,{id:e.id})));return l.a.createElement(E.y,{innerRef:a,style:[i,Wh,r&&Gh],onKeyDown:e=>{13===e.keyCode&&(s(null),e.stopPropagation())}},l.a.createElement(xa.f,{value:e.name,formatter:e=>O,width:"flex",exposed:t,borderColor:w.a.border,onUpdate:t=>{m?""===t?p():""!==t&&u({id:e.id,name:t}):u({id:e.id,name:t})},onBlur:()=>s(null),style:Hh,inputProps:{style:{marginLeft:20},placeholder:m?"New Group Name":""}}))}var Yh={flex:1},Kh={borderLeft:"1px solid "+w.a.border};function Vh({component:e,editingIndex:t,args:n,style:r}){let a=Object(o.useContext)(up),i=a.months,c=a.type;return i.map((a,o)=>{let i=t===o;return l.a.createElement(Op.a.Provider,{key:o,value:Ee.w(a,c)},l.a.createElement(E.y,{style:[Yh,Kh,r]},l.a.createElement(e,Object.assign({monthIndex:o,editing:i},n))))})}var Qh={backgroundColor:"white",flexDirection:"row",flexShrink:0,boxShadow:bp,marginLeft:5,marginRight:5+yh(),borderRadius:"4px 4px 0 0",borderBottom:"1px solid "+w.a.border},Zh={width:200,color:w.a.n4,justifyContent:"center",paddingLeft:18};const Xh=l.a.memo(function({MonthComponent:e}){return l.a.createElement(E.y,{style:Qh},l.a.createElement(E.y,{style:Zh},"Category"),l.a.createElement(Vh,{component:e}))});var Jh={fontWeight:600};function eb({group:e,collapsed:t,editingCell:n,dragState:r,itemPos:a,MonthComponent:o,onEditName:i,onSave:c,onDelete:s,onDragChange:u,onReorderGroup:d,onReorderCategory:f,onToggleCollapse:p,onShowNewCategory:y}){let m=r&&r.item===e,g=Xt({type:"group",onDragChange:u,item:e,canDrag:null===n}).dragRef,h=Jt({types:"group",id:e.id,onDrop:d}),b=h.dropRef,O=h.dropPos,v=Jt({types:"category",id:e.id,onDrop:f,onLongHover:()=>{t&&p(e.id)}}),j=v.dropRef,S=v.dropPos;return l.a.createElement(xa.h,{collapsed:!0,backgroundColor:w.a.n11,style:Jh},r&&!r.preview&&"group"===r.type&&l.a.createElement(E.y,{innerRef:b,style:{position:"absolute",left:0,right:0,height:t?xa.g-1:(1+e.categories.length)*(xa.g-1)+1,zIndex:1e4}},l.a.createElement(nn,{pos:O,offset:{top:1}})),l.a.createElement(nn,{pos:S,offset:{top:1}}),l.a.createElement(E.y,{innerRef:j,style:{flex:1,flexDirection:"row",opacity:m&&!r.preview?.3:1}},l.a.createElement(qh,{innerRef:g,group:e,editing:n&&"name"===n.cell&&n.id===e.id,dragPreview:m&&r.preview,collapsed:t,onToggleCollapse:p,onEdit:i,onSave:c,onDelete:s,onShowNewCategory:y}),l.a.createElement(Vh,{component:o,args:{group:e}})))}var tb={flex:1,flexDirection:"row"};function nb({cat:e,budgetArray:t,editingCell:n,dragState:r,MonthComponent:a,onEditName:o,onEditMonth:i,onSave:c,onDelete:s,onBudgetAction:u,onShowActivity:d,onDragChange:f,onReorder:p}){let y=r&&r.item===e;r&&r.item.id===e.cat_group&&(y=!0);let m=Xt({type:"category",onDragChange:f,item:e,canDrag:null===n}).dragRef,g=Jt({types:"category",id:e.id,onDrop:p}),h=g.dropRef,b=g.dropPos;return l.a.createElement(xa.h,{innerRef:h,collapsed:!0,backgroundColor:"transparent"},l.a.createElement(nn,{pos:b,offset:{top:1}}),l.a.createElement(E.y,{style:[tb]},l.a.createElement(Bh,{innerRef:m,category:e,dragPreview:y&&r.preview,dragging:y&&!r.preview,editing:n&&"name"===n.cell&&n.id===e.id,onEditName:o,onSave:c,onDelete:s,onDragChange:f}),l.a.createElement(Vh,{component:a,editingIndex:n&&n.id===e.id&&n.cell,args:{category:e,onEdit:i,onBudgetAction:u,onShowActivity:d}})))}var rb={fontWeight:600};function ab({group:e,editingCell:t,collapsed:n,MonthComponent:r,onEditName:a,onSave:o,onToggleCollapse:i,onShowNewCategory:c}){return l.a.createElement(xa.h,{collapsed:!0,backgroundColor:w.a.n11,style:rb},l.a.createElement(qh,{group:e,collapsed:n,editing:t&&"name"===t.cell&&t.id===e.id,onEdit:a,onSave:o,onToggleCollapse:i,onShowNewCategory:c}),l.a.createElement(Vh,{component:r,args:{group:e}}))}function ob({cat:e,isLast:t,editingCell:n,MonthComponent:r,onEditName:a,onEditMonth:o,onSave:i,onDelete:c,onDragChange:s,onBudgetAction:u,onReorder:d,onShowActivity:f}){let p=Xt({type:"income-category",onDragChange:s,item:e,canDrag:null===n}).dragRef,y=Jt({types:"income-category",id:e.id,onDrop:d}),m=y.dropRef,g=y.dropPos;return l.a.createElement(xa.h,{innerRef:m,collapsed:!0,backgroundColor:"transparent"},l.a.createElement(nn,{pos:g,offset:{top:1}}),l.a.createElement(Bh,{innerRef:p,category:e,isLast:t,editing:n&&"name"===n.cell&&n.id===e.id,onEditName:a,onSave:i,onDelete:c}),l.a.createElement(Vh,{component:r,editingIndex:n&&n.id===e.id&&n.cell,args:{category:e,onEdit:o,isLast:t,onShowActivity:f,onBudgetAction:u}}))}var lb={marginBottom:10,backgroundColor:"white",overflow:"hidden",boxShadow:bp,borderRadius:"0 0 4px 4px",flex:1},ib={backgroundColor:w.a.n11},cb={height:70,backgroundColor:"white"},sb={":hover":{backgroundColor:"#fcfcfc"}};const ub=l.a.memo(({categoryGroups:e,newCategoryForGroup:t,isAddingGroup:n,editingCell:r,collapsed:a,setCollapsed:i,dataComponents:c,onBudgetAction:s,onShowActivity:u,onEditName:d,onEditMonth:f,onSaveCategory:p,onSaveGroup:y,onDeleteCategory:m,onDeleteGroup:g,onReorderCategory:h,onReorderGroup:b,onShowNewCategory:O,onHideNewCategory:w,onShowNewGroup:v,onHideNewGroup:j})=>{let S=Object(o.useMemo)(()=>{let r=sh(function(e){return[e.filter(e=>!e.is_income),e.find(e=>e.is_income)]}(e),2),o=r[0],l=r[1],i=Array.prototype.concat.apply([],o.map(e=>{let n=[{type:"expense-group",value:e}];return t===e.id&&n.push({type:"new-category"}),[...n,...(a.includes(e.id)?[]:e.categories).map(e=>({type:"expense-category",value:e}))]}));return n&&i.push({type:"new-group"}),l&&(i=i.concat([{type:"income-separator"},{type:"income-group",value:l},t===l.id&&{type:"new-category"},...(a.includes(l.id)?[]:l.categories).map(e=>({type:"income-category",value:e}))].filter(e=>e))),i},[e,a,t,n]),x=sh(Object(o.useState)(null),2),C=x[0],k=x[1],P=sh(Object(o.useState)(null),2),A=P[0],I=P[1];function D(e){let t=e.state;"start-preview"===t?k({type:e.type,item:e.item,preview:!0}):"start"===t?C&&(k(fh(fh({},C),{},{preview:!1})),I(a)):"hover"===t?k(fh(fh({},C),{},{hoveredId:e.id,hoveredPos:e.pos})):"end"===t&&(k(null),i(A))}function T(e){a.includes(e)?i(a.filter(t=>t!==e)):i([...a,e])}return l.a.createElement(E.y,{style:lb},S.map((n,o)=>{let i;switch(n.type){case"new-group":i=l.a.createElement(xa.h,{style:ib},l.a.createElement(qh,{group:{id:"new",name:""},editing:!0,onSave:y,onHideNewGroup:j,onEdit:d}));break;case"new-category":i=l.a.createElement(xa.h,null,l.a.createElement(Bh,{category:{name:"",cat_group:t,is_income:t===e.find(e=>e.is_income).id,id:"new"},editing:!0,onSave:p,onHideNewCategory:w,onEditName:d}));break;case"expense-group":i=l.a.createElement(eb,{group:n.value,editingCell:r,collapsed:a.includes(n.value.id),MonthComponent:c.ExpenseGroupComponent,dragState:C,onEditName:d,onSave:y,onDelete:g,onDragChange:D,onReorderGroup:b,onReorderCategory:h,onToggleCollapse:T,onShowNewCategory:O});break;case"expense-category":i=l.a.createElement(nb,{cat:n.value,editingCell:r,MonthComponent:c.ExpenseCategoryComponent,dragState:C,onEditName:d,onEditMonth:f,onSave:p,onDelete:m,onDragChange:D,onReorder:h,onBudgetAction:s,onShowActivity:u});break;case"income-separator":i=l.a.createElement(E.y,{style:cb},l.a.createElement(mb,{MonthComponent:c.IncomeHeaderComponent,onShowNewGroup:v}));break;case"income-group":i=l.a.createElement(ab,{group:n.value,editingCell:r,MonthComponent:c.IncomeGroupComponent,collapsed:a.includes(n.value.id),onEditName:d,onSave:y,onToggleCollapse:T,onShowNewCategory:O});break;case"income-category":i=l.a.createElement(ob,{cat:n.value,editingCell:r,isLast:o===S.length-1,MonthComponent:c.IncomeCategoryComponent,onEditName:d,onEditMonth:f,onSave:p,onDelete:m,onDragChange:D,onReorder:h,onBudgetAction:s,onShowActivity:u});break;default:throw new Error("Unknown item type: "+n.type)}let x=0===o?"first":o===S.length-1?"last":null;return l.a.createElement(en.Provider,{key:n.value?n.value.id:"income-separator"===n.type?"separator":o,value:x},l.a.createElement(E.y,{style:!C&&sb},i))}))});var db={flexDirection:"row",flex:1},fb={width:200,alignItems:"flex-start",justifyContent:"flex-start"},pb={fontSize:12,margin:10},yb={border:0,justifyContent:"flex-end"};function mb({MonthComponent:e,onShowNewGroup:t}){return l.a.createElement(E.y,{style:db},l.a.createElement(E.y,{style:fb},l.a.createElement(E.d,{onClick:t,style:pb},"Add Group")),l.a.createElement(Vh,{component:e,style:yb}))}var gb={marginLeft:205,flexShrink:0},hb={marginRight:5+yh()},bb={paddingTop:5};const Ob=l.a.memo(({startMonth:e,onMonthSelect:t,numMonths:n,monthBounds:r,style:a})=>{return l.a.createElement(E.y,{style:gb},l.a.createElement(E.y,{style:hb},l.a.createElement(Ib,{startMonth:e,numDisplayed:n,monthBounds:r,style:bb,onSelect:e=>t(function(e){let t=r.start,a=Ee.y(r.end,n-1);return e<t?t:e>a?a:e}(e))})))});var wb={flexDirection:"row",alignItems:"center",justifyContent:"space-between"},Eb={padding:"3px 0px",margin:"3px 0",fontWeight:"bold",fontSize:14,flex:"0 0 40px"},vb={flexDirection:"row",flex:1,alignItems:"center",justifyContent:"center"},jb={color:w.a.n7},Sb={backgroundColor:w.a.p6,color:"white",borderRadius:0},xb={borderTopLeftRadius:2,borderBottomLeftRadius:2},Cb={borderTopRightRadius:2,borderBottomRightRadius:2},kb={marginRight:0,borderRight:"solid 1px",borderColor:w.a.p6},Pb={textDecoration:"underline"},Ab={flexDirection:"row",alignItems:"center",flex:"0 0 50px",justifyContent:"flex-end"};const Ib=Object(Zn.scope)(e=>{function t(e,t){return Ee.o(e)===Ee.o(t)?Ee.g(t,"MMM"):null}return e(function({state:{monthNames:e,currentMonthName:t},props:{startMonth:n,numDisplayed:r,monthBounds:a,style:o,onSelect:i}}){const c=Ee.o(n),s=Ee.k(n);return l.a.createElement(E.y,{style:[wb,o]},l.a.createElement(E.y,{style:Eb},Ee.g(c,"yyyy")),l.a.createElement(Qg,{sizes:[{width:320,size:"small"},{width:400,size:"medium"},{size:"big"}]},(n,o)=>l.a.createElement(E.y,{innerRef:o,style:vb},e.map((e,o)=>{const u=s+r,d=o>=s&&o<u,f=e===t,p=function(e,t){return Ee.b(e,t)}(c,o),y=p>=a.start&&p<=a.end;return l.a.createElement(E.y,{key:e,style:[{marginRight:1,padding:n&&"big"===n.size?"3px 5px":"3px 3px",textAlign:"center",cursor:"default",borderRadius:2,":hover":y&&{backgroundColor:w.a.p6,color:"white"}},!y&&jb,w.c.smallText,d&&Sb,o===s&&xb,o===u-1&&Cb,o>=s&&o<u-1&&kb,f&&Pb],onClick:()=>i(p)},n&&"small"===n.size?e[0]:e)}))),l.a.createElement(E.y,{style:Ab},l.a.createElement(E.d,{onClick:()=>i(Ee.y(n,1)),bare:!0},l.a.createElement(eh,{width:12,height:12})),l.a.createElement(E.d,{onClick:()=>i(Ee.b(n,1)),bare:!0},l.a.createElement(Dp,{width:12,height:12}))))},{getInitialState:function({props:{startMonth:e,monthBounds:n}}){const r=Ee.d();var a;return{monthNames:(a=r,Ee.v(Ee.q(a),Ee.p(a))).map(e=>Ee.g(e,"MMM")),currentMonthName:t(e,r)}},componentWillReceiveProps:function({props:e},n){if(Ee.o(e.startMonth)!==Ee.o(n.startMonth))return{currentMonthName:t(n.startMonth,Ee.d())}}})}),Db=["width","height","categoryGroups","prewarmStartMonth","startMonth","maxMonths","monthBounds","onMonthSelect","onPreload"];function Tb(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const Mb=l.a.forwardRef((e,t)=>{let n=e.width,r=e.height,a=e.categoryGroups,i=e.prewarmStartMonth,c=e.startMonth,s=e.maxMonths,u=void 0===s?3:s,d=e.monthBounds,f=e.onMonthSelect,p=(e.onPreload,Tb(e,Db)),y=$().setDisplayMax,m=function(e){let t=e-200;return t<500?1:t<750?2:t<1e3?3:t<1250?4:t<1500?5:6}(n),g=Math.min(m,u),h=200+500*g;return Object(o.useEffect)(()=>{y(m)},[m]),l.a.createElement(fp.Provider,{value:a},l.a.createElement(E.y,{style:{width:n,height:r,alignItems:"center",opacity:n<=0||r<=0?0:1}},l.a.createElement(E.y,{style:{width:"100%",maxWidth:h}},l.a.createElement(Ob,{startMonth:i,numMonths:g,monthBounds:d,onMonthSelect:function(e){f(e,g)}}),l.a.createElement(wh,Object.assign({ref:t,categoryGroups:a,prewarmStartMonth:i,startMonth:c,numMonths:g,monthBounds:d},p)))))});var Rb=l.a.forwardRef((e,t)=>l.a.createElement(cp.a,null,({width:n,height:r})=>l.a.createElement(Mb,Object.assign({ref:t,width:n,height:r},e))));function Bb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bb(Object(n),!0).forEach(function(t){Lb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Lb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Nb(e,t){return e.map(e=>(e.id===t.cat_group&&(e.categories=[t,...e.categories]),_b({},e)))}function Fb(e,t){return e.map(e=>(e.id===t.cat_group&&(e.categories=e.categories.map(e=>e.id===t.id?_b(_b({},e),t):e)),e))}function Ub(e,t,n,r){if(t===r)return e;let a=e.reduce((e,n)=>e||n.categories.find(e=>e.id===t),null);return a=_b(_b({},a),{},{cat_group:n}),e.map(e=>(e.id===n?(e.categories=e.categories.reduce((e,n)=>(n.id===r?(e.push(a),e.push(n)):n.id!==t&&e.push(n),e),[]),r||e.categories.push(a)):e.categories=e.categories.filter(e=>e.id!==t),_b({},e)))}function zb(e,t,n){if(t===n)return e;let r=e.find(e=>e.id===t);return e=e.reduce((e,a)=>(a.id===n?(e.push(r),e.push(a)):a.id!==t&&e.push(a),e),[]),n||e.push(r),e}function $b(e,t){return e.map(e=>(e.categories=e.categories.filter(e=>e.id!==t),e))}function Wb(e,t){return[...e,t]}function Gb(e,t){return e.map(e=>e.id===t.id?_b(_b({},e),t):e)}function Hb(e,t){return e.filter(e=>e.id!==t)}function qb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yb(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qb(Object(n),!0).forEach(function(t){Kb(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qb(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kb(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let Vb=null;var Qb={flex:1};class Zb extends l.a.PureComponent{constructor(e){super(e),this.prewarmMonth=(async(e,t=null)=>{let n="report"===(t=t||this.props.budgetType)?"report-budget-month":"rollover-budget-month",r=await Object(h.send)(n,{month:e});for(let a of r)this.props.spreadsheet.prewarmCache(a.name,a)}),this.onMonthSelect=(async(e,t)=>{let n=this.state.startMonth;this.setState({prewarmStartMonth:e}),this.warmingMonth=e,e<n?await this.prewarmMonth(Ee.y(e,1)):e>n&&await this.prewarmMonth(Ee.b(e,t)),this.warmingMonth===e&&this.setState({startMonth:e})}),this.onShowNewCategory=(e=>{this.setState({newCategoryForGroup:e,collapsed:this.state.collapsed.filter(t=>t!==e)})}),this.onHideNewCategory=(()=>{this.setState({newCategoryForGroup:null})}),this.onShowNewGroup=(()=>{this.setState({isAddingGroup:!0})}),this.onHideNewGroup=(()=>{this.setState({isAddingGroup:!1})}),this.setCollapsed=(e=>{this.setState({collapsed:e})}),this.onSaveCategory=(async e=>{let t=this.state.categoryGroups;if("new"===e.id){let n=await this.props.createCategory(e.name,e.cat_group,e.is_income);this.setState({newCategoryForGroup:null,categoryGroups:Nb(t,Yb(Yb({},e),{},{is_income:e.is_income?1:0,id:n}))})}else this.props.updateCategory(e),this.setState({categoryGroups:Fb(t,e)})}),this.onDeleteCategory=(async e=>{const t=await Object(h.send)("must-category-transfer",{id:e});let n=this.state.categoryGroups;t?this.props.pushModal("confirm-category-delete",{category:e,onDelete:t=>{e!==t&&(this.props.deleteCategory(e,t),this.setState({categoryGroups:$b(n,e)}))}}):(this.props.deleteCategory(e),this.setState({categoryGroups:$b(n,e)}))}),this.onSaveGroup=(async e=>{let t=this.state.categoryGroups;if("new"===e.id){let n=await this.props.createGroup(e.name);this.setState({isAddingGroup:!1,categoryGroups:Wb(t,Yb(Yb({},e),{},{is_income:0,categories:e.categories||[],id:n}))})}else this.props.updateGroup(e),this.setState({categoryGroups:Gb(t,e)})}),this.onDeleteGroup=(async e=>{let t=this.state.categoryGroups,n=t.find(t=>t.id===e),r=!1;for(let a of n.categories)if(await Object(h.send)("must-category-transfer",{id:a.id})){r=!0;break}r?this.props.pushModal("confirm-category-delete",{group:e,onDelete:n=>{this.props.deleteGroup(e,n),this.setState({categoryGroups:Hb(t,e)})}}):(this.props.deleteGroup(e),this.setState({categoryGroups:Hb(t,e)}))}),this.onBudgetAction=((e,t,n)=>{this.props.applyBudgetAction(e,t,n)}),this.onShowActivity=((e,t,n)=>{this.props.history.push({pathname:"/accounts",state:{goBack:!0,filterName:`${e} (${Ee.g(n,"MMMM yyyy")})`,filter:{category:t,date:{$transform:"$month",$eq:n}}}})}),this.onReorderCategory=(async e=>{let t=this.state.categoryGroups;this.props.moveCategory(e.id,e.groupId,e.targetId),this.setState({categoryGroups:Ub(t,e.id,e.groupId,e.targetId)})}),this.onReorderGroup=(async e=>{let t=this.state.categoryGroups;this.props.moveCategoryGroup(e.id,e.targetId),this.setState({categoryGroups:zb(t,e.id,e.targetId)})}),this.onToggleCollapse=(()=>{let e=!this.state.summaryCollapsed;this.setState({summaryCollapsed:e}),this.props.savePrefs({"budget.summaryCollapsed":e})}),this.onTitlebarEvent=(async e=>{switch(e){case"budget/switch-type":{let e="rollover"===this.props.budgetType?"report":"rollover";this.props.spreadsheet.disableObservers(),await Object(h.send)("budget-set-type",{type:e}),await this.prewarmAllMonths(this.state.bounds,e),this.props.spreadsheet.enableObservers(),this.props.loadPrefs();break}}});const t=Vb||Ee.d();this.state={initialized:!1,prewarmStartMonth:t,startMonth:t,newCategoryForGroup:null,isAddingGroup:!1,collapsed:e.collapsedPrefs||[],bounds:{start:t,end:t},categoryGroups:null,summaryCollapsed:e.summaryCollapsed}}async loadCategories(){let e=await this.props.getCategories();this.setState({categoryGroups:e.grouped})}async componentDidMount(){let e=this.props,t=e.titlebar,n=e.budgetType;this.loadCategories();let r=await Object(h.send)("get-budget-bounds"),a=r.start,o=r.end;this.setState({bounds:{start:a,end:o}}),this.prewarmAllMonths({start:a,end:o},n);let l=[Object(h.listen)("sync-event",({type:e,tables:t})=>{"success"===e&&(t.includes("categories")||t.includes("category_mapping")||t.includes("category_groups"))&&this.loadCategories()}),Object(h.listen)("undo-event",({tables:e})=>{this.table&&this.table.clearEditing(),e.includes("categories")&&this.loadCategories()}),t.subscribe(this.onTitlebarEvent)];this.cleanup=(()=>{l.forEach(e=>e())})}componentDidUpdate(e,t){t.collapsed!==this.state.collapsed&&this.props.savePrefs({"budget.collapsed":this.state.collapsed}),t.startMonth!==this.state.startMonth&&(Vb=this.state.startMonth),this.props.match&&!e.match&&Object(h.send)("get-budget-bounds").then(({start:e,end:t})=>{let n=this.state.bounds;n.start===e&&n.end===t||this.setState({bounds:{start:e,end:t}})})}componentWillUnmount(){this.cleanup&&this.cleanup()}async prewarmAllMonths(e,t=null){let n=this.state.startMonth;e=sp(e,Ee.y(n,1),Ee.b(n,4));let r=Ee.v(e.start,e.end);await Promise.all(r.map(e=>this.prewarmMonth(e,t))),this.setState({initialized:!0})}onCopy(e){this.props.copyPreviousMonthInto(e,this.props.categories)}render(){let e,t=this.props,n=t.maxMonths,r=t.budgetType,a=t.reportComponents,o=t.rolloverComponents,i=this.state,c=i.initialized,s=i.categoryGroups,u=i.prewarmStartMonth,d=i.startMonth,f=i.newCategoryForGroup,p=i.isAddingGroup,y=i.collapsed,m=i.summaryCollapsed,g=i.bounds;return n=n||1,c&&s?(e="report"===r?l.a.createElement(Rm,{summaryCollapsed:m,onBudgetAction:this.onBudgetAction,onToggleSummaryCollapse:this.onToggleCollapse},l.a.createElement(Rb,{ref:e=>this.table=e,type:r,categoryGroups:s,prewarmStartMonth:u,startMonth:d,monthBounds:g,maxMonths:n,collapsed:y,setCollapsed:this.setCollapsed,newCategoryForGroup:f,isAddingGroup:p,dataComponents:a,onMonthSelect:this.onMonthSelect,onShowNewCategory:this.onShowNewCategory,onHideNewCategory:this.onHideNewCategory,onShowNewGroup:this.onShowNewGroup,onHideNewGroup:this.onHideNewGroup,onDeleteCategory:this.onDeleteCategory,onDeleteGroup:this.onDeleteGroup,onSaveCategory:this.onSaveCategory,onSaveGroup:this.onSaveGroup,onBudgetAction:this.onBudgetAction,onShowActivity:this.onShowActivity,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup})):l.a.createElement(Kp,{categoryGroups:s,summaryCollapsed:m,onBudgetAction:this.onBudgetAction,onToggleSummaryCollapse:this.onToggleCollapse},l.a.createElement(Rb,{ref:e=>this.table=e,type:r,categoryGroups:s,prewarmStartMonth:u,startMonth:d,monthBounds:g,maxMonths:n,collapsed:y,setCollapsed:this.setCollapsed,newCategoryForGroup:f,isAddingGroup:p,dataComponents:o,onMonthSelect:this.onMonthSelect,onShowNewCategory:this.onShowNewCategory,onHideNewCategory:this.onHideNewCategory,onShowNewGroup:this.onShowNewGroup,onHideNewGroup:this.onHideNewGroup,onDeleteCategory:this.onDeleteCategory,onDeleteGroup:this.onDeleteGroup,onSaveCategory:this.onSaveCategory,onSaveGroup:this.onSaveGroup,onBudgetAction:this.onBudgetAction,onShowActivity:this.onShowActivity,onReorderCategory:this.onReorderCategory,onReorderGroup:this.onReorderGroup})),l.a.createElement(E.y,{style:Qb,innerRef:e=>this.page=e},e)):null}}var Xb={paddingLeft:8,paddingRight:8,overflow:"hidden"};var Jb=Object(s.b)(e=>({collapsedPrefs:e.prefs.local["budget.collapsed"],summaryCollapsed:e.prefs.local["budget.summaryCollapsed"],budgetType:e.prefs.local.budgetType||"rollover",maxMonths:e.prefs.global.maxMonths,categoryGroups:e.queries.categories.grouped}),p)(function(e){let t=Object(o.useContext)(g.a),n=Object(o.useContext)(gr),i=Object(o.useMemo)(()=>({SummaryComponent:gg,ExpenseCategoryComponent:qg,ExpenseGroupComponent:Hg,IncomeCategoryComponent:Kg,IncomeGroupComponent:Yg,BudgetTotalsComponent:xg,IncomeHeaderComponent:Ag}),[a]),c=Object(o.useMemo)(()=>({SummaryComponent:Gy,ExpenseCategoryComponent:Sm,ExpenseGroupComponent:gm,IncomeCategoryComponent:Tm,IncomeGroupComponent:km,BudgetTotalsComponent:cm,IncomeHeaderComponent:dm}),[r]);return l.a.createElement(E.y,{style:[w.c.page,Xb]},l.a.createElement(Zb,Object.assign({},e,{reportComponents:i,rolloverComponents:c,spreadsheet:t,titlebar:n})))}),eO=n(546),tO=n(553),nO=n(560);function rO(e){return(...t)=>Object(o.useMemo)(()=>e(...t),t)}function aO(e){return e.slice(0,7)}function oO(e){return e}async function lO(e,t){t(await Promise.all(e.map(e=>Object(ae.f)(e).then(({data:e})=>e))))}function iO(e,t,n){const r={};return e.forEach(e=>{r[n?n(e[t]):e[t]]=e}),r}function cO(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sO(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cO(Object(n),!0).forEach(function(t){uO(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cO(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uO(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const dO={fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", "Helvetica", "Arial", sans-serif',fontSize:13,letterSpacing:"normal",fill:w.a.n1,stroke:"transparent"};var fO={colors:sO(sO({},{blueFadeStart:"rgba(229, 245, 255, 1)",blueFadeEnd:"rgba(229, 245, 255, 0)",redFadeStart:"rgba(255, 243, 242, 1)",redFadeEnd:"rgba(255, 243, 242, 0)"}),{},{red:w.a.r7,blue:w.a.b6}),area:{style:{data:{stroke:w.a.b6,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}}},axis:{style:{axis:{fill:"transparent",stroke:"none"},grid:{fill:"none",stroke:"none",pointerEvents:"none"},ticks:{fill:"transparent",size:1,stroke:"none"},tickLabels:dO}},dependentAxis:{style:{grid:{stroke:"rgba(0,0,0,.2)",strokeDasharray:"1,1"},tickLabels:{padding:5}}},independentAxis:{style:{axis:{stroke:"rgba(0,0,0,.2)"},tickLabels:{padding:10}}},bar:{style:{data:{fill:w.a.b6,stroke:"none"}}},line:{style:{data:{fill:"none",stroke:w.a.b6,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round"}}},chart:{padding:{top:20,left:65,right:20,bottom:50}}},pO={height:300,position:"relative",flexShrink:0};var yO=class extends l.a.Component{render(){const e=this.props,t=e.style,n=e.children;return l.a.createElement(E.y,{style:[pO,t]},l.a.createElement("div",{ref:e=>this.portalHost=e}),l.a.createElement(cp.a,null,({width:e,height:t})=>l.a.createElement("div",{style:{width:e,height:t}},n(e,t,this.portalHost))))}},mO=n(87),gO=n.n(mO),hO=n(564);class bO extends l.a.Component{render(){let e=this.props,t=e.active,n=e.x,r=e.y,a=e.scale,o=e.datum,i=e.portalHost,c=e.offsetX,s=void 0===c?0:c,u=e.offsetY,d=e.position,f=e.light,p=e.forceActive,y=e.style;const m=n-a.x.range()[0];return d||(d=o.labelPosition?o.labelPosition:m<150?"right":"left"),i&&(t||p)?(r=u?u(r):r,gO.a.createPortal(l.a.createElement("div",Object(j.css)({position:"absolute",top:0,left:s,transform:"right"===d?`translate(calc(${n}px + 15px), calc(${r}px ${f?"":"- 50%"}))`:`translate(calc(${n}px - 100% - 15px), calc(${r}px ${f?"":"- 50%"}))`,zIndex:1e3,pointerEvents:"none",borderRadius:2,boxShadow:f?"none":"0 1px 6px rgba(0, 0, 0, .20)",backgroundColor:f?"transparent":w.a.n1,color:f?"inherit":"white",padding:10},!f&&Object(j.before)({position:"absolute",display:"inline-block",borderTop:"7px solid transparent",borderBottom:"7px solid transparent",["right"===d?"borderRight":"borderLeft"]:"7px solid "+w.a.n1,["right"===d?"left":"right"]:-6,top:"calc(50% - 7px)",content:'" "'}),y),o.premadeLabel),i)):null}}bO.defaultEvents=hO.a.defaultEvents;var OO=bO;function wO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return EO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return EO(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function EO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var vO=function(e,t){const n=Object(o.useContext)(g.a),r=wO(Object(o.useState)(null),2),a=r[0],l=r[1];return Object(o.useEffect)(()=>{let e;return t(n,e=>l(e)).then(t=>{e=t}),()=>{e&&e()}},[t]),a};function jO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return SO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return SO(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function SO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function xO(e,t,n){return async(r,a)=>{if(0===n.length)return null;a(function(e,t,n){const r=Ee.v(t,n),a=e.map(e=>{let t=e.starting;return r.map(n=>(e.balances[n]&&(t+=e.balances[n].amount),t))});let o=!1,i=0,c=0;return{graphData:{data:r.reduce((e,t,n)=>{let r=0,s=0,u=0;const d=0===e.length?null:e[e.length-1];a.forEach(e=>{const t=e[n];t<0?r+=-t:s+=t,u+=t}),u<0&&(o=!0);const f=Ga.a(t+"-01"),p=d?u-Object(we.amountToInteger)(d.y):0,y=l.a.createElement("div",null,l.a.createElement("div",{style:CO},l.a.createElement("strong",null,Ha.a(f,"MMMM yyyy"))),l.a.createElement("div",{style:kO},l.a.createElement(E.a,{left:"Assets:",right:Object(we.integerToCurrency)(s)}),l.a.createElement(E.a,{left:"Debt:",right:`-${Object(we.integerToCurrency)(r)}`}),l.a.createElement(E.a,{left:"Net worth:",right:l.a.createElement("strong",null,Object(we.integerToCurrency)(u))}),l.a.createElement(E.a,{left:"Change:",right:Object(we.integerToCurrency)(p)})));return 0===e.length&&(i=u),c=u,e.push({x:f,y:Object(we.integerToAmount)(u),premadeLabel:y}),e},[]),hasNegative:o,start:t,end:n},netWorth:c,totalChange:c-i}}(await Promise.all(n.map(async n=>{let r=jO(await Promise.all([Object(ae.f)(Object(ae.c)("transactions").filter({account:n.id,date:{$lt:e+"-01"}}).calculate({$sum:"$amount"})).then(({data:e})=>e),Object(ae.f)(Object(ae.c)("transactions").filter({account:n.id,$and:[{date:{$gte:e+"-01"}},{date:{$lte:t+"-31"}}]}).groupBy({$month:"$date"}).select([{date:{$month:"$date"}},{amount:{$sum:"$amount"}}])).then(({data:e})=>e)]),2),a=r[0],o=r[1];return{id:n.id,balances:iO(o,"date"),starting:a}})),e,t))}}var CO={marginBottom:10},kO={lineHeight:1.5};function PO(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return AO(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return AO(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function AO(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function IO(e,t){return async(n,r)=>{function a(){return Object(ae.c)("transactions").filter({$and:[{date:{$gte:e}},{date:{$lte:t}}],"account.offbudget":!1,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]}).calculate({$sum:"$amount"})}return lO([a().filter({amount:{$gt:0}}),a().filter({amount:{$lt:0}})],e=>{r({graphData:{income:e[0],expense:e[1]}})})}}function DO(e,t,n){return async(r,a)=>{function o(r){let a=Object(ae.c)("transactions").filter({$and:[{date:{$transform:"$month",$gte:e}},{date:{$transform:"$month",$lte:t}}],"account.offbudget":!1,$or:[{"payee.transfer_acct.offbudget":!0,"payee.transfer_acct":null}]});return n?a.groupBy({$month:"$date"}).select([{date:{$month:"$date"}},{amount:{$sum:"$amount"}}]):a.groupBy("date").select(["date",{amount:{$sum:"$amount"}}])}return lO([Object(ae.c)("transactions").filter({date:{$transform:"$month",$lt:e},"account.offbudget":!1}).calculate({$sum:"$amount"}),o().filter({amount:{$gt:0}}),o().filter({amount:{$lt:0}})],r=>{a(function(e,t,n,r){let a=PO(e,3),o=a[0],i=a[1],c=a[2];const s=r?Ee.v(Ee.j(t),Ee.j(n)):Ee.f(t,n),u=iO(i,"date",r?aO:oO),d=iO(c,"date",r?aO:oO);let f=o,p=0,y=0;const m=s.reduce((e,t)=>{let n=0,a=0;u[t]&&(n=u[t].amount),d[t]&&(a=d[t].amount),p+=a,y+=n,f+=n+a;const o=Ga.a(t),i=l.a.createElement("div",null,l.a.createElement("div",{style:TO},l.a.createElement("strong",null,Ha.a(o,r?"MMMM yyyy":"MMMM d, yyyy"))),l.a.createElement("div",{style:MO},l.a.createElement(E.a,{left:"Income:",right:Object(we.integerToCurrency)(n)}),l.a.createElement(E.a,{left:"Expenses:",right:Object(we.integerToCurrency)(a)}),l.a.createElement(E.a,{left:"Change:",right:l.a.createElement("strong",null,Object(we.integerToCurrency)(n+a))}),l.a.createElement(E.a,{left:"Balance:",right:Object(we.integerToCurrency)(f)})));return e.income.push({x:o,y:Object(we.integerToAmount)(n)}),e.expenses.push({x:o,y:Object(we.integerToAmount)(a)}),e.balances.push({x:o,y:Object(we.integerToAmount)(f),premadeLabel:i,amount:f}),e},{expenses:[],income:[],balances:[]}),g=m.balances;return{graphData:m,balance:g[g.length-1].amount,totalExpenses:p,totalIncome:y,totalChange:g[g.length-1].amount-g[0].amount}}(r,e,t,n))})}}var TO={marginBottom:10},MO={lineHeight:1.5};var RO=n(556),BO=n(561),_O=n(532);function LO({start:e,end:t,data:n,style:r,scale:a,range:o}){const i=a.y(0),c=a.x(Ga.a(e+"-01")),s=a.x(Ga.a(t+"-01"));return c<0||s<0?null:l.a.createElement("svg",null,l.a.createElement("defs",null,l.a.createElement("clipPath",{id:"positive"},l.a.createElement("rect",{x:c,y:o.y[1],width:s-c,height:i-o.y[1]+1,fill:"#ffffff"})),l.a.createElement("clipPath",{id:"negative"},l.a.createElement("rect",{x:c,y:i+1,width:s-c,height:o.y[0]-i-1,fill:"#ffffff"})),l.a.createElement("linearGradient",{id:"positive-gradient",gradientUnits:"userSpaceOnUse",x1:0,y1:o.y[1],x2:0,y2:i},l.a.createElement("stop",{offset:"0%",stopColor:fO.colors.blueFadeStart}),l.a.createElement("stop",{offset:"100%",stopColor:fO.colors.blueFadeEnd})),l.a.createElement("linearGradient",{id:"negative-gradient",gradientUnits:"userSpaceOnUse",x1:0,y1:i,x2:0,y2:o.y[0]},l.a.createElement("stop",{offset:"0%",stopColor:fO.colors.redFadeEnd}),l.a.createElement("stop",{offset:"100%",stopColor:fO.colors.redFadeStart}))))}var NO={height:"auto"},FO={data:{clipPath:"url(#negative)",fill:"url(#negative-gradient)",stroke:fO.colors.red,strokeLinejoin:"round"}};var UO=function({style:e,start:t,end:n,graphData:r,compact:a}){const o=a?eO.a:RO.a;return l.a.createElement(yO,{style:[e,a&&NO]},(e,t,n)=>r&&l.a.createElement(o,{scale:{x:"time"},theme:fO,domainPadding:{x:0,y:10},width:e,height:t,containerComponent:l.a.createElement(tO.a,{voronoiDimension:"x"}),padding:a&&{top:0,bottom:0,left:0,right:0}},l.a.createElement(LO,{start:r.start,end:r.end,data:r.data}),l.a.createElement(1===r.data.length?nO.a:BO.a,{data:r.data,labelComponent:l.a.createElement(OO,{portalHost:n}),labels:e=>e.premadeLabel,style:{data:1===r.data.length?{width:50}:{clipPath:"url(#positive)",fill:"url(#positive-gradient)"}}}),r.data.length>1&&l.a.createElement(BO.a,{data:r.data,style:FO}),!a&&l.a.createElement(_O.a,{tickFormat:e=>Ha.a(e,"MMM ''yy"),tickValues:r.data.map(e=>e.x),tickCount:Math.min(5,r.data.length),offsetY:50}),!a&&l.a.createElement(_O.a,{dependentAxis:!0,crossAxis:!r.hasNegative})))};var zO=function({amount:e,style:t}){return l.a.createElement(E.c,{style:[w.c.smallText,{color:e<0?w.a.r5:w.a.g5}]},e>=0?"+":"",Object(we.integerToCurrency)(e))},$O={color:w.a.n6};var WO=function({start:e,end:t}){let n;return e=Ga.a(e),t=Ga.a(t),n=e.getYear()!==t.getYear()?l.a.createElement("div",null,Ha.a(e,"MMM yyyy")," - ",Ha.a(t,"MMM yyyy")):e.getMonth()!==t.getMonth()?l.a.createElement("div",null,Ha.a(e,"MMM")," - ",Ha.a(t,"MMM yyyy")):Ha.a(t,"MMMM yyyy"),l.a.createElement(E.c,{style:$O},n)};function GO({flex:e,to:t,style:n,children:r}){const a={flex:e,margin:15},o=l.a.createElement(E.y,{style:[{backgroundColor:"white",borderRadius:2,height:200,boxShadow:"0 2px 6px rgba(0, 0, 0, .15)",transition:"box-shadow .25s",":hover":t&&{boxShadow:"0 4px 6px rgba(0, 0, 0, .15)"}},t?null:a,n]},r);return t?l.a.createElement(E.b,{to:t,exact:!0,style:[{textDecoration:"none",flex:e},a]},o):o}var HO={flex:1},qO={flexDirection:"row",padding:20},YO={flex:1},KO={fontWeight:500,marginBottom:5},VO={textAlign:"right"},QO={fontWeight:500,marginBottom:5},ZO={color:w.a.n6,fontWeight:300},XO={height:"auto",flex:1};function JO({accounts:e}){const t=Ee.d(),n=Ee.y(t,5),r=vO("net_worth",rO(xO)(n,t,e));return r?l.a.createElement(GO,{flex:2,to:"/reports/net-worth"},l.a.createElement(E.y,{style:HO},l.a.createElement(E.y,{style:qO},l.a.createElement(E.y,{style:YO},l.a.createElement(E.c,{style:[w.c.mediumText,KO]},"Net Worth"),l.a.createElement(WO,{start:n,end:t})),l.a.createElement(E.y,{style:VO},l.a.createElement(E.c,{style:[w.c.mediumText,QO]},Object(we.integerToCurrency)(r.netWorth)),l.a.createElement(zO,{amount:r.totalChange,style:ZO}))),l.a.createElement(UO,{start:n,end:t,graphData:r.graphData,compact:!0,style:XO}))):null}var ew={flex:1},tw={flexDirection:"row",padding:20},nw={flex:1},rw={fontWeight:500,marginBottom:5},aw={textAlign:"right"},ow={color:w.a.n6,fontWeight:300},lw={height:"auto",flex:1},iw={padding:0},cw={textAlign:"right"};function sw(){const e=Ee.c(),t=Ee.d()+"-01",n=vO("cash_flow_simple",rO(IO)(t,e));if(!n)return null;const r=n.graphData,a=-(r.expense||0),o=r.income||0;return l.a.createElement(GO,{flex:1,to:"/reports/cash-flow"},l.a.createElement(E.y,{style:ew},l.a.createElement(E.y,{style:tw},l.a.createElement(E.y,{style:nw},l.a.createElement(E.c,{style:[w.c.mediumText,rw]},"Cash Flow"),l.a.createElement(WO,{start:t,end:e})),l.a.createElement(E.y,{style:aw},l.a.createElement(zO,{amount:o-a,style:ow}))),l.a.createElement(yO,{style:lw},(e,t,n)=>l.a.createElement(eO.a,{colorScale:[fO.colors.blue,fO.colors.red],width:100,height:t,theme:fO,domain:{x:[0,100],y:[0,Math.max(o,a,100)]},containerComponent:l.a.createElement(tO.a,{voronoiDimension:"x"}),labelComponent:l.a.createElement(OO,{portalHost:n,offsetX:(e-100)/2,offsetY:e=>e+40>t?t-40:e,light:!0,forceActive:!0,style:iw}),padding:{top:0,bottom:0,left:0,right:0}},l.a.createElement(nO.a,{data:[{x:30,y:Math.max(o,5),width:20,premadeLabel:l.a.createElement("div",{style:cw},l.a.createElement("div",null,"Income"),l.a.createElement("div",null,Object(we.integerToCurrency)(o))),labelPosition:"left"}],labels:e=>e.premadeLabel}),l.a.createElement(nO.a,{data:[{x:60,y:Math.max(a,5),width:20,premadeLabel:l.a.createElement("div",null,l.a.createElement("div",null,"Expenses"),l.a.createElement("div",null,Object(we.integerToCurrency)(a))),labelPosition:"right",fill:fO.colors.red}],labels:e=>e.premadeLabel})))))}var uw={paddingLeft:40,paddingRight:40,minWidth:700},dw={flexDirection:"row",flex:"0 0 auto"},fw={flex:"0 0 auto",flexDirection:"row"},pw={color:"#a0a0a0",justifyContent:"center",alignItems:"center",width:200};var yw=Object(s.b)(e=>({accounts:e.queries.accounts}),e=>Object(Qn.b)(p,e))(function({accounts:e}){return l.a.createElement(E.y,{style:[w.c.page,uw]},l.a.createElement(E.y,{style:dw},l.a.createElement(JO,{accounts:e}),l.a.createElement(sw,null)),l.a.createElement(E.y,{style:fw},l.a.createElement(GO,{style:[pw,w.c.mediumText]},"More reports",l.a.createElement("br",null)," coming soon!")))});function mw(e,t,n){const r=Ee.d();return n>r&&(n=r),t<e&&(t=e),[t,n]}function gw(e){const t=Ee.d();return[Ee.y(t,e),t]}var hw={padding:20,paddingTop:0,flexShrink:0},bw={marginBottom:"15",alignSelf:"flex-start"},Ow={marginRight:5},ww={flexDirection:"row",alignItems:"center",marginTop:15},Ew={flex:0,backgroundColor:"white"},vw={flex:0,backgroundColor:"white"},jw={marginLeft:15},Sw={marginLeft:15},xw={marginLeft:15},Cw={marginLeft:15},kw={marginLeft:15};var Pw=function({title:e,start:t,end:n,show1Month:r,allMonths:a,onChangeDates:o}){return l.a.createElement(E.y,{style:hw},l.a.createElement(E.e,{to:"/reports",bare:!0,style:bw},l.a.createElement(Qe,{width:10,height:10,style:Ow})," Back"),l.a.createElement(E.y,{style:w.c.veryLargeText},e),l.a.createElement(E.y,{style:ww},l.a.createElement("div",null,l.a.createElement(E.u,{style:Ew,onChange:e=>o(...function(e,t,n){const r=e[e.length-1].name;return n<t&&(n=Ee.b(t,6)),mw(r,t,n)}(a,e.target.value,n)),value:t},a.map(e=>l.a.createElement("option",{key:e.name,value:e.name},e.pretty)))," ","to"," ",l.a.createElement(E.u,{style:vw,onChange:e=>o(...function(e,t,n){const r=e[e.length-1].name;return t>n&&(t=Ee.y(n,6)),mw(r,t,n)}(a,t,e.target.value)),value:n},a.map(e=>l.a.createElement("option",{key:e.name,value:e.name},e.pretty)))),r&&l.a.createElement(E.d,{bare:!0,style:jw,onClick:()=>o(...gw(1))},"1 month"),l.a.createElement(E.d,{bare:!0,style:Sw,onClick:()=>o(...gw(2))},"3 months"),l.a.createElement(E.d,{bare:!0,style:xw,onClick:()=>o(...gw(5))},"6 months"),l.a.createElement(E.d,{bare:!0,style:Cw,onClick:()=>o(...gw(12))},"1 Year"),l.a.createElement(E.d,{bare:!0,style:kw,onClick:()=>o(...function(e){return[e[e.length-1].name,Ee.d()]}(a))},"All Time")))};function Aw(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Iw(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Iw(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Iw(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Dw={minWidth:650,overflow:"hidden"},Tw={backgroundColor:"white",padding:"30px",overflow:"auto"},Mw={textAlign:"right",paddingRight:20,flexShrink:0},Rw={fontWeight:400,marginBottom:5},Bw={marginTop:30};var _w=Object(s.b)(e=>({accounts:e.queries.accounts}),e=>Object(Qn.b)(p,e))(function({accounts:e}){const t=Aw(Object(o.useState)(null),2),n=(t[0],t[1]),r=Aw(Object(o.useState)(null),2),a=r[0],i=r[1],c=Aw(Object(o.useState)(Ee.y(Ee.d(),5)),2),s=c[0],u=c[1],d=Aw(Object(o.useState)(Ee.d()),2),f=d[0],p=d[1],y=vO("net_worth",rO(xO)(s,f,e));return Object(o.useEffect)(()=>{!async function(){const e=await Object(h.send)("get-earliest-transaction"),t=Ee.d();let r=e?Ee.s(Ga.a(aO(e.date))):t;const a=Ee.y(Ee.d(),12);r>a&&(r=a);const o=Ee.v(r,Ee.d()).map(e=>({name:e,pretty:Ee.g(e,"MMMM, yyyy")})).reverse();n(r),i(o)}()},[]),a&&y?l.a.createElement(E.y,{style:[w.c.page,Dw]},l.a.createElement(Pw,{title:"Net Worth",allMonths:a,start:s,end:f,onChangeDates:function(e,t){u(e),p(t)}}),l.a.createElement(E.y,{style:Tw},l.a.createElement(E.y,{style:Mw},l.a.createElement(E.y,{style:[w.c.largeText,Rw]},Object(we.integerToCurrency)(y.netWorth)),l.a.createElement(zO,{amount:y.totalChange})),l.a.createElement(UO,{start:s,end:f,graphData:y.graphData}),l.a.createElement(E.y,{style:Bw},l.a.createElement(E.t,null,l.a.createElement("strong",null,"How is net worth calculated?")),l.a.createElement(E.t,null,'Net worth shows the balance of all accounts over time, including all of your investments. Your "net worth" is considered to be the amount you\'d have if you sold all your assets and paid off as much debt as possible. If you hover over the graph, you can also see the amount of assets and debt individually.')))):null}),Lw=n(563),Nw=n(562),Fw={data:{fill:fO.colors.red}},Uw={data:{stroke:w.a.n5}};var zw=function({style:e,start:t,end:n,graphData:r,isConcise:a,compact:o}){return l.a.createElement(yO,null,(e,t,n)=>r&&l.a.createElement(RO.a,{scale:{x:"time"},theme:fO,domainPadding:10,width:e,height:t,containerComponent:l.a.createElement(tO.a,{voronoiDimension:"x"})},l.a.createElement(eO.a,null,l.a.createElement(nO.a,{data:r.expenses,style:Fw}),l.a.createElement(nO.a,{data:r.income})),l.a.createElement(Nw.a,{data:r.balances,labelComponent:l.a.createElement(OO,{portalHost:n}),labels:e=>e.premadeLabel,style:Uw}),l.a.createElement(_O.a,{tickFormat:e=>Ha.a(e,a?"MMM ''yy":"MMM d"),tickValues:r.balances.map(e=>e.x),tickCount:Math.min(5,r.balances.length),offsetY:50}),l.a.createElement(_O.a,{dependentAxis:!0,crossAxis:!1})))};function $w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ww(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ww(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ww(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Gw={minWidth:650,overflow:"hidden"},Hw={backgroundColor:"white",paddingLeft:30,paddingRight:30,overflow:"auto"},qw={paddingTop:20,paddingRight:20,flexShrink:0,alignItems:"flex-end",color:w.a.n3},Yw={marginBottom:5,minWidth:160},Kw={fontWeight:600},Vw={marginBottom:5,minWidth:160},Qw={fontWeight:600},Zw={fontWeight:600},Xw={marginTop:30};var Jw=function(){const e=$w(Object(o.useState)(null),2),t=(e[0],e[1]),n=$w(Object(o.useState)(null),2),r=n[0],a=n[1],i=$w(Object(o.useState)(Ee.y(Ee.d(),30)),2),c=i[0],s=i[1],u=$w(Object(o.useState)(Ee.c()),2),d=u[0],f=u[1],p=$w(Object(o.useState)(()=>Lw.a(Ga.a(d),Ga.a(c))>93),2),y=p[0],m=p[1],g=vO("cash_flow",rO(DO)(c,d,y));if(Object(o.useEffect)(()=>{!async function(){const e=await Object(h.send)("get-earliest-transaction"),n=e?Ee.s(Ga.a(e.date)):Ee.d(),r=Ee.v(n,Ee.d()).map(e=>({name:e,pretty:Ee.g(e,"MMMM, yyyy")})).reverse();t(n),a(r)}()},[]),!r||!g)return null;const b=g.graphData,O=(g.balance,g.totalChange,g.totalExpenses),v=g.totalIncome;return l.a.createElement(E.y,{style:[w.c.page,Gw]},l.a.createElement(Pw,{title:"Cash Flow",allMonths:r,start:Ee.j(c),end:Ee.j(d),show1Month:!0,onChangeDates:function(e,t){const n=Lw.a(Ga.a(t),Ga.a(e))>93;let r=t+"-31";r>Ee.c()&&(r=Ee.c()),s(e+"-01"),f(r),m(n)}}),l.a.createElement(E.y,{style:Hw},l.a.createElement(E.y,{style:qw},l.a.createElement(E.a,{style:Yw,left:l.a.createElement(E.c,null,"Income:"),right:l.a.createElement(E.w,{style:Kw},Object(we.integerToCurrency)(v))}),l.a.createElement(E.a,{style:Vw,left:l.a.createElement(E.c,null,"Expenses:"),right:l.a.createElement(E.w,{style:Qw},Object(we.integerToCurrency)(O))}),l.a.createElement(E.w,{style:Zw},l.a.createElement(zO,{amount:v+O}))),l.a.createElement(zw,{start:c,end:d,graphData:b,isConcise:y}),l.a.createElement(E.y,{style:Xw},l.a.createElement(E.t,null,l.a.createElement("strong",null,"How is cash flow calculated?")),l.a.createElement(E.t,null,'Cash flow shows the balance of your budgeted accounts over time, and the amount of expenses/income each day or month. Your budgeted accounts are considered to be "cash on hand", so this gives you a picture of how available money fluctuates.'))))},eE={flex:1};var tE=class extends l.a.Component{render(){return l.a.createElement(E.y,{style:eE},l.a.createElement(i.b,{path:"/reports",exact:!0,component:yw}),l.a.createElement(i.b,{path:"/reports/net-worth",exact:!0,component:_w}),l.a.createElement(i.b,{path:"/reports/cash-flow",exact:!0,component:Jw}))}};function nE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function rE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?nE(Object(n),!0).forEach(function(t){aE(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):nE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function aE(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var oE=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:rE({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M6.847 21.429a3.408 3.408 0 0 1-2.662-1.34l-3.76-4.273a1.714 1.714 0 0 1 2.572-2.263l3.522 4.01a.429.429 0 0 0 .631.014L21.036 3.105a1.715 1.715 0 1 1 2.486 2.362l-14.06 14.8a3.327 3.327 0 0 1-2.615 1.162z",fill:"currentColor"}));function lE({type:e,id:t,noneColor:n=w.a.n8}){var r={color:n};let a;switch(e){case"payees":a=ue;break;case"accounts":a=ge;break;default:throw new Error("DisplayId: unknown object type: "+e)}return l.a.createElement(a,{idKey:!0},e=>{let n=e[t];return l.a.createElement(E.w,{style:null==n?r:null,title:n?n.name:"None"},n?n.name:"None")})}function iE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return cE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function cE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let sE=43;var uE={color:"inherit",transform:"rotateZ(90deg)"},dE={padding:0};function fE({schedule:e,status:t,onAction:n}){let r=iE(Object(o.useState)(!1),2),a=r[0],i=r[1];return l.a.createElement(E.y,null,l.a.createElement(E.d,{bare:!0,onClick:e=>{e.stopPropagation(),i(!0)}},l.a.createElement(Yt.a,{width:15,height:15,style:uE})),a&&l.a.createElement(E.x,{position:"bottom-right",width:150,style:dE,onClose:()=>i(!1)},l.a.createElement(E.q,{onMenuSelect:t=>{n(t,e.id),i(!1)},items:["due"===t&&{name:"post-transaction",text:"Post transaction"},...e.completed?[{name:"restart",text:"Restart"}]:[{name:"skip",text:"Skip next date"},{name:"complete",text:"Complete"}],{name:"delete",text:"Delete"}]})))}var pE={textAlign:"right",flexDirection:"row",alignItems:"center",padding:"0 5px"},yE={textAlign:"left",color:w.a.n7,lineHeight:"1em",marginRight:10};function mE({amount:e,op:t}){let n=Di(e),r=Object(we.integerToCurrency)(Math.abs(n||0)),a="isapprox"===t||"isbetween"===t;return l.a.createElement(xa.a,{width:100,plain:!0,style:pE},a&&l.a.createElement(E.y,{style:yE,title:(a?"Approximately ":"")+r},"~"),l.a.createElement(E.w,{style:{flex:1,color:n>0?w.a.g5:null,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},title:(a?"Approximately ":"")+r},n>0?`+${r}`:`${r}`))}var gE={cursor:"pointer",backgroundColor:"white",":hover":{backgroundColor:w.a.hover}},hE={alignItems:"flex-start"},bE={textAlign:"center"},OE={width:13,height:13},wE={cursor:"pointer",backgroundColor:"white",":hover":{backgroundColor:w.a.hover}},EE={fontStyle:"italic",textAlign:"center",color:w.a.n6},vE={textAlign:"right"},jE={textAlign:"center"},SE={flex:1,backgroundColor:"transparent"};function xE({schedules:e,statuses:t,minimal:n,allowCompleted:r,style:a,onSelect:i,onAction:c}){let u=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy"),d=iE(Object(o.useState)(!1),2),f=d[0],p=d[1],y=Object(o.useMemo)(()=>{if(!r)return e.filter(e=>!e.completed);if(f)return e;let t=e.filter(e=>!e.completed);return e.find(e=>e.completed)&&t.push({type:"show-completed"}),t},[e,f,r]);return l.a.createElement(l.a.Fragment,null,l.a.createElement(xa.m,{height:sE,inset:15,version:"v2"},l.a.createElement(xa.e,{width:"flex"},"Payee"),l.a.createElement(xa.e,{width:"flex"},"Account"),l.a.createElement(xa.e,{width:110},"Next date"),l.a.createElement(xa.e,{width:120},"Status"),l.a.createElement(xa.e,{width:100,style:vE},"Amount"),!n&&l.a.createElement(xa.e,{width:80,style:jE},"Recurring"),!n&&l.a.createElement(xa.e,{width:40})),l.a.createElement(xa.l,{rowHeight:sE,backgroundColor:"transparent",version:"v2",style:[SE,a],items:y,renderItem:function({item:e}){return"show-completed"===e.type?l.a.createElement(xa.h,{height:sE,inset:15,backgroundColor:"transparent",style:wE,onClick:()=>p(!0)},l.a.createElement(xa.e,{width:"flex",style:EE},"Show completed schedules")):function({item:e}){return l.a.createElement(xa.h,{height:sE,inset:15,backgroundColor:"transparent",onClick:()=>i(e.id),style:gE},l.a.createElement(xa.e,{width:"flex"},l.a.createElement(lE,{type:"payees",id:e._payee})),l.a.createElement(xa.e,{width:"flex"},l.a.createElement(lE,{type:"accounts",id:e._account})),l.a.createElement(xa.e,{width:110},e.next_date?Ee.g(e.next_date,u):null),l.a.createElement(xa.e,{width:120,style:hE},l.a.createElement(xi,{status:t.get(e.id)})),l.a.createElement(mE,{amount:e._amount,op:e._amountOp}),!n&&l.a.createElement(xa.e,{width:80,style:bE},e._date&&e._date.frequency&&l.a.createElement(oE,{style:OE})),!n&&l.a.createElement(xa.e,{width:40},l.a.createElement(fE,{schedule:e,status:t.get(e.id),onAction:c})))}({item:e})},renderEmpty:"No schedules",allowPopupsEscape:y.length<6}))}var CE={backgroundColor:"white"},kE={alignItems:"flex-end",margin:"20px 0",flexShrink:0};function PE(){let e=Object(i.g)(),t=Bi();if(null==t)return null;let n=t.schedules,r=t.statuses;return l.a.createElement(Q,{title:"Schedules"},l.a.createElement(E.y,{style:{marginTop:20,flexBasis:(sE-1)*(Math.max(n.length,1)+1),overflow:"hidden"}},l.a.createElement(xE,{schedules:n,statuses:r,allowCompleted:!0,onSelect:function(t){e.push(`/schedule/edit/${t}`,{locationPtr:e.location})},onAction:async function(e,t){switch(e){case"post-transaction":await Object(h.send)("schedule/post-transaction",{id:t});break;case"skip":await Object(h.send)("schedule/skip-next-date",{id:t});break;case"complete":await Object(h.send)("schedule/update",{schedule:{id:t,completed:!0}});break;case"restart":await Object(h.send)("schedule/update",{schedule:{id:t,completed:!1},resetNextDate:!0});break;case"delete":await Object(h.send)("schedule/delete",{id:t})}},style:CE})),l.a.createElement(E.y,{style:kE},l.a.createElement(E.d,{primary:!0,onClick:function(){e.push("/schedule/edit",{locationPtr:e.location})}},"Add new schedule")))}var AE={fontWeight:500,textTransform:"uppercase",color:w.a.b3,marginBottom:5,lineHeight:"1em"};function IE({title:e,style:t}){return l.a.createElement(E.y,{style:[AE,t]},e)}var DE={fontSize:13,marginBottom:3,color:w.a.n3};function TE({style:e,title:t}){return l.a.createElement(E.w,{style:[DE,e]},t)}function ME({style:e,children:t}){return l.a.createElement(E.y,{style:e},t)}var RE={position:"relative",margin:0,marginRight:6,width:15,height:15,appearance:"none",outline:0,border:"1px solid #d0d0d0",borderRadius:4,display:"flex",alignItems:"center",justifyContent:"center",color:"white",backgroundColor:"white",":checked":{border:"1px solid "+w.a.b6,backgroundColor:w.a.b6,"::after":{display:"block",background:w.a.b6+' url(\'data:image/svg+xml; utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="white" d="M0 11l2-2 5 5L18 3l2 2L7 18z"/></svg>\') 9px 9px',width:9,height:9,content:" "}},"&.focus-visible:focus":{"::before":{position:"absolute",top:-5,bottom:-5,left:-5,right:-5,border:"2px solid "+w.a.b5,borderRadius:6,content:" "}}};function BE(e){return l.a.createElement("input",Object.assign({type:"checkbox"},e,Object(j.css)([RE],e.style)))}function _E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function LE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_E(Object(n),!0).forEach(function(t){NE(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_E(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function NE(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var FE={flexDirection:"row",alignItems:"center",justifyContent:"flex-start"},UE={width:13,height:13,margin:"0 5px"},zE={textAlign:"right"};const $E=l.a.memo(function({transaction:e,fields:t,payees:n,categories:r,accounts:a,selected:o}){let i=Object(oe.d)(r)[e.category],c=Object(oe.b)(a)[e.account],s=Object(si.d)();e.schedule;return l.a.createElement(xa.h,null,l.a.createElement(xa.i,{exposed:!0,focused:!1,onSelect:()=>{s({type:"select",id:e.id})},selected:o}),t.map((t,n)=>{switch(t){case"date":return l.a.createElement(xa.e,{key:n,width:100},e.date);case"imported_payee":return l.a.createElement(xa.e,{key:n,width:"flex"},e.imported_payee);case"payee":return l.a.createElement(xa.a,{key:n,width:"flex",exposed:!0,style:FE},()=>l.a.createElement(l.a.Fragment,null,e.schedule&&l.a.createElement(ti,{style:UE}),l.a.createElement(lE,{type:"payees",id:e.payee})));case"category":return l.a.createElement(xa.e,{key:n,width:"flex",title:i&&i.name},i?i.name:"");case"account":return l.a.createElement(xa.e,{key:n,width:"flex",title:c.name},c.name);case"notes":return l.a.createElement(xa.e,{key:n,width:"flex",title:e.notes},e.notes);case"amount":return l.a.createElement(xa.e,{key:n,width:75,style:[zE,w.c.tnum]},Object(we.integerToCurrency)(e.amount));default:return null}}))});var WE={textAlign:"right"};function GE({transactions:e,schedules:t,fields:n=["date","payee","amount"],style:r}){let a=Object(s.d)(e=>({payees:e.queries.payees,accounts:e.queries.accounts,categories:e.queries.categories.grouped,dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy"})),i=a.payees,c=a.categories,u=a.accounts,d=a.dateFormat,f=Object(si.e)(),p=Object(si.d)(),y=Object(o.useMemo)(()=>n,[JSON.stringify(n)]),m=Object(o.useMemo)(()=>e.map(e=>(function(e,t){let n=e.date;return Object(Oe.a)(Object(Ga.a)(n))||(n=null),LE(LE({},e),{},{date:n?Object(Ha.a)(Object(Ga.a)(n),t):null})})(e,d)),[e]),g=Object(o.useCallback)(({item:e})=>l.a.createElement($E,{transaction:e,payees:i,categories:c,accounts:u,fields:y,selected:f&&f.has(e.id)}),[i,c,y,f]);return l.a.createElement(xa.l,{style:r,items:m,headers:l.a.createElement(l.a.Fragment,null,l.a.createElement(xa.i,{exposed:!0,focused:!1,selected:f.size>0,width:20,onSelect:()=>p({type:"select-all"})}),n.map((e,t)=>{switch(e){case"date":return l.a.createElement(xa.e,{key:t,width:100},"Date");case"imported_payee":return l.a.createElement(xa.e,{key:t,width:"flex"},"Imported payee");case"payee":return l.a.createElement(xa.e,{key:t,width:"flex"},"Payee");case"category":return l.a.createElement(xa.e,{key:t,width:"flex"},"Category");case"account":return l.a.createElement(xa.e,{key:t,width:"flex"},"Account");case"notes":return l.a.createElement(xa.e,{key:t,width:"flex"},"Notes");case"amount":return l.a.createElement(xa.e,{key:t,width:75,style:WE},"Amount");default:return null}})),renderItem:g})}function HE(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function qE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?HE(Object(n),!0).forEach(function(t){YE(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):HE(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function YE(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var KE=e=>l.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 23 3",style:qE({color:"#242134"},e.style)}),l.a.createElement("path",{d:"M23 1.5A1.5 1.5 0 0 1 21.5 3h-20a1.5 1.5 0 0 1 0-3h20A1.5 1.5 0 0 1 23 1.5z",fillRule:"nonzero",fill:"currentColor"}));function VE(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return QE(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return QE(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function QE(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ZE={padding:"0 7px"},XE={width:8,height:8},JE={width:8,height:8},ev={flex:1,alignItems:"stretch"},tv={paddingLeft:0};function nv({defaultValue:e,onChange:t}){let n=VE(Object(o.useState)(e<=0),2),r=n[0],a=n[1],i=VE(Object(o.useState)(Object(we.integerToCurrency)(Math.abs(e))),2),c=i[0],s=i[1];function u(e=r){let n=Object(we.currencyToInteger)(c);t(e?n<0?n:-n:n>0?n:-n)}return l.a.createElement(E.n,{leftContent:l.a.createElement(E.d,{bare:!0,style:ZE,onClick:function(){a(!r),u(!r)}},r?l.a.createElement(KE,{style:XE}):l.a.createElement(Ct,{style:JE})),value:c,style:ev,inputStyle:tv,onChange:e=>s(e.target.value),onBlur:e=>u()})}var rv={flexDirection:"row",alignItems:"center"},av={margin:"0 5px"};function ov({defaultValue:e,onChange:t}){let n=VE(Object(o.useState)(e.num1),2),r=n[0],a=n[1],i=VE(Object(o.useState)(e.num2),2),c=i[0],s=i[1];return l.a.createElement(E.y,{style:rv},l.a.createElement(nv,{defaultValue:r,onChange:e=>{a(e),t({num1:e,num2:c})}}),l.a.createElement(E.y,{style:av},"and"),l.a.createElement(nv,{defaultValue:c,onChange:e=>{s(e),t({num1:r,num2:e})}}))}function lv(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return iv(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iv(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function iv(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function cv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sv(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?cv(Object(n),!0).forEach(function(t){uv(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):cv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function uv(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dv(e,t,n){return e.map(e=>e===t?n():e)}function fv(e,t){return e.map((e,n)=>sv(sv({},e),{},{error:t[n]}))}function pv(e,t){let n=["date"];return e.find(e=>"imported_payee"===e.field)&&n.push("imported_payee"),n.push("payee"),t.find(e=>"category"===e.field)?n.push("category"):t.length>0&&!["payee","date","amount"].includes(t[0].field)&&n.push(t[0].field),n.push("amount"),n}var yv={color:w.a.p4};function mv({fields:e,style:t,value:n,onChange:r}){return l.a.createElement(E.y,{style:t},l.a.createElement(E.g,{options:e,value:n,onChange:e=>r("field",e),style:yv}))}function gv({ops:e,type:t,style:n,value:r,formatOp:a=ds,onChange:o}){return"id"===t&&(e=e.filter(e=>"contains"!==e)),l.a.createElement(E.g,{options:e.map(e=>[e,a(e,t)]),value:r,onChange:e=>o("op",e),style:n})}var hv={padding:7},bv={width:8,height:8},Ov={padding:7},wv={width:10,height:10};function Ev({onAdd:e,onDelete:t,style:n}){return l.a.createElement(l.a.Fragment,null,t&&l.a.createElement(E.d,{bare:!0,onClick:t,style:hv},l.a.createElement(js,{style:bv})),e&&l.a.createElement(E.d,{bare:!0,onClick:e,style:Ov},l.a.createElement(Cs,{style:wv})))}var vv={fontSize:12,textAlign:"center",color:w.a.r5,marginBottom:5};function jv({type:e}){return l.a.createElement(E.w,{style:vv},fs(e))}var Sv={padding:"3px 5px"};function xv({error:e,style:t,children:n}){return l.a.createElement(E.y,{style:t},l.a.createElement(E.v,{direction:"row",align:"center",spacing:1,style:Sv},n),e&&l.a.createElement(jv,{type:e}))}var Cv={flex:1};function kv({conditionFields:e,ops:t,condition:n,editorStyle:r,onChange:a,onDelete:o,onAdd:i}){let c,s=n.field,u=n.op,d=n.value,f=n.type,p=n.options,y=n.error;n.inputKey;return"amount"===s&&p&&(p.inflow?s="amount-inflow":p.outflow&&(s="amount-outflow")),c="number"===f&&"isbetween"===u?l.a.createElement(ov,{defaultValue:d,onChange:e=>a("value",e)}):l.a.createElement(hu,{field:s,type:f,value:d,multi:"oneOf"===u,onChange:e=>a("value",e)}),l.a.createElement(xv,{style:r,error:y},l.a.createElement(mv,{fields:e,value:s,onChange:a}),l.a.createElement(gv,{ops:t,value:u,type:f,onChange:a}),l.a.createElement(E.y,{style:Cv},c),l.a.createElement(E.v,{direction:"row"},l.a.createElement(Ev,{onAdd:i,onDelete:o})))}var Pv={flex:1},Av={flex:1,flexDirection:"row",alignItems:"center"},Iv={marginRight:15,flexDirection:"row"},Dv={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},Tv={margin:"0 5px"},Mv={flexShrink:0},Rv={margin:"0 5px"},Bv={flexShrink:0};function _v({id:e}){let t=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy"),n=Bi({transform:Object(o.useCallback)(t=>t.filter({id:e}),[])});if(null==n)return null;if(0===n.schedules.length)return l.a.createElement(E.y,{style:Pv},e);let r=lv(n.schedules,1)[0],a=r&&n.statuses.get(r.id);return l.a.createElement(E.y,{style:Av},l.a.createElement(E.y,{style:Iv},l.a.createElement(E.w,{style:Dv},"Payee:"," ",l.a.createElement(lE,{type:"payees",id:r._payee,noneColor:w.a.n5})),l.a.createElement(E.w,{style:Tv}," \u2014 "),l.a.createElement(E.w,{style:Mv},"Amount: ",Object(we.integerToCurrency)(r._amount||0)),l.a.createElement(E.w,{style:Rv}," \u2014 "),l.a.createElement(E.w,{style:Bv},"Next: ",Ee.g(r.next_date,t))),l.a.createElement(xi,{status:a}))}let Lv=["payee","notes","date","amount","category","account"].map(e=>[e,us(e)]);var Nv={padding:"5px 10px",lineHeight:"1em"},Fv={flex:1},Uv={padding:"5px 10px",color:w.a.p4};function zv({ops:e,action:t,editorStyle:n,onChange:r,onDelete:a,onAdd:o}){let i=t.field,c=t.op,s=t.value,u=t.type,d=t.error,f=t.inputKey,p=void 0===f?"initial":f;return l.a.createElement(xv,{style:n,error:d},"set"===c?l.a.createElement(l.a.Fragment,null,l.a.createElement(E.y,{style:Nv},ds(c)),l.a.createElement(mv,{fields:Lv,value:i,onChange:r}),l.a.createElement(E.y,{style:Fv},l.a.createElement(hu,{key:p,field:i,type:u,op:c,value:s,onChange:e=>r("value",e)}))):"link-schedule"===c?l.a.createElement(l.a.Fragment,null,l.a.createElement(E.y,{style:Uv},ds(c)),l.a.createElement(_v,{id:s||null})):null,l.a.createElement(E.v,{direction:"row"},l.a.createElement(Ev,{onAdd:o,onDelete:"link-schedule"!==c&&a})))}var $v={position:"relative",marginLeft:5},Wv={width:11,height:11,color:w.a.n4},Gv={padding:10,color:w.a.n4,maxWidth:450,lineHeight:1.5};function Hv(){let e=lv(Object(o.useState)(),2),t=e[0],n=e[1];return l.a.createElement(E.y,{style:$v},l.a.createElement(E.y,{onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1)},l.a.createElement(Eu,{style:Wv})),t&&l.a.createElement(E.x,{position:"bottom-left",style:Gv},"The stage of a rule allows you to force a specific order. Pre rules always run first, and post rules always run last. Within each stage rules are automatically ordered from least to most specific."))}var qv={fontSize:"inherit"},Yv={backgroundColor:w.a.b9,":hover":{backgroundColor:w.a.b9}};function Kv({selected:e,children:t,style:n,onSelect:r}){return l.a.createElement(E.d,{bare:!0,style:[qv,e&&Yv,n],onClick:r},t)}function Vv(e){return sv(sv({},e),{},{inputKey:""+Math.random()})}var Qv={alignSelf:"flex-start"};function Zv({conditions:e,conditionFields:t,editorStyle:n,onChangeConditions:r}){function a(t){let n=[...e];n.splice(t+1,0,{type:ss.get("payee"),field:"payee",op:"is",value:null}),r(n)}return 0===e.length?l.a.createElement(E.d,{style:Qv,onClick:function(){a(-1)}},"Add condition"):l.a.createElement(E.v,{spacing:2},e.map((o,i)=>{let c=cs[o.type].ops;return"date"===o.type&&o.value&&o.value.frequency?c=["is","isapprox"]:o.options&&(o.options.inflow||o.options.outflow)&&(c=c.filter(e=>"isbetween"!==e)),l.a.createElement(E.y,null,l.a.createElement(kv,{key:i,conditionFields:t,editorStyle:n,ops:c,condition:o,onChange:(t,n)=>{!function(t,n,a){r(dv(e,t,()=>{if("field"===n){let e={field:a};"amount-inflow"===a?(e.field="amount",e.options={inflow:!0}):"amount-outflow"===a&&(e.field="amount",e.options={outflow:!0}),e.type=ss.get(e.field);let n=ss.get(t.field);return"string"!==n&&"number"!==n||n!==e.type||"isbetween"===t.op?(e.op=cs[e.type].ops[0],Vv(ms(null,e))):(e.op=t.op,Vv(ms(t.value,e)))}if("op"===n){let e=a;return"oneOf"!==t.op&&"oneOf"===e?Vv(ms(null!=t.value?[t.value]:[],sv(sv({},t),{},{op:a}))):"oneOf"===t.op&&"oneOf"!==e?Vv(ms(t.value.length>0?t.value[0]:null,sv(sv({},t),{},{op:a}))):"isbetween"!==t.op&&"isbetween"===e?ms({num1:Object(we.amountToInteger)(t.value),num2:Object(we.amountToInteger)(t.value)},sv(sv({},t),{},{op:a})):"isbetween"===t.op&&"isbetween"!==e?ms(Object(we.integerToAmount)(t.value.num1||0),sv(sv({},t),{},{op:a})):sv(sv({},t),{},{op:a})}return"value"===n?ms(a,t):t}))}(o,t,n)},onDelete:()=>(function(t){r(e.filter(e=>e!==t))})(o),onAdd:()=>a(i)}))}))}let Xv=["account","imported_payee","payee","category","date","notes","amount"].map(e=>[e,us(e)]).concat([["amount-inflow",us("amount",{inflow:!0})],["amount-outflow",us("amount",{outflow:!0})]]);var Jv={flex:"inherit",maxWidth:"90%"},ej={maxWidth:"100%",width:900,height:"80vh",flexGrow:0,flexShrink:0,flexBasis:"auto",overflow:"hidden"},tj={flexDirection:"row",alignItems:"center",marginBottom:15,padding:"0 20px"},nj={color:w.a.n4,marginRight:15},rj={borderBottom:"1px solid "+w.a.border,padding:20,overflow:"auto",maxHeight:"calc(100% - 300px)"},aj={flexShrink:0},oj={marginBottom:30},lj={color:w.a.n4,marginBottom:15},ij={color:w.a.n4,marginBottom:15},cj={flex:1},sj={alignSelf:"flex-start"},uj={padding:"20px",flex:1},dj={flexDirection:"row",alignItems:"center",marginBottom:12},fj={color:w.a.n4,marginBottom:0},pj={flex:1},yj={border:"1px solid "+w.a.border},mj={marginTop:20};function gj({history:e,modalProps:t,defaultRule:n,onSave:r}){let a=lv(Object(o.useState)(n.conditions.map(ps)),2),i=a[0],c=a[1],u=lv(Object(o.useState)(n.actions.map(ps)),2),d=u[0],f=u[1],p=lv(Object(o.useState)(n.stage),2),y=p[0],m=p[1],g=lv(Object(o.useState)([]),2),b=g[0],O=g[1],v=Object(s.c)(),j=Object(o.useRef)();Object(o.useEffect)(()=>(v(Object(il.m)()),Object(il.s)(!1),()=>Object(il.s)(!0)),[]),Object(o.useEffect)(()=>{if(j.current){let e=j.current,t=e.scrollTop;e.scrollTop=t+1,e.scrollTop=t}!async function(){let e=(await Object(h.send)("make-filters-from-conditions",{conditions:i.map(ys)})).filters;if(e.length>0){let t=(await Object(ae.f)(Object(ae.c)("transactions").filter({$and:e}).select("*"))).data;O(t)}else O([])}()},[d,i]);let S=Object(si.c)("transactions",b,[]);function x(){C(-1)}function C(e){let t=[...d];t.splice(e+1,0,{type:ss.get("category"),field:"category",op:"set",value:null}),f(t)}function k(e){m(e)}function P(){Object(h.send)("rule-apply-actions",{transactionIds:[...S.items],actions:d}).then(()=>{f([...d])})}let A={backgroundColor:w.a.n10,borderRadius:4};return l.a.createElement(E.r,Object.assign({title:"Rule",padding:0},t,{style:[t.style,Jv]}),()=>l.a.createElement(E.y,{style:ej},l.a.createElement(E.y,{style:tj},l.a.createElement(E.w,{style:nj},"Stage of rule:"),l.a.createElement(E.v,{direction:"row",align:"center",spacing:1},l.a.createElement(Kv,{selected:"pre"===y,onSelect:()=>k("pre")},"Pre"),l.a.createElement(Kv,{selected:null===y,onSelect:()=>k(null)},"Default"),l.a.createElement(Kv,{selected:"post"===y,onSelect:()=>k("post")},"Post"),l.a.createElement(Hv,null))),l.a.createElement(E.y,{innerRef:j,style:rj},l.a.createElement(E.y,{style:aj},l.a.createElement(E.y,{style:oj},l.a.createElement(E.w,{style:lj},"If all these conditions match:"),l.a.createElement(Zv,{conditions:i,conditionFields:Xv,editorStyle:A,onChangeConditions:e=>c(e)})),l.a.createElement(E.w,{style:ij},"Then apply these actions:"),l.a.createElement(E.y,{style:cj},0===d.length?l.a.createElement(E.d,{style:sj,onClick:x},"Add action"):l.a.createElement(E.v,{spacing:2},d.map((e,t)=>l.a.createElement(E.y,null,l.a.createElement(zv,{key:t,ops:["set","link-schedule"],action:e,editorStyle:A,onChange:(t,n)=>{!function(e,t,n){f(dv(d,e,()=>{let r=sv({},e);return r[t]=n,"field"===t?(r.type=ss.get(r.field),r.value=null,Vv(r)):"op"===t?(r.value=null,r.inputKey=""+Math.random(),Vv(r)):r}))}(e,t,n)},onDelete:()=>(function(e){f(d.filter(t=>t!==e))})(e),onAdd:()=>C(t)}))))))),l.a.createElement(si.a,{instance:S},l.a.createElement(E.y,{style:uj},l.a.createElement(E.y,{style:dj},l.a.createElement(E.w,{style:fj},"This rule applies to these transactions:"),l.a.createElement(E.y,{style:pj}),l.a.createElement(E.d,{disabled:0===S.items.size,onClick:P},"Apply actions (",S.items.size,")")),l.a.createElement(GE,{transactions:b,fields:pv(i,d),style:yj}),l.a.createElement(E.v,{direction:"row",justify:"flex-end",style:mj},l.a.createElement(E.d,{onClick:()=>t.onClose()},"Cancel"),l.a.createElement(E.d,{primary:!0,onClick:()=>(async function(){let e=sv(sv({},n),{},{stage:y,conditions:i.map(ys),actions:d.map(ys)}),a=e.id?"rule-update":"rule-add",o=await Object(h.send)(a,e),l=o.error,s=o.id;l?(l.conditionErrors&&c(fv(i,l.conditionErrors)),l.actionErrors&&f(fv(d,l.actionErrors))):(s&&(e.id=s),r&&r(e),t.onClose())})()},"Save"))))))}function hj(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return bj(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bj(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function bj(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Oj(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wj(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Oj(Object(n),!0).forEach(function(t){Ej(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Oj(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ej(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vj(e,t){let n=wj({},e);return t&&Object.keys(t).forEach(r=>{r in e&&(n[r]=t[r])}),n}function jj(e,t){let n=Ii(e._conditions),r=(e,t,n,r)=>e?wj(wj({},e),{},{value:r}):null!=r?{op:t,field:n,value:r}:null;return null==t.date?{error:"Date is required"}:null==t.amount?{error:"A valid amount is required"}:{conditions:[r(n.payee,"is","payee",t.payee),r(n.account,"is","account",t.account),r(n.date,"isapprox","date",t.date),{op:t.amountOp,field:"amount",value:t.amount}].filter(Boolean)}}var Sj={marginTop:20},xj={flex:1},Cj={flex:1},kj={flex:1},Pj={marginBottom:3},Aj={margin:0,flex:1},Ij={padding:"0 10px",color:w.a.n5,fontSize:12},Dj={marginTop:20},Tj={flex:1},Mj={fontSize:13,marginTop:20},Rj={color:w.a.n4,fontWeight:600},Bj={marginTop:10,color:w.a.n4},_j={marginTop:5,flex:1,flexDirection:"row",alignItems:"center",userSelect:"none"},Lj={userSelect:"none"},Nj={alignItems:"flex-end",flex:1},Fj={marginTop:5,flexDirection:"row",alignItems:"center",userSelect:"none",justifyContent:"flex-end"},Uj={userSelect:"none"},zj={width:350,textAlign:"right",color:w.a.n4,marginTop:10,fontSize:13,lineHeight:"1.4em"},$j={marginTop:30},Wj={color:w.a.b5,fontSize:13,textAlign:"right",width:350},Gj={marginTop:30,flex:1},Hj={flexDirection:"row",padding:"5px 0"},qj={color:w.a.n4},Yj={flex:1},Kj={color:w.a.n6},Vj={flexDirection:"row",alignItems:"center"},Qj={flex:1},Zj={border:"1px solid "+w.a.border,borderRadius:4,overflow:"hidden",marginTop:5},Xj={marginTop:20},Jj={color:w.a.r4},eS={marginRight:10};function tS(){let e=Object(i.i)(),t=e.id,n=e.initialFields,r=null==t,a=de({idKey:!0}),c=Object(i.g)(),u=Object(s.c)(),d=Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy"),f=(q(),hj(Object(o.useReducer)((e,t)=>{switch(t.type){case"set-schedule":{let n=t.schedule,r=Ii(n._conditions),a=new Set(Object.values(r)),o=n._conditions.find(e=>!a.has(e))||n._actions.find(e=>"link-schedule"!==e.op);return wj(wj({},e),{},{schedule:t.schedule,isCustom:o,fields:{payee:n._payee,account:n._account,amount:n._amount||0,amountOp:n._amountOp||"isapprox",date:n._date,posts_transaction:t.schedule.posts_transaction}})}case"set-field":if(!(t.field in e.fields))throw new Error("Unknown field: "+t.field);let n={[t.field]:t.value};return"amountOp"===t.field&&t.value!==e.fields.amountOp&&("isbetween"===t.value?n.amount="number"===typeof e.fields.amount?{num1:e.fields.amount,num2:e.fields.amount}:{num1:0,num2:0}:"isbetween"===e.fields.amountOp&&(n.amount="number"===typeof e.fields.amount?e.fields.amount:e.fields.amount.num1)),wj(wj({},e),{},{fields:wj(wj({},e.fields),n)});case"set-transactions":return wj(wj({},e),{},{transactions:t.transactions});case"set-repeats":return wj(wj({},e),{},{fields:wj(wj({},e.fields),{},{date:t.repeats?{frequency:"monthly",start:Ee.c(),patterns:[]}:Ee.c()})});case"set-upcoming-dates":return wj(wj({},e),{},{upcomingDates:t.dates});case"form-error":return wj(wj({},e),{},{error:t.error});case"switch-transactions":return wj(wj({},e),{},{transactionsMode:t.mode});default:throw new Error("Unknown action: "+t.type)}},{schedule:null,upcomingDates:null,error:null,fields:vj({payee:null,account:null,amount:null,amountOp:null,date:null,posts_transaction:!1},n),transactions:[],transactionsMode:r?"matched":"linked"}),2)),p=f[0],y=f[1];async function m(){return(await Object(ae.f)(Object(ae.c)("schedules").filter({id:t}).select("*"))).data[0]}Object(o.useEffect)(()=>{!async function(){if(r){let e={start:Ee.c(),frequency:"monthly",patterns:[]};y({type:"set-schedule",schedule:{posts_transaction:!1,_date:e,_conditions:[{op:"isapprox",field:"date",value:e}],_actions:[]}})}else{let e=await m();e&&null==p.schedule&&y({type:"set-schedule",schedule:e})}}()},[]),Object(o.useEffect)(()=>{!async function(){let e=p.fields.date;if(null==e)y({type:"set-upcoming-dates",dates:null});else if(e.frequency){let t=(await Object(h.sendCatch)("schedule/get-upcoming-dates",{config:e,count:3})).data;y({type:"set-upcoming-dates",dates:t})}else{let t=Ee.c();e===t||Ee.r(e,t)?y({type:"set-upcoming-dates",dates:[e]}):y({type:"set-upcoming-dates",dates:null})}}()},[p.fields.date]),Object(o.useEffect)(()=>{if(p.schedule&&p.schedule.id&&"linked"===p.transactionsMode){return Object(ae.d)(Object(ae.c)("transactions").filter({schedule:p.schedule.id}).select("*").options({splits:"none"}),e=>y({type:"set-transactions",transactions:e})).unsubscribe}},[p.schedule,p.transactionsMode]),Object(o.useEffect)(()=>{let e,t=!0;if(p.schedule&&"matched"===p.transactionsMode){let n=jj(p.schedule,p.fields),r=(n.error,n.conditions);y({type:"set-transactions",transactions:[]}),r=r.map(e=>"description"===e.field?wj(wj({},e),{},{field:"payee"}):"acct"===e.field?wj(wj({},e),{},{field:"account"}):e),Object(h.send)("make-filters-from-conditions",{conditions:r}).then(({filters:n})=>{if(t){let t=Object(ae.d)(Object(ae.c)("transactions").filter({$and:n}).select("*").options({splits:"none"}),e=>y({type:"set-transactions",transactions:e}));e=t.unsubscribe}})}return()=>{t=!1,e&&e()}},[p.schedule,p.transactionsMode,p.fields]);let g=Object(si.c)("transactions",p.transactions,[]);async function b(e,t){await Object(h.send)("transactions-batch-update",{updated:e.map(e=>({id:e,schedule:t||p.schedule.id}))}),g.dispatch({type:"select-none"})}if(null==p.schedule)return null;function O(e){y({type:"switch-transactions",mode:e}),g.dispatch({type:"select-none"})}let v=a?a[p.fields.payee]:null,j=!!p.fields.date&&!!p.fields.date.frequency;return l.a.createElement(Q,{title:v?`Schedule: ${v.name}`:"Schedule",modalSize:"medium"},l.a.createElement(E.v,{direction:"row",style:Sj},l.a.createElement(ME,{style:xj},l.a.createElement(TE,{title:"Payee"}),l.a.createElement(Tl,{value:p.fields.payee,inputProps:{placeholder:"(none)"},onSelect:e=>y({type:"set-field",field:"payee",value:e})})),l.a.createElement(ME,{style:Cj},l.a.createElement(TE,{title:"Account"}),l.a.createElement(Fl,{value:p.fields.account,inputProps:{placeholder:"(none)"},onSelect:e=>y({type:"set-field",field:"account",value:e})})),l.a.createElement(ME,{style:kj},l.a.createElement(E.v,{direction:"row",align:"center",style:Pj},l.a.createElement(TE,{title:"Amount",style:Aj}),l.a.createElement(gv,{ops:["is","isapprox","isbetween"],value:p.fields.amountOp,formatOp:e=>{switch(e){case"is":return"is exactly";case"isapprox":return"is approximately";case"isbetween":return"is between";default:throw new Error("Invalid op for select: "+e)}},style:Ij,onChange:(e,t)=>y({type:"set-field",field:"amountOp",value:t})})),"isbetween"===p.fields.amountOp?l.a.createElement(ov,{defaultValue:p.fields.amount,onChange:e=>y({type:"set-field",field:"amount",value:e})}):l.a.createElement(nv,{defaultValue:p.fields.amount,onChange:e=>y({type:"set-field",field:"amount",value:e})}))),l.a.createElement(E.y,{style:Dj},l.a.createElement(TE,{title:"Date"})),l.a.createElement(E.v,{direction:"row",align:"flex-start"},l.a.createElement(E.y,{style:Tj},j?l.a.createElement(du,{value:p.fields.date,onChange:e=>y({type:"set-field",field:"date",value:e})}):l.a.createElement(Ul.a,{value:p.fields.date,onSelect:e=>y({type:"set-field",field:"date",value:e}),dateFormat:d}),p.upcomingDates&&l.a.createElement(E.y,{style:Mj},l.a.createElement(E.w,{style:Rj},"Upcoming dates"),l.a.createElement(E.v,{direction:"column",spacing:1,style:Bj},p.upcomingDates.map(e=>l.a.createElement(E.y,null,Ee.g(e,`${d} EEEE`)))))),l.a.createElement(E.y,{style:_j},l.a.createElement(BE,{id:"form_repeats",checked:j,onChange:e=>{y({type:"set-repeats",repeats:e.target.checked})}}),l.a.createElement("label",{for:"form_repeats",style:Lj},"Repeats")),l.a.createElement(E.y,{style:Nj},l.a.createElement(E.y,{style:Fj},l.a.createElement(BE,{id:"form_posts_transaction",checked:p.fields.posts_transaction,onChange:e=>{y({type:"set-field",field:"posts_transaction",value:e.target.checked})}}),l.a.createElement("label",{for:"form_posts_transaction",style:Uj},"Automatically add transaction")),l.a.createElement(E.w,{style:zj},"If checked, the schedule will automatically create transactions for you in the specified account"),!r&&p.schedule.rule&&l.a.createElement(E.v,{direction:"row",align:"center",style:$j},p.isCustom&&l.a.createElement(E.w,{style:Wj},"This schedule has custom conditions and actions"),l.a.createElement(E.d,{onClick:()=>(async function(e){let t=await Object(h.send)("rule-get",{id:e||p.schedule.rule});u(Object(bt.d)("edit-rule",{rule:t,onSave:async()=>{let e=await m();y({type:"set-schedule",schedule:e})}}))})(),disabled:r},"Edit as rule")))),l.a.createElement(E.y,{style:Gj},l.a.createElement(si.a,{instance:g},r?l.a.createElement(E.y,{style:Hj},l.a.createElement(E.w,{style:qj},"These transactions match this schedule:"),l.a.createElement(E.y,{style:Yj}),l.a.createElement(E.w,{style:Kj},"Select transactions to link on save")):l.a.createElement(E.y,{style:Vj},l.a.createElement(E.d,{bare:!0,style:{color:"linked"===p.transactionsMode?w.a.b4:w.a.n7,marginRight:10,fontSize:14},onClick:()=>O("linked")},"Linked transactions")," ",l.a.createElement(E.d,{bare:!0,style:{color:"matched"===p.transactionsMode?w.a.b4:w.a.n7,fontSize:14},onClick:()=>O("matched")},"Find matching transactions"),l.a.createElement(E.y,{style:Qj}),l.a.createElement(xa.j,{name:"transactions",items:"linked"===p.transactionsMode?[{name:"unlink",text:"Unlink from schedule"}]:[{name:"link",text:"Link to schedule"}],onSelect:(e,t)=>{switch(e){case"link":b(t);break;case"unlink":!async function(e){await Object(h.send)("transactions-batch-update",{updated:e.map(e=>({id:e,schedule:null}))}),g.dispatch({type:"select-none"})}(t)}}})),l.a.createElement(GE,{transactions:p.transactions,fields:["date","payee","amount"],style:Zj}))),l.a.createElement(E.v,{direction:"row",justify:"flex-end",align:"center",style:Xj},p.error&&l.a.createElement(E.w,{style:Jj},p.error),l.a.createElement(E.d,{style:eS,onClick:()=>c.goBack()},"Cancel"),l.a.createElement(E.d,{primary:!0,onClick:async function(){y({type:"form-error",error:null});let e=jj(p.schedule,p.fields),t=e.error,n=e.conditions;if(t)return void y({type:"form-error",error:t});let a=await Object(h.sendCatch)(r?"schedule/create":"schedule/update",{schedule:{id:p.schedule.id,posts_transaction:p.fields.posts_transaction},conditions:n});a.error?y({type:"form-error",error:"An error occurred while saving. Please contact help@actualbudget.com for support."}):(r&&await b([...g.items],a.data),c.goBack())}},r?"Add":"Save")))}var nS={marginBottom:20};function rS(){let e=Object(i.h)(),t=Object(i.g)(),n=Bi(Object(o.useCallback)(e=>e.filter({completed:!1}),[]));Object(s.d)(e=>e.prefs.local.dateFormat||"MM/dd/yyyy");if(null==n)return null;let r=n.schedules,a=n.statuses;return l.a.createElement(Q,{title:"Link Schedule",modalSize:"medium"},l.a.createElement(E.w,{style:nS},"Choose a schedule to link these transactions to:"),l.a.createElement(xE,{schedules:r,statuses:a,minimal:!0,onSelect:async function(n){let r=e.state.transactionIds;r&&r.length>0&&await Object(h.send)("transactions-batch-update",{updated:r.map(e=>({id:e,schedule:n}))}),t.goBack()}}))}function aS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return oS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return oS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function oS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let lS=43;var iS={flex:1.5},cS={flex:1},sS={flex:1.5},uS={textAlign:"right"},dS={flex:1,backgroundColor:"transparent"};function fS({schedules:e,loading:t}){let n=Object(si.e)(),r=Object(si.d)();return l.a.createElement(E.y,{style:cS},l.a.createElement(xa.m,{height:lS,inset:15,version:"v2"},l.a.createElement(xa.i,{exposed:!0,focused:!1,selected:n.size>0,onSelect:()=>r({type:"select-all"})}),l.a.createElement(xa.e,{width:"flex"},"Payee"),l.a.createElement(xa.e,{width:"flex"},"Account"),l.a.createElement(xa.e,{width:"auto",style:sS},"When"),l.a.createElement(xa.e,{width:100,style:uS},"Amount")),l.a.createElement(xa.l,{rowHeight:lS,backgroundColor:"transparent",version:"v2",style:dS,items:e,loading:t,isSelected:e=>n.has(e),renderItem:function({item:e}){let t=n.has(e.id),a=e._conditions.find(e=>"amount"===e.field).op,o=Ai(e.date);return l.a.createElement(xa.h,{height:lS,inset:15,backgroundColor:"transparent",onClick:()=>{r({type:"select",id:e.id})},borderColor:t?w.a.b8:w.a.border,style:{cursor:"pointer",backgroundColor:t?w.a.selected:"white",":hover":{backgroundColor:t?w.a.selected:w.a.hover}}},l.a.createElement(xa.i,{exposed:!0,focused:!1,selected:t,onSelect:()=>{r({type:"select",id:e.id})}}),l.a.createElement(xa.e,{width:"flex"},l.a.createElement(lE,{type:"payees",id:e.payee})),l.a.createElement(xa.e,{width:"flex"},l.a.createElement(lE,{type:"accounts",id:e.account})),l.a.createElement(xa.e,{width:"auto",title:o,style:iS},o),l.a.createElement(mE,{amount:e.amount,op:a}))},renderEmpty:"No schedules found"}))}var pS={paddingTop:20};function yS(){Object(i.h)();let e=Object(i.g)(),t=aS(Object(o.useState)(),2),n=t[0],r=t[1],a=aS(Object(o.useState)(!1),2),c=a[0],s=a[1],u=Object(si.c)("discover-schedules",n,[]);return Object(o.useEffect)(()=>{!async function(){r(await Object(h.send)("schedule/discover"))}()},[]),l.a.createElement(Q,{title:"Found schedules",modalSize:{width:850,height:650}},l.a.createElement(E.t,null,"We found some possible schedules in your current transactions. Select the ones you want to create."),l.a.createElement(E.t,null,"If you expected a schedule here and don't see it, it might be because the payees of the transactions don't match. Make sure you rename payees on all transactions for a schedule to be the same payee."),l.a.createElement(E.t,null,"You can always do this later",Ie.a.isBrowser?' from the "Find schedules" item in the sidebar menu':' from the "Tools > Find schedules" menu item',"."),l.a.createElement(si.a,{instance:u},l.a.createElement(fS,{loading:null==n,schedules:n})),l.a.createElement(E.v,{direction:"row",align:"center",justify:"flex-end",style:pS},l.a.createElement(E.d,{onClick:()=>e.goBack()},"Do nothing"),l.a.createElement(E.f,{primary:!0,loading:c,disabled:0===u.items.size,onClick:async function(){u.items;let t=n.filter(e=>u.items.has(e.id));s(!0);for(let e of t){let t=await Object(h.send)("schedule/create",{conditions:e._conditions}),n=(await Object(h.send)("make-filters-from-conditions",{conditions:e._conditions})).filters;if(n.length>0){let e=(await Object(ae.f)(Object(ae.c)("transactions").filter({$and:n}).select("id"))).data;await Object(h.send)("transactions-batch-update",{updated:e.map(e=>({id:e.id,schedule:t}))})}}s(!1),e.goBack()}},"Create schedules")))}var mS={color:w.a.p4},gS={marginTop:20};function hS(){let e=Object(i.h)(),t=Object(i.g)(),n=e.state&&e.state.payees||[],r=n.length>1;return l.a.createElement(Q,{title:"Post transactions?",modalSize:"small"},l.a.createElement(E.t,null,n.length>0?l.a.createElement(E.w,null,"The ",r?"payees ":"payee ",n.map((e,t)=>l.a.createElement(E.w,null,l.a.createElement(E.w,{style:mS},l.a.createElement(lE,{key:e,id:e,type:"payees"})),t===n.length-1?" ":t===n.length-2?", and ":", "))):l.a.createElement(E.w,null,"There ",r?"are payees ":"is a payee "," that "),l.a.createElement(E.w,null,r?"have ":"has "," schedules that are due today. Usually we automatically post transactions for these, but you are offline or syncing failed. In order to avoid duplicate transactions, we let you choose whether or not to create transactions for these schedules.")),l.a.createElement(E.t,null,"Be aware that other devices may have already created these transactions. If you have multiple devices, make sure you only do this on one device or you will have duplicate transactions."),l.a.createElement(E.t,null,'You can always manually post a transaction later for a due schedule by selecting the schedule and clicking "Post transaction" in the action menu.'),l.a.createElement(E.v,{direction:"row",justify:"flex-end",style:gS,spacing:2},l.a.createElement(E.d,{onClick:function(){t.goBack()}},"Decide later"),l.a.createElement(E.d,{primary:!0,onClick:async function(){await Object(h.send)("schedule/force-run-service"),t.goBack()}},"Post transactions")))}function bS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return OS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return OS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function OS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var wS={alignSelf:"center",color:w.a.g3},ES={alignSelf:"center",color:w.a.g3};var vS={alignItems:"flex-start"},jS={margin:0},SS={marginBottom:"1em"},xS={alignSelf:"center",margin:"15px 0"};function CS(){let e=bS(Object(o.useState)(!1),2),t=e[0],n=e[1],r=bS(Object(o.useState)(null),2),a=r[0],i=r[1];return l.a.createElement(Q,{title:"Repair Split Transactions",modalSize:{width:650}},l.a.createElement(E.y,{style:vS},l.a.createElement(E.t,null,"This tool does two things:"),l.a.createElement(E.t,null,l.a.createElement("ul",{style:jS},l.a.createElement("li",{style:SS},"Ensures that deleted split transactions are fully deleted. In previous versions of the app, certain split transactions may appear deleted but not all of them are actually deleted. This causes the transactions list to look correct, but certain balances may be incorrect when filtering."),l.a.createElement("li",null,'Sync the payee and cleared flag of a split transaction to the main or "parent" transaction, if appropriate. The payee will only be set if it currently doesn\'t have one.'))),l.a.createElement(E.t,null,"If you see blank payees on splits or account balances (or any balances) are incorrect, this may fix it."),l.a.createElement(E.f,{primary:!0,loading:t,onClick:async function(){n(!0);let e=await Object(h.send)("tools/fix-split-transactions");i(e),n(!1)},style:xS},"Repair split transactions"),a&&function(e){let t=e.numBlankPayees,n=e.numCleared,r=e.numDeleted;if(0===t&&0===n&&0===r)return l.a.createElement(E.t,{style:wS},"No split transactions found needing repair.");let a="";return t>0&&(a+=`${t} split transactions with a blank payee`),n>0&&(""!==a&&(a+=", and "),a+=`${n} split transactions with the wrong cleared flag`),r>0&&(""!==a&&(a+=", and "),a+=`${r} split transactions that weren't properly deleted`),l.a.createElement(E.t,{style:ES},"Fixed ",a,".")}(a)))}var kS={paddingLeft:2,paddingTop:".11em",alignSelf:"stretch",flexShrink:0,marginRight:5},PS={zIndex:1,lineHeight:1.5};function AS({icon:e,color:t,backgroundColor:n,style:r,children:a}){return l.a.createElement(E.y,{style:[{color:t,fontSize:13,boxShadow:w.c.shadow,borderRadius:4,backgroundColor:n,padding:10,flexDirection:"row","& a, & a:active, & a:visited":{color:w.a.b3}},r]},l.a.createElement(E.y,{style:kS},l.a.createElement(e,{width:13,style:{color:t,marginTop:2}})),l.a.createElement(E.w,{style:PS},a))}var IS={boxShadow:"none",padding:5};function DS({style:e,children:t}){return l.a.createElement(AS,{icon:Eu,color:w.a.n4,backgroundColor:"transparent",style:[e,IS]},t)}function TS({style:e,children:t}){return l.a.createElement(AS,{icon:at,color:w.a.r2,backgroundColor:w.a.r10,style:e},t)}var MS=n(120);n(264);function RS(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return BS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return BS(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function BS(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let _S=[{value:"MM/dd/yyyy",label:"MM/DD/YYYY"},{value:"dd/MM/yyyy",label:"DD/MM/YYYY"},{value:"yyyy-MM-dd",label:"YYYY-MM-DD"},{value:"MM.dd.yyyy",label:"MM.DD.YYYY"},{value:"dd.MM.yyyy",label:"DD.MM.YYYY"}];var LS={fontSize:20,fontWeight:500,marginBottom:20,flexShrink:0};function NS({name:e,style:t}){return l.a.createElement(E.y,{style:[LS,t]},e)}var FS={alignItems:"flex-start",marginTop:55},US={fontSize:15,marginBottom:20,flexDirection:"row",alignItems:"center"},zS={marginBottom:20,alignItems:"flex-start"},$S={backgroundColor:w.a.n9,alignItems:"flex-start",padding:15,borderRadius:4,marginTop:20,border:"1px solid "+w.a.n8},WS={marginBottom:10,width:500,lineHeight:1.5},GS={backgroundColor:w.a.n9,alignItems:"flex-start",padding:15,borderRadius:4,marginTop:20,border:"1px solid "+w.a.n8},HS={marginBottom:10,width:500,lineHeight:1.5},qS={marginTop:15,color:w.a.n4,fontSize:12};function YS({prefs:e,userData:t,pushModal:n,resetSync:r}){let a=RS(Object(o.useState)(!0),2),i=a[0],c=a[1],s=RS(Object(o.useState)(!1),2),u=s[0],d=s[1],f=RS(Object(o.useState)(!1),2),p=f[0],y=f[1];return l.a.createElement(E.y,{style:FS},l.a.createElement(E.y,{style:[US,w.c.staticText],onClick:()=>c(!i)},l.a.createElement(vu.a,{width:8,height:8,style:{marginRight:5,transition:"transform .2s",transform:!i&&"rotateZ(-90deg)"}}),"Advanced"),i&&l.a.createElement(E.y,{style:zS},l.a.createElement(E.w,null,l.a.createElement("strong",null,"Budget ID"),": ",e.id),l.a.createElement(E.y,{style:$S},l.a.createElement(E.w,{style:WS},l.a.createElement("strong",null,"Reset budget cache")," will clear all cached values for the budget and recalculate the entire budget. All values in the budget are cached for performance reasons, and if there is a bug in the cache you won't see correct values. There is no danger in resetting the cache. Hopefully you never have to do this."),l.a.createElement(E.f,{loading:p,onClick:async function(){y(!0),await Object(h.send)("reset-budget-cache"),y(!1)}},"Reset budget cache")),l.a.createElement(E.y,{style:GS},l.a.createElement(E.w,{style:HS},l.a.createElement("strong",null,"Reset sync")," will remove all local data used to track changes for syncing, and create a fresh sync id on our server. This file on other devices will have to be re-downloaded to use the new sync id. Use this if there is a problem with syncing and you want to start fresh."),l.a.createElement(E.f,{loading:u,onClick:async function(){d(!0),await r(),d(!1)}},"Reset sync"),l.a.createElement(E.w,{style:qS},"Sync ID: ",e.groupId||"(none)"))))}var KS={flexDirection:"row",maxWidth:550,alignItems:"center",overflow:"hidden"},VS={flexShrink:0},QS={backgroundColor:"white",padding:"7px 10px",borderRadius:4,marginLeft:5,overflow:"auto",whiteSpace:"nowrap","::-webkit-scrollbar":{display:"none"}},ZS={fontSize:14,marginLeft:5,flexShrink:0,alignSelf:"flex-start"},XS={marginTop:10},JS={flexDirection:"row",marginTop:30,alignItems:"flex-start"},ex={marginRight:5},tx={fontSize:15},nx={color:w.a.n2,marginTop:10,maxWidth:600,lineHeight:"1.4em"},rx={marginTop:30},ax={flexDirection:"row",marginTop:30,alignItems:"flex-start"},ox={marginRight:5},lx={fontSize:15},ix={color:w.a.n2,marginTop:10,maxWidth:600,lineHeight:"1.4em"};function cx({globalPrefs:e,userData:t,saveGlobalPrefs:n,pushModal:r,closeBudget:a}){let i=RS(Object(o.useState)(!1),2),c=i[0],s=i[1],u=Object(o.useRef)(null);return Object(o.useEffect)(()=>{u.current&&u.current.scrollTo(1e4,0)},[]),l.a.createElement(E.y,null,l.a.createElement(E.y,null,l.a.createElement(NS,{name:"General"}),!Ie.a.isBrowser&&l.a.createElement(E.y,{style:KS},l.a.createElement(E.w,{style:VS},"Store files here: "),l.a.createElement(E.w,{innerRef:u,style:QS},e.documentDir),l.a.createElement(E.d,{primary:!0,onClick:async function(){let e=await window.Actual.openFileDialog({properties:["openDirectory"]});e&&(n({documentDir:e[0]}),s(!0))},style:ZS},"Change location")),c&&l.a.createElement(DS,{style:XS},"A restart is required for this change to take effect"),l.a.createElement(E.y,{style:JS},l.a.createElement("input",{type:"checkbox",checked:e.autoUpdate,style:ex,onChange:function(e){n({autoUpdate:e.target.checked})}}),l.a.createElement(E.y,null,l.a.createElement(E.w,{style:tx},"Automatically check for updates"),l.a.createElement(E.y,{style:nx},"By default, Actual will automatically apply new updates as they are available. Disabling this will avoid updating Actual. You will need to go to the About menu to manually check for updates.")))),l.a.createElement(E.y,{style:rx},l.a.createElement(NS,{name:"Privacy"}),l.a.createElement(E.y,{style:ax},l.a.createElement("input",{type:"checkbox",checked:e.trackUsage,style:ox,onChange:function(e){n({trackUsage:e.target.checked})}}),l.a.createElement(E.y,null,l.a.createElement(E.w,{style:lx},"Send basic usage statistics back to Actual","'","s servers"),l.a.createElement(E.y,{style:ix},"We don","'","t track anything specific \u2014 only the fact that you","'","ve opened Actual. This helps by giving us important feedback about how popular new features are.")))))}var sx={marginTop:30},ux={marginLeft:5,fontSize:14},dx={marginTop:20},fx={marginLeft:5,fontSize:14},px={marginTop:30},yx={flexDirection:"row"},mx={fontWeight:700,fontSize:15},gx={color:w.a.n2,marginTop:10,maxWidth:600,lineHeight:"1.4em"},hx={color:w.a.g4,fontWeight:600},bx={marginTop:10},Ox={alignItems:"flex-start"},wx={lineHeight:"1.4em"},Ex={marginTop:10},vx={marginTop:30,alignItems:"flex-start"};function jx({savePrefs:e,prefs:t,userData:n,localServerURL:r,pushModal:a,resetSync:o,setAppState:i,signOut:c}){let s=t.dateFormat||"MM/dd/yyyy",u=t.numberFormat||"comma-dot";return l.a.createElement(E.y,null,l.a.createElement(E.y,{style:sx},l.a.createElement(NS,{name:"Formatting"}),l.a.createElement(E.w,null,"Date format:"," ",l.a.createElement("select",Object.assign({},Object(j.css)(ux),{onChange:function(t){let n=t.target.value;e({dateFormat:n})}}),_S.map(e=>l.a.createElement("option",{value:e.value,selected:e.value===s},e.label)))),l.a.createElement(E.w,{style:dx},"Number format:"," ",l.a.createElement("select",Object.assign({},Object(j.css)(fx),{onChange:function(t){let n=t.target.value;e({numberFormat:n})}}),we.numberFormats.map(e=>l.a.createElement("option",{value:e.value,selected:e.value===u},e.label))))),l.a.createElement(E.y,{style:px},l.a.createElement(NS,{name:"Encryption"}),l.a.createElement(E.y,{style:yx},l.a.createElement(E.y,null,l.a.createElement(E.w,{style:mx},"End-to-end encryption"),l.a.createElement(E.y,{style:gx},t.encryptKeyId?l.a.createElement(E.w,null,l.a.createElement(E.w,{style:hx},"Encryption is turned on.")," ","Your data is encrypted with a key that only you have before sending it out to the cloud . Local data remains unencrypted so if you forget your password you can re-encrypt it.",l.a.createElement(E.d,{style:bx,onClick:()=>void a("create-encryption-key",{recreate:!0})},"Generate new key")):l.a.createElement(E.y,{style:Ox},l.a.createElement(E.w,{style:wx},"Encryption is not enabled. Any data on our servers is still stored safely and securely, but it's not end-to-end encrypted which means we have the ability to read it (but we won't). If you want, you can use a password to encrypt your data on our servers."),l.a.createElement(E.d,{style:Ex,onClick:()=>{alert("End-to-end encryption is not supported on the self-hosted service yet")}},"Enable encryption")))))),Ie.a.isBrowser&&l.a.createElement(E.y,{style:vx},l.a.createElement(NS,{name:"Export"}),l.a.createElement(E.d,{onClick:async function(){let e=await Object(h.send)("export-budget");window.Actual.saveFile(e,"budget.zip","Export budget")}},"Export data")),l.a.createElement(YS,{prefs:t,userData:n,pushModal:a,resetSync:o}))}var Sx={backgroundColor:w.a.p6,borderColor:w.a.p6,color:"white"};function xx({to:e,name:t,style:n,first:r,last:a}){return l.a.createElement(E.b,{to:e,style:[{fontSize:14,padding:"6px 10px",borderBottom:"2px solid transparent",textDecoration:"none",borderRadius:r?"4px 0 0 4px":a?"0 4px 4px 0":4,border:"1px solid "+w.a.n4,color:w.a.n3},n],activeStyle:Sx},t)}var Cx={overflow:"hidden",fontSize:14},kx={flexDirection:"row",alignSelf:"center",margin:"15px 0"},Px={alignItems:"flex-start",flex:1,overflow:"auto",paddingBottom:20},Ax={flexShrink:0};var Ix=Object(s.b)(e=>({prefs:e.prefs.local,globalPrefs:e.prefs.global,localServerURL:e.account.localServerURL,userData:e.user.data}),p)(class extends l.a.Component{componentDidMount(){this.unlisten=Object(h.listen)("prefs-updated",()=>{this.props.loadPrefs()}),this.props.getUserData(),this.props.loadPrefs()}componentWillUnmount(){this.unlisten()}render(){let e=this.props,t=e.prefs,n=e.globalPrefs,r=e.localServerURL,a=e.userData,o=e.match;return l.a.createElement(E.y,{style:[w.c.page,Cx]},l.a.createElement(E.y,{style:kx},l.a.createElement(xx,{to:`${o.path}/file`,name:"File",first:!0}),l.a.createElement(xx,{to:`${o.path}/global`,name:"Global",last:!0})),l.a.createElement(E.y,{style:[w.c.pageContent,Px]},l.a.createElement(E.y,{style:Ax},l.a.createElement(i.d,null,l.a.createElement(i.b,{path:`${o.path}/`,exact:!0},l.a.createElement(i.a,{to:`${o.path}/file`})),l.a.createElement(i.b,{path:`${o.path}/global`},l.a.createElement(cx,{globalPrefs:n,userData:a,saveGlobalPrefs:this.props.saveGlobalPrefs,pushModal:this.props.pushModal,closeBudget:this.props.closeBudget})),l.a.createElement(i.b,{path:`${o.path}/file`},l.a.createElement(jx,{prefs:t,localServerURL:r,userData:a,pushModal:this.props.pushModal,savePrefs:this.props.savePrefs,setAppState:this.props.setAppState,signOut:this.props.signOut,resetSync:this.props.resetSync}))))))}});var Dx={maxWidth:500},Tx={marginBottom:10,lineHeight:"1.4em",fontSize:15},Mx={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10},Rx={marginTop:30,marginBottom:10,lineHeight:"1.4em",fontSize:15},Bx={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10,color:w.a.n3};var _x=Object(s.b)(e=>({currentModal:e.modals.currentModal}),e=>Object(Qn.b)(p,e))(class extends l.a.Component{constructor(...e){super(...e),this.onConnect=(async()=>{lt(this.props.pushModal)}),this.onCreateLocalAccount=(()=>{(0,this.props.pushModal)("add-local-account")})}render(){const e=this.props.modalProps;return l.a.createElement(E.r,Object.assign({title:"Add Account"},e),()=>l.a.createElement(E.y,{style:Dx},l.a.createElement(E.w,{style:Tx},l.a.createElement("strong",null,"Link your bank accounts")," to automatically download transactions. We offer hundreds of banks to sync with, and our service will provide reliable, up-to-date information."),l.a.createElement(E.d,{primary:!0,style:Mx,onClick:this.onConnect},"Link bank account"),l.a.createElement(E.y,{style:Rx},"You can also create a local account if you want to track transactions manually. You can add transactions manually or import QIF/OFX/QFX files."),l.a.createElement(E.d,{style:Bx,onClick:this.onCreateLocalAccount},"Create local account")))}});function Lx(e,t){switch(e){case"brokerage":case"investment":return"investment";case"credit":return"credit";case"loan":return"debt";case"other":return"other";case"depository":default:switch(t){case"money market":case"savings":return"savings";case"cd":return"cd";default:return"checking"}}}function Nx(e){switch(e){case"checking":return"Checking";case"savings":return"Savings";case"cd":return"CD";case"investment":return"Investment";case"credit":return"Credit Card";case"mortgage":return"Mortgage";case"debt":return"Debt";case"other":default:return"Other"}}function Fx(e){switch(e){case"investment":case"mortgage":case"debt":case"other":return!0}return!1}var Ux=n(206),zx={flex:1},$x={marginLeft:75},Wx={marginLeft:75},Gx={width:"75%",flexDirection:"row",justifyContent:"flex-end"},Hx={userSelect:"none"},qx={flex:1},Yx={marginLeft:75},Kx={marginLeft:10};var Vx=function({modalProps:e,actions:t,history:n}){return l.a.createElement(E.r,Object.assign({title:"Create Local Account"},e,{showBack:!1}),()=>l.a.createElement(E.y,null,l.a.createElement(Ux.a,{validateOnChange:!1,initialValues:{name:"",type:"checking",balance:"0"},validate:()=>({}),onSubmit:async(r,{setErrors:a})=>{const o={};if(r.type||(o.type="required"),r.name||(o.name="required"),isNaN(parseFloat(r.balance))&&(o.balance="format"),a(o),0===Object.keys(o).length){e.onClose();let a=await t.createAccount(r.name,r.type,Object(we.toRelaxedNumber)(r.balance),r.offbudget);n.push("/accounts/"+a)}},render:({values:t,errors:n,touched:r,handleChange:a,handleBlur:o,handleSubmit:i,isSubmitting:c,setFieldValue:s})=>l.a.createElement("form",{onSubmit:i},l.a.createElement(E.l,{label:"Name",width:"75%"},l.a.createElement(E.k,null,l.a.createElement(E.m,{name:"name",value:t.name,onChange:a,onBlur:o,style:zx}))),n.name&&l.a.createElement(E.i,{style:$x},"Name is required"),l.a.createElement(E.l,{label:"Type",width:"75%"},l.a.createElement(E.u,{name:"type",value:t.type,onChange:e=>{s("offbudget",Fx(e.target.value)),a(e)},onBlur:o},l.a.createElement("option",{value:"checking"},"Checking / Cash"),l.a.createElement("option",{value:"savings"},"Savings"),l.a.createElement("option",{value:"credit"},"Credit Card"),l.a.createElement("option",{value:"investment"},"Investment"),l.a.createElement("option",{value:"mortgage"},"Mortgage"),l.a.createElement("option",{value:"debt"},"Debt"),l.a.createElement("option",{value:"other"},"Other"))),n.type&&l.a.createElement(E.i,{style:Wx},"You must select a type"),l.a.createElement(E.y,{style:Gx},l.a.createElement("label",{style:Hx},l.a.createElement("input",{name:"offbudget",type:"checkbox",checked:!!t.offbudget,onChange:a,onBlur:o})," ","Off-budget")),l.a.createElement(E.l,{label:"Balance",width:"75%"},l.a.createElement(E.m,{name:"balance",value:t.balance,onChange:a,onBlur:o,style:qx})),n.balance&&l.a.createElement(E.i,{style:Yx},"Balance must be a number"),l.a.createElement(E.s,null,l.a.createElement(E.d,{onClick:()=>e.onBack()},"Back"),l.a.createElement(E.d,{primary:!0,style:Kx},"Create")))})))};const Qx=["categoryGroups"];function Zx(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Xx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xx(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Xx(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Jx(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function eC(e,t,n){const r=n.find(e=>e.id===t),a=r&&1===r.offbudget;return 0===e.offbudget&&a}function tC(e){let t=e.categoryGroups,n=Jx(e,Qx);return l.a.createElement(E.u,n,l.a.createElement("option",{value:""},"Select category..."),t.map(e=>l.a.createElement("optgroup",{key:e.id,label:e.name},e.categories.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name)))))}var nC={flex:0},rC={width:200,marginBottom:15},aC={marginBottom:15},oC={marginBottom:15},lC={width:200},iC={marginBottom:15},cC={fontSize:12},sC={color:w.a.r6},uC={flexDirection:"row",justifyContent:"flex-end"},dC={marginRight:10};var fC=function({account:e,accounts:t,categoryGroups:n,balance:r,canDelete:a,actions:i,modalProps:c}){let s=Zx(Object(o.useState)(!1),2),u=s[0],d=s[1],f=t.filter(t=>t.id!==e.id),p=f.filter(e=>0===e.offbudget),y=f.filter(e=>1===e.offbudget);return l.a.createElement(E.r,Object.assign({title:"Close Account"},c,{style:nC,loading:u}),()=>l.a.createElement(E.y,null,l.a.createElement(E.t,null,"Are you sure you want to close ",l.a.createElement("strong",null,e.name),"?"," ",a?l.a.createElement("span",null,"This account has no transactions so it will be permanently deleted."):l.a.createElement("span",null,"This account has transactions so we can","'","t permanently delete it.")),l.a.createElement(Ux.a,{validateOnChange:!1,initialValues:{transfer:"",category:""},onSubmit:(n,{setErrors:a})=>{const o={};0!==r&&""===n.transfer&&(o.transfer="required"),eC(e,n.transfer,t)&&""===n.category&&(o.category="required"),a(o),0===Object.keys(o).length&&(d(!0),i.closeAccount(e.id,n.transfer||null,n.category||null).then(()=>{c.onClose()}))},render:({values:o,errors:s,touched:u,handleChange:f,handleBlur:m,handleSubmit:g,isSubmitting:h,setFieldValue:b})=>l.a.createElement("form",{onSubmit:g},0!==r&&l.a.createElement(E.y,null,l.a.createElement(E.t,null,"This account has a balance of"," ",l.a.createElement("strong",null,"$",Object(we.integerToCurrency)(r)),". To close this account, select a different account to transfer this balance to:"),l.a.createElement(E.u,{name:"transfer",value:o.transfer,onChange:f,onBlur:m,style:rC},l.a.createElement("option",{value:""},"Select account..."),l.a.createElement("optgroup",{label:"For Budget"},p.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name))),l.a.createElement("optgroup",{label:"Off Budget"},y.map(e=>l.a.createElement("option",{key:e.id,value:e.id},e.name)))),s.transfer&&l.a.createElement(E.i,{style:aC},"Transfer is required"),eC(e,o.transfer,t)&&l.a.createElement(E.y,{style:oC},l.a.createElement(E.t,null,"Since you are transferring the balance from a budgeted account to an off-budget account, this transaction must be categorized. Select a category:"),l.a.createElement(tC,{categoryGroups:n,name:"category",value:o.category,onChange:f,onBlur:m,style:lC}),s.category&&l.a.createElement(E.i,null,"Category is required"))),!a&&l.a.createElement(E.y,{style:iC},l.a.createElement(E.w,{style:cC},"You can also ",l.a.createElement("a",{href:"#",onClick:t=>{t.preventDefault(),d(!0),i.forceCloseAccount(e.id).then(()=>c.onClose())},style:sC},"force close")," ","the account which will delete it and all its transactions permanently. Doing so may change your budget unexpectedly since money in it may vanish.")),l.a.createElement(E.y,{style:uC},l.a.createElement(E.d,{type:"submit",style:dC,onClick:c.onClose},"Cancel"),l.a.createElement(E.d,{type:"submit",primary:!0},"Close Account")))})))};function pC(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return yC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return yC(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function mC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function gC(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?mC(Object(n),!0).forEach(function(t){hC(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):mC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function hC(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let bC={color:w.a.n1};function OC(){return null}var wC={marginBottom:8,flexShrink:0,userSelect:"none"},EC={padding:12,boxShadow:w.c.shadow,cursor:"pointer",transition:"transform .20s",fontSize:14,borderRadius:4,flexDirection:"row",alignItems:"center",border:"1px solid "+w.a.n10,":hover":bC},vC=gC(gC({},bC),{},{borderColor:w.a.b9,backgroundColor:w.a.b10}),jC={fontWeight:600,flex:1},SC={fontSize:13,color:w.a.n5,flexDirection:"row"},xC={marginLeft:4};function CC({account:e,selected:t,onSelect:n}){return l.a.createElement(E.y,{style:[wC,w.c.mediumText],onClick:n},l.a.createElement(E.y,{style:[EC,t&&vC]},l.a.createElement(E.y,null,l.a.createElement(E.y,{style:jC},e.name),l.a.createElement(E.y,{style:SC},Nx(Lx(e.type,e.subtype)),l.a.createElement(E.w,{style:xC},"...",e.mask)))))}var kC={maxWidth:500},PC={maxHeight:300,overflow:"auto",paddingLeft:5,paddingRight:5,marginLeft:-5,marginRight:-5},AC={flexDirection:"row",justifyContent:"flex-end",marginTop:30},IC={marginRight:10};function DC({institution:e,publicToken:t,upgradingId:n,modalProps:r,accounts:a,actions:i}){let c=pC(Object(o.useState)([]),2),s=c[0],u=c[1];async function d(){s.length>0&&(n?(i.linkAccount(e,t,s[0],n),i.closeModal()):i.pushModal("configure-linked-accounts",{institution:e,publicToken:t,accounts:s.map(e=>a.find(t=>t.id===e))}))}return l.a.createElement(E.r,Object.assign({title:n?"Link Account":"Link Accounts"},r),()=>l.a.createElement(E.y,{style:kC},n?l.a.createElement(E.t,null,"We found the following accounts. Select the one you want to link with:"):l.a.createElement(E.t,null,"We found the following accounts. Select which ones you want to add:"),l.a.createElement(E.y,{style:PC},l.a.createElement(E.y,null,0===a.length?l.a.createElement(OC,null):a.map(e=>{let t=s.includes(e.id);return l.a.createElement(CC,{key:e.id,account:e,selected:t,onSelect:()=>(function(e){n?u([e]):s.includes(e)?u(s.filter(t=>t!==e)):u([...s,e])})(e.id)})}))),l.a.createElement(E.y,{style:AC},l.a.createElement(E.d,{style:IC,onClick:r.onClose},"Cancel"),l.a.createElement(E.d,{primary:!0,onClick:d},n?"Link Account":"Next"))))}function TC(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return MC(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return MC(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function MC(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function RC(){return null}var BC={marginBottom:8,flexShrink:0,userSelect:"none"},_C={padding:12,boxShadow:w.c.shadow,cursor:"pointer",transition:"transform .20s",fontSize:14,borderRadius:4,flexDirection:"row",alignItems:"center",border:"1px solid "+w.a.n10},LC={flex:1},NC={fontWeight:600},FC={fontSize:13,color:w.a.n5,flexDirection:"row"},UC={marginLeft:4},zC={color:w.a.n8},$C={width:15,height:15,color:w.a.g5},WC={color:w.a.g5,marginLeft:5};function GC({account:e,offbudget:t,onSelect:n}){return l.a.createElement(E.y,{style:[BC,w.c.mediumText],onClick:n},l.a.createElement(E.y,{style:[_C]},l.a.createElement(E.y,{style:LC},l.a.createElement(E.y,{style:NC},e.name),l.a.createElement(E.y,{style:FC},Nx(Lx(e.type,e.subtype)),l.a.createElement(E.w,{style:UC},"...",e.mask))),t?l.a.createElement(E.w,{style:zC},"Off budget"):l.a.createElement(l.a.Fragment,null,l.a.createElement(MS.a,{style:$C}),l.a.createElement(E.w,{style:WC},"Budgeted"))))}var HC={maxWidth:500},qC={fontSize:15,marginBottom:15,lineHeight:"1.4em"},YC={maxHeight:300,overflow:"auto",paddingLeft:5,paddingRight:5,marginLeft:-5,marginRight:-5},KC={flexDirection:"row",justifyContent:"flex-end",marginTop:30},VC={marginRight:10};function QC({institution:e,publicToken:t,upgradingId:n,modalProps:r,accounts:a,actions:i}){let c=TC(Object(o.useState)(()=>a.filter(e=>Fx(Lx(e.type))).map(e=>e.id)),2),s=c[0],u=c[1];async function d(){let n=await i.connectAccounts(e,t,a.map(e=>e.id),s);i.closeModal(),1===n.length?window.location.hash="/accounts/"+n[0]:n.length>0&&(window.location.hash="/accounts")}return l.a.createElement(E.r,Object.assign({title:n?"Link Account":"Link Accounts"},r),()=>l.a.createElement(E.y,{style:HC},l.a.createElement(E.w,{style:qC},"A ",l.a.createElement("strong",null,"budgeted account")," is one where expenses and income affect the budget. Usually things like investments are off budget. We","'","ve chosen some defaults here, but you can change the status if you like."),l.a.createElement(E.y,{style:YC},l.a.createElement(E.y,null,0===a.length?l.a.createElement(RC,null):a.map(e=>{let t=s.includes(e.id);return l.a.createElement(GC,{key:e.id,account:e,offbudget:t,onSelect:()=>(function(e){s.includes(e)?u(s.filter(t=>t!==e)):u([...s,e])})(e.id)})}))),l.a.createElement(E.y,{style:KC},l.a.createElement(E.d,{style:VC,onClick:r.onBack},"Back"),l.a.createElement(E.d,{primary:!0,onClick:d},n?"Link Account":"Next"))))}var ZC=n(196),XC=(n(96),n(32));const JC=["width","height","style","color"];function ek(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var tk=function(e){let t=e.width,n=e.height,r=e.style,a=e.color,o=void 0===a?"currentColor":a,i=ek(e,JC);return l.a.createElement("svg",Object.assign({width:t,height:n},i,Object(j.css)(r),{viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"}),l.a.createElement("path",{d:"M24 29H29.3333",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M8.00002 29H2.66669",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 21L8 29",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 21L24 29",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 2.66669V21.3334",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 2.66669L8 9.33335",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}),l.a.createElement("path",{d:"M16 2.66669L24 9.33335",stroke:o,className:"path",strokeWidth:"3.5",strokeMiterlimit:"10",strokeLinecap:"round"}))};const nk=["modalProps","payees","ruleCounts","categoryGroups","tableNavigatorOpts","initialSelectedIds","ruleActions","onBatchChange","onViewRules","onCreateRule"];function rk(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function ak(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return ok(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ok(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ok(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let lk=Object(XC.a)(e=>Object(we.groupById)(e));function ik(e,t,n){return 1===e?t:n}var ck={padding:"0 10px"},sk={borderRadius:4,padding:"3px 6px",backgroundColor:w.a.g9,border:"1px solid "+w.a.g9,color:w.a.g1,fontSize:12},uk={paddingRight:5},dk={width:8,height:8,color:w.a.g1};function fk({ruleCount:e,focused:t,onEdit:n,onClick:r}){return l.a.createElement(xa.a,{name:"rule-count",width:"auto",focused:t,style:ck,plain:!0},l.a.createElement(xa.b,{style:sk,onEdit:n,onSelect:r,onFocus:n},l.a.createElement(E.w,{style:uk},e>0?l.a.createElement(l.a.Fragment,null,e," associated ",ik(e,"rule","rules")):l.a.createElement(l.a.Fragment,null,"Create rule")),l.a.createElement(Dp,{style:dk})))}var pk={alignItems:"stretch"},yk={backgroundColor:w.a.b9,zIndex:100},mk={color:w.a.n7};let gk=l.a.memo(({style:e,payee:t,ruleCount:n,categoryGroups:r,selected:a,highlighted:o,hovered:i,editing:c,focusedField:s,onViewRules:u,onCreateRule:d,onHover:f,onEdit:p,onUpdate:y,ruleActions:m})=>{let g=t.id,h=Object(si.d)(),b=a?w.a.b8:w.a.border,O=i||"select"===s;return l.a.createElement(xa.h,{borderColor:b,backgroundColor:a?w.a.b9:O?w.a.hover:"white",highlighted:o,style:[pk,e,{backgroundColor:i?w.a.hover:null},a&&yk],"data-focus-key":t.id,onMouseEnter:()=>f&&f(t.id)},l.a.createElement(xa.i,{exposed:null==t.transfer_acct&&(i||a||c),focused:"select"===s,selected:a,onSelect:()=>{h({type:"select",id:t.id})}}),l.a.createElement(xa.f,{value:(t.transfer_acct?"Transfer: ":"")+t.name,valueStyle:!a&&t.transfer_acct&&mk,exposed:"name"===s,width:"flex",onUpdate:e=>!t.transfer_acct&&y(g,"name",e),onExpose:()=>p(g,"name"),inputProps:{readOnly:!!t.transfer_acct}}),l.a.createElement(fk,{ruleCount:n,focused:"rule-count"===s,onEdit:()=>p(g,"rule-count"),onClick:()=>n>0?u(t.id):d(t.id)}))});var hk={flex:1};const bk=l.a.forwardRef(({payees:e,ruleCounts:t,navigator:n,categoryGroups:r,highlightedRows:a,ruleActions:i,onUpdate:c,onViewRules:s,onCreateRule:u},d)=>{let f=ak(Object(o.useState)(null),2),p=f[0],y=f[1],m=Object(si.e)();Object(o.useLayoutEffect)(()=>{let e=[...m][0];d.current.scrollTo(e,"center"),n.onEdit(e,"select")},[]);let g=Object(o.useCallback)(e=>{y(e)},[]);return l.a.createElement(E.y,{style:[hk],onMouseLeave:()=>y(null)},l.a.createElement(xa.l,{ref:d,items:e,navigator:n,renderItem:({item:e,editing:n,focusedField:o,onEdit:i})=>l.a.createElement(gk,{payee:e,ruleCount:t.get(e.id)||0,categoryGroups:r,selected:m.has(e.id),highlighted:a&&a.has(e.id),editing:n,focusedField:o,hovered:p===e.id,onHover:g,onEdit:i,onUpdate:c,onViewRules:s,onCreateRule:u})}))});var Ok={backgroundColor:"white",color:w.a.n4,zIndex:200,userSelect:"none"};function wk(){let e=w.a.border,t=Object(si.d)(),n=Object(si.e)();return l.a.createElement(E.y,null,l.a.createElement(xa.h,{borderColor:e,style:Ok,collapsed:!0},l.a.createElement(xa.i,{exposed:!0,focused:!1,selected:n.size>0,onSelect:()=>t({type:"select-all"})}),l.a.createElement(xa.a,{value:"Name",width:"flex"})))}var Ek={textAlign:"center",color:w.a.n7,fontStyle:"italic",fontSize:13,marginTop:5};function vk({text:e,style:t}){return l.a.createElement(E.y,{style:[Ek,t]},e)}var jk={padding:0},Sk={padding:3,fontSize:11,fontStyle:"italic",color:w.a.n7};function xk({payeesById:e,selectedPayees:t,onDelete:n,onMerge:r,onClose:a}){let o=[...t].some(t=>null==e[t]||e[t].transfer_acct);return l.a.createElement(E.x,{position:"bottom",width:250,style:jk,onClose:a},l.a.createElement(E.q,{onMenuSelect:e=>{switch(a(),e){case"delete":n();break;case"merge":r()}},footer:l.a.createElement(E.y,{style:Sk},[...t].slice(0,4).map(t=>e[t].name).join(", ")+(t.size>4?", and more":"")),items:[{icon:Zl.a,name:"delete",text:"Delete",disabled:o},{icon:tk,iconSize:9,name:"merge",text:"Merge",disabled:o||t.size<2},E.q.line]}))}var Ck={flex:"inherit",maxWidth:"90%"},kk={maxWidth:"100%",width:900,height:550},Pk={flexDirection:"row",alignItems:"center",padding:"0 10px"},Ak={marginRight:10},Ik={marginLeft:5},Dk={flex:1},Tk={width:350,borderColor:"transparent",backgroundColor:w.a.n11,":focus":{backgroundColor:"white","::placeholder":{color:w.a.n8}}},Mk={flex:1,border:"1px solid "+w.a.border,borderRadius:4,overflow:"hidden",margin:5},Rk={marginTop:15};const Bk=l.a.forwardRef((e,t)=>{let n=e.modalProps,r=e.payees,a=e.ruleCounts,i=e.categoryGroups,c=e.tableNavigatorOpts,s=e.initialSelectedIds,u=(e.ruleActions,e.onBatchChange),d=e.onViewRules,f=e.onCreateRule,p=rk(e,nk),y=ak(Object(o.useState)(null),2),m=y[0],g=y[1],h=ak(Object(o.useState)(""),2),b=h[0],O=h[1],w=Object(o.useRef)(null),v=Object(o.useRef)(null),j=Object(o.useRef)(!1),S=Object(o.useMemo)(()=>""===b?r:r.filter(e=>e.name.toLowerCase().includes(b.toLowerCase())),[r,b]),x=Object(si.c)("payees",S,s);function C(e){b!==e&&(w.current&&w.current.setRowAnimation(!1),O(e),j.current=!0)}function k(e){C(""),v.current=e}Object(o.useEffect)(()=>{j.current&&(setTimeout(()=>{w.current&&w.current.setRowAnimation(!0)},0),j.current=!1)}),Object(o.useImperativeHandle)(t,()=>({selectRows:(e,t)=>{M.onEdit(null),x.dispatch({type:"select-all",ids:e}),g(null),t&&e.length>0&&k(e[0])},highlightRow:e=>{M.onEdit(null),g(new Set([e])),k(e)}})),Object(o.useEffect)(()=>{m&&g(null)},[m]),Object(o.useLayoutEffect)(()=>{v.current&&(w.current.scrollTo(v.current),v.current=null)});let P=Object(E.z)((e,t,n)=>{r.find(t=>t.id===e)[t]!==n&&u({updated:[{id:e,[t]:n}]})}),A=Object(o.useCallback)(()=>S.filter(e=>null==e.transfer_acct).map(e=>e.id),[S]);function I(){u({deleted:[...x.items].map(e=>({id:e}))}),x.dispatch({type:"select-none"})}async function D(){let e=[...x.items];await p.onMerge(e),M.onEdit(e[0],"name"),x.dispatch({type:"select-none"}),k(e[0])}let T=0===x.items.size,M=Object(xa.o)(S,e=>["select","name","rule-count"].filter(t=>{switch(t){case"select":return null==e.transfer_acct;default:return!0}}),c),R=lk(r);return l.a.createElement(E.r,Object.assign({title:"Payees",padding:0},n,{style:[n.style,Ck]}),l.a.createElement(E.y,{style:kk},l.a.createElement(E.y,{style:Pk},l.a.createElement(zr.a,{initialState:{menuOpen:!1}},({state:e,setState:t})=>l.a.createElement(E.y,null,l.a.createElement(E.d,{bare:!0,style:Ak,disabled:T,onClick:()=>t({menuOpen:!0})},T?"No payees selected":x.items.size+" "+ik(x.items.size,"payee","payees"),l.a.createElement(vu.a,{width:8,height:8,style:Ik})),e.menuOpen&&l.a.createElement(xk,{payeesById:R,selectedPayees:x.items,onClose:()=>t({menuOpen:!1}),onDelete:I,onMerge:D}))),l.a.createElement(E.y,{style:Dk}),l.a.createElement(E.m,{placeholder:"Filter payees...",value:b,onChange:e=>{C(e.target.value),M.onEdit(null)},style:Tk})),l.a.createElement(si.a,{instance:x,fetchAllIds:A},l.a.createElement(E.y,{style:Mk},l.a.createElement(wk,null),0===S.length?l.a.createElement(vk,{text:"No payees",style:Rk}):l.a.createElement(bk,{ref:w,payees:S,ruleCounts:a,categoryGroups:i,highlightedRows:m,navigator:M,onUpdate:P,onViewRules:d,onCreateRule:f})))))});function _k(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Lk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Lk(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Lk(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Nk=Object(s.b)(e=>({initialPayees:e.queries.payees,lastUndoState:e.app.lastUndoState,categoryGroups:e.queries.categories.grouped}),p)(function({history:e,modalProps:t,initialSelectedIds:n,lastUndoState:r,initialPayees:a,categoryGroups:i,initiallyLoadPayees:c,getPayees:s,setLastUndoState:u,pushModal:d}){let f=_k(Object(o.useState)(a),2),p=f[0],y=f[1],m=_k(Object(o.useState)({value:new Map}),2),g=m[0],b=m[1],O=Object(o.useRef)();async function w(){let e=await Object(h.send)("payees-get-rule-counts");e=new Map(Object.entries(e)),b({value:e})}async function E({tables:e,messages:t,meta:n,url:r},a=!1){(e.includes("payees")||e.includes("payee_mapping")||e.includes("payee_rules"))&&(y(await s()),(n&&n.targetId||t.find(e=>"rules"===e.dataset))&&w(),u(null))}return Object(o.useEffect)(()=>{!async function(){let e=await c();await new Promise(e=>setTimeout(e,100)),e&&y(e),w()}();let e=Object(h.listen)("sync-event",async({type:e,tables:t})=>{"applied"===e&&t.includes("rules")&&w()});return W.setUndoState("openModal","manage-payees"),()=>{W.setUndoState("openModal",null),e()}},[]),Object(o.useEffect)(()=>(r.current&&E(r.current,!0),Object(h.listen)("undo-event",E)),[]),l.a.createElement(Bk,{ref:O,modalProps:t,payees:p,ruleCounts:g.value,categoryGroups:i,initialSelectedIds:n,lastUndoState:r,onBatchChange:e=>{Object(h.send)("payees-batch-change",e),y(Object(we.applyChanges)(e,p))},onMerge:async([e,...t])=>{await Object(h.send)("payees-merge",{targetId:e,mergeIds:t});let n=p.filter(e=>!t.includes(e.id));t.forEach(t=>{let n=g.value.get(t)||0;g.value.set(e,(g.value.get(e)||0)+n)}),y(n),b({value:g.value})},onViewRules:function(e){d("manage-rules",{payeeId:e})},onCreateRule:function(e){let t={id:null,stage:null,conditions:[{field:"description",op:"is",value:p.find(t=>t.id===e).id,type:"id"}],actions:[]};d("edit-rule",{rule:t})}})});function Fk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Uk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Uk(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Uk(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let zk={color:w.a.p5};var $k={padding:20,maxWidth:500},Wk={marginBottom:10,fontWeight:500},Gk={margin:0,marginTop:10,maxHeight:140,overflow:"auto"},Hk={fontSize:13,marginTop:10,color:w.a.n4,userSelect:"none",display:"flex",alignItems:"center",justifyContent:"center"},qk={marginLeft:3},Yk={marginTop:20},Kk={marginRight:10},Vk={marginRight:10},Qk={marginRight:10};function Zk({history:e,modalProps:t,payeeIds:n,targetPayeeId:r}){let a=Object(s.d)(e=>({payees:e.queries.payees,modalStack:e.modals.modalStack})),i=a.payees,c=!!a.modalStack.find(e=>"edit-rule"===e.name),u=Object(s.c)(),d=Fk(Object(o.useState)(!0),2),f=d[0],p=d[1],y=Object(o.useRef)(null);Object(o.useEffect)(()=>{if(y.current){let e=y.current,t=e.scrollTop;e.scrollTop=t+1,e.scrollTop=t}},[y.current,!0]);let m=Fk(Object(o.useState)(()=>n.map(e=>i.find(t=>t.id===e))),1)[0],g=i.find(e=>e.id===r);if(!g)return null;async function b(){let e;if(await Object(h.send)("payees-merge",{targetId:g.id,mergeIds:m.map(e=>e.id)}),f&&!c){e=await Object(h.send)("rule-add-payee-rename",{fromNames:m.map(e=>e.name),to:g.id})}return t.onClose(),e}async function O(){let e=await b();if(e){let t=await Object(h.send)("rule-get",{id:e});u(Object(bt.e)("edit-rule",{rule:t}))}}return l.a.createElement(E.r,Object.assign({title:"Merge payee?",padding:0,showHeader:!1},t,{style:t.style}),()=>l.a.createElement(E.y,{style:$k},l.a.createElement(E.y,null,l.a.createElement(E.t,{style:Wk},1===m.length?l.a.createElement(l.a.Fragment,null,"The payee ",l.a.createElement(E.w,{style:zk},m[0].name)," ","is not used by transactions any more. Would like to merge it with ",l.a.createElement(E.w,{style:zk},g.name),"?"):l.a.createElement(l.a.Fragment,null,"The following payees are not used by transactions any more. Would like to merge them with"," ",l.a.createElement(E.w,{style:zk},g.name),"?",l.a.createElement("ul",{ref:y,style:Gk},m.map(e=>l.a.createElement("li",null,l.a.createElement(E.w,{style:zk},e.name)))))),l.a.createElement(DS,null,"Merging will remove the payee and transfer any existing rules to the new payee. If checked below, a rule will be created to do this rename while importing transactions."),!c&&l.a.createElement("label",{style:Hk},l.a.createElement("input",{type:"checkbox",checked:f,onChange:e=>p(e.target.checked)}),l.a.createElement(E.w,{style:qk},"Automatically rename"," ",1===m.length?"this payee":"these payees"," in the future")),l.a.createElement(E.s,{style:Yk,focusButton:!0},l.a.createElement(E.d,{primary:!0,style:Kk,onClick:b,type:"button"},"Merge"),!c&&l.a.createElement(E.d,{style:Vk,onClick:O,type:"button"},"Merge and edit rule"),l.a.createElement(E.d,{style:Qk,onClick:()=>t.onBack(),type:"button"},"Do nothing")))))}function Xk(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Jk(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jk(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jk(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var eP={alignSelf:"center"};var tP={flex:0},nP={fontSize:15},rP={alignItems:"center",marginTop:15},aP={width:20,height:20},oP={marginTop:10,color:w.a.n4},lP={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10,backgroundColor:w.a.g4,borderColor:w.a.g4},iP={padding:"10px 0",fontSize:15,fontWeight:600,marginTop:10},cP={color:w.a.n5,fontWeight:600},sP={marginTop:10,color:w.a.n5,fontSize:13,"& a, & a:visited":{color:w.a.n5}},uP={marginTop:10};function dP({modalProps:e,onMoveExternal:t,onSuccess:n,onClose:r}){let a=Xk(Object(o.useState)(null),2),i=a[0],c=a[1],s=Xk(Object(o.useState)(!1),2),u=s[0],d=s[1],f=Xk(Object(o.useState)(null),2),p=f[0],y=f[1],m=Object(o.useRef)(null);async function g(){y(null),c("browser");let e=await t();if(e.error)return y(e.error),void c(null);m.current=e.data,c(null),d(!0)}async function h(){c("accounts"),await n(m.current),c(null)}var b={marginTop:i?30:35};return l.a.createElement(E.r,Object.assign({title:"Link Your Bank"},e,{onClose:function(){r&&r(),e.onClose()},style:tP}),()=>l.a.createElement(E.y,null,l.a.createElement(E.t,{style:nP},"To link your bank account, you will be moved to your browser for enhanced security. Click below and Actual will automatically resume when you have given your bank","'","s credentials."),p&&function(e){return l.a.createElement(TS,{style:eP},"timeout"===e?"Timed out. Please try again.":"An error occurred while linking your account, sorry!")}(p),i?l.a.createElement(E.y,{style:rP},l.a.createElement(pa.a,{color:w.a.n1,style:aP}),l.a.createElement(E.y,{style:oP},"browser"===i?"Waiting on browser...":"accounts"===i?"Loading accounts...":null)):u?l.a.createElement(E.d,{primary:!0,style:lP,onClick:h},"Success! Click to continue \u2192"):l.a.createElement(E.d,{primary:!0,style:iP,onClick:g},"Link bank in browser \u2192"),l.a.createElement("div",{style:b},l.a.createElement(E.w,{style:cP},"Why not link it in the app?")),l.a.createElement(E.w,{style:sP},"Typing your bank","'","s username and password is one of the most security-sensitive things you can do, and the browser is the most secure app in the world. Why not use it to make sure your information is safe?"," ",l.a.createElement("a",{href:"https://actualbudget.com/security-learn-more"},"Learn more about security")),l.a.createElement(E.s,{style:uP},l.a.createElement(E.d,{onClick:()=>e.onBack()},"Back"))))}function fP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function pP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?fP(Object(n),!0).forEach(function(t){yP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):fP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function yP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var mP={marginTop:15,color:w.a.r4},gP={flex:0},hP={lineHeight:1.5},bP={marginTop:20,flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},OP={flex:1,marginLeft:10,marginRight:30};var wP=class extends l.a.Component{constructor(...e){super(...e),this.state={transferCategory:null,error:null},this.onDelete=(()=>{let e=this.state.transferCategory,t=this.props,n=(t.category,t.group,t.onDelete);e?(n(e),this.props.modalProps.onClose()):this.setState({error:"required-transfer"})}),this.renderError=(e=>{let t;switch(e){case"required-transfer":t="You must select a category";break;default:t="Something bad happened, sorry!"}return l.a.createElement(E.w,{style:mP},t)})}componentDidMount(){setTimeout(()=>{this.input.focus()},200)}render(){const e=this.props,t=e.modalProps,n=e.category,r=e.group,a=e.categoryGroups,o=this.state,i=o.transferCategory,c=o.error,s=!!(n||r).is_income;return l.a.createElement(E.r,Object.assign({title:"Confirm Delete"},t,{style:gP}),()=>l.a.createElement(E.y,{style:hP},r?l.a.createElement(E.c,null,"Categories in the group ",l.a.createElement("strong",null,r.name)," are used by existing transaction",!s&&" or it has a positive leftover balance currently",". ",l.a.createElement("strong",null,"Are you sure you want to delete it?")," If so, you must select another category to transfer existing transactions and balance to."):l.a.createElement(E.c,null,l.a.createElement("strong",null,n.name)," is used by existing transactions",!s&&" or it has a positive leftover balance currently",". ",l.a.createElement("strong",null,"Are you sure you want to delete it?")," If so, you must select another category to transfer existing transactions and balance to."),c&&this.renderError(c),l.a.createElement(E.y,{style:bP},l.a.createElement(E.w,null,"Transfer to:"),l.a.createElement(E.y,{style:OP},l.a.createElement(Jo,{ref:e=>this.input=e,categoryGroups:r?a.filter(e=>e.id!==r.id&&!!e.is_income===s):a.filter(e=>!!e.is_income===s).map(e=>pP(pP({},e),{},{categories:e.categories.filter(e=>e.id!==n.id)})),name:"category",value:i,onChange:e=>this.setState({transferCategory:e.target.value})})),l.a.createElement(E.d,{primary:!0,onClick:()=>this.onDelete()},"Delete"))))}},EP={maxWidth:500,fontSize:15},vP={color:w.a.p5,fontWeight:600,"& a, & a:visited":{color:w.a.p5}};var jP=Object(s.b)(null,p)(function({modalProps:e,actions:t}){return l.a.createElement(E.r,Object.assign({title:"Welcome to Actual"},e),()=>l.a.createElement(E.y,{style:EP},l.a.createElement(E.t,null,"Actual is a personal finance tool that focuses on beautiful design and a slick user experience."," ",l.a.createElement("strong",null,"Editing your data should be as fast as possible.")," On top of that, we want to provide powerful tools to allow you to do whatever you want with your data."),l.a.createElement(E.t,null,"Currently Actual implements budgeting based on a"," ",l.a.createElement(E.h,{asAnchor:!0,href:"https://actualbudget.com/how-it-works/"},"monthly envelope system"),"."),l.a.createElement(E.t,null,"In the future, we","'","ll support multiple ways to do budgeting. We","'","re also working hard on custom reports and a lot more things."),l.a.createElement(E.t,{style:vP},"Read the"," ",l.a.createElement(E.h,{asAnchor:!0,href:"https://actualbudget.com/docs/"},"documentation")," ","to get started and learn about"," ",l.a.createElement(E.h,{asAnchor:!0,href:"https://actualbudget.com/docs/budgeting/how-it-works/"},"budgeting"),","," ",l.a.createElement(E.h,{asAnchor:!0,href:"https://actualbudget.com/docs/accounts/overview/"},"accounts")," ","and more.")))});const SP=["inflow","outflow"];function xP(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function CP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function kP(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?CP(Object(n),!0).forEach(function(t){PP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):CP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function PP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function AP(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return IP(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return IP(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function IP(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let DP=[{format:"yyyy mm dd",label:"YYYY MM DD"},{format:"yy mm dd",label:"YY MM DD"},{format:"mm dd yyyy",label:"MM DD YYYY"},{format:"mm dd yy",label:"MM DD YY"},{format:"dd mm yyyy",label:"DD MM YYYY"},{format:"dd mm yy",label:"DD MM YY"}];function TP(e,t){if("string"!==typeof e)return null;function n(e){return e&&1===e.length?"0"+e:e}let r,a,o,l=e.replace(/ /g,"").split(/[^0-9]/);switch(t){case"dd mm yyyy":r=l[2],a=l[1],o=l[0];break;case"dd mm yy":r=`20${l[2]}`,a=l[1],o=l[0];break;case"yyyy mm dd":r=l[0],a=l[1],o=l[2];break;case"yy mm dd":r=`20${l[0]}`,a=l[1],o=l[2];break;case"mm dd yy":r=`20${l[2]}`,a=l[0],o=l[1];break;default:case"mm dd yyyy":r=l[2],a=l[0],o=l[1]}let i=`${r}-${n(a)}-${n(o)}`;return Oe.a(Ga.a(i))?i:null}function MP(e,t){if(!e)return null;try{return Object(Ee.g)(e,t)}catch(n){}return null}function RP(e){let t=e.match(/\.([^.]*)$/);return t?t[1].toLowerCase():"ofx"}var BP={color:w.a.n4,fontStyle:"italic"};function _P({parseDateFormat:e,showParsed:t,dateFormat:n,date:r}){let a=r&&MP(e?TP(r,e):r,n);return l.a.createElement(E.w,null,l.a.createElement(E.w,null,r||l.a.createElement(E.w,{style:BP},"Empty")," ","\u2192"," "),l.a.createElement(E.w,{style:{color:a?w.a.g3:w.a.r4}},a||"Invalid"))}function LP(e,t){if(0===e.length||null==t.date)return"yyyy mm dd";let n=e[0][t.date],r=null==n?null:DP.find(e=>null!=TP(n,e.format));return r?r.format:"mm dd yyyy"}function NP(e){if(0===e.length)return{};let t=e[0],n=Object.entries(t);function r(e){return e?e[0]:null}let a=r(n.find(([e,t])=>e.toLowerCase().includes("date"))||n.find(([e,t])=>t.match(/^\d+[-/]\d+[-/]\d+$/))),o=r(n.find(([e,t])=>e.toLowerCase().includes("amount"))||n.find(([e,t])=>t.match(/^-?[.,\d]+$/))),l=r(n.find(([e,t])=>e!==a&&e!==o)),i=r(n.find(([e,t])=>e!==a&&e!==o&&e!==l));return{date:a,amount:o,payee:l,notes:i}}function FP(e,t){let n={};for(let a of Object.entries(t)){var r=AP(a,2);let t=r[0],o=r[1];"payee"===t&&(t="payee_name"),n[t]=e[o||t]}return n}function UP(e,t){if(null==e)return null;return t("string"===typeof e?Object(we.looselyParseAmount)(e):e)}function zP(e,t,n){if(t){let t=UP(e.outflow,e=>-Math.abs(e)),n=t?0:UP(e.inflow,e=>Math.abs(e));return{amount:t||n,outflow:t,inflow:n}}return{amount:UP(e.amount,e=>n?-1*e:e),outflow:null,inflow:null}}var $P={backgroundColor:"white"},WP={textAlign:"right"},GP={textAlign:"right"},HP={textAlign:"right"};function qP({transaction:e,fieldMappings:t,showParsed:n,parseDateFormat:r,dateFormat:a,splitMode:i,flipAmount:c}){let s=Object(o.useMemo)(()=>t?FP(e,t):e,[e,t]),u=zP(s,i,c),d=u.amount,f=u.outflow,p=u.inflow;return d=Object(we.amountToCurrency)(d),f=Object(we.amountToCurrency)(f),p=Object(we.amountToCurrency)(p),l.a.createElement(xa.h,{style:$P},l.a.createElement(xa.e,{width:200,borderColor:w.a.border},n?l.a.createElement(_P,{parseDateFormat:r,dateFormat:a,date:s.date}):MP(s.date,a)),l.a.createElement(xa.e,{width:"flex",borderColor:w.a.border,title:s.imported_payee||s.payee_name},s.payee_name),l.a.createElement(xa.e,{width:"flex",borderColor:w.a.border,title:s.notes},s.notes),i?l.a.createElement(l.a.Fragment,null,l.a.createElement(xa.e,{width:90,borderColor:w.a.border,contentStyle:[WP,w.c.tnum],title:f},f),l.a.createElement(xa.e,{width:90,borderColor:w.a.border,contentStyle:[GP,w.c.tnum],title:p},p)):l.a.createElement(xa.e,{width:90,borderColor:w.a.border,contentStyle:[HP,w.c.tnum],title:d},d))}var YP={fontSize:13,marginBottom:3,color:w.a.n3};function KP({title:e}){return l.a.createElement(E.w,{style:YP},e)}function VP({width:e,style:t,options:n,value:r,onChange:a}){return l.a.createElement(E.u,{value:r,style:t,onChange:e=>a(e.target.value)},l.a.createElement("option",{value:""},"Choose field..."),n.map(e=>l.a.createElement("option",{key:e,value:e},e)))}var QP={width:120};function ZP({transactions:e,fieldMappings:t,parseDateFormat:n,onChange:r}){let a="-";if(e.length>0&&t&&null!=t.date){let n=e[0][t.date],r=n&&n.match(/[/.,-/\\]/);a=r?r[0]:" "}return l.a.createElement(E.y,{style:QP},l.a.createElement(IE,{title:"Date format"}),l.a.createElement(E.u,{value:n||"",onChange:e=>r(e.target.value)},DP.map(e=>l.a.createElement("option",{key:e.format,value:e.format},e.label.replace(/ /g,a)))))}var XP={flex:1,flexDirection:"row",alignItems:"center",userSelect:"none"};function JP({value:e,disabled:t,onChange:n}){return l.a.createElement(E.y,{style:XP},l.a.createElement(BE,{id:"form_flip",checked:e,disabled:t,onChange:n}),l.a.createElement("label",{htmlFor:"form_flip",style:{userSelect:"none",color:t?w.a.n6:null}},"Flip amount"))}var eA={flex:1,flexDirection:"row",alignItems:"center",userSelect:"none"},tA={userSelect:"none"};function nA({value:e,onChange:t}){return l.a.createElement(E.y,{style:eA},l.a.createElement(BE,{id:"form_split",checked:e,onChange:t}),l.a.createElement("label",{htmlFor:"form_split",style:tA},"Split amount into separate inflow/outflow columns"))}var rA={marginTop:5},aA={width:200},oA={marginRight:5},lA={flex:1},iA={marginRight:5},cA={flex:1},sA={marginRight:5},uA={width:90},dA={width:90},fA={width:90};function pA({transactions:e,mappings:t,onChange:n,splitMode:r}){if(0===e.length)return null;let a=Object.keys(e[0]);return t=t||{},l.a.createElement(E.y,null,l.a.createElement(IE,{title:"CSV FIELDS"}),l.a.createElement(E.v,{direction:"row",align:"flex-start",spacing:1,style:rA},l.a.createElement(E.y,{style:aA},l.a.createElement(KP,{title:"Date"}),l.a.createElement(VP,{width:200,options:a,value:t.date||"",style:oA,onChange:e=>n("date",e)})),l.a.createElement(E.y,{style:lA},l.a.createElement(KP,{title:"Payee"}),l.a.createElement(VP,{width:"flex",options:a,value:t.payee||"",style:iA,onChange:e=>n("payee",e)})),l.a.createElement(E.y,{style:cA},l.a.createElement(KP,{title:"Notes"}),l.a.createElement(VP,{width:"flex",options:a,value:t.notes||"",style:sA,onChange:e=>n("notes",e)})),r?l.a.createElement(l.a.Fragment,null,l.a.createElement(E.y,{style:uA},l.a.createElement(KP,{title:"Outflow"}),l.a.createElement(VP,{width:90,options:a,value:t.outflow||"",onChange:e=>n("outflow",e)})),l.a.createElement(E.y,{style:dA},l.a.createElement(KP,{title:"Inflow"}),l.a.createElement(VP,{width:90,options:a,value:t.inflow||"",onChange:e=>n("inflow",e)}))):l.a.createElement(E.y,{style:fA},l.a.createElement(KP,{title:"Amount"}),l.a.createElement(VP,{width:90,options:a,value:t.amount||"",onChange:e=>n("amount",e)}))))}var yA={width:800},mA={alignItems:"center",marginBottom:15},gA={marginRight:10,color:w.a.r4},hA={flex:"unset",height:300,border:"1px solid "+w.a.border},bA={backgroundColor:w.a.n11},OA={textAlign:"center",marginTop:25,color:w.a.n4,fontStyle:"italic"},wA={color:w.a.r4,alignItems:"center",marginTop:10},EA={maxWidth:450,marginBottom:15},vA={marginTop:25},jA={marginTop:25},SA={marginTop:5},xA={marginTop:10},CA={flexDirection:"row",marginTop:25},kA={marginLeft:25},PA={flex:1},AA={alignSelf:"flex-end",flexDirection:"row",alignItems:"center"};var IA=Object(s.b)(e=>({dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy",prefs:e.prefs.local}),p)(function({modalProps:e,options:t,dateFormat:n="MM/dd/yyyy",prefs:r,parseTransactions:a,importTransactions:i,getPayees:c,savePrefs:s}){let u=AP(Object(o.useState)("parsing"),2),d=u[0],f=u[1],p=AP(Object(o.useState)(null),2),y=p[0],m=p[1],g=AP(Object(o.useState)(t.filename),2),h=g[0],b=g[1],O=AP(Object(o.useState)([]),2),w=O[0],v=O[1],j=AP(Object(o.useState)(null),2),S=j[0],x=j[1],C=AP(Object(o.useState)(null),2),k=C[0],P=C[1],A=AP(Object(o.useState)(!1),2),I=A[0],D=A[1],T=AP(Object(o.useState)(!1),2),M=T[0],R=T[1],B=t.accountId,_=t.onImported,L=AP(Object(o.useState)(r[`csv-delimiter-${B}`]||","),2),N=L[0],F=L[1],U=AP(Object(o.useState)(null),2),z=U[0],$=U[1];async function W(e,t){f("parsing");let n=await a(e,t),o=n.errors,l=n.transactions;if(f(null),m(null),o.length>0)m({parsed:!0,message:o[0].message||"Internal error"});else{let t=RP(e);if(b(e),x(t),"csv"!==t&&"qif"!==t||R(r[`flip-amount-${B}-${t}`]||!1),"csv"===t){let e=r[`csv-mappings-${B}`];e=e?JSON.parse(e):NP(l),P(e);let n=!(!e.outflow&&!e.inflow);D(n),$(r[`parse-date-${B}-${t}`]||LP(l,e))}else"qif"===t?$(r[`parse-date-${B}-${t}`]||LP(l,{date:"date"})):(P(null),$(null));v(l.reverse())}}Object(o.useEffect)(()=>{W(t.filename,"csv"===RP(t.filename)?{delimiter:N}:null)},[a,t.filename]);let G=[{name:"Date",width:200},{name:"Payee",width:"flex"},{name:"Notes",width:"flex"}];return I?(G.push({name:"Outflow",width:90,style:{textAlign:"right"}}),G.push({name:"Inflow",width:90,style:{textAlign:"right"}})):G.push({name:"Amount",width:90,style:{textAlign:"right"}}),l.a.createElement(E.r,Object.assign({title:"Import transactions"+(S?` (${S.toUpperCase()})`:"")},e,{loading:"parsing"===d,style:yA}),y&&!y.parsed&&l.a.createElement(E.y,{style:mA},l.a.createElement(E.w,{style:gA},l.a.createElement("strong",null,"Error:")," ",y.message)),(!y||!y.parsed)&&l.a.createElement(E.y,{style:hA},l.a.createElement(xa.m,{headers:G}),l.a.createElement(xa.n,{items:w,fields:["payee","amount"],style:bA,getItemKey:e=>e,renderEmpty:()=>l.a.createElement(E.y,{style:OA},"No transactions found"),renderItem:({key:e,style:t,item:r,editing:a,focusedField:o})=>l.a.createElement(E.y,{key:e,style:t},l.a.createElement(qP,{transaction:r,showParsed:"csv"===S||"qif"===S,parseDateFormat:z,dateFormat:n,fieldMappings:k,splitMode:I,flipAmount:M}))})),y&&y.parsed&&l.a.createElement(E.y,{style:wA},l.a.createElement(E.w,{style:EA},l.a.createElement("strong",null,"Error:")," ",y.message),y.parsed&&l.a.createElement(E.d,{onClick:()=>(function(){const e=window.Actual.openFileDialog({filters:[{name:"Financial Files",extensions:["qif","ofx","qfx","csv"]}]});W(e[0],"csv"===RP(e[0])?{delimiter:N}:null)})()},"Select new file...")),"csv"===S&&l.a.createElement(E.y,{style:vA},l.a.createElement(pA,{transactions:w,onChange:function(e,t){P(kP(kP({},k),{},{[e]:""===t?null:t}))},mappings:k,splitMode:I})),("qif"===S||"csv"===S)&&l.a.createElement(E.y,{style:jA},l.a.createElement(IE,{title:"IMPORT OPTIONS"}),l.a.createElement(E.y,{style:SA},l.a.createElement(JP,{value:M,disabled:I,onChange:()=>{R(!M)}})),"csv"===S&&l.a.createElement(E.y,{style:xA},l.a.createElement(nA,{value:I,onChange:function(){if(null==k)return;let e=!I;D(e);let t=NP(w),n=e?{amount:null,outflow:t.amount,inflow:null}:{amount:t.amount,outflow:null,inflow:null};P(kP(kP({},k),n))}}))),l.a.createElement(E.y,{style:CA},("qif"===S||"csv"===S)&&l.a.createElement(ZP,{transactions:w,fieldMappings:k,parseDateFormat:z,onChange:$}),"csv"===S&&l.a.createElement(E.y,{style:kA},l.a.createElement(IE,{title:"CSV DELIMITER"}),l.a.createElement(E.u,{value:N,onChange:e=>{F(e.target.value),W(h,{delimiter:e.target.value})}},l.a.createElement("option",{value:","},","),l.a.createElement("option",{value:";"},";"))),l.a.createElement(E.y,{style:PA}),l.a.createElement(E.y,{style:AA},l.a.createElement(E.f,{primary:!0,disabled:0===w.length,loading:"importing"===d,onClick:async function(){f("importing");let t,n=[];for(let e of w){e=k?FP(e,k):e;let r="qfx"===S||"ofx"===S?e.date:TP(e.date,z);if(null==r){t=`Unable to parse date ${e.date||"(empty)"} with given date format`;break}let a=zP(e,I,M).amount;if(null==a){t=`Transaction on ${e.date} has no amount`;break}let o=e,l=(o.inflow,o.outflow,xP(o,SP));n.push(kP(kP({},l),{},{date:r,amount:Object(we.amountToInteger)(a)}))}if(t)return f(null),void m({parsed:!1,message:t});"ofx"!==S&&"qfx"!==S&&s({[`parse-date-${B}-${S}`]:z}),"csv"===S&&(s({[`csv-mappings-${B}`]:JSON.stringify(k)}),s({[`csv-delimiter-${B}`]:N})),"csv"!==S&&"qif"!==S||s({[`flip-amount-${B}-${S}`]:M});let r=await i(B,n);r&&await c(),_&&_(r),e.onClose()}},"Import ",w.length," transactions"))))}),DA=n(200),TA=n(201),MA={flex:0,padding:"15px 10px",backgroundColor:w.a.n1,color:"white"},RA={alignSelf:"center",color:w.a.b10,marginBottom:10},BA={flex:1};var _A=Object(s.b)(e=>({dateFormat:e.prefs.local.dateFormat||"MM/dd/yyyy",categoryGroups:e.queries.categories.grouped,accounts:e.queries.accounts,payees:e.queries.payees}),p)(function({actions:e,modalProps:t,name:n,accounts:r,categoryGroups:a,payees:i,onSubmit:c,dateFormat:s,createPayee:u}){let d,f,p;function y(e){"amount"===n&&(e=Object(we.amountToInteger)(e)),c(n,e),t.onClose()}Object(o.useRef)();let m={":focus":{boxShadow:0}},g={inputProps:{style:m},containerProps:{style:{height:275}}};switch(n){case"date":{let e=Object(Ee.c)();d="Date",p=350,f=l.a.createElement(Ul.a,{value:Object(Ha.a)(Object(Ga.a)(e),s),dateFormat:s,focused:!0,embedded:!0,onUpdate:()=>{},onSelect:e=>{y(Object(Ee.e)(Object(be.a)(e,"yyyy-MM-dd",new Date)))}});break}case"account":d="Account",f=l.a.createElement(Fl,Object.assign({value:null,accounts:r,focused:!0,embedded:!0,onSelect:e=>{e&&y(e)}},g));break;case"payee":d="Payee",f=l.a.createElement(Tl,Object.assign({payees:i,accounts:r,value:null,focused:!0,embedded:!0,showManagePayees:!1,onSelect:async e=>{e&&e.startsWith("new:")&&(e=await u(e.slice("new:".length))),y(e)}},g));break;case"notes":d="Notes",f=l.a.createElement(E.m,{focused:!0,onEnter:e=>y(e.target.value),style:m});break;case"category":d="Category",f=l.a.createElement(ll,Object.assign({categoryGroups:a,value:null,focused:!0,embedded:!0,showSplitOption:!1,onUpdate:()=>{},onSelect:e=>{y(e)}},g));break;case"amount":d="Amount",f=l.a.createElement(E.m,{focused:!0,onEnter:e=>y(e.target.value),style:m})}return l.a.createElement(E.r,Object.assign({noAnimation:!0,showHeader:!1,focusAfterClose:!1},t,{padding:0,style:[MA,p&&{minWidth:p}]}),()=>l.a.createElement(E.y,null,l.a.createElement(IE,{title:d,style:RA}),l.a.createElement(E.y,{style:BA},f)))});var LA=Object(s.b)(e=>({modalStack:e.modals.modalStack,isHidden:e.modals.isHidden,accounts:e.queries.accounts,categoryGroups:e.queries.categories.grouped,categories:e.queries.categories.list,payees:e.queries.payees,budgetId:e.prefs.local&&e.prefs.local.id}),e=>({actions:Object(Qn.b)(p,e)}))(function({history:e,modalStack:t,isHidden:n,accounts:r,categoryGroups:a,categories:o,payees:s,budgetId:u,actions:d}){return t.map(({name:s,options:f={}},p)=>{const y={onClose:d.popModal,onBack:d.popModal,showBack:p>0,isCurrent:p===t.length-1,isHidden:n,stackIndex:p};let m=Object(c.c)("/"+s);return l.a.createElement(i.d,{key:s,location:m},l.a.createElement(i.b,{path:"/import-transactions"},l.a.createElement(IA,{modalProps:y,options:f})),l.a.createElement(i.b,{path:"/add-account"},l.a.createElement(_x,{modalProps:y,actions:d})),l.a.createElement(i.b,{path:"/add-local-account"},l.a.createElement(Vx,{modalProps:y,actions:d,history:e})),l.a.createElement(i.b,{path:"/close-account"},l.a.createElement(fC,{modalProps:y,account:f.account,balance:f.balance,canDelete:f.canDelete,accounts:r.filter(e=>0===e.closed),categoryGroups:a,actions:d})),l.a.createElement(i.b,{path:"/select-linked-accounts"},l.a.createElement(DC,{modalProps:y,institution:f.institution,publicToken:f.publicToken,accounts:f.accounts,upgradingId:f.upgradingId,actions:d})),l.a.createElement(i.b,{path:"/configure-linked-accounts"},l.a.createElement(QC,{modalProps:y,institution:f.institution,publicToken:f.publicToken,accounts:f.accounts,upgradingId:f.upgradingId,actions:d})),l.a.createElement(i.b,{path:"/confirm-category-delete",render:()=>{const e=f.category,t=f.group,n=f.onDelete;return l.a.createElement(wP,{modalProps:y,actions:d,category:o.find(t=>t.id===e),group:a.find(e=>e.id===t),categoryGroups:a,onDelete:n})}}),l.a.createElement(i.b,{path:"/load-backup",render:()=>l.a.createElement(zr.a,{initialState:{backups:[]},didMount:async({setState:e})=>{e({backups:await Object(h.send)("backups-get",{id:u})}),Object(h.listen)("backups-updated",t=>{e({backups:t})})},willUnmount:()=>{Object(h.unlisten)("backups-updated")}},({state:e})=>l.a.createElement(ZC.a,{budgetId:u,modalProps:y,actions:d,backups:e.backups}))}),l.a.createElement(i.b,{path:"/manage-payees",render:()=>l.a.createElement(Nk,{history:e,modalProps:y,initialSelectedIds:f.selectedPayee?[f.selectedPayee]:void 0})}),l.a.createElement(i.b,{path:"/manage-rules",render:()=>l.a.createElement(Od,{history:e,modalProps:y,payeeId:f.payeeId})}),l.a.createElement(i.b,{path:"/edit-rule",render:()=>l.a.createElement(gj,{history:e,modalProps:y,defaultRule:f.rule,onSave:f.onSave})}),l.a.createElement(i.b,{path:"/merge-unused-payees",render:()=>l.a.createElement(Zk,{history:e,modalProps:y,payeeIds:f.payeeIds,targetPayeeId:f.targetPayeeId})}),l.a.createElement(i.b,{path:"/plaid-external-msg",render:()=>l.a.createElement(dP,{modalProps:y,actions:d,onMoveExternal:f.onMoveExternal,onClose:()=>{f.onClose&&f.onClose(),Object(h.send)("poll-web-token-stop")},onSuccess:f.onSuccess})}),l.a.createElement(i.b,{path:"/create-encryption-key",render:()=>l.a.createElement(DA.a,{key:s,modalProps:y,actions:d,options:f})}),l.a.createElement(i.b,{path:"/fix-encryption-key",render:()=>l.a.createElement(TA.a,{key:s,modalProps:y,actions:d,options:f})}),l.a.createElement(i.b,{path:"/edit-field",render:()=>l.a.createElement(_A,{key:s,modalProps:y,actions:d,name:f.name,onSubmit:f.onSubmit})}),l.a.createElement(i.b,{path:"/welcome-screen"},l.a.createElement(jP,{modalProps:y,actions:d})))})}),NA=n(195);var FA=Object(i.k)(class extends l.a.Component{componentDidMount(){const e=e=>{if(!Ie.a.isBrowser&&e.metaKey){const t=this.props.history;switch(e.keyCode){case 49:t.push("/budget");break;case 50:t.push("/reports");break;case 51:t.push("/accounts");break;case 188:"mac"===Ie.a.OS&&t.push("/settings")}}};document.addEventListener("keydown",e),this.cleanupListeners=(()=>{document.removeEventListener("keydown",e)})}componentWillUnmount(){this.cleanupListeners()}render(){return null}});w.a.n9;function UA({path:e,component:t}){return l.a.createElement(i.b,{path:e,children:e=>l.a.createElement(E.y,{style:{flex:1,display:e.match?"flex":"none"}},l.a.createElement(t,e))})}function zA({location:e}){return l.a.createElement(i.d,{location:e},l.a.createElement(i.b,{path:"/"},l.a.createElement(i.b,{path:"/",exact:!0,render:()=>l.a.createElement(i.a,{to:"/budget"})}),l.a.createElement(UA,{path:"/reports",component:tE}),l.a.createElement(UA,{path:"/budget",component:Jb}),l.a.createElement(i.b,{path:"/schedules",exact:!0,component:PE}),l.a.createElement(i.b,{path:"/schedule/edit",exact:!0,component:tS}),l.a.createElement(i.b,{path:"/schedule/edit/:id",component:tS}),l.a.createElement(i.b,{path:"/schedule/link",component:rS}),l.a.createElement(i.b,{path:"/schedule/discover",component:yS}),l.a.createElement(i.b,{path:"/schedule/posts-offline-notification",component:hS}),l.a.createElement(i.b,{path:"/tools/fix-splits",exact:!0,component:CS}),l.a.createElement(i.b,{path:"/accounts/:id",exact:!0,children:e=>e.match&&l.a.createElement(ip,Object.assign({key:e.match.params.id},e))}),l.a.createElement(i.b,{path:"/accounts",exact:!0,component:ip}),l.a.createElement(i.b,{path:"/settings",component:Ix})))}function $A(){let e=Object(i.h)(),t=te(e,"locationPtr"),n=[e];for(;t;)n.unshift(t),t=te(t,"locationPtr");let r=n[0],a=n.slice(1);return l.a.createElement(re,{location:n[n.length-1]},l.a.createElement(zA,{location:r}),a.map((e,t)=>l.a.createElement(H,{key:e.key,type:"modal",current:t===a.length-1},l.a.createElement(zA,{location:e}))))}var WA={height:"100%",backgroundColor:w.a.n10},GA={flexDirection:"row",flex:1},HA={flex:1,display:"flex",flexDirection:"column",overflow:"hidden",position:"relative"},qA={WebkitAppRegion:"drag",position:"absolute",top:0,left:0,right:0,zIndex:1e3},YA={flex:1,display:"flex",overflow:"auto",position:"relative"};class KA extends l.a.Component{constructor(e){super(e),this.history=Object(c.a)();let t=this.history.push;this.history.push=((e,n)=>t.call(this.history,e,function(e){return X(X({},e),{},{_version:ee})}(n))),window.__history=this.history,W.setUndoState("url",window.location.href),this.cleanup=this.history.listen(e=>{W.setUndoState("url",window.location.href)})}componentDidMount(){"/subscribe"===this.history.location.pathname&&this.history.push("/"),this.props.getAccounts().then(e=>{0===e.length&&this.history.push("/accounts")}),f.a.setScope("app"),setTimeout(async()=>{await this.props.sync(),Object(O.a)(this.props.addNotification,this.props.resetSync,this.history)},100)}componentWillUnmount(){this.cleanup()}render(){return l.a.createElement(i.c,{history:this.history},l.a.createElement(E.y,{style:WA},l.a.createElement(FA,null),l.a.createElement(E.y,{style:GA},l.a.createElement(pr,null),l.a.createElement("div",{style:HA},l.a.createElement(Ur,{style:qA}),l.a.createElement("div",{style:YA},l.a.createElement(NA.a,null),l.a.createElement(_,null),l.a.createElement($A,null),l.a.createElement(LA,{history:this.history}))))))}}t.a=Object(s.b)(null,p)(function(e){let t=Object(o.useMemo)(()=>l.a.createElement(KA,e),[e]);return l.a.createElement(b,null,l.a.createElement(hr,null,l.a.createElement(ur,null,l.a.createElement(z,null,l.a.createElement(se,null,l.a.createElement(me,null,l.a.createElement(u.a,{backend:d.a},t)))))))})},343:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(10),l=n(61),i=n(29),c=n(3),s=n(21),u=n(1),d=n(2);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return p(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var y={position:"absolute",bottom:0,left:0,right:0,justifyContent:"center",flexDirection:"row",marginBottom:15,zIndex:5e3},m={marginLeft:15};function g(){let e=f(Object(r.useState)(null),2),t=e[0],n=e[1];return Object(r.useEffect)(()=>{!async function(){let e=await Object(c.send)("get-server-url");n(e)}()},[]),a.a.createElement(u.y,{style:y},a.a.createElement(u.w,null,"Using server: ",a.a.createElement("strong",null,t)),a.a.createElement(u.b,{bare:!0,to:"/config-server",style:m},"Change"))}var h=n(194),b=n(195),O=n(27),w=n(88);function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function v(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach(function(t){j(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var S=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:v({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M24 11.113a5.765 5.765 0 0 0-5.216-5.952.249.249 0 0 1-.191-.12 7.684 7.684 0 0 0-14.1 2.294.251.251 0 0 1-.227.2A4.643 4.643 0 0 0 .624 9.774 4.47 4.47 0 0 0 0 12.223a4.293 4.293 0 0 0 1.235 3.1 4.624 4.624 0 0 0 1.78 1.062.963.963 0 0 0 1.243-.86v-.026a.985.985 0 0 0-.658-1.033 2.58 2.58 0 0 1-.96-.572A2.374 2.374 0 0 1 2 12.109a2.588 2.588 0 0 1 2.586-2.588 2.7 2.7 0 0 1 .535.054.989.989 0 0 0 .811-.184 1 1 0 0 0 .392-.779c.085-5.736 8.293-7.372 10.818-2.044a.974.974 0 0 0 .941.57 3.733 3.733 0 0 1 3 1.309 3.888 3.888 0 0 1 .9 2.812 3.428 3.428 0 0 1-1.473 2.667.973.973 0 0 0-.4.964l.01.059a.968.968 0 0 0 1.525.608A5.4 5.4 0 0 0 24 11.113z",fill:"currentColor"}),a.a.createElement("path",{d:"M12.231 9.7a6.5 6.5 0 1 0 6.5 6.5 6.508 6.508 0 0 0-6.5-6.5zm3.124 4.155a.75.75 0 0 1 .15 1.05l-2.905 3.87a1.493 1.493 0 0 1-1.1.6h-.111a1.485 1.485 0 0 1-1.055-.443l-1.5-1.5a.75.75 0 0 1 1.066-1.06l1.3 1.3a.249.249 0 0 0 .376-.026L14.305 14a.751.751 0 0 1 1.05-.149z",fill:"currentColor"}));function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var P=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:C({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M24 10.663A5.817 5.817 0 0 0 22.228 6.5a5.711 5.711 0 0 0-3.447-1.585.249.249 0 0 1-.191-.12 7.684 7.684 0 0 0-14.1 2.294.251.251 0 0 1-.227.2A4.59 4.59 0 0 0 0 11.859a4.324 4.324 0 0 0 1.236 3.21 5.529 5.529 0 0 0 3.605 1.377 1 1 0 0 0 .985-1.015 1.023 1.023 0 0 0-1.015-.985 3.3 3.3 0 0 1-2.172-.8A2.374 2.374 0 0 1 2 11.859a2.576 2.576 0 0 1 .954-2.007 2.6 2.6 0 0 1 2.167-.527 1 1 0 0 0 1.2-.919 5.686 5.686 0 0 1 10.82-2.088.959.959 0 0 0 .941.57 3.687 3.687 0 0 1 2.758 1.049A3.752 3.752 0 0 1 22 10.663a3.835 3.835 0 0 1-3.438 3.791 1 1 0 0 0 .132 1.992.961.961 0 0 0 .131-.009A5.807 5.807 0 0 0 24 10.663z",fill:"currentColor"}),a.a.createElement("path",{d:"M15.5 17.446h-1.75a.25.25 0 0 1-.25-.25v-7.25a1.5 1.5 0 1 0-3 0V17.2a.25.25 0 0 1-.25.25H8.5a1 1 0 0 0-.707 1.707l3.5 3.5a1 1 0 0 0 1.414 0l3.5-3.5a1 1 0 0 0-.707-1.707z",fill:"currentColor"}));function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach(function(t){D(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var T=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:I({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M3.566 15.457a1 1 0 0 0-.5-.844 2.248 2.248 0 0 1-.431-.329A2.371 2.371 0 0 1 2 12.5a2.588 2.588 0 0 1 2.585-2.588 2.645 2.645 0 0 1 .536.056A1 1 0 0 0 6.324 9c.081-5.754 8.3-7.363 10.818-2.045a.97.97 0 0 0 .941.571 3.7 3.7 0 0 1 3 1.3 3.874 3.874 0 0 1 .908 2.811 3.428 3.428 0 0 1-1.1 2.375 1.316 1.316 0 0 0-.42 1.089.912.912 0 0 0 1.476.628A5.408 5.408 0 0 0 24 11.418a5.763 5.763 0 0 0-5.22-5.866.25.25 0 0 1-.19-.12 7.685 7.685 0 0 0-14.1 2.3.251.251 0 0 1-.227.2 4.642 4.642 0 0 0-3.643 2.24A4.471 4.471 0 0 0 0 12.619a4.287 4.287 0 0 0 1.235 3.09 4.177 4.177 0 0 0 .852.645 1 1 0 0 0 1.478-.9z",fill:"currentColor"}),a.a.createElement("path",{d:"M18.5 15.8a6.5 6.5 0 1 0-6.5 6.5 6.508 6.508 0 0 0 6.5-6.5zm-7.25 1.25v-.55a1.257 1.257 0 0 1 .986-1.221 1.125 1.125 0 1 0-1.361-1.1.75.75 0 1 1-1.5 0 2.625 2.625 0 1 1 3.538 2.461.25.25 0 0 0-.163.234v.18a.75.75 0 0 1-1.5 0zM12 18.8a1 1 0 1 1-1 1 1 1 0 0 1 1-1z",fill:"currentColor"}));function M(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function R(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?M(Object(n),!0).forEach(function(t){B(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):M(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function B(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:R({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M21.941 3.607L18.87.554A1.912 1.912 0 0 0 17.527 0H8.9A1.9 1.9 0 0 0 7 1.9V5H3.4a1.9 1.9 0 0 0-1.9 1.9v15.21A1.9 1.9 0 0 0 3.4 24h11.7a1.9 1.9 0 0 0 1.9-1.895V19h3.6a1.9 1.9 0 0 0 1.9-1.895V4.949a1.882 1.882 0 0 0-.559-1.342zM14.5 22H4a.5.5 0 0 1-.5-.5v-14A.5.5 0 0 1 4 7h7.784a.5.5 0 0 1 .35.143L14.85 9.8a.5.5 0 0 1 .15.357V21.5a.5.5 0 0 1-.5.5zm5.5-5h-2.75a.25.25 0 0 1-.25-.25v-6.8a1.892 1.892 0 0 0-.558-1.341L13.37 5.554A1.9 1.9 0 0 0 12.028 5H9.25A.25.25 0 0 1 9 4.75V2.5a.5.5 0 0 1 .5-.5l7.756-.026a.5.5 0 0 1 .351.143L20.35 4.8a.5.5 0 0 1 .15.357V16.5a.5.5 0 0 1-.5.5z",fill:"currentColor"}));function L(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?L(Object(n),!0).forEach(function(t){F(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):L(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function F(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var U=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:N({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M23.113 5.954L21.849 4.69l.881-.88a1.914 1.914 0 1 0-2.707-2.71L9.04 12.085a6.014 6.014 0 1 0 2.707 2.707l3.739-3.737.762.762a1.75 1.75 0 1 0 2.475-2.475l-.763-.762 1.416-1.417 1.264 1.263a1.788 1.788 0 0 0 2.473 0 1.751 1.751 0 0 0 0-2.472zm-16.737 8.5a3 3 0 1 1-3 3 3 3 0 0 1 3-2.998z",fill:"currentColor"})),z=n(75);function $(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?$(Object(n),!0).forEach(function(t){G(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var H=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 24 24",style:W({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M10.664 20.073a1.249 1.249 0 1 0-.507 2.447A10.739 10.739 0 1 0 2.4 16.1a.25.25 0 0 1-.084.3l-1 .726a1 1 0 0 0 .377 1.787l3.946.849a1.062 1.062 0 0 0 .21.022 1 1 0 0 0 .978-.79l.945-4.4a1 1 0 0 0-1.565-1.02l-1.361.989a.25.25 0 0 1-.386-.128 8.255 8.255 0 1 1 6.205 5.643z",fill:"currentColor"})),q=n(66);function Y(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return K(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return K(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function V(e){return"unknown"===e.state?"This is a cloud-based file but it's state is unknown because you are offline.":e.encryptKeyId?e.hasKey?"This file is encrypted and you have key to access it.":"This file is encrypted and you do not have the key for it.":null}function Q({state:e,onDelete:t,onUpload:n,onClose:r,onDownload:o}){return a.a.createElement(u.q,{onMenuSelect:function(e){switch(r(),e){case"delete":t()}},items:[{name:"delete",text:"Delete"}]})}var Z={width:16,height:16},X={padding:0};function J({state:e,onDelete:t}){let n=Y(Object(r.useState)(!1),2),o=n[0],l=n[1];return a.a.createElement(u.y,null,a.a.createElement(u.d,{bare:!0,onClick:e=>{e.stopPropagation(),l(!0)}},a.a.createElement(z.a,{style:Z})),o&&a.a.createElement(u.x,{position:"bottom-right",style:X,onClose:()=>l(!1)},a.a.createElement(Q,{state:e,onDelete:t,onClose:()=>l(!1)})))}var ee={width:18,height:18,color:"currentColor"},te={marginLeft:5};function ne({file:e}){let t,n,r;switch(e.state){case"unknown":t=T,n="Network unavailable",r=d.a.n7;break;case"remote":t=P,n="Available for download";break;case"local":case"broken":t=_,n="Local";break;default:t=S,n="Syncing"}return a.a.createElement(u.y,{style:{color:r,alignItems:"center",flexDirection:"row",marginTop:8}},a.a.createElement(t,{color:r,style:ee}),a.a.createElement(u.w,{style:te},n))}var re={flexDirection:"row",justifyContent:"space-between",alignItems:"center",boxShadow:d.c.shadow,margin:10,padding:"12px 15px",backgroundColor:"white",borderRadius:6,flexShrink:0,cursor:"pointer",":hover":{backgroundColor:d.a.hover}},ae={alignItems:"flex-start"},oe={fontSize:16,fontWeight:700},le={flexDirection:"row",alignItems:"center"};function ie({file:e,onSelect:t,onDelete:n}){let o=Object(r.useRef)(!1);return a.a.createElement(u.y,{onClick:()=>(async function(e){o.current||(o.current=!0,await t(e),o.current=!1)})(e),title:V(e),style:[re]},a.a.createElement(u.y,{style:ae},a.a.createElement(u.w,{style:[oe]},e.name),a.a.createElement(ne,{file:e})),a.a.createElement(u.y,{style:le},e.encryptKeyId&&a.a.createElement(U,{style:{width:13,height:13,marginRight:8,color:e.hasKey?d.a.b5:d.a.n8}}),a.a.createElement(J,{state:e.state,onDelete:()=>n(e)})))}var ce={flex:1,maxHeight:310,overflow:"auto","& *":{userSelect:"none"}};class se extends a.a.Component{render(){const e=this.props,t=e.files,n=e.onSelect,r=e.onDelete;return a.a.createElement(u.y,{style:ce},t.map((e,t)=>a.a.createElement(ie,{key:e.id||e.cloudFileId,file:e,onSelect:n,onDelete:r})))}}var ue={padding:10,marginRight:5},de={width:18,height:18,color:d.a.n1};function fe({onRefresh:e}){let t=Y(Object(r.useState)(!1),2),n=t[0],o=t[1];let l=n?q.a:H;return a.a.createElement(u.d,{bare:!0,style:ue,onClick:async function(){o(!0),await e(),o(!1)}},a.a.createElement(l,{color:d.a.n1,style:de}))}var pe={boxShadow:"none",backgroundColor:"transparent"},ye={flex:1},me={margin:20},ge={position:"absolute",right:0,top:0,bottom:0,justifyContent:"center",marginRight:5},he={flexDirection:"row",justifyContent:"flex-end",padding:25,paddingLeft:5},be={marginLeft:10,color:d.a.n4},Oe={marginLeft:15};var we=class extends a.a.Component{constructor(...e){super(...e),this.creating=!1,this.onCreate=(({testMode:e}={})=>{this.creating||(this.creating=!0,this.props.actions.createBudget({testMode:e}))})}render(){let e=this.props,t=e.modalProps,n=e.files,r=void 0===n?[]:n,o=e.actions,l=e.onDownload;return a.a.createElement(u.r,Object.assign({},t,{noAnimation:!0,showHeader:!1,showOverlay:!1,padding:0,style:pe}),()=>a.a.createElement(u.y,{style:ye},a.a.createElement(u.y,null,a.a.createElement(u.w,{style:[d.c.veryLargeText,me]},"Files"),a.a.createElement(u.y,{style:ge},a.a.createElement(fe,{onRefresh:()=>{o.getUserData(),o.loadAllFiles()}}))),a.a.createElement(se,{files:r,actions:o,onSelect:e=>{"remote"===e.state?l(e.cloudFileId):o.loadBudget(e.id)},onDelete:e=>o.pushModal("delete-budget",{file:e})}),a.a.createElement(u.y,{style:he},a.a.createElement(u.d,{bare:!0,style:be,onClick:e=>{e.preventDefault(),o.pushModal("import")}},"Import file"),a.a.createElement(u.d,{primary:!0,onClick:()=>this.onCreate(),style:Oe},"Create new file"),!1)))}},Ee=n(196);function ve(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return je(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return je(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function je(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Se={width:400},xe={lineHeight:1.5,marginTop:20},Ce={color:d.a.r4,marginBottom:15},ke={fontSize:25,fontWeight:700,marginBottom:20},Pe={fontWeight:700},Ae={color:d.a.n5},Ie={fontWeight:700},De={color:d.a.n5},Te=(d.a.n5,{flexDirection:"row",marginTop:20,alignItems:"center"}),Me={flex:1},Re={marginRight:10};var Be=function({modalProps:e,actions:t,availableImports:n}){const o=ve(Object(r.useState)(!1),2),l=o[0],i=(o[1],ve(Object(r.useState)(!1),2)),c=(i[0],i[1],ve(Object(r.useState)(null),2));function s(e){switch(e){case"ynab4":t.pushModal("import-ynab4");break;case"ynab5":t.pushModal("import-ynab5")}}c[0],c[1];let f={padding:10,border:"1px solid "+d.a.border,borderRadius:6,marginBottom:10,display:"block"};return a.a.createElement(u.r,Object.assign({},e,{noAnimation:!0,showHeader:!1,showOverlay:!1,style:Se}),()=>a.a.createElement(u.y,{style:[d.c.smallText,xe]},l&&a.a.createElement(u.c,{style:Ce},function(e){switch(e){case"not-ynab4":return"This file is not valid. Please select a .ynab4 file";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(l)),a.a.createElement(u.y,null,a.a.createElement(u.y,{style:ke},"Import from:"),a.a.createElement(u.y,null,a.a.createElement(u.d,{style:f,onClick:()=>s("ynab4")},a.a.createElement("span",{style:Pe},"YNAB4"),a.a.createElement(u.y,{style:Ae},"The old unsupported desktop app")),a.a.createElement(u.d,{style:f,onClick:()=>s("ynab5")},a.a.createElement("span",{style:Ie},"nYNAB"),a.a.createElement(u.y,{style:De},a.a.createElement("div",null,"The newer web app"))),!1)),a.a.createElement(u.y,{style:Te},a.a.createElement(u.y,{style:Me}),a.a.createElement(u.d,{style:Re,onClick:()=>e.onBack()},"Back"))))},_e=n(57);function Le(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ne(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Fe={width:400},Ue={lineHeight:1.5,marginTop:20},ze={color:d.a.r4,marginBottom:15},$e={alignItems:"center"},We={flexDirection:"row",marginTop:20,alignItems:"center"},Ge={flex:1},He={marginRight:10};var qe=function({modalProps:e,availableImports:t}){const n=Object(o.c)(),l=Le(Object(r.useState)(!1),2),i=l[0],c=l[1],s=Le(Object(r.useState)(!1),2),f=s[0],p=s[1];async function y(){const e=await window.Actual.openFileDialog({properties:["openFile"],filters:[{name:"ynab",extensions:["zip"]}]});if(e){p(!0),c(!1);try{await n(Object(_e.h)(e[0],"ynab4"))}catch(t){c(t.message)}finally{p(!1)}}}return a.a.createElement(u.r,Object.assign({},e,{showHeader:!1,showOverlay:!1,noAnimation:!0,style:Fe}),()=>a.a.createElement(u.y,{style:[d.c.smallText,Ue]},i&&a.a.createElement(u.c,{style:ze},function(e){switch(e){case"not-ynab4":return"This file is not valid. Please select a compressed ynab4 zip file.";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(i)),a.a.createElement(u.y,{style:$e},a.a.createElement(u.t,null,'To import data from YNAB4, locate where your YNAB4 data is stored. It is usually in your Documents folder under YNAB. Your data is a directory inside that with the ".ynab4" suffix.'),a.a.createElement(u.t,null,"When you've located your data,"," ",a.a.createElement("strong",null,"compress it into a zip file"),'. On macOS, right-click the folder and select "Compress". On Windows, right-click and select "Send to > Compressed (zipped) folder". Upload the zipped folder for importing.'),a.a.createElement(u.y,null,a.a.createElement(u.f,{loading:f,primary:!0,onClick:y},"Select zip file..."))),a.a.createElement(u.y,{style:We},a.a.createElement(u.y,{style:Ge}),a.a.createElement(u.d,{style:He,onClick:()=>e.onBack()},"Back"))))};function Ye(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ke(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ke(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ke(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ve={width:400},Qe={lineHeight:1.5,marginTop:20},Ze={color:d.a.r4,marginBottom:15},Xe={alignItems:"center","& > div":{lineHeight:"1.7em"}},Je={flexDirection:"row",marginTop:20,alignItems:"center"},et={flex:1},tt={marginRight:10};var nt=function({modalProps:e,availableImports:t}){const n=Object(o.c)(),l=Ye(Object(r.useState)(!1),2),i=l[0],c=l[1],s=Ye(Object(r.useState)(!1),2),f=s[0],p=s[1];async function y(){const e=await window.Actual.openFileDialog({properties:["openFile"],filters:[{name:"ynab",extensions:["json"]}]});if(e){p(!0),c(!1);try{await n(Object(_e.h)(e[0],"ynab5"))}catch(t){c(t.message)}finally{p(!1)}}}return a.a.createElement(u.r,Object.assign({},e,{showHeader:!1,showOverlay:!1,noAnimation:!0,style:Ve}),()=>a.a.createElement(u.y,{style:[d.c.smallText,Qe]},i&&a.a.createElement(u.c,{style:Ze},function(e){switch(e){case"parse-error":return"Unable to parse file. Please select a JSON file exported from nYNAB.";case"not-ynab5":return"This file is not valid. Please select a JSON file exported from nYNAB.";default:return"An unknown error occurred while importing. Sorry! We have been notified of this issue."}}(i)),a.a.createElement(u.y,{style:Xe},a.a.createElement(u.t,null,a.a.createElement(u.h,{asAnchor:!0,href:"https://actualbudget.com/blog/importing-from-ynab",target:"_blank"},"Read here")," ","for instructions on how to migrate your data from YNAB. You need to export your data as JSON, and that page explains how to do that."),a.a.createElement(u.t,null,"Once you have exported your data, select the file and Actual will import it. Budgets may not match up exactly because things work slightly differently, but you should be able to fix up any problems."),a.a.createElement(u.y,null,a.a.createElement(u.f,{loading:f,primary:!0,onClick:y},"Select file..."))),a.a.createElement(u.y,{style:Je},a.a.createElement(u.y,{style:et}),a.a.createElement(u.d,{style:tt,onClick:()=>e.onBack()},"Back"))))};function rt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return at(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return at(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function at(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var ot={padding:15,paddingTop:0,paddingBottom:25,width:500,lineHeight:"1.5em"},lt={backgroundColor:d.a.r4,alignSelf:"center",border:0,marginTop:10,padding:"10px 30px",fontSize:14},it={marginTop:20},ct={alignSelf:"center",marginTop:10,padding:"10px 30px",fontSize:14},st={color:d.a.r4,borderColor:d.a.r4},ut={border:0,backgroundColor:d.a.r4};function dt({modalProps:e,actions:t,file:n}){let o=rt(Object(r.useState)(null),2),l=o[0],i=o[1];n.state;async function c(){i("cloud"),await t.deleteBudget(n.id,n.cloudFileId),i(null),e.onBack()}async function s(){i("local"),await t.deleteBudget(n.id),i(null),e.onBack()}let d=n.cloudFileId&&"broken"!==n.state;return a.a.createElement(u.r,Object.assign({},e,{title:"Delete "+n.name,padding:0,showOverlay:!1,onClose:e.onBack}),()=>a.a.createElement(u.y,{style:ot},d&&a.a.createElement(a.a.Fragment,null,a.a.createElement(u.w,null,"This is a ",a.a.createElement("strong",null,"hosted file")," which we store to make it available for download on any device. You can delete it from our servers which will remove it from all of your devices."),a.a.createElement(u.f,{primary:!0,loading:"cloud"===l,style:lt,onClick:c},"Delete file from all devices")),n.id&&a.a.createElement(a.a.Fragment,null,a.a.createElement(u.w,{style:[d&&it]},d?a.a.createElement(u.w,null,"You can also delete just the local copy. This will remove all local data and the file will be listed as available for download."):a.a.createElement(u.w,null,"broken"===n.state?a.a.createElement(u.w,null,"This is a ",a.a.createElement("strong",null,"hosted file")," but it was created by another user. You can only delete the local copy."):a.a.createElement(u.w,null,"This a ",a.a.createElement("strong",null,"local file")," which is not stored on our servers.")," ","Deleting it will remove it and all of its backup permanently.")),a.a.createElement(u.f,{primary:!d,loading:"local"===l,style:[ct,d?st:ut],onClick:s},"Delete file locally"))))}var ft=n(200),pt=n(201);function yt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function mt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?yt(Object(n),!0).forEach(function(t){gt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):yt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function gt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var ht={flex:1,padding:50};var bt=Object(o.b)(e=>({modalStack:e.modals.modalStack,isHidden:e.modals.isHidden,budgets:e.budgets.budgets,availableImports:e.budgets.availableImports,globalPrefs:e.prefs.global,allFiles:e.budgets.allFiles,isLoggedIn:!!e.user.data}),e=>({actions:Object(O.b)(s,e)}))(function({modalStack:e,isHidden:t,allFiles:n,availableImports:r,globalPrefs:o,isLoggedIn:l,actions:i}){let s=e.map(({name:o,options:s},u)=>{const d={onClose:i.closeModal,onPush:i.pushModal,onBack:i.popModal,isCurrent:u===e.length-1,isHidden:t,stackIndex:u};switch(o){case"select-budget":return a.a.createElement(we,{key:o,modalProps:d,files:n,actions:i,isLoggedIn:l,onDownload:e=>i.downloadBudget(e)});case"delete-budget":return a.a.createElement(dt,{key:o,modalProps:d,actions:i,file:s.file});case"import":return a.a.createElement(Be,{key:o,modalProps:d,actions:i,availableImports:r});case"import-ynab4":return a.a.createElement(qe,{key:o,modalProps:d,actions:i});case"import-ynab5":return a.a.createElement(nt,{key:o,modalProps:d,actions:i});case"load-backup":return a.a.createElement(w.a,{key:o,initialState:{backups:[]},didMount:async({setState:e})=>{e({backups:await Object(c.send)("backups-get",{id:s.budgetId})})}},({state:e})=>a.a.createElement(Ee.a,{budgetId:s.budgetId,modalProps:mt(mt({},d),{},{onClose:i.popModal}),backupDisabled:!0,actions:i,backups:e.backups}));case"create-encryption-key":return a.a.createElement(ft.a,{key:o,modalProps:d,actions:i,options:s});case"fix-encryption-key":return a.a.createElement(pt.a,{key:o,modalProps:d,actions:i,options:s});default:throw new Error("Unknown modal: "+o)}});return a.a.createElement(u.y,{style:ht},s)}),Ot=n(135);function wt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Et(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Et(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Et(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function vt(){let e=wt(Object(r.useState)(!1),2),t=e[0],n=e[1],a=Object(i.g)(),o=Object(i.h)();return Object(r.useEffect)(()=>{!async function(){let e=e=>{o.pathname!==e?a.push(e):n(!0)};if(null==await Object(c.send)("get-server-url"))a.push("/config-server");else{let t=await Object(c.send)("subscribe-needs-bootstrap"),n=t.error,r=t.bootstrapped;n?a.push("/error",{error:n}):r?(console.log("ensuring login"),e("/login")):e("/bootstrap")}}()},[a,o]),{checked:t}}var jt={fontSize:40,fontWeight:700,color:d.a.p3,marginBottom:20};function St({text:e}){return a.a.createElement(u.w,{style:jt},e)}var xt={padding:10,fontSize:15,border:"none",boxShadow:d.c.shadow,":focus":{border:"none",boxShadow:d.c.shadow}};const Ct=a.a.forwardRef((e,t)=>a.a.createElement(u.m,Object.assign({},e,{style:[xt,e.style]})));d.a.p4,d.a.n9,d.a.n9;d.a.n2;function kt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Pt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Pt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Pt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var At={width:450,marginTop:-30},It={fontSize:16,color:d.a.n2,lineHeight:1.4},Dt={marginTop:20,color:d.a.r4,borderRadius:4,fontSize:15},Tt={display:"flex",flexDirection:"row",marginTop:30},Mt={flex:1,marginRight:10},Rt={fontSize:15},Bt={flexDirection:"row",justifyContent:"center",marginTop:15},_t={fontSize:15,color:d.a.b4,marginLeft:10};function Lt(){let e=Object(o.c)(),t=(Object(i.g)(),kt(Object(r.useState)(""),2)),n=t[0],l=t[1],s=kt(Object(r.useState)(!1),2),d=s[0],f=s[1],p=kt(Object(r.useState)(null),2),y=p[0],m=p[1];return vt().checked?a.a.createElement(a.a.Fragment,null,a.a.createElement(u.y,{style:At},a.a.createElement(St,{text:"Sign in to this Actual instance"}),a.a.createElement(u.w,{style:It},"If you lost your password, you likely still have access to your server to manually reset it."),y&&a.a.createElement(u.w,{style:Dt},function(e){switch(e){case"invalid-password":return"Invalid password";case"network-failure":return"Unable to contact the server";default:return"Whoops, an error occurred on our side! We'll try to get it fixed soon."}}(y)),a.a.createElement("form",{style:Tt,onSubmit:async function(t){if(t.preventDefault(),""===n||d)return;m(null),f(!0);let r=(await Object(c.send)("subscribe-sign-in",{password:n})).error;f(!1),r?m(r):e(Object(Ot.b)())}},a.a.createElement(Ct,{autoFocus:!0,placeholder:"Password",type:"password",onChange:e=>l(e.target.value),style:Mt}),a.a.createElement(u.f,{primary:!0,loading:d,style:Rt},"Sign in")),a.a.createElement(u.y,{style:Bt},a.a.createElement(u.d,{bare:!0,style:_t,onClick:async function(){await e(Object(_e.d)({demoMode:!0}))}},"Try Demo \u2192")))):null}function Nt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Ft(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Ft(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ft(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Ut={display:"flex",flexDirection:"column",alignItems:"stretch",marginTop:30},zt={marginTop:10},$t={flexDirection:"row",alignItems:"center",fontSize:15,marginTop:20},Wt={userSelect:"none"},Gt={flex:1};function Ht({buttons:e,onSetPassword:t,onError:n}){let o=Nt(Object(r.useState)(""),2),l=o[0],i=o[1],c=Nt(Object(r.useState)(""),2),s=c[0],d=c[1],f=Nt(Object(r.useState)(!1),2),p=f[0],y=f[1],m=Nt(Object(r.useState)(!1),2),g=m[0],h=m[1];return a.a.createElement("form",{style:Ut,onSubmit:async function(e){e.preventDefault(),g||(l===s?(h(!0),await t(l),h(!1)):n("password-match"))}},a.a.createElement(Ct,{autoFocus:!0,placeholder:"Password",type:p?"text":"password",value:l,onChange:e=>i(e.target.value)}),a.a.createElement(Ct,{placeholder:"Confirm password",type:p?"text":"password",value:s,onChange:e=>d(e.target.value),style:zt}),a.a.createElement(u.y,{style:$t},a.a.createElement("label",{style:Wt},a.a.createElement("input",{type:"checkbox",onChange:function(e){y(e.target.checked)}})," Show password"),a.a.createElement(u.y,{style:Gt}),e,a.a.createElement(u.f,{primary:!0,loading:g},"OK")))}function qt(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return Yt(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yt(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Yt(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var Kt={width:450,marginTop:-30},Vt={fontSize:16,color:d.a.n2,lineHeight:1.4},Qt={marginTop:20,color:d.a.r4,borderRadius:4,fontSize:15},Zt={fontSize:15,color:d.a.b4,marginRight:15};function Xt(){let e=Object(o.c)(),t=(Object(i.g)(),qt(Object(r.useState)(null),2)),n=t[0],l=t[1];return vt().checked?a.a.createElement(a.a.Fragment,null,a.a.createElement(u.y,{style:Kt},a.a.createElement(St,{text:"Bootstrap this Actual instance"}),a.a.createElement(u.w,{style:Vt},"Set a password for this server instance"),n&&a.a.createElement(u.w,{style:Qt},function(e){switch(e){case"invalid-password":return"Password cannot be empty";case"password-match":return"Passwords do not match";case"network-failure":return"Unable to contact the server";default:return"Whoops, an error occurred on our side! We'll try to get it fixed soon."}}(n)),a.a.createElement(Ht,{buttons:a.a.createElement(u.d,{bare:!0,style:Zt,onClick:async function(){await e(Object(_e.d)({demoMode:!0}))}},"Try Demo"),onSetPassword:async function(t){l(null);let n=(await Object(c.send)("subscribe-bootstrap",{password:t})).error;n?l(n):e(Object(Ot.b)())},onError:l}))):null}var Jt={alignItems:"center"},en={fontSize:16,color:d.a.n2,lineHeight:1.4},tn={marginTop:20};function nn(){let e=Object(i.g)(),t=(Object(i.h)().state||{}).error;return a.a.createElement(u.y,{style:Jt},a.a.createElement(u.w,{style:en},function(e){switch(e){case"network-failure":return"Unable to access server. Make sure the configured URL for the server is accessible.";default:return"Server returned an error while checking its status."}}(t)),a.a.createElement(u.d,{onClick:function(){e.push("/")},style:tn},"Try again"))}function rn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return an(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return an(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var on={width:500,marginTop:-30},ln={fontSize:16,color:d.a.n2,lineHeight:1.4},cn={marginTop:20,color:d.a.r4,borderRadius:4,fontSize:15},sn={marginTop:20,color:d.a.g4,borderRadius:4,fontSize:15},un={fontSize:15,marginRight:10};function dn(){Object(o.c)();let e=Object(i.g)(),t=rn(Object(r.useState)(null),2),n=t[0],l=t[1],s=rn(Object(r.useState)(null),2),d=s[0],f=s[1];return a.a.createElement(a.a.Fragment,null,a.a.createElement(u.y,{style:on},a.a.createElement(St,{text:"Change server password"}),a.a.createElement(u.w,{style:ln},"This will change the password for this server instance. All existing sessions will stay logged in."),n&&a.a.createElement(u.w,{style:cn},function(e){switch(e){case"invalid-password":return"Password cannot be empty";case"password-match":return"Passwords do not match";case"network-failure":return"Unable to contact the server";default:return"Internal server error"}}(n)),d&&a.a.createElement(u.w,{style:sn},d),a.a.createElement(Ht,{buttons:a.a.createElement(u.d,{bare:!0,type:"button",style:un,onClick:()=>e.push("/")},"Cancel"),onSetPassword:async function(t){l(null);let n=(await Object(c.send)("subscribe-change-password",{password:t})).error;n?l(n):(f("Password successfully changed"),setTimeout(()=>{e.push("/")},1500))},onError:l})))}function fn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return pn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pn(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var yn={width:500,marginTop:-30},mn={fontSize:16,color:d.a.n2,lineHeight:1.5},gn={marginTop:20,color:d.a.r4,borderRadius:4,fontSize:15},hn={display:"flex",flexDirection:"row",marginTop:30},bn={flex:1,marginRight:10},On={fontSize:15},wn={fontSize:15,marginLeft:10};function En(){let e=Object(o.c)(),t=Object(i.g)(),n=fn(Object(r.useState)(""),2),l=n[0],s=n[1],d=fn(Object(r.useState)(!1),2),f=d[0],p=d[1],y=fn(Object(r.useState)(null),2),m=y[0],g=y[1],h=fn(Object(r.useState)(null),2),b=h[0],O=h[1];return Object(r.useEffect)(()=>{!async function(){let e=await Object(c.send)("get-server-url");s(e),O(e)}()},[]),a.a.createElement(a.a.Fragment,null,a.a.createElement(u.y,{style:yn},a.a.createElement(St,{text:"Where's the server?"}),a.a.createElement(u.w,{style:mn},b?a.a.createElement(a.a.Fragment,null,"Existing sessions will be logged out and you will log in to this server. We will validate that Actual is running at this URL."):a.a.createElement(a.a.Fragment,null,"There is no server configured. After running the server, specify the URL here to use the app. You can always change this later. We will validate that Actual is running at this URL.")),m&&a.a.createElement(u.w,{style:gn},function(e){switch(e){case"network-failure":return"Server is not running at this URL";default:return"Server does not look like an Actual server. Is it set up correctly?"}}(m)),a.a.createElement("form",{style:hn,onSubmit:async function(n){if(n.preventDefault(),""===l||f)return;g(null),p(!0);let r=(await Object(c.send)("set-server-url",{url:l})).error;p(!1),r?g(r):(await e(Object(Ot.c)()),t.push("/"))}},a.a.createElement(Ct,{autoFocus:!0,placeholder:"https://example.com",value:l,onChange:e=>s(e.target.value),style:bn}),a.a.createElement(u.f,{primary:!0,loading:f,style:On},"OK"),a.a.createElement(u.d,{bare:!0,type:"button",loading:f,style:wn,onClick:()=>t.goBack()},"Cancel"))))}function vn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jn(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Sn={position:"absolute",bottom:0,right:0,color:d.a.n7,margin:15,marginRight:17,":hover":{color:d.a.n2},zIndex:5001};function xn(){return a.a.createElement(u.h,{style:Sn,href:"https://actualbudget.com/blog/"+window.Actual.ACTUAL_VERSION},window.Actual.ACTUAL_VERSION)}var Cn={height:"100%",minHeight:500},kn={position:"absolute",top:0,left:0,right:0,height:40,WebkitAppRegion:"drag"},Pn={position:"absolute",bottom:40,right:15},An={position:"relative",left:"initial",right:"initial"},In={position:"absolute",top:0,left:0,right:0,bottom:0,justifyContent:"center",alignItems:"center"},Dn={position:"absolute",top:0,right:0,padding:"6px 10px",zIndex:4e3};t.a=Object(o.b)(e=>{let t=e.modals.modalStack;return{files:e.budgets.allFiles,userData:e.user.data,managerHasInitialized:e.app.managerHasInitialized,loadingText:e.app.loadingText,currentModals:t.map(e=>e.name)}},s)(class extends a.a.Component{constructor(e){super(e),this.mounted=!0,this.history=Object(l.a)(),window.__history=this.history,console.log("SETTING",window.__history)}async componentDidMount(){let e=null!=this.props.loadingText;this.props.managerHasInitialized?this.showModal():e||this.props.setAppState({loadingText:""}),await this.props.getUserData()&&await this.props.loadAllFiles(),this.props.setAppState(function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?vn(Object(n),!0).forEach(function(t){jn(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({managerHasInitialized:!0},e?null:{loadingText:null}))}async showModal(){if(this.props.managerHasInitialized){let e=this.props,t=e.currentModals,n=e.userData,r=e.files,a=e.replaceModal;r&&n&&(r.length>0?t.includes("select-budget")||a("select-budget"):this.props.createBudget())}}componentDidUpdate(e){this.mounted&&(this.props.managerHasInitialized===e.managerHasInitialized&&this.props.files===e.files&&this.props.userData===e.userData||this.showModal())}componentWillUnmount(){this.mounted=!1}render(){let e=this.props,t=e.userData,n=e.managerHasInitialized,r=e.loadingText;if(!n)return null;let o=null!=r;return console.log("his",this.history.location),a.a.createElement(i.c,{history:this.history},a.a.createElement(u.y,{style:Cn},a.a.createElement(u.y,{style:kn}),a.a.createElement(u.y,{style:Pn},a.a.createElement(b.a,{style:An})),!o&&a.a.createElement(u.y,{style:In},t?a.a.createElement(a.a.Fragment,null,a.a.createElement(i.d,null,a.a.createElement(i.b,{exact:!0,path:"/config-server",component:En}),a.a.createElement(i.b,{exact:!0,path:"/change-password",component:dn}),a.a.createElement(i.b,{exact:!0,path:"/",component:bt}),a.a.createElement(i.b,{path:"/",render:()=>a.a.createElement(i.a,{to:"/"})})),a.a.createElement(u.y,{style:Dn},a.a.createElement(h.a,null))):a.a.createElement(i.d,null,a.a.createElement(i.b,{exact:!0,path:"/login",component:Lt}),a.a.createElement(i.b,{exact:!0,path:"/error",component:nn}),a.a.createElement(i.b,{exact:!0,path:"/config-server",component:En}),a.a.createElement(i.b,{exact:!0,path:"/bootstrap",component:Xt}),a.a.createElement(i.b,{path:"/",render:()=>a.a.createElement(i.a,{to:"/bootstrap"})}))),a.a.createElement(g,null),a.a.createElement(xn,null)))}})},345:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(27),l=n(10),i=n(21),c=n(1),s=n(2);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){f(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function f(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var p=e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:d({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M10 8.586L2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z",fill:"currentColor"}));var y={position:"absolute",bottom:0,right:0,margin:"15px 17px",backgroundColor:s.a.p6,color:"white",padding:"7px 10px",borderRadius:4,zIndex:1e4,maxWidth:450},m={flexDirection:"row",alignItems:"center"},g={marginRight:10,fontWeight:700},h={flex:1},b={marginTop:-1},O={color:"white",textDecoration:"underline"},w={color:"white",textDecoration:"underline"},E={display:"inline",padding:"1px 7px 2px 7px"},v={color:"white"},j={marginTop:10,fontWeight:500};t.a=Object(l.b)(e=>({updateInfo:e.app.updateInfo,showUpdateNotification:e.app.showUpdateNotification}),e=>Object(o.b)(i,e))(function({updateInfo:e,showUpdateNotification:t,updateApp:n,setAppState:r}){if(e&&t){let t=e.releaseNotes;return a.a.createElement(c.y,{style:y},a.a.createElement(c.y,{style:m},a.a.createElement(c.y,{style:g},a.a.createElement(c.w,null,"App updated to ",e.version)),a.a.createElement(c.y,{style:h}),a.a.createElement(c.y,{style:b},a.a.createElement(c.w,null,a.a.createElement(c.p,{onClick:n,style:O},"Restart")," ","(",a.a.createElement(c.p,{style:w,onClick:()=>window.Actual.openURLInBrowser("https://actualbudget.com/blog/"+e.version)},"notes"),")",a.a.createElement(c.d,{bare:!0,style:E,onClick:()=>(function(e){e({updateInfo:null,showUpdateNotification:!1})})(r)},a.a.createElement(p,{width:9,style:v}))))),t&&a.a.createElement(c.y,{style:j},t))}return null})},355:function(e,t,n){"use strict";(function(e){var t=n(77),r=n(251),a=n(308),o=n(309),l=n(310);let i,c=!1,s=null!=Object({NODE_ENV:"production",PUBLIC_URL:"",REACT_APP_ACTUAL_VERSION:"0.0.148",REACT_APP_BACKEND_WORKER_HASH:"b16816d5632f095a8a84"}).PERF_BUILD,u="0.0.148";function d(){i=new l.a,Object(o.a)(i),i.postMessage({type:"init",version:u,isDev:c,hash:"b16816d5632f095a8a84"}),(c||s)&&(i.addEventListener("message",e=>{if("__actual:backend-running"===e.data.type){let e=document.querySelector(".debugger .activity");if(e){let t=window.getComputedStyle(e)["background-color"];e.style.transition="none",e.style.backgroundColor="#3EBD93",setTimeout(()=>{e.style.transition="background-color 1s",e.style.backgroundColor=t},100)}}}),Promise.resolve().then(function(){var e=new Error("Cannot find module 'perf-deets/frontend'");throw e.code="MODULE_NOT_FOUND",e}).then(({listenForPerfData:e})=>{e(i)}))}c||(t.e({dsn:"https://9e6094adfc9f43b5b5b9994cee44d7c2@sentry.io/5169928",release:u,ignoreErrors:["ResizeObserver loop"],integrations:[new a.SentryMetricIntegration({url:"https://sync.actualbudget.com/metrics",metric:"app-errors",dimensions:{platform:"web"}})]}),window.SentryClient=r),d(),e.SentryClient=r,(c||s)&&Promise.resolve().then(function(){var e=new Error("Cannot find module 'perf-deets/frontend'");throw e.code="MODULE_NOT_FOUND",e}).then(({listenForPerfData:t})=>{t(window),e.__startProfile=(()=>{window.postMessage({type:"__perf-deets:start-profile"}),i.postMessage({type:"__perf-deets:start-profile"})}),e.__stopProfile=(()=>{window.postMessage({type:"__perf-deets:stop-profile"}),i.postMessage({type:"__perf-deets:stop-profile"})})}),e.Actual={IS_DEV:c,ACTUAL_VERSION:u,IS_FAKE_WEB:!0,IS_BETA:"beta"===Object({NODE_ENV:"production",PUBLIC_URL:"",REACT_APP_ACTUAL_VERSION:"0.0.148",REACT_APP_BACKEND_WORKER_HASH:"b16816d5632f095a8a84"}).REACT_APP_RELEASE_TYPE,logToTerminal:(...e)=>{console.log(...e)},relaunch:()=>{window.location.reload()},openFileDialog:async({filters:e=[],properties:t})=>new Promise(t=>{let n=document.createElement("input");n.type="file";let r=e.find(e=>e.extensions);r&&(n.accept=r.extensions.map(e=>"."+e).join(",")),n.style.position="absolute",n.style.top="0px",n.style.left="0px",n.dispatchEvent(new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0})),n.addEventListener("change",e=>{let n=e.target.files[0],r=n.name.replace(/.*(\.[^.]*)/,"file$1");if(n){var a=new FileReader;a.readAsArrayBuffer(n),a.onload=async function(e){let n=`/uploads/${r}`;window.__actionsForMenu.uploadFile(r,e.target.result).then(()=>t([n]))},a.onerror=function(e){alert("Error reading file")}}})}),saveFile:(e,t,n)=>{const r=document.createElement("a");r.style="display: none",r.download=t,r.rel="noopener";const a=new Blob([e]);r.href=URL.createObjectURL(a),r.dispatchEvent(new MouseEvent("click"))},openURLInBrowser:e=>{window.open(e,"_blank")},onEventFromMain:(e,t)=>{},applyAppUpdate:()=>{},updateAppMenu:e=>{},ipcConnect:()=>{},getServerSocket:async()=>i},c&&(e.Actual.reloadBackend=(()=>{i.postMessage({type:"__actual:shutdown"}),d()})),document.addEventListener("keydown",e=>{(e.metaKey||e.ctrlKey)&&(79===e.keyCode?(e.preventDefault(),window.__actionsForMenu.closeBudget()):90===e.keyCode&&(e.shiftKey?window.__actionsForMenu.redo():window.__actionsForMenu.undo()))})}).call(this,n(56))},399:function(e,t,n){"use strict";function r(e){console.log("[Exception]",e),SentryClient.captureException(e)}function a(e){SentryClient.addBreadcrumb(e)}n.r(t),n.d(t,"captureException",function(){return r}),n.d(t,"captureBreadcrumb",function(){return a})},40:function(e,t,n){"use strict";var r=n(0),a=n.n(r),o=n(12);const l=["style","nativeStyle","innerRef"];function i(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}t.a=function(e){e.style;const t=e.nativeStyle,n=e.innerRef,r=i(e,l);return a.a.createElement("div",Object.assign({},r,{ref:n,style:t,className:`view ${e.className||""} ${Object(o.css)(e.style)}`}))}},41:function(e,t,n){"use strict";n.d(t,"d",function(){return a}),n.d(t,"e",function(){return o}),n.d(t,"b",function(){return l}),n.d(t,"f",function(){return i}),n.d(t,"c",function(){return c}),n.d(t,"a",function(){return s});var r=n(11);function a(e,t){return{type:r.a.PUSH_MODAL,name:e,options:t}}function o(e,t){return{type:r.a.REPLACE_MODAL,name:e,options:t}}function l(){return{type:r.a.HIDE_MODALS}}function i(){return{type:r.a.SHOW_MODALS}}function c(){return{type:r.a.POP_MODAL}}function s(){return{type:r.a.CLOSE_MODAL}}},43:function(e,t,n){"use strict";const r=navigator.platform&&"win32"===navigator.platform.toLowerCase(),a=navigator.platform&&navigator.platform.toUpperCase().indexOf("MAC")>=0,o=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);t.a={OS:r?"windows":a?"mac":"linux",env:"web",isBrowser:!!window.Actual.IS_FAKE_WEB,isReactNativeWeb:!1,isProbablySafari:o}},528:function(e,t,n){"use strict";n.r(t);n(355),n(356);var r=n(0),a=n.n(r),o=n(87),l=n.n(o),i=n(316),c=n(27),s=n(10),u=n(11);function d(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach(function(t){p(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function p(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const y={loadingText:null,updateInfo:null,showUpdateNotification:!0,managerHasInitialized:!1,lastUndoState:{current:null},lastSplitState:{current:null}};var m=n(31);function g(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function h(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?g(Object(n),!0).forEach(function(t){b(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function b(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const O={banks:[],failedAccounts:new Map,accountsSyncing:null};function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function E(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach(function(t){v(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const j={selectedCell:null};var S=function(e=j,t){switch(t.type){case u.a.DEBUG_CELL:return E(E({},e),{},{selectedCell:t.sheet?{sheet:t.sheet,name:t.name}:null})}return e};function x(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?x(Object(n),!0).forEach(function(t){k(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const P={};var A=n(9);function I(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function D(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?I(Object(n),!0).forEach(function(t){T(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):I(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const M={local:null,global:null};function R(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?R(Object(n),!0).forEach(function(t){_(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function _(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const L={modalStack:[],isHidden:!1};var N=function(e=L,t){switch(t.type){case u.a.PUSH_MODAL:return B(B({},e),{},{modalStack:[...e.modalStack,{name:t.name,options:t.options}]});case u.a.REPLACE_MODAL:return B(B({},e),{},{modalStack:[{name:t.name,options:t.options}]});case u.a.POP_MODAL:return B(B({},e),{},{modalStack:e.modalStack.slice(0,-1)});case u.a.CLOSE_MODAL:return B(B({},e),{},{modalStack:[]});case u.a.HIDE_MODALS:return B(B({},e),{},{isHidden:!0});case u.a.SHOW_MODALS:return B(B({},e),{},{isHidden:!1});case u.a.SET_APP_STATE:if("loadingText"in t.state)return B(B({},e),{},{isHidden:null!=t.state.loadingText});break;case u.a.SIGN_OUT:return L}return e};function F(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach(function(t){z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function z(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const $={notifications:[]};function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function G(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach(function(t){H(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function H(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function q(e,t){let n=new Set,r=e.map(e=>{if(e.cloudFileId){if(null==t)return G(G({},e),{},{state:"unknown"});let r=t.find(t=>e.cloudFileId===t.fileId);return r?(n.add(r.fileId),r.groupId===e.groupId?G(G({},e),{},{name:r.name,deleted:r.deleted,encryptKeyId:r.encryptKeyId,hasKey:r.hasKey,state:"synced"}):G(G({},e),{},{name:r.name,deleted:r.deleted,encryptKeyId:r.encryptKeyId,hasKey:r.hasKey,state:"detached"})):G(G({},e),{},{state:"broken"})}return G(G({},e),{},{state:"local"})}),a=((o=r.concat((t||[]).filter(e=>!n.has(e.fileId)).map(e=>({cloudFileId:e.fileId,groupId:e.groupId,name:e.name,deleted:e.deleted,encryptKeyId:e.encryptKeyId,hasKey:e.hasKey,state:"remote"}))).filter(e=>!e.deleted)).sort((e,t)=>{let n=e.name.toLowerCase(),r=t.name.toLowerCase(),a=n<r?-1:n>r?1:0;return 0===a&&(a=e.id<t.id?-1:e.id>t.id?1:0),a}),o);var o;return a.filter(e=>"broken"!==e.state).concat(a.filter(e=>"broken"===e.state))}const Y={budgets:[],availableImports:[],remoteFiles:null,allFiles:null};function K(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function V(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?K(Object(n),!0).forEach(function(t){Q(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):K(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const Z={stage:null,fromYNAB:!1};function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function J(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach(function(t){ee(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ee(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const te={data:null};var ne={app:function(e=y,t){switch(t.type){case u.a.SET_APP_STATE:return f(f({},e),t.state);case u.a.SET_LAST_UNDO_STATE:return e.lastUndoState.current=t.undoState,e;case u.a.SET_LAST_SPLIT_STATE:return e.lastSplitState.current=t.splitState,e}return e},queries:m.a,account:function(e=O,t){switch(t.type){case u.a.LOAD_BANKS:return h(h({},e),{},{banks:t.banks});case u.a.SET_ACCOUNTS_SYNCING:return h(h({},e),{},{accountsSyncing:t.name});case u.a.ACCOUNT_SYNC_STATUS:{let n=new Map(e.failedAccounts);return t.failed?n.set(t.id,{type:t.errorType,code:t.errorCode}):n.delete(t.id),h(h({},e),{},{failedAccounts:n})}case u.a.ACCOUNT_SYNC_FAILURES:{let n=new Map;return t.syncErrors.forEach(e=>{n.set(e.id,{type:e.type,code:e.code})}),h(h({},e),{},{failedAccounts:n})}}return e},debug:S,profile:function(e=P,t){switch(t.type){case u.a.SET_PROFILE:return C(C({},e),t.profile)}return e},prefs:function(e=M,t){switch(t.type){case u.a.SET_PREFS:return t.prefs&&Object(A.setNumberFormat)(t.prefs.numberFormat||"comma-dot"),{local:t.prefs,global:t.globalPrefs};case u.a.MERGE_LOCAL_PREFS:return t.prefs.numberFormat&&Object(A.setNumberFormat)(t.prefs.numberFormat),D(D({},e),{},{local:D(D({},e.local),t.prefs)});case u.a.MERGE_GLOBAL_PREFS:return D(D({},e),{},{global:D(D({},e.global),t.globalPrefs)})}return e},modals:N,notifications:function(e=$,t){switch(t.type){case u.a.ADD_NOTIFICATION:return e.notifications.find(e=>e.id===t.notification.id)?e:U(U({},e),{},{notifications:[...e.notifications,t.notification]});case u.a.REMOVE_NOTIFICATION:return U(U({},e),{},{notifications:e.notifications.filter(e=>e.id!==t.id)})}return e},budgets:function(e=Y,t){switch(t.type){case u.a.SET_BUDGETS:return G(G({},e),{},{budgets:t.budgets,allFiles:q(t.budgets,e.remoteFiles)});case u.a.SET_REMOTE_FILES:return G(G({},e),{},{remoteFiles:t.files,allFiles:q(e.budgets,t.files)});case u.a.SET_ALL_FILES:return G(G({},e),{},{budgets:t.budgetes,remoteFiles:t.remoteFiles,allFiles:q(t.budgets,t.remoteFiles)});case u.a.SET_AVAILABLE_IMPORTS:return G(G({},e),{},{availableImports:t.imports});case u.a.SIGN_OUT:return G(G({},e),{},{allFiles:null})}return e},tutorial:function(e=Z,t){switch(t.type){case u.a.SET_TUTORIAL_STAGE:return V(V({},e),{},{deactivated:!1,stage:t.stage,fromYNAB:"fromYNAB"in t?t.fromYNAB:e.fromYNAB});case u.a.DEACTIVATE_TUTORIAL:return V(V({},e),{},{stage:null})}return e},user:function(e=te,t){switch(t.type){case u.a.GET_USER_DATA:return J(J({},e),{},{data:t.data})}return e}},re=n(3),ae=n(16),oe=n(21),le=n(341),ie=n(339);function ce(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function se(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?ce(Object(n),!0).forEach(function(t){ue(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ce(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ue(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(527);const de=Object(c.c)(ne);const fe=Object(c.d)(function(e,t){return t.type===u.a.CLOSE_BUDGET&&(e={budgets:e.budgets,user:e.user,prefs:{local:null,global:e.prefs.global},app:se(se({},y),{},{updateInfo:e.updateInfo,showUpdateNotification:e.showUpdateNotification,managerHasInitialized:e.app.managerHasInitialized,loadingText:e.app.loadingText})}),de(e,t)},void 0,Object(c.a)(le.a)),pe=Object(c.b)(oe,fe.dispatch);Object(ie.a)(pe,fe),window.__actionsForMenu=pe,window.$send=re.send,window.$query=ae.f,window.$q=ae.c,l.a.render(a.a.createElement(s.a,{store:fe},a.a.createElement(i.a,null)),document.getElementById("root"))},57:function(e,t,n){"use strict";n.d(t,"m",function(){return f}),n.d(t,"k",function(){return p}),n.d(t,"l",function(){return y}),n.d(t,"i",function(){return m}),n.d(t,"j",function(){return g}),n.d(t,"b",function(){return h}),n.d(t,"c",function(){return b}),n.d(t,"e",function(){return O}),n.d(t,"d",function(){return w}),n.d(t,"h",function(){return E}),n.d(t,"n",function(){return v}),n.d(t,"a",function(){return j}),n.d(t,"f",function(){return S}),n.d(t,"g",function(){return x});var r=n(11),a=n(41),o=n(130),l=n(3),i=n(124),c=n(176),s=n(140);function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n(96);function f(e){return(t,n)=>{null!=n().app.loadingText&&t(Object(i.b)({loadingText:e}))}}function p(){return async e=>{const t=await Object(l.send)("get-budgets");e({type:r.a.SET_BUDGETS,budgets:t})}}function y(){return async e=>{const t=await Object(l.send)("get-remote-files");e({type:r.a.SET_REMOTE_FILES,files:t})}}function m(){return async(e,t)=>{const n=await Object(l.send)("get-budgets"),a=await Object(l.send)("get-remote-files");return e({type:r.a.SET_ALL_FILES,budgets:n,remoteFiles:a}),t().budgets.allFiles}}function g(e,t="",n={}){return async(r,s)=>{r(Object(i.b)({loadingText:t}));let f=(await Object(l.send)("load-budget",function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach(function(t){d(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({id:e},n))).error;if(f){if("out-of-sync-migrations"===f||"out-of-sync-data"===f)if("undefined"!==typeof confirm){confirm("This budget cannot be loaded with this version of the app. Make sure the app is up-to-date. Do you want to load a backup?")&&r(Object(a.d)("load-backup",{budgetId:e}))}else alert("This budget cannot be loaded with this version of the app. Make sure the app is up-to-date.");else"budget-not-found"===f?alert("Budget file could not be found. If you changed something manually, please restart the app."):alert("Error loading budget. Please contact help@actualbudget.com for support.");return void r(Object(i.b)({loadingText:null}))}r(Object(a.a)()),await r(Object(o.b)());const p=s().prefs.local;r(Object(i.b)({loadingText:null})),r(Object(i.b)({maxMonths:p.maxMonths})),r(Object(c.a)())}}function h(){return async(e,t)=>{const n=t().prefs.local;n&&n.id&&(e({type:r.a.CLOSE_BUDGET}),e(Object(i.b)({loadingText:"Closing..."})),await Object(l.send)("close-budget"),e(Object(i.b)({loadingText:null})))}}function b(){return async(e,t)=>{let n=t().prefs.local;n&&n.id&&e({type:r.a.CLOSE_BUDGET})}}function O(e,t){return async n=>{await Object(l.send)("delete-budget",{id:e,cloudFileId:t}),await n(m())}}function w({testMode:e,demoMode:t}={}){return async(n,r)=>{n(Object(i.b)({loadingText:e||t?"Making demo...":""})),t?await Object(l.send)("create-demo-budget"):await Object(l.send)("create-budget",{testMode:e}),n(Object(a.a)()),await n(m()),await n(Object(o.b)()),n(Object(c.a)()),n(Object(i.b)({loadingText:null}))}}function E(e,t){return async(n,r)=>{const i=(await Object(l.send)("import-budget",{filepath:e,type:t})).error;if(i)throw new Error(i);n(Object(a.a)()),await n(Object(o.b)()),n(Object(c.a)())}}function v(e){return async t=>{let n=(await Object(l.send)("upload-budget",{id:e})).error;return n?{error:n}:(await t(m()),{})}}function j(e){return async t=>{t(Object(i.b)({loadingText:"Downloading..."})),await t(h()),t(S(e,{replace:!0}))}}function S(e,{replace:t}={}){return async n=>{n(Object(i.b)({loadingText:"Downloading..."}));let r=await Object(l.send)("download-budget",{fileId:e,replace:t}),c=r.id,u=r.error;if(u){if("decrypt-failure"===u.reason){let r={hasExistingKey:u.meta&&u.meta.isMissingKey,cloudFileId:e,onSuccess:()=>{n(S(e,{replace:t}))}};n(Object(a.d)("fix-encryption-key",r)),n(Object(i.b)({loadingText:null}))}else{if("file-exists"===u.reason)return alert(`A file with id "${u.meta.id}" already exists with the name "${u.meta.name}". `+"This file will be replaced. This probably happened because files were manually moved around outside of Actual."),n(S(e,{replace:!0}));n(Object(i.b)({loadingText:null})),alert(Object(s.b)(u))}return null}return await Promise.all([n(Object(o.a)()),n(m()),n(g(c))]),n(Object(i.b)({loadingText:null})),c}}function x(){return async e=>{let t=await Object(l.send)("get-ynab4-files");return e({type:"SET_AVAILABLE_IMPORTS",imports:t}),t}}},6:function(e,t,n){"use strict";(function(e){n.d(t,"g",function(){return z}),n.d(t,"e",function(){return V}),n.d(t,"a",function(){return X}),n.d(t,"h",function(){return ee}),n.d(t,"f",function(){return ae}),n.d(t,"c",function(){return le}),n.d(t,"d",function(){return se}),n.d(t,"b",function(){return de}),n.d(t,"i",function(){return me}),n.d(t,"k",function(){return ge}),n.d(t,"m",function(){return ve}),n.d(t,"j",function(){return Ce}),n.d(t,"n",function(){return Pe}),n.d(t,"l",function(){return Te}),n.d(t,"o",function(){return Me});var r=n(0),a=n.n(r),o=n(10),l=n(78),i=n(100),c=n(321),s=n(2),u=n(128),d=n(120),f=n(129),p=n(66),y=n(1),m=n(198),g=n(93),h=n(76),b=n(30),O=n(33),w=n(179),E=n(25);const v=["width","name","borderColor","truncate","children","style","contentStyle"],j=["width","name","exposed","focused","value","formatter","textAlign","onExpose","borderColor","children","plain","style","valueStyle"],S=["backgroundColor","borderColor","inset","collapsed","focused","highlighted","children","height","style"],x=["value","onUpdate","onBlur"],C=["inputProps","onUpdate","onBlur","textAlign","error"],k=["value","children","onUpdate","onBlur"],P=["dateSelectProps"],A=["onDelete","style"],I=["focused","selected","partial","style","onSelect","onEdit"],D=["valueProps","valueStyle","inputProps","sync","textAlign","onSave"],T=["headers","children","version"],M=["fields"],R=["items","count","headers","contentHeader","loading","rowHeight","backgroundColor","renderItem","renderEmpty","getItemKey","loadMore","style","navigator","listRef","onScroll","version","animated","allowPopupsEscape","isSelected"];function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach(function(t){L(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function L(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return F(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return F(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function U(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const z=32,$=s.a.n11;function W(e,t){document.hasFocus()?e&&e(t):t.stopPropagation()}const G=a.a.createContext({backgroundColor:"white",borderColor:s.a.n9});function H({backgroundColor:e,borderColor:t,children:n}){let o=Object(r.useMemo)(()=>({backgroundColor:e,borderColor:t}),[e,t]);return a.a.createElement(G.Provider,{value:o},n)}var q={flex:1,flexBasis:0},Y={flex:1,padding:"0 5px",justifyContent:"center"},K={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};const V=a.a.forwardRef(function(e,t){let n=e.width,o=e.name,l=e.borderColor,i=e.truncate,c=void 0===i||i,u=e.children,d=e.style,f=e.contentStyle,p=U(e,v),m=Object(r.useContext)(G),g=m.backgroundColor,h=m.borderColor;return l&&(h=l),a.a.createElement(y.y,Object.assign({innerRef:t},p,{style:["flex"===n?q:{width:n},{position:"relative",borderTopWidth:h?1:0,borderBottomWidth:h?1:0,borderColor:h,backgroundColor:g},s.c.smallText,d],"data-testid":o}),a.a.createElement(y.y,{style:[Y,f]},c?a.a.createElement(y.w,{style:K},u):u))});var Q={flex:1,padding:"0 5px",justifyContent:"center"},Z={whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"};function X(t){let n=t.width,o=t.name,l=t.exposed,i=t.focused,c=t.value,u=t.formatter,d=t.textAlign,f=t.onExpose,p=t.borderColor,m=t.children,g=t.plain,h=t.style,b=t.valueStyle,O=U(t,j),E=Object(r.useRef)(null),v=Object(r.useRef)(null),S=Object(r.useContext)(G),x=S.backgroundColor,C=S.borderColor;Object(w.b)(v,void 0!==i?i:l),p&&(C=p);const k="flex"===n?{flex:1,flexBasis:0}:{width:n},P={position:"relative",textAlign:d||"left",justifyContent:"center",borderTopWidth:C?1:0,borderBottomWidth:C?1:0,borderColor:C,backgroundColor:x};return a.a.createElement(y.y,Object.assign({innerRef:v,style:[k,P,h],className:"animated-cell"},O,{"data-testid":o}),g?m:l?m():a.a.createElement(y.y,{style:[Q,s.c.smallText,b],onMouseDown:e=>E.current=[e.clientX,e.clientY],onMouseUp:e=>{E.current&&Math.abs(e.clientX-E.current[0])<5&&Math.abs(e.clientY-E.current[1])<5&&f&&f(o)},onClick:e.IS_TESTING&&(()=>f&&f(o))},a.a.createElement(y.w,{style:Z},u?u(c):c)))}var J={marginTop:-1};function ee(e){let t=e.backgroundColor,n=void 0===t?"white":t,o=e.borderColor,l=void 0===o?s.a.border:o,i=e.inset,c=void 0===i?0:i,u=e.collapsed,d=(e.focused,e.highlighted),f=e.children,p=e.height,m=e.style,g=U(e,S),h=N(Object(r.useState)(!1),2),b=h[0],O=h[1],w=Object(r.useRef)(!1),E=Object(r.useRef)(null),v=Object(r.useRef)(null);return Object(r.useEffect)(()=>{d&&!w.current&&E.current&&(E.current.classList.add("animated"),O(!0),clearTimeout(v.current),v.current=setTimeout(()=>{O(!1),v.current=setTimeout(()=>{E.current&&E.current.classList.remove("animated")},500)},500))},[d]),Object(r.useEffect)(()=>{w.current=d}),a.a.createElement(H,{backgroundColor:b?s.a.y9:n,borderColor:b?s.a.y8:l},a.a.createElement(y.y,Object.assign({innerRef:E,style:[{flexDirection:"row",height:p||z,flex:"0 0 "+(p||z)+"px",userSelect:"text","&.animated .animated-cell":{transition:".7s background-color"}},u&&J,m],"data-testid":"row"},g),0!==c&&a.a.createElement(V,{width:c}),f,0!==c&&a.a.createElement(V,{width:c})))}const te={backgroundColor:"white",padding:"5px 3px",margin:"0 1px"},ne={backgroundColor:"transparent","::selection":{backgroundColor:"#d9d9d9"}};function re(e){let t=e.value,n=e.onUpdate,o=e.onBlur,l=U(e,x),i=N(Object(r.useState)(t),2),c=i[0],s=i[1];return a.a.createElement(y.m,Object.assign({},l,{value:c,onUpdate:e=>s(e),onBlur:function(e){n&&n(c),o&&W(o,e)},onKeyDown:function(e){e.keyCode!==O.b.ENTER&&e.keyCode!==O.b.TAB&&e.stopPropagation(),e.keyCode===O.b.ESC?c!==t&&s(t):oe(e)&&n&&n(c)},style:[te,l.readOnly?ne:null,l.style]}))}function ae(e){let t=e.inputProps,n=e.onUpdate,r=e.onBlur,o=e.textAlign,l=e.error,i=U(e,C);var c={textAlign:o};return a.a.createElement(X,Object.assign({textAlign:o},i),()=>a.a.createElement(a.a.Fragment,null,a.a.createElement(re,Object.assign({value:i.value,onUpdate:n,onBlur:r,style:[c,t&&t.style]},t)),l&&a.a.createElement(y.x,{key:"error",targetHeight:z,width:180,position:"bottom-left"},l)))}function oe(e){switch(e.keyCode){case O.b.TAB:case O.b.ENTER:return e.preventDefault(),!0}}function le(e){let t=e.value,n=e.children,o=e.onUpdate,l=e.onBlur,i=U(e,k),c=N(Object(r.useState)(t),2),s=c[0],u=c[1],d=N(Object(r.useState)(t),2),f=d[0],p=d[1];function y(e){document.hasFocus()&&(o&&o(s),W(l,e))}function m(e){oe(e)&&o&&o(s)}return f!==t&&(u(t),p(t)),a.a.createElement(X,Object.assign({},i,{value:t}),()=>n({onBlur:y,onKeyDown:m,onUpdate:e=>u(e),onSave:e=>{u(e),o&&o(e)},shouldSaveFromKey:oe,inputStyle:te}))}var ie={minWidth:225};Object(l.scope)(e=>{return e(function(e){let t=e.props,n=t.dateSelectProps,r=U(t,P);e.updater;const o=n.inputProps,l=void 0===o?{}:o;return a.a.createElement(X,Object.assign({},r,{style:_({zIndex:r.exposed?1:0},r.style)}),()=>a.a.createElement(h.a,Object.assign({},n,{tooltipStyle:ie,inputProps:_(_({},l),{},{onBlur:e=>W(l&&l.onBlur,e),style:[te,{zIndex:300}]})})))})});var ce={alignItems:"center",userSelect:"none"};function se(e){let t=e.onDelete,n=e.style,r=U(e,A);return a.a.createElement(X,Object.assign({},r,{name:"delete",width:20,style:[ce,n],onClick:e=>{e.stopPropagation(),t&&t()}}),()=>a.a.createElement(u.a,{width:7,height:7}))}var ue={flexDirection:"row",alignItems:"center",cursor:"default",transition:"box-shadow .15s",":focus":{outline:0,boxShadow:`0 0 0 3px white, 0 0 0 5px ${s.a.b5}`}};const de=a.a.forwardRef(({style:e,disabled:t,clickBehavior:n,onSelect:r,onEdit:o,children:l},i)=>a.a.createElement(y.y,{innerRef:i,className:"cell-button",tabIndex:"0",onKeyDown:e=>{e.keyCode!==O.b.X&&e.keyCode!==O.b.SPACE||(e.preventDefault(),t||r&&r())},style:[ue,e],onFocus:()=>o&&o(),"data-testid":"cell-button",onClick:"none"===n?null:()=>{t||(r&&r(),o&&o())}},l));var fe={alignItems:"center",userSelect:"none"},pe={width:12,height:12,border:"1px solid "+s.a.n8,borderRadius:3,justifyContent:"center",alignItems:"center",":focus":{border:"1px solid "+s.a.b5,boxShadow:"0 1px 2px "+s.a.b5}},ye={color:"white"};function me(e){let t=e.focused,n=e.selected,r=e.partial,o=e.style,l=e.onSelect,i=e.onEdit,c=U(e,I);var u={backgroundColor:r?s.a.b9:s.a.b5,borderColor:r?s.a.b9:s.a.b5};return a.a.createElement(X,Object.assign({},c,{focused:t,name:"select",width:20,style:[fe,o],onClick:e=>{e.stopPropagation(),l&&l(),i&&i()}}),()=>a.a.createElement(de,{style:[pe,n&&u],onEdit:i,onSelect:l,clickBehavior:"none"},n&&a.a.createElement(d.a,{width:6,height:6,style:ye})))}function ge(e){let t=e.valueProps,n=e.valueStyle,r=e.inputProps,o=(e.sync,e.textAlign),l=e.onSave,i=U(e,D);var c={textAlign:o};const s=t.binding,u=t.type,d=t.getValueStyle,f=t.formatExpr,p=t.unformatExpr;return a.a.createElement(g.a,{binding:s,onChange:()=>{i.exposed&&r&&r.onBlur&&r.onBlur()}},e=>a.a.createElement(X,Object.assign({valueStyle:d?[n,d(e.value)]:n,textAlign:o},i,{value:e.value,formatter:e=>i.formatter?i.formatter(e,u):Object(b.a)(e,u),"data-cellname":e.name}),()=>a.a.createElement(re,Object.assign({value:f?f(e.value):e.value,onUpdate:e=>{l(p?p(e):e)},style:c},r))))}var he={position:"absolute",top:0,left:0,right:0,bottom:0,transition:"background-color 1.8s",backgroundColor:"white"};Object(l.scope)(e=>{function t({inst:e}){e.el.style.transitionDuration="0s",e.el.style.backgroundColor=s.a.y9,setTimeout(()=>{e.el&&(e.el.style.transitionDuration="1.8s",e.el.style.backgroundColor="white")},0)}return e(function({inst:e,state:{activated:t,highlightOff:n}}){return a.a.createElement(y.y,{innerRef:t=>e.el=t,style:he})},{getInitialState:({props:e})=>({activated:!1,highlightOff:!0}),componentWillReceiveProps(e,n){if(!e.props.active&&n.active)return t(e)},componentDidMount(e){if(e.props.active)return t(e)}})});var be={borderRadius:"6px 6px 0 0",overflow:"hidden"},Oe={zIndex:200},we={color:s.a.n4,fontWeight:500},Ee={color:s.a.n4};function ve(e){let t=e.headers,n=e.children,r=e.version,o=U(e,T);return a.a.createElement(y.y,{style:"v2"===r&&be},a.a.createElement(ee,Object.assign({backgroundColor:"white",borderColor:s.a.border,collapsed:!0},o,{style:[Oe,"v2"===r?we:Ee,o.style]}),t?t.map(e=>a.a.createElement(X,{key:e.name,value:e.name,width:e.width,style:e.style,valueStyle:e.valueStyle})):n))}var je={color:s.a.b3},Se={marginRight:5},xe={padding:0};function Ce({name:e,keyHandlers:t,items:n,onSelect:o}){let l=Object(E.e)(),i=N(Object(r.useState)(null),2),c=i[0],s=i[1];return 0===l.size?null:a.a.createElement(y.y,null,a.a.createElement(m.a,{keys:t||{}}),a.a.createElement(y.d,{bare:!0,style:je,onClick:()=>s(!0)},a.a.createElement(f.a,{width:8,height:8,style:Se}),l.size," ",e),c&&a.a.createElement(y.x,{position:"bottom-right",width:200,style:xe,onClose:()=>s(!1)},a.a.createElement(y.q,{onMenuSelect:e=>{o(e,[...l]),s(!1)},items:n})))}let ke={position:"absolute",willChange:"transform",width:"100%"};const Pe=a.a.forwardRef((e,t)=>{let n=e.fields,r=U(e,M),o=Me(r.items,n);return a.a.createElement(Te,Object.assign({},r,{navigator:o}))});var Ae={justifyContent:"center",alignItems:"center",fontStyle:"italic",color:s.a.n6,flex:1},Ie={flex:1,justifyContent:"center",alignItems:"center"},De={flex:1,outline:"none","& .animated .animated-row":{transition:".25s transform"}};const Te=a.a.forwardRef((e,t)=>{let n=e.items,o=e.count,l=e.headers,u=e.contentHeader,d=e.loading,f=e.rowHeight,m=void 0===f?z:f,g=e.backgroundColor,h=void 0===g?$:g,b=e.renderItem,O=e.renderEmpty,E=e.getItemKey,v=e.loadMore,j=e.style,S=e.navigator,x=(e.listRef,e.onScroll),C=e.version,k=void 0===C?"v1":C,P=e.animated,A=e.allowPopupsEscape,I=e.isSelected,D=U(e,R);S||(S={onEdit:()=>{},editingId:null,focusedField:null,getNavigatorProps:e=>e});let T=S,M=T.onEdit,B=T.editingId,_=T.focusedField,L=T.getNavigatorProps,N=Object(r.useRef)(null),F=Object(r.useRef)(null),W=Object(r.useRef)(null),G=Object(r.useRef)(null),H=Object(r.useRef)(!1);function q({index:e,style:t,key:r}){let o=n[e],l=B===o.id,i=I&&I(o.id),c=b({item:o,editing:l,focusedField:l&&_,onEdit:M,index:e,position:t.top});return a.a.createElement(y.y,{key:r,className:"animated-row",style:[ke,{zIndex:l||i?101:"auto",transform:"translateY(var(--pos))"}],nativeStyle:{"--pos":`${t.top-1}px`},"data-focus-key":o.id},c)}function Y(e,t){return t*(m-1)+(m-1)/2-e/2+2*(m-1)}function K({overscanStartIndex:e,overscanStopIndex:t}){v&&t>n.length-100&&v()}if(Object(r.useImperativeHandle)(t,()=>({scrollTo:(e,t="smart")=>{let r=n.findIndex(t=>t.id===e);-1!==r&&(N.current?N.current.scrollToItem(r,t):G.current=r)},scrollToTop:()=>{N.current&&N.current.scrollTo(0)},getScrolledItem:()=>{if(W.current){let e=W.current.scrollTop,t=N.current.getStartIndexForOffset(e);return n[t].id}return 0},setRowAnimation:e=>{N.current&&N.current.setRowAnimation(e)},edit(e,n,r){M(e,n),e&&r&&t.scrollTo(e)},anchor(){N.current&&N.current.anchor()},unanchor(){N.current&&N.current.unanchor()},isAnchored:()=>N.current&&N.current.isAnchored()})),Object(r.useLayoutEffect)(()=>{!H.current&&F.current&&(N.current&&N.current.setRowAnimation(!0),H.current=!0)}),d)return a.a.createElement(y.y,{style:[Ie]},a.a.createElement(p.a,{width:25,color:s.a.n1}));let V=0===(o||n.length);return a.a.createElement(y.y,Object.assign({style:[De,j],tabIndex:"1"},L(D),{"data-testid":"table"}),l&&a.a.createElement(ve,Object.assign({version:k,height:m},Array.isArray(l)?{headers:l}:{children:l})),a.a.createElement(y.y,{style:{flex:1,backgroundColor:h}},V?function(e){return null==e?null:"function"===typeof e?e():a.a.createElement(y.y,{style:Ae},e)}(O):a.a.createElement(i.a,null,({width:e,height:t})=>0===e||0===t?null:a.a.createElement(y.o.Provider,{value:!A&&F},a.a.createElement(w.a,null,a.a.createElement(c.a,{ref:N,header:u,innerRef:F,outerRef:W,width:e,height:t,renderRow:q,itemCount:o||n.length,itemSize:m-1,itemKey:E||((e,t)=>n[e].id),indexForKey:e=>n.findIndex(t=>t.id===e),initialScrollOffset:G.current?Y(t,G.current):0,version:k,animated:P,overscanCount:5,onItemsRendered:K,onScroll:x}))))))});function Me(e,t,n={}){let a="function"!==typeof t?()=>t:t,l=n.initialEditingId,i=n.initialFocusedField,c=n.moveKeys,s=N(Object(r.useState)(l||null),2),u=s[0],d=s[1],f=N(Object(r.useState)(i||null),2),p=f[0],y=f[1],m=Object(r.useRef)(),g=Object(o.e)(),h=Object(r.useRef)(0),b=Object(r.useCallback)((e,t)=>{d(e),y(e?t:null)},[]);function w(){m.current.focus(),b(null),setTimeout(()=>{b(u,p)},100)}function E(t){if(u){let n=a(e.find(e=>e.id===u)),r=n.indexOf(p)+t;r<0?function(){let t=e.findIndex(e=>e.id===u);if(t>0){let n=e[t-1],r=a(n);b(n.id,r[r.length-1])}else w()}():r>=n.length?function(){let t=e.findIndex(e=>e.id===u);if(t<e.length-1){let n=e[t+1],r=a(n);b(n.id,r[0])}else w()}():y(n[r])}}function v(t){if(u){let n=e.findIndex(e=>e.id===u);for(;;){if(!((n+=t)>=0&&n<e.length)){w();break}{const t=e[n];if(a(t).includes(p)){b(t.id,p);break}}}}}function j(e){switch(e){case"left":E(-1);break;case"right":E(1);break;case"up":v(-1);break;case"down":v(1);break;default:throw new Error("Unknown direction: "+e)}}return Object(r.useEffect)(()=>{h.current=g.getState().modals.modalStack.length},[]),{onEdit:b,editingId:u,focusedField:p,getNavigatorProps:function(e){return _(_({},e),{},{innerRef:m,onKeyDown:t=>{if(e&&e.onKeyDown&&e.onKeyDown(t),t.isPropagationStopped())return;let n=c&&c[p]&&c[p];if(n&&n[t.keyCode])t.preventDefault(),t.stopPropagation(),j(n[t.keyCode]);else switch(t.keyCode){case O.b.UP:case O.b.K:"INPUT"!==t.target.tagName&&j("up");break;case O.b.DOWN:case O.b.J:"INPUT"!==t.target.tagName&&j("down");break;case O.b.ENTER:case O.b.TAB:t.preventDefault(),t.stopPropagation(),j(t.keyCode===O.b.ENTER?t.shiftKey?"up":"down":t.shiftKey?"left":"right")}},onBlur:e=>{let t=h.current,n=g.getState().modals.modalStack.length;!document.hasFocus()||null!=e.relatedTarget&&m.current.contains(e.relatedTarget)||t!==n||b(null)}})}}}}).call(this,n(56))},60:function(e,t,n){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach(function(t){o(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const l=n(96);n(9).getChangedValues;let i=40,c=[],s={url:null,openModal:null,selectedItems:null};e.exports={setUndoState:function(e,t){s[e]=t,s.id=l.v4Sync()},getUndoState:function(e){return s[e]},getTaggedState:function(e){return c.find(t=>t.id===e)},snapshot:function(){let e=a(a({},s),{},{id:l.v4Sync()});return c.unshift(e),c=c.slice(0,i),e.id},gc:function(e){c=c.filter(t=>t.id!==e)}}},63:function(e,t,n){"use strict";n.d(t,"a",function(){return d}),n.d(t,"k",function(){return f}),n.d(t,"d",function(){return p}),n.d(t,"g",function(){return y}),n.d(t,"v",function(){return m}),n.d(t,"n",function(){return g}),n.d(t,"o",function(){return h}),n.d(t,"e",function(){return b}),n.d(t,"w",function(){return O}),n.d(t,"h",function(){return w}),n.d(t,"l",function(){return E}),n.d(t,"m",function(){return v}),n.d(t,"f",function(){return j}),n.d(t,"j",function(){return S}),n.d(t,"u",function(){return x}),n.d(t,"c",function(){return C}),n.d(t,"p",function(){return k}),n.d(t,"b",function(){return P}),n.d(t,"r",function(){return A}),n.d(t,"i",function(){return I}),n.d(t,"s",function(){return R}),n.d(t,"t",function(){return B}),n.d(t,"q",function(){return _});var r=n(167),a=n.n(r),o=n(3),l=n(11),i=n(137),c=n(41);const s=["categories"];function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function d(e,t,n){return async function(){switch(t){case"budget-amount":await Object(o.send)("budget/budget-amount",{month:e,category:n.category,amount:n.amount});break;case"copy-last":await Object(o.send)("budget/copy-previous-month",{month:e});break;case"set-zero":await Object(o.send)("budget/set-zero",{month:e});break;case"set-3-avg":await Object(o.send)("budget/set-3month-avg",{month:e});break;case"set-all-future":await Object(o.send)("budget/set-all-future",{startMonth:e});break;case"hold":await Object(o.send)("budget/hold-for-next-month",{month:e,amount:n.amount});break;case"hold-all-future":await Object(o.send)("budget/hold-for-future-months",{startMonth:e,amount:n.amount});break;case"reset-hold":await Object(o.send)("budget/reset-hold",{month:e});break;case"cover":await Object(o.send)("budget/cover-overspending",{month:e,to:n.to,from:n.from});break;case"transfer-available":await Object(o.send)("budget/transfer-available",{month:e,amount:n.amount,category:n.category});break;case"transfer-category":await Object(o.send)("budget/transfer-category",{month:e,amount:n.amount,from:n.from,to:n.to});break;case"carryover":await Object(o.send)("budget/set-carryover",{startMonth:e,category:n.category,flag:n.flag})}}}function f(){return async function(e){const t=await Object(o.send)("get-categories");return e({type:l.a.LOAD_CATEGORIES,categories:t}),t}}function p(e,t,n){return async function(r){let a=await Object(o.send)("category-create",{name:e,groupId:t,isIncome:n});return r(f()),a}}function y(e,t){return async function(n,r){let a=(await Object(o.send)("category-delete",{id:e,transferId:t})).error;if(a){switch(a){case"category-type":n(Object(i.b)({type:"error",message:"A category must be transferred to another of the same type (expense or income)"}));break;default:n(Object(i.a)())}throw new Error(a)}n(f()),n(E())}}function m(e){return async t=>{await Object(o.send)("category-update",e),t(f())}}function g(e,t,n){return async(r,a)=>{await Object(o.send)("category-move",{id:e,groupId:t,targetId:n}),await r(f())}}function h(e,t){return async n=>{await Object(o.send)("category-group-move",{id:e,targetId:t}),await n(f())}}function b(e){return async t=>{let n=await Object(o.send)("category-group-create",{name:e});return t(f()),n}}function O(e){e.categories;const t=u(e,s);return async e=>{await Object(o.send)("category-group-update",t),await e(f())}}function w(e,t){return async function(n,r){r().queries.categories.grouped.find(t=>t.id===e);await Object(o.send)("category-group-delete",{id:e,transferId:t}),await n(f()),await n(E())}}function E(){return async function(e){let t=await Object(o.send)("payees-get");return e({type:l.a.LOAD_PAYEES,payees:t}),t}}function v(){return async function(e,t){if(0===t().queries.payees.length)return e(E())}}function j(e){return async t=>Object(o.send)("payee-create",{name:e.trim()})}function S(){return async function(e){const t=await Object(o.send)("accounts-get");return e({type:l.a.LOAD_ACCOUNTS,accounts:t}),t}}function x(e){return async function(t){t({type:l.a.UPDATE_ACCOUNT,account:e}),await Object(o.send)("account-update",e)}}function C(e,t,n,r){return async function(a){let l=await Object(o.send)("account-create",{name:e,type:t,balance:n,offBudget:r});return await a(S()),await a(E()),l}}function k(e){return async function(t,n){const r=await Object(o.send)("account-properties",{id:e}),a=r.balance,l=r.numTransactions,i=n().queries.accounts.find(t=>t.id===e);t(Object(c.d)("close-account",{account:i,balance:a,canDelete:0===l}))}}function P(e,t,n,r){return async function(a){await Object(o.send)("account-close",{id:e,transferAccountId:t,categoryId:n,forced:r}),a(S())}}function A(e){return async function(t){await Object(o.send)("account-reopen",{id:e}),t(S())}}function I(e){return P(e,null,null,!0)}let D=a()(()=>Object(o.send)("undo"),100),T=a()(()=>Object(o.send)("redo"),100),M=!0;function R(e){M=e}function B(){return async()=>{M&&D()}}function _(){return async()=>{M&&T()}}},65:function(e,t,n){"use strict";var r=n(0),a=n.n(r);t.a=a.a.createContext(void 0)},66:function(e,t,n){"use strict";var r=n(0),a=n.n(r);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var u=e=>{let t=e.color,n=void 0===t?"#fff":t,o=c(Object(r.useState)("gradient-"+Math.random()),1)[0];return a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 38 38",style:l({},e.style)}),a.a.createElement("defs",null,a.a.createElement("linearGradient",{x1:"8.042%",y1:"0%",x2:"65.682%",y2:"23.865%",id:o},a.a.createElement("stop",{stopColor:n,stopOpacity:0,offset:"0%"}),a.a.createElement("stop",{stopColor:n,stopOpacity:.631,offset:"63.146%"}),a.a.createElement("stop",{stopColor:n,offset:"100%"}))),a.a.createElement("g",{transform:"translate(1 2)",fill:"none",fillRule:"evenodd"},a.a.createElement("path",{d:"M36 18c0-9.94-8.06-18-18-18",stroke:"url(#"+o+")",strokeWidth:2,fill:"none"}),a.a.createElement("circle",{fill:n,cx:36,cy:18,r:1})))},d=n(12);var f={animationName:d.css.keyframes({"0%":{transform:"rotate(-90deg)"},"100%":{transform:"rotate(666deg)"}}),animationDuration:"1.6s",animationTimingFunction:"cubic-bezier(0.17, 0.67, 0.83, 0.67)",animationIterationCount:"infinite",lineHeight:0};t.a=function(e){return a.a.createElement("span",Object(d.css)(f),a.a.createElement(u,e))}},68:function(e,t,n){"use strict";var r=n(0),a=n.n(r);t.a=a.a.createContext(void 0)},71:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return a(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"b",function(){return s}),n.d(t,"a",function(){return u});class c{constructor(e){this.state=l({filterExpressions:e.filterExpressions||[],selectExpressions:e.selectExpressions||[],groupExpressions:e.groupExpressions||[],orderExpressions:e.orderExpressions||[],calculation:!1,rawMode:!1,withDead:!1,validateRefs:!0,limit:null,offset:null},e)}filter(e){return new c(l(l({},this.state),{},{filterExpressions:[...this.state.filterExpressions,e]}))}unfilter(e){let t=new Set(e);return new c(l(l({},this.state),{},{filterExpressions:this.state.filterExpressions.filter(e=>!t.has(Object.keys(e)[0]))}))}select(e=[]){Array.isArray(e)||(e=[e]);let t=new c(l(l({},this.state),{},{selectExpressions:e}));return t.state.calculation=!1,t}calculate(e){let t=this.select({result:e});return t.state.calculation=!0,t}groupBy(e){return Array.isArray(e)||(e=[e]),new c(l(l({},this.state),{},{groupExpressions:[...this.state.groupExpressions,...e]}))}orderBy(e){return Array.isArray(e)||(e=[e]),new c(l(l({},this.state),{},{orderExpressions:[...this.state.orderExpressions,...e]}))}limit(e){return new c(l(l({},this.state),{},{limit:e}))}offset(e){return new c(l(l({},this.state),{},{offset:e}))}raw(){return new c(l(l({},this.state),{},{rawMode:!0}))}withDead(){return new c(l(l({},this.state),{},{withDead:!0}))}withoutValidatedRefs(){return new c(l(l({},this.state),{},{validateRefs:!1}))}options(e){return new c(l(l({},this.state),{},{tableOptions:e}))}serialize(){return this.state}}function s(e,t){let n=e.serialize().orderExpressions;if(0===n.length)return t?l({order:"asc"},t):null;let a=n[0];if("string"===typeof a)return{field:a,order:"asc"};let o=r(Object.keys(a),1)[0];return{field:o,order:a[o]}}function u(e){return new c({table:e})}},75:function(e,t,n){"use strict";var r=n(0),a=n.n(r);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}t.a=(e=>a.a.createElement("svg",Object.assign({},e,{viewBox:"0 0 20 20",style:l({color:"#242134"},e.style)}),a.a.createElement("path",{d:"M10 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0-6a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4z",fill:"currentColor"})))},76:function(e,t,n){"use strict";n.d(t,"a",function(){return k});var r=n(0),a=n.n(r),o=n(252),l=n(183),i=n(554),c=n(555),s=n(545),u=n(416),d=(n(12),n(322)),f=n.n(d),p=(n(414),n(2)),y=n(1),m=n(8),g=n(323),h=n.n(g),b=n(324),O=n.n(b);function w(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}let v={"& .pika-single.actual-date-picker":{color:p.a.n11,background:p.a.n1,border:"none",boxShadow:"0 0px 4px rgba(0, 0, 0, .25)",borderRadius:4},"& .actual-date-picker":{"& .pika-lendar":{float:"none",width:"auto"},"& .pika-label":{backgroundColor:p.a.n1},"& .pika-prev":{backgroundImage:`url(${h.a})`},"& .pika-next":{backgroundImage:`url(${O.a})`},"& .pika-table th":{color:p.a.n11,"& abbr":{textDecoration:"none"}},"& .pika-button":{backgroundColor:p.a.n2,color:p.a.n11},"& .is-today .pika-button":{textDecoration:"underline"},"& .is-selected .pika-button":{backgroundColor:p.a.n5,boxShadow:"none"}}};var j={flex:1};let S=a.a.forwardRef(({value:e,dateFormat:t,onUpdate:n,onSelect:s},u)=>{let d=Object(r.useRef)(null),p=Object(r.useRef)(null);return Object(r.useImperativeHandle)(u,()=>({handleInputKeyDown(e){let t=null;switch(e.keyCode){case 37:e.preventDefault(),t=o.a(d.current.getDate(),1);break;case 38:e.preventDefault(),t=o.a(d.current.getDate(),7);break;case 39:e.preventDefault(),t=l.a(d.current.getDate(),1);break;case 40:e.preventDefault(),t=l.a(d.current.getDate(),7)}t&&(d.current.setDate(t,!0),n&&n(t))}}),[]),Object(r.useLayoutEffect)(()=>(d.current=new f.a({theme:"actual-date-picker",keyboardInput:!1,defaultDate:e?i.a(e,t,new Date):new Date,setDefaultDate:!0,toString:e=>c.a(e,t),parse:e=>i.a(e,t,new Date),onSelect:s}),p.current.appendChild(d.current.el),()=>{d.current.destroy()}),[]),Object(r.useEffect)(()=>{d.current.getDate()!==e&&d.current.setDate(i.a(e,t,new Date),!0)},[e,t]),a.a.createElement(y.y,{style:[v,j],innerRef:p})});function x(e){return 13===e.keyCode}var C={padding:0,minWidth:225};function k({containerProps:e,inputProps:t,tooltipStyle:n,value:o,isOpen:l,embedded:d,dateFormat:f="yyyy-MM-dd",focused:p,openOnFocus:g=!0,inputRef:h,shouldSaveFromKey:b=x,tableBehavior:O,onUpdate:E,onSelect:v}){let j=Object(r.useMemo)(()=>{if(o){let e=s.a(o);if(u.a(e))return c.a(e,f)}return null},[o,f]),k=Object(r.useRef)(null),P=w(Object(r.useState)(j||""),2),A=P[0],I=P[1],D=w(Object(r.useState)(d||l||!1),2),T=D[0],M=D[1],R=Object(r.useRef)(null);Object(r.useLayoutEffect)(()=>{h&&(h.current=R.current)},[]);let B=w(Object(r.useState)(A),2),_=B[0],L=B[1],N=Object(r.useRef)(_);Object(r.useEffect)(()=>{N.current=A},[A]),Object(r.useEffect)(()=>I(j),[j]),Object(r.useEffect)(()=>{if(Object(m.i)(f).test(A)){let e=i.a(A,Object(m.h)(f),new Date);u.a(e)&&(E&&E(c.a(e,"yyyy-MM-dd")),L(c.a(e,f)))}else if(Object(m.n)(f).test(A)){let e=i.a(A,Object(m.m)(f),new Date);u.a(e)&&(E&&E(c.a(e,"yyyy-MM-dd")),L(c.a(e,f)))}else{let e=i.a(A,f,new Date);if(u.a(e)){let t=c.a(e,"yyyy-MM-dd");E&&E(t),L(A)}}},[A]);return a.a.createElement(y.y,e,a.a.createElement(y.m,Object.assign({focused:p},t,{inputRef:R,value:A,onKeyDown:function(e){if(e.keyCode>=37&&e.keyCode<=40&&!e.shiftKey&&!e.metaKey&&!e.altKey&&T)k.current.handleInputKeyDown(e);else if(27===e.keyCode)I(j),L(j),j===A?T&&(d||e.stopPropagation(),M(!1)):(M(!0),E&&E(o));else if(b(e)){I(_),M(!1);let n=i.a(_,f,new Date);v(c.a(n,"yyyy-MM-dd")),T&&N.current!==_&&(e.stopPropagation(),e.preventDefault());let r=(t||{}).onKeyDown;r&&r(e)}else T||(M(!0),R.current&&R.current.setSelectionRange(0,1e4))},onChange:function(e){I(e.target.value)},onFocus:e=>{!d&&g&&M(!0),t&&t.onFocus&&t.onFocus(e)},onBlur:e=>{if(d||M(!1),t&&t.onBlur&&t.onBlur(e),!O)if(""===A)L(null),v(null);else{I(_||"");let e=i.a(_,f,new Date);v(c.a(e,"yyyy-MM-dd"))}}})),T&&(F=a.a.createElement(S,{ref:k,value:_,dateFormat:f,onUpdate:e=>{L(c.a(e,f)),E&&E(c.a(e,"yyyy-MM-dd"))},onSelect:e=>{I(c.a(e,f)),v(c.a(e,"yyyy-MM-dd")),M(!1)}}),d?F:a.a.createElement(y.x,{position:"bottom-left",offset:2,style:[C,n]},F)));var F}},8:function(e,t,n){"use strict";(function(e){n.d(t,"t",function(){return y}),n.d(t,"s",function(){return m}),n.d(t,"e",function(){return g}),n.d(t,"d",function(){return h}),n.d(t,"c",function(){return b}),n.d(t,"u",function(){return O}),n.d(t,"b",function(){return w}),n.d(t,"y",function(){return E}),n.d(t,"a",function(){return v}),n.d(t,"x",function(){return j}),n.d(t,"r",function(){return S}),n.d(t,"v",function(){return C}),n.d(t,"f",function(){return P}),n.d(t,"k",function(){return A}),n.d(t,"o",function(){return I}),n.d(t,"j",function(){return D}),n.d(t,"q",function(){return T}),n.d(t,"p",function(){return M}),n.d(t,"w",function(){return R}),n.d(t,"g",function(){return B}),n.d(t,"h",function(){return _}),n.d(t,"i",function(){return L}),n.d(t,"l",function(){return N}),n.d(t,"m",function(){return F}),n.d(t,"n",function(){return U});var r=n(555),a=n(223),o=n(346),l=n(183),i=n(252),c=n(253),s=n(542),u=(n(543),n(544),n(32));function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function p(e){if("string"===typeof e){let t=d(e.split("-"),3),n=t[0],r=t[1],a=t[2];return null!=a?new Date(parseInt(n),parseInt(r)-1,parseInt(a),12):null!=r?new Date(parseInt(n),parseInt(r)-1,1,12):new Date(parseInt(n),0,1,12)}return e}const y=p;function m(e){return r.a(p(e),"yyyy-MM")}function g(e){return r.a(p(e),"yyyy-MM-dd")}function h(){return e.IS_TESTING?"2017-01":r.a(new Date,"yyyy-MM")}function b(){return e.IS_TESTING?"2017-01-01":r.a(new Date,"yyyy-MM-dd")}function O(e){return r.a(o.a(p(e),1),"yyyy-MM")}function w(e,t){return r.a(a.a(p(e),t),"yyyy-MM")}function E(e,t){return r.a(o.a(p(e),t),"yyyy-MM")}function v(e,t){return r.a(l.a(p(e),t),"yyyy-MM-dd")}function j(e,t){return r.a(i.a(p(e),t),"yyyy-MM-dd")}function S(e,t){return s.a(p(e),p(t))}function x(e,t,n){const r=[];let a=m(e);for(;c.a(p(a),p(t));)r.push(a),a=w(a,1);return n&&r.push(a),r}function C(e,t){return x(e,t,!0)}function k(e,t,n){const r=[];let a=e;for(;c.a(p(a),p(t));)r.push(a),a=v(a,1);return n&&r.push(a),r}function P(e,t){return k(e,t,!0)}function A(e){return parseInt(e.slice(5,7))-1}function I(e){return e.slice(0,4)}function D(e){return e.slice(0,7)}function T(e){return I(e)+"-01"}function M(e){return I(e)+"-12"}function R(e){return"budget"+e.replace("-","")}function B(e,t){return r.a(p(e),t)}Object(u.a)(e=>new RegExp(e.replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{4}")));const _=Object(u.a)(e=>e.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"")),L=Object(u.a)(e=>{let t=e.replace(/y+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}");return new RegExp("^"+t+"$")}),N=Object(u.a)(e=>e.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/\.\./,".").replace(/--/,"-")),F=(Object(u.a)(e=>{let t=e.replace(/d+/g,"").replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/\/\//,"/").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2,4}");return new RegExp("^"+t+"$")}),Object(u.a)(e=>e.replace(/y+/g,"yy"))),U=Object(u.a)(e=>{let t=e.replace(/[^\w]$/,"").replace(/^[^\w]/,"").replace(/d+/g,"\\d{1,2}").replace(/M+/g,"\\d{1,2}").replace(/y+/g,"\\d{2}");return new RegExp("^"+t+"$")})}).call(this,n(56))},9:function(e,t,n){"use strict";n.r(t),n.d(t,"cleanUUID",function(){return s}),n.d(t,"last",function(){return u}),n.d(t,"mergeObjects",function(){return d}),n.d(t,"composeCellChanges",function(){return f}),n.d(t,"flattenArray",function(){return p}),n.d(t,"shallowEqual",function(){return y}),n.d(t,"getChangedValues",function(){return m}),n.d(t,"hasFieldsChanged",function(){return g}),n.d(t,"applyChanges",function(){return h}),n.d(t,"partitionByField",function(){return b}),n.d(t,"groupBy",function(){return O}),n.d(t,"groupBySingle",function(){return w}),n.d(t,"diffItems",function(){return v}),n.d(t,"groupById",function(){return j}),n.d(t,"debugMemoFailure",function(){return S}),n.d(t,"setIn",function(){return x}),n.d(t,"getIn",function(){return C}),n.d(t,"throwError",function(){return k}),n.d(t,"fastSetMerge",function(){return P}),n.d(t,"titleFirst",function(){return A}),n.d(t,"numberFormats",function(){return I}),n.d(t,"setNumberFormat",function(){return T}),n.d(t,"getNumberFormat",function(){return M}),n.d(t,"toRelaxedNumber",function(){return R}),n.d(t,"toRelaxedInteger",function(){return B}),n.d(t,"integerToCurrency",function(){return _}),n.d(t,"amountToCurrency",function(){return L}),n.d(t,"amountToPrettyCurrency",function(){return N}),n.d(t,"currencyToAmount",function(){return F}),n.d(t,"currencyToInteger",function(){return U}),n.d(t,"stringToInteger",function(){return z}),n.d(t,"amountToInteger",function(){return $}),n.d(t,"integerToAmount",function(){return W}),n.d(t,"looselyParseAmount",function(){return G}),n.d(t,"semverToNumber",function(){return H});const r=["id"];function a(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach(function(t){i(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}let c=n(393);function s(e){return e.replace(/-/g,"")}function u(e){return e[e.length-1]}function d(e){return Object.assign.apply(null,[{},...e])}function f(e){const t={};Object.keys(e).forEach(n=>{t[n]?t[n]=l(l({},t[n]),e[n]):t[n]=e[n]})}function p(e){return Array.prototype.concat.apply([],e)}function y(e,t){if(e===t)return!0;var n,r=0,a=0;for(n in t)if(a++,!e.hasOwnProperty(n)||e[n]!==t[n])return!1;for(n in e)r++;return r===a}function m(e,t){const n=e.id?{id:e.id}:{},r=Object.keys(t);let a=!1;for(let o=0;o<r.length;o++){let l=r[o];e[l]!==t[l]&&(n[l]=t[l],a=!0)}return a?n:null}function g(e,t,n){let r=!1;for(var a=0;a<n.length;a++){let o=n[a];if(e[o]!==t[o]){r=!0;break}}return r}function h(e,t){return t=[...t],e.added&&e.added.forEach(e=>{t.push(e)}),e.updated&&e.updated.forEach(e=>{let n=e.id,o=a(e,r);const i=t.findIndex(e=>e.id===n);t[i]=l(l({},t[i]),o)}),e.deleted&&e.deleted.forEach(e=>{const n=t.findIndex(t=>e.id===t.id);-1!==n&&t.splice(n,1)}),t}function b(e,t){let n=new Map;for(let r=0;r<e.length;r++){let a=e[r],o=a[t],l=n.get(o)||[];l.push(a),n.set(o,l)}return n}function O(e,t,n){let r=new Map;for(let a=0;a<e.length;a++){let o=e[a],l=o[t],i=r.get(l)||[];r.set(l,i.concat([n?n(o):e[a]]))}return r}function w(e,t,n){let r=new Map;for(let a=0;a<e.length;a++){let o=e[a],l=o[t];if(r.has(l))throw new Error("groupBySingle found conflicting key: "+l);r.set(l,n?n(o):e[a])}return r}function E(e){let t=new Map;for(let n=0;n<e.length;n++){let r=e[n];t.set(r.id,r)}return t}function v(e,t){let n=E(e),r=E(t),a=[],o=[],l=e.filter(e=>!r.has(e.id)).map(e=>({id:e.id}));return t.forEach(e=>{let t=n.get(e.id);if(t){const n=m(t,e);n&&o.push(n)}else a.push(e)}),{added:a,updated:o,deleted:l}}function j(e){let t={};for(let n=0;n<e.length;n++){let r=e[n];t[r.id]=r}return t}function S(e,t){let n=m(e,t);return null!==n&&console.log(n),null===n}function x(e,t,n){for(let r=0;r<t.length;r++){let a=t[r];r===t.length-1?e.set(a,n):(e.has(a)||e.set(a,new Map),e=e.get(a))}}function C(e,t){let n=e;for(let r=0;r<t.length;r++)if(null==(n=n.get(t[r])))return n;return n}function k(e){throw e}function P(e,t){let n=new Set(e),r=t.values(),a=r.next();for(;!a.done;)n.add(a.value),a=r.next();return n}function A(e){return e[0].toUpperCase()+e.slice(1)}let I=[{value:"comma-dot",label:"1,000.33"},{value:"dot-comma",label:"1.000,33"},{value:"space-comma",label:"1 000,33"}],D={value:null,formatter:null,regex:null};function T(e){let t,n,r;switch(e){case"space-comma":t="za-ZA",n=/[^-0-9,]/g,r=",";break;case"dot-comma":t="de-DE",n=/[^-0-9,]/g,r=",";break;case"comma-dot":default:t="en-US",n=/[^-0-9.]/g,r="."}D={value:e,separator:r,formatter:{format:e=>c.format(e,{locale:t,format:"%v"})},regex:n}}function M(){return D}function R(e){return W(U(e)||0)}function B(e){return z(e)||0}function _(e){return D.formatter.format(e/100)}function L(e){return D.formatter.format(e)}function N(e,t){return c.format(e,{code:t})}function F(e){let t=parseFloat(e.replace(D.regex,"").replace(D.separator,"."));return isNaN(t)?null:t}function U(e){let t=F(e);return t?$(t):null}function z(e){let t=parseInt(e.replace(/[^-0-9.,]/g,""));return isNaN(t)?null:t}function $(e){return Math.round(100*e)}function W(e){return parseFloat((e/100).toFixed(2))}function G(e){function t(e){return isNaN(e)?null:e}let n=e.match(/[.,][^.,]*$/);if(!n||0===n.index)return t(parseFloat(e));let r=e.slice(0,n.index),a=e.slice(n.index+1);return t(parseFloat(r.replace(/[^0-9-]/g,"")+"."+a))}function H(e){return parseInt("1"+e.split(".").map(e=>("000"+e.replace(/[^0-9]/g,"")).slice(-3)).join(""))}T("1,000.33")},93:function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return d});var r=n(0),a=n(68),o=n(65);function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,a,o=[],l=!0,i=!1;try{for(n=n.call(e);!(l=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);l=!0);}catch(c){i=!0,a=c}finally{try{l||null==n.return||n.return()}finally{if(i)throw a}}return o}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?c(Object(n),!0).forEach(function(t){u(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):c(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d({binding:t,initialValue:n,children:i,onChange:c}){if(!t)throw new Error("SheetValue binding is required");if(e.IS_TESTING&&"string"!==typeof t&&!t.name&&(t=s(s({},t),{},{name:t.value.toString()})),null==(t="string"===typeof t?{name:t,value:null}:t).name)throw new Error("Binding name is now required");let u=Object(r.useContext)(o.a),d=Object(r.useContext)(a.a)||"__global",f=l(Object(r.useState)({name:d+"!"+t.name,value:null!=n?n:t.value,query:t.query}),2),p=f[0],y=f[1],m=Object(r.useRef)(c),g=Object(r.useRef)(p.value);return Object(r.useLayoutEffect)(()=>{m.current=c,g.current=p.value}),Object(r.useLayoutEffect)(()=>(t.query&&u.createQuery(d,t.name,t.query),u.bind(d,t,null,e=>{m.current&&m.current(e),e.value!==g.current&&y(e)})),[d,t.name]),null!=p.value?i(p,function(){throw new Error("setCell is not implemented anymore")}):null}}).call(this,n(56))},96:function(e,t,n){const r=n(390);e.exports={v4:function(){return Promise.resolve(r.v4())},v4Sync:function(){return r.v4()}}}},[[528,4,3]]]);
//# sourceMappingURL=main.a27b6a9d.chunk.js.map